{
  "openapi": "3.0.1",
  "info": {
    "title": "Dataset & CSV Cleaner → Excel — Filter, Dedupe, Japanese CSV",
    "description": "Clean any Apify dataset, CSV, JSON or Excel file: flatten nested fields, filter, dedupe, sort, rename, normalize full-width text. Get an Excel file and a CSV that opens in Excel without garbled Japanese. $0.05 per 1,000 rows.",
    "version": "1.0",
    "x-build-id": "HNE3WHreiikDannK2"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/masahishop~dataset-cleaner/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-masahishop-dataset-cleaner",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/acts/masahishop~dataset-cleaner/runs": {
      "post": {
        "operationId": "runs-sync-masahishop-dataset-cleaner",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor and returns information about the initiated run in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/runsResponseSchema"
                }
              }
            }
          }
        }
      }
    },
    "/acts/masahishop~dataset-cleaner/run-sync": {
      "post": {
        "operationId": "run-sync-masahishop-dataset-cleaner",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "inputSchema": {
        "type": "object",
        "properties": {
          "datasetId": {
            "title": "Apify dataset",
            "type": "string",
            "description": "A dataset from one of your runs (e.g. a scraper's results). The Actor gets read-only access to this dataset only."
          },
          "fileUrls": {
            "title": "File URLs",
            "type": "array",
            "description": "CSV, TSV, JSON, JSON Lines or Excel (.xlsx) files. Japanese Shift_JIS CSV files are detected automatically.",
            "items": {
              "type": "string"
            }
          },
          "data": {
            "title": "Inline data (JSON)",
            "type": "array",
            "description": "Rows as a JSON array of objects."
          },
          "fileEncoding": {
            "title": "File encoding",
            "enum": [
              "auto",
              "utf8",
              "shift_jis",
              "euc-jp",
              "gb18030",
              "big5",
              "euc-kr"
            ],
            "type": "string",
            "description": "Auto: UTF-8 (with/without BOM), UTF-16 with BOM, otherwise Shift_JIS.",
            "default": "auto"
          },
          "csvDelimiter": {
            "title": "CSV delimiter",
            "enum": [
              "auto",
              ",",
              "\\t",
              ";",
              "|"
            ],
            "type": "string",
            "description": "Auto-detects comma, tab or semicolon from the header line.",
            "default": "auto"
          },
          "sheetName": {
            "title": "Excel sheet name",
            "type": "string",
            "description": "For .xlsx input. Empty = first sheet. The first row is used as the header."
          },
          "flattenNested": {
            "title": "Flatten nested fields",
            "type": "boolean",
            "description": "{\"address\":{\"city\":\"Tokyo\"}} becomes a column \"address.city\" — needed for tidy Excel/CSV output.",
            "default": true
          },
          "arrayMode": {
            "title": "Arrays become",
            "enum": [
              "join",
              "index",
              "json"
            ],
            "type": "string",
            "description": "How lists are written into cells.",
            "default": "join"
          },
          "trimSpaces": {
            "title": "Trim spaces",
            "type": "boolean",
            "description": "Removes leading/trailing spaces, including full-width spaces (　).",
            "default": true
          },
          "normalizeWidth": {
            "title": "Normalize full-width / half-width characters",
            "type": "boolean",
            "description": "Unicode NFKC: ＡＢＣ１２３ → ABC123, ｶﾀｶﾅ → カタカナ, ① → 1. Makes Japanese data match and dedupe correctly.",
            "default": false
          },
          "collapseSpaces": {
            "title": "Collapse repeated spaces",
            "type": "boolean",
            "description": "Several spaces/tabs inside a value become one space.",
            "default": false
          },
          "emptyToNull": {
            "title": "Empty text → empty cell (null)",
            "type": "boolean",
            "description": "Text values that are empty after cleaning are written as empty cells (null).",
            "default": false
          },
          "filters": {
            "title": "Filters",
            "type": "array",
            "description": "Keep only rows that match. Each rule: {\"field\", \"operator\", \"value\"}. Operators: equals, notEquals, contains, notContains, startsWith, endsWith, in (comma-separated list), regex, gt, gte, lt, lte (numbers like \"1,200\" and dates like 2026/10/07 or 2026年10月7日 are compared correctly), isEmpty, notEmpty. Use the field names after flattening (e.g. \"address.pref\")."
          },
          "filterMode": {
            "title": "Combine filters with",
            "enum": [
              "all",
              "any"
            ],
            "type": "string",
            "description": "How several filter rules are combined.",
            "default": "all"
          },
          "caseSensitive": {
            "title": "Case-sensitive filters",
            "type": "boolean",
            "description": "By default, text filters ignore upper/lower case.",
            "default": false
          },
          "dedupeBy": {
            "title": "Remove duplicates by",
            "type": "array",
            "description": "Field names; rows with the same values in these fields are kept once (first one wins). \"*\" = whole row.",
            "items": {
              "type": "string"
            }
          },
          "sortBy": {
            "title": "Sort by",
            "type": "array",
            "description": "Field names; prefix with \"-\" for descending (e.g. \"-price\"). Numbers, dates and Japanese text are sorted naturally. Empty values go last.",
            "items": {
              "type": "string"
            }
          },
          "offset": {
            "title": "Skip first N rows",
            "minimum": 0,
            "type": "integer",
            "description": "Applied after filtering, deduplication and sorting.",
            "default": 0
          },
          "limit": {
            "title": "Max output rows",
            "minimum": 0,
            "type": "integer",
            "description": "0 = no limit.",
            "default": 0
          },
          "fields": {
            "title": "Columns to keep (in this order)",
            "type": "array",
            "description": "Empty = all columns.",
            "items": {
              "type": "string"
            }
          },
          "renameFields": {
            "title": "Rename columns",
            "type": "object",
            "description": "{\"old name\": \"new name\"}, applied last. Japanese column names are fine, e.g. {\"price\": \"価格\"}."
          },
          "outputFormats": {
            "title": "Output files",
            "type": "array",
            "description": "xlsx = Excel workbook (header row frozen, auto filter, column widths). csv-excel = CSV that opens in Excel without garbled Japanese (UTF-8 with BOM). csv-sjis = Shift_JIS CSV for older Japanese systems. csv / tsv / json / jsonl = plain UTF-8.",
            "default": [
              "xlsx",
              "csv-excel"
            ],
            "items": {
              "type": "string"
            }
          },
          "fileName": {
            "title": "File name",
            "type": "string",
            "description": "Base name of the output files (letters a–z, digits, - and _). Also used as the Excel sheet name, which may be Japanese.",
            "default": "data"
          },
          "excelNumbers": {
            "title": "Numbers as numbers in Excel",
            "type": "boolean",
            "description": "Text like \"1,200\" becomes the number 1200 in the .xlsx file. Values with leading zeros (zip codes, phone numbers) stay text.",
            "default": true
          },
          "pushToDataset": {
            "title": "Also write rows to the run's dataset",
            "type": "boolean",
            "description": "Lets you use Apify's own exports and integrations on the cleaned rows.",
            "default": true
          },
          "maxInputRows": {
            "title": "Max input rows",
            "minimum": 1,
            "maximum": 2000000,
            "type": "integer",
            "description": "Rows read from all inputs together; the rest is ignored.",
            "default": 200000
          },
          "maxFileSizeMb": {
            "title": "Max file size",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "Larger input files are rejected.",
            "default": 100
          }
        }
      },
      "runsResponseSchema": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "actId": {
                "type": "string"
              },
              "userId": {
                "type": "string"
              },
              "startedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "finishedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "status": {
                "type": "string",
                "example": "READY"
              },
              "meta": {
                "type": "object",
                "properties": {
                  "origin": {
                    "type": "string",
                    "example": "API"
                  },
                  "userAgent": {
                    "type": "string"
                  }
                }
              },
              "stats": {
                "type": "object",
                "properties": {
                  "inputBodyLen": {
                    "type": "integer",
                    "example": 2000
                  },
                  "rebootCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "restartCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "resurrectCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "computeUnits": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "options": {
                "type": "object",
                "properties": {
                  "build": {
                    "type": "string",
                    "example": "latest"
                  },
                  "timeoutSecs": {
                    "type": "integer",
                    "example": 300
                  },
                  "memoryMbytes": {
                    "type": "integer",
                    "example": 1024
                  },
                  "diskMbytes": {
                    "type": "integer",
                    "example": 2048
                  }
                }
              },
              "buildId": {
                "type": "string"
              },
              "defaultKeyValueStoreId": {
                "type": "string"
              },
              "defaultDatasetId": {
                "type": "string"
              },
              "defaultRequestQueueId": {
                "type": "string"
              },
              "buildNumber": {
                "type": "string",
                "example": "1.0.0"
              },
              "containerUrl": {
                "type": "string"
              },
              "usage": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "integer",
                    "example": 1
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "usageTotalUsd": {
                "type": "number",
                "example": 0.00005
              },
              "usageUsd": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "number",
                    "example": 0.00005
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}