{
  "openapi": "3.0.1",
  "info": {
    "title": "Dataset Transform: JSON to CSV, Flatten, Filter, Rename",
    "description": "Turn any Apify dataset (or pasted JSON) into clean tables: flatten nested JSON, pick and rename columns, convert types, filter, sort, then export CSV, JSON or JSONL with a link. Empty input = free demo. $0.50 per 1,000 output rows.",
    "version": "0.1",
    "x-build-id": "iae86baevgl1zTovb"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/ucchiii~dataset-transform/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-ucchiii-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/ucchiii~dataset-transform/runs": {
      "post": {
        "operationId": "runs-sync-ucchiii-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/ucchiii~dataset-transform/run-sync": {
      "post": {
        "operationId": "run-sync-ucchiii-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": {
          "datasetIds": {
            "title": "Datasets",
            "type": "array",
            "description": "Dataset IDs (the 'defaultDatasetId' of a finished run of any Actor, e.g. 'WkzbQMuFYuamGv3YF'). Rows are read in the order given. You can paste a dataset URL from Apify Console or the API too. Leave this AND 'items' empty to run a free demo on sample data (not charged)."
          },
          "items": {
            "title": "Or paste rows (JSON)",
            "type": "array",
            "description": "Rows to transform, as a JSON array of objects, e.g. [{\"name\":\"A\",\"price\":\"$1,200\"}]. Used after the datasets (if any). Up to 50,000 rows; use a dataset for more."
          },
          "select": {
            "title": "Keep only these columns",
            "type": "array",
            "description": "Columns to output, in this order. Use the flattened name, e.g. 'address.city'. A parent name such as 'address' keeps all columns under it ('address.city', 'address.zip'). Empty = all columns.",
            "items": {
              "type": "string"
            }
          },
          "omit": {
            "title": "Remove these columns",
            "type": "array",
            "description": "Columns to drop from the output. A parent name such as 'meta' removes everything under it ('meta.id', 'meta.tags.0'). Applied after 'Keep only these columns'.",
            "items": {
              "type": "string"
            }
          },
          "rename": {
            "title": "Rename columns",
            "type": "object",
            "description": "Map of current column name to new name, e.g. {\"address.city\": \"city\", \"price\": \"price_usd\"}. Use names as they are after flattening. Two columns cannot share a new name."
          },
          "maxDepth": {
            "title": "Flatten depth",
            "minimum": 0,
            "maximum": 20,
            "type": "integer",
            "description": "How many levels of nested objects and arrays to flatten into dot-path columns (e.g. address.geo.lat). 0 = do not flatten (nested values stay as JSON). Anything deeper than this limit stays as a JSON value. Default 10, maximum 20.",
            "default": 10
          },
          "arrayMode": {
            "title": "Arrays",
            "enum": [
              "json",
              "join",
              "index",
              "first",
              "count"
            ],
            "type": "string",
            "description": "How arrays are turned into columns. 'join' only joins numbers/text; arrays of objects stay as a JSON string. 'index' creates columns like 'lines.0.sku'. Default: json.",
            "default": "json"
          },
          "arrayJoinSeparator": {
            "title": "Join separator",
            "type": "string",
            "description": "Text placed between values when Arrays = join. Default '; ' (semicolon and space). Max 20 characters.",
            "default": "; "
          },
          "maxArrayItems": {
            "title": "Max items per array (index mode)",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "With Arrays = index, only the first N items of each array get columns (protects against thousands of columns). Rows that were cut are counted in the run statistics. Default 100, maximum 1000.",
            "default": 100
          },
          "flattenSeparator": {
            "title": "Path separator",
            "type": "string",
            "description": "Character(s) that join nested names in flattened columns, e.g. '.' gives 'address.city' and '_' gives 'address_city'. Column names in other settings must use the same separator. Max 5 characters.",
            "default": "."
          },
          "coerce": {
            "title": "Convert column types",
            "type": "object",
            "description": "Map of column name to type: string, number, integer, boolean or date. Example: {\"price\": \"number\", \"inStock\": \"boolean\", \"createdAt\": \"date\"}. Numbers accept '$1,234.50' and '(12)'; dates become ISO 8601 UTC. Values that cannot be converted become empty and are counted in the run statistics. Runs before filters and sorting."
          },
          "decimalSeparator": {
            "title": "Decimal separator in numbers",
            "enum": [
              ".",
              ","
            ],
            "type": "string",
            "description": "How to read numbers written as text when converting to number or integer. Default: dot.",
            "default": "."
          },
          "trimStrings": {
            "title": "Trim spaces in text",
            "type": "boolean",
            "description": "Remove leading and trailing spaces from all text values.",
            "default": false
          },
          "emptyStringsAsNull": {
            "title": "Treat empty text as empty value",
            "type": "boolean",
            "description": "Turn empty or whitespace-only text into null (an empty cell in CSV).",
            "default": false
          },
          "filters": {
            "title": "Filter rows",
            "type": "array",
            "description": "Keep only rows that match. A JSON list of conditions: {\"field\": \"price\", \"op\": \"gt\", \"value\": 10}. Operators: eq, ne, gt, gte, lt, lte, contains, notContains, startsWith, endsWith, in, notIn (value is a list), exists, notExists. Up to 50 conditions. Field names are the flattened names, before renaming."
          },
          "filterMode": {
            "title": "Combine conditions with",
            "enum": [
              "all",
              "any"
            ],
            "type": "string",
            "description": "Whether a row must match all filter conditions or just one.",
            "default": "all"
          },
          "filterIgnoreCase": {
            "title": "Ignore letter case in filters",
            "type": "boolean",
            "description": "Compare text without regard to upper/lower case in eq, ne, in, contains and similar operators.",
            "default": true
          },
          "sortBy": {
            "title": "Sort by column",
            "type": "string",
            "description": "Flattened column name to sort by, e.g. 'price'. Numbers sort before text; empty values always go last. Sorting holds the matching rows in memory (max 500,000 rows). Empty = keep the original order."
          },
          "sortOrder": {
            "title": "Sort order",
            "enum": [
              "asc",
              "desc"
            ],
            "type": "string",
            "description": "Ascending or descending. Only used when 'Sort by column' is set.",
            "default": "asc"
          },
          "offset": {
            "title": "Skip first rows",
            "minimum": 0,
            "type": "integer",
            "description": "Skip this many rows of the final result (after filtering and sorting). Skipped rows are not charged. Default 0.",
            "default": 0
          },
          "limit": {
            "title": "Max output rows",
            "minimum": 1,
            "maximum": 1000000,
            "type": "integer",
            "description": "Stop after this many output rows. Leave empty for no limit (hard cap 1,000,000 rows per run). Billing is per output row, so this also caps cost."
          },
          "maxCellChars": {
            "title": "Max characters per text cell",
            "minimum": 0,
            "maximum": 10000000,
            "type": "integer",
            "description": "Longer text is cut to this length (32,000 fits Excel's cell limit of 32,767). Cut cells are counted in the run statistics. 0 = no limit. Default 32000.",
            "default": 32000
          },
          "exportFormat": {
            "title": "Also save a file",
            "enum": [
              "csv",
              "jsonl",
              "json",
              "none"
            ],
            "type": "string",
            "description": "Besides the output dataset, save all output rows as a file in the run's key-value store and return a link in the run statistics (record STATS, field fileUrl). The file is capped at 150 MB. Default: csv.",
            "default": "csv"
          },
          "fileName": {
            "title": "File name",
            "type": "string",
            "description": "File name without extension. Only letters, digits, dot, dash and underscore are kept. The extension (.csv, .jsonl or .json) is added automatically.",
            "default": "export"
          },
          "csvDelimiter": {
            "title": "CSV delimiter",
            "enum": [
              ",",
              ";",
              "tab",
              "|"
            ],
            "type": "string",
            "description": "Column separator for CSV files. Default: comma.",
            "default": ","
          },
          "csvBom": {
            "title": "CSV: add UTF-8 BOM for Excel",
            "type": "boolean",
            "description": "Adds a byte-order mark so Excel opens non-English text correctly. Leave off for pandas, databases and most code.",
            "default": false
          },
          "csvEscapeFormulas": {
            "title": "CSV: neutralize spreadsheet formulas",
            "type": "boolean",
            "description": "Prefix text cells starting with =, +, @ (or - followed by text) with an apostrophe so Excel or Sheets never run them as formulas. Recommended when the CSV will be opened in a spreadsheet and the data comes from untrusted sources.",
            "default": false
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}