{
  "openapi": "3.0.1",
  "info": {
    "title": "Dataset Transformer: Filter, Dedupe, JSON to CSV",
    "description": "Clean, merge and deduplicate data: Apify datasets, pasted rows, JSON, CSV, JSONL, Excel XLSX or Google Sheets. Filter by regex, dates or lists, remove duplicates by any field (URL, email, phone aware), keep only new rows, sort, rename, flatten. JSON to CSV, CSV to JSON, Excel to CSV, Excel to JSON.",
    "version": "1.4",
    "x-build-id": "yhL3ht391EDKQFYIt"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/humble-echidna~dataset-transform/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-humble-echidna-dataset-transform",
        "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/humble-echidna~dataset-transform/runs": {
      "post": {
        "operationId": "runs-sync-humble-echidna-dataset-transform",
        "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/humble-echidna~dataset-transform/run-sync": {
      "post": {
        "operationId": "run-sync-humble-echidna-dataset-transform",
        "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": "The id or name of one of your own Apify datasets, e.g. the defaultDatasetId of another actor's run (or pick one in the form). The run reads it with your own Apify account's access, read-only. When it's set, items and fileUrl are ignored."
          },
          "fileUrl": {
            "title": "Or: file URL or upload (CSV, JSON, JSONL or Excel)",
            "type": "string",
            "description": "Upload a CSV/TSV, JSON (an array of objects), JSON Lines or Excel (.xlsx) file from your computer, or give a direct public http(s) link to one, up to 200 MB, gzip-compressed or not. A Google Sheets link works too when the sheet is shared as \"Anyone with the link\" (the tab in the link is read, or the one named in sheetName). Used only when datasetId and items are empty. The default is the US Treasury's official exchange rates for 2025-12-31 (a public CSV of 174 currencies).",
            "default": "https://api.fiscaldata.treasury.gov/services/api/fiscal_service/v1/accounting/od/rates_of_exchange?format=csv&filter=record_date:eq:2025-12-31&page[size]=300"
          },
          "items": {
            "title": "Or: paste rows (JSON array)",
            "type": "array",
            "description": "Rows given directly in the input, as a JSON array of objects, e.g. [{\"name\": \"Ada\", \"city\": \"London\"}, {\"name\": \"Bo\", \"city\": \"Paris\"}]. For data you already have, such as JSON an AI agent wants as CSV; for large data use datasetId or fileUrl. Used when datasetId is empty; fileUrl is then ignored. An element that isn't an object becomes {\"value\": ...}. Default: none."
          },
          "datasetIds": {
            "title": "More Apify datasets",
            "type": "array",
            "description": "Several of your own Apify datasets (ids or names, or pick them), read one after another and handled as one table: filters, duplicates, sorting and the row limit apply across all of them. Read after the Apify dataset above, if one is picked, and before pasted rows and files. Up to 100 sources per run. Read-only access to exactly these. Default: none."
          },
          "fileUrls": {
            "title": "More file URLs (CSV, JSON, JSONL, Excel or Google Sheets)",
            "type": "array",
            "description": "Several file links, one per line, read after the datasets and pasted rows, each like the file URL above (direct public links up to 200 MB each, or shared Google Sheets links; the tab in each link is read). The file URL above is read too, first, unless it's still the example file. The file options below apply to every file. Default: none.",
            "items": {
              "type": "string"
            }
          },
          "sourceField": {
            "title": "Add a field naming each row's source",
            "type": "string",
            "description": "A field name, e.g. `source`: every row gets that field holding where it came from (`dataset:<id>`, `pasted rows`, or the file's link without its query part). It's added before the rules and filters, so they can use it, and kept at the end of `fields` if you don't place it yourself. Leave empty (the default) for no such field."
          },
          "filters": {
            "title": "Filters",
            "type": "array",
            "description": "Keep only rows that match, one condition per line: `field operator value`. `==` `!=` `>` `>=` `<` `<=` (numbers as numbers, else text), `contains`, `not contains`, `starts with`, `ends with` (ignore case), `is empty`, `is not empty`, `~` (regex), `in [US, CA]`, `between 10 and 20`, `after 2026-11-01`, `before today`, `within last 7 days`, `older than 30 days`, `is true`, `exists`, `length(tags) > 2`. E.g. `price > 10`, `address.city == Paris`. Default: none.",
            "items": {
              "type": "string"
            }
          },
          "filterMode": {
            "title": "A row must match",
            "enum": [
              "all",
              "any"
            ],
            "type": "string",
            "description": "How several filters combine. `all` (the default): a row must match every filter (AND). `any`: a row must match at least one (OR).",
            "default": "all"
          },
          "rules": {
            "title": "Clean values and add fields",
            "type": "array",
            "description": "Change values or add fields, one rule per line, `field: operation`, run in order before the filters. Text: trim, collapse spaces, strip html, lowercase, uppercase, empty to null, replace A => B, regex replace A => B. Conversions: number, boolean, date, text, digits, domain, regex extract. Also template {first} {last}, default X. `*` = every field; `website -> domain: domain` writes a new field. Default: none.",
            "items": {
              "type": "string"
            }
          },
          "dedupeBy": {
            "title": "Remove duplicates by",
            "type": "array",
            "description": "Fields that together identify a row, one per line or comma-separated (e.g. `url`, or `name, city`; put a field name that has a comma in double quotes: `\"Revenue, USD\"`). Only the first row with each combination is kept; text that differs only in how an accent is encoded counts as the same. `*` alone compares whole rows. Rows where all these fields are empty are always kept. Default: no deduplication.",
            "items": {
              "type": "string"
            }
          },
          "dedupeNormalize": {
            "title": "Match duplicates loosely",
            "type": "array",
            "description": "How Remove duplicates by values are compared, any of: `trim` (extra spaces), `lowercase`, `accents`, `url` (web addresses without scheme, www, port, fragment, trailing slash and tracking parameters like utm_*, gclid), `email` (no case, spaces, mailto:), `phone` (digits only). `url`, `email` and `phone` only touch values of that kind. The output keeps the original values. Default: none (exact).",
            "items": {
              "type": "string",
              "enum": [
                "trim",
                "lowercase",
                "accents",
                "url",
                "email",
                "phone"
              ],
              "enumTitles": [
                "Extra spaces",
                "Upper/lower case",
                "Accents (é = e)",
                "Web addresses (http/https, www, trailing slash, utm_ and click-id parameters)",
                "Email addresses (case, spaces, mailto:)",
                "Phone numbers (digits only)"
              ]
            }
          },
          "sortBy": {
            "title": "Sort by",
            "type": "array",
            "description": "Fields to sort by, one per line, each optionally followed by `desc` (e.g. `price desc`). Numbers sort as numbers, text ignoring upper/lower case; empty values always go last. Leave empty to keep the source order.",
            "items": {
              "type": "string"
            }
          },
          "fields": {
            "title": "Fields to keep (and rename)",
            "type": "array",
            "description": "The output fields, in this order, one per line: `field`, or `field -> new name` to rename it. A field a row doesn't have is null. Leave empty to keep every field. Filters, duplicates and sorting use the original names.",
            "items": {
              "type": "string"
            }
          },
          "flatten": {
            "title": "Flatten nested objects",
            "type": "boolean",
            "description": "Default false. When true, turn nested objects and arrays into dotted fields ({\"address\": {\"city\": \"Paris\"}} becomes \"address.city\": \"Paris\"), which is what spreadsheets and CSV need. Dotted field names in the options above work either way.",
            "default": false
          },
          "exportFormat": {
            "title": "Also save as a file",
            "enum": [
              "none",
              "csv",
              "jsonl",
              "xlsx"
            ],
            "type": "string",
            "description": "Also save the output rows as one file in the run's key-value store (up to 100 MB), at no extra cost. `none` (the default): no file. `csv`: OUTPUT.csv. `jsonl`: OUTPUT.jsonl (JSON Lines). `xlsx`: OUTPUT.xlsx, an Excel workbook with one sheet (text stays text, numbers stay numbers). The dataset itself can always be downloaded as CSV, JSON, Excel and more from Apify.",
            "default": "none"
          },
          "csvFormulaSafe": {
            "title": "Protect the CSV from spreadsheet formulas",
            "type": "boolean",
            "description": "CSV file only (in the Excel file text is always stored as text, so a formula there never runs and gets no apostrophe). On (the default): text a spreadsheet would run as a formula, starting with `=`, `+`, `-` or `@` and not a plain number, gets an apostrophe in front, so scraped text can't run when the file is opened. This also marks values like `+1 555 0100`. Turn it off when another program reads the file and needs the text exactly as it was. The dataset itself is never changed.",
            "default": true
          },
          "maxResults": {
            "title": "Max rows per run",
            "minimum": 1,
            "type": "integer",
            "description": "Stop after this many output rows in total, e.g. 20. Minimum 1; leave empty (the default) for no limit. With sorting, these are the top rows. The run also stops cleanly at the maximum cost per run you set in the run options, whichever comes first. Set it to keep a run small and quick."
          },
          "onlyNew": {
            "title": "Only rows not returned by earlier runs",
            "type": "boolean",
            "description": "Default false. When true, the key of each row written (the Remove duplicates by fields, or the whole row) is remembered in a key-value store in your account, and later runs skip those rows, free: a scheduled scraper's run gives only rows not given before. The memory belongs to memoryName, else the saved task, else the scraper behind the first dataset (with its filters), and restarts when the duplicate fields, matching or flatten change.",
            "default": false
          },
          "memoryName": {
            "title": "Memory name",
            "type": "string",
            "description": "Optional name for what Only rows not returned by earlier runs remembers, so several tasks or scrapers share one memory and changing a filter keeps it, e.g. `all-leads`. Letters, digits and hyphens, at most 63 characters. Default: none."
          },
          "webhookUrl": {
            "title": "Webhook URL",
            "type": "string",
            "description": "Optional: when the run ends, one POST request with JSON to this address (a Zapier or n8n catch hook, or your own endpoint; public http or https, ports 80 and 443): the rows written plus a summary with the counts and links to the dataset and file, or the summary alone when the rows are over 5 MB. Free. Stored encrypted and never logged. Default: none."
          },
          "webhookPayload": {
            "title": "Webhook: what to send",
            "enum": [
              "rows",
              "summary"
            ],
            "type": "string",
            "description": "`rows` (the default): the rows written and the summary, or the summary alone when the rows are over 5 MB. `summary`: only the counts and the links to the dataset and the file.",
            "default": "rows"
          },
          "webhookSkipEmpty": {
            "title": "Webhook: skip runs with no rows",
            "type": "boolean",
            "description": "Default false. When true, a run that writes no rows (say, nothing new since the last run) sends nothing.",
            "default": false
          },
          "fileFormat": {
            "title": "File format",
            "enum": [
              "auto",
              "csv",
              "json",
              "jsonl",
              "xlsx"
            ],
            "type": "string",
            "description": "The format of fileUrl. `auto` (the default): read from the file itself; set another only if detection gets it wrong. `csv`: CSV or TSV. `json`: JSON (an array, or see itemsPath). `jsonl`: JSON Lines. `xlsx`: an Excel workbook (.xlsx or .xlsm; for an old .xls, save it as .xlsx first).",
            "default": "auto"
          },
          "itemsPath": {
            "title": "JSON: path to the list of rows",
            "type": "string",
            "description": "JSON files only: when the file is one object with the rows inside it (like {\"data\": {\"items\": [...]}}), the dotted path to that list, e.g. `data.items`. Leave empty (the default) for a file that is a list."
          },
          "csvDelimiter": {
            "title": "CSV: delimiter",
            "type": "string",
            "description": "CSV files only: the character between columns: `,` `;` `|` or `tab`. Leave empty (the default) to detect it."
          },
          "sheetName": {
            "title": "Excel: sheet name",
            "type": "string",
            "description": "Excel files only: the worksheet to read, by its tab name (e.g. `Sales 2025`; upper/lower case doesn't matter). Leave empty (the default) for the first sheet. Its first non-empty row is the header row; formulas give the value Excel last saved."
          },
          "headerRow": {
            "title": "Excel: header row",
            "minimum": 1,
            "type": "integer",
            "description": "Excel files only: the number of the row that has the column names, as Excel numbers rows (e.g. `5` when a title and notes fill rows 1-4). Rows above it are skipped. Leave empty (the default) to use the first non-empty row."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}