{
  "openapi": "3.0.1",
  "info": {
    "title": "Dataset Transformer: Filter, Dedupe, JSON to CSV",
    "description": "Clean, deduplicate and transform data: an Apify dataset, pasted JSON or a CSV, JSON, JSONL or Excel XLSX file URL. Filter rows, remove duplicates by any field, sort, rename fields, flatten JSON. Get a dataset and an optional CSV or JSONL file: JSON to CSV, CSV to JSON, Excel to CSV or Excel to JSON.",
    "version": "1.3",
    "x-build-id": "aPkFsfIcXLYrYxQxY"
  },
  "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."
          },
          "filters": {
            "title": "Filters",
            "type": "array",
            "description": "Keep only rows that match, one condition per line: `field operator value`. Operators: == != > >= < <= (numbers compare as numbers, anything else as text), contains, not contains, starts with, ends with (these ignore upper/lower case), is empty, is not empty. Examples: `price > 10`, `country == US`, `email is not empty`. Dots for nested fields: `address.city == Paris`. Combined per filterMode. 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"
          },
          "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"
            }
          },
          "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"
            ],
            "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). The dataset itself can always be downloaded as CSV, JSON, Excel and more from Apify.",
            "default": "none"
          },
          "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."
          },
          "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}