{
  "openapi": "3.0.1",
  "info": {
    "title": "Dataset Splitter: CSV, XLSX, JSON by rows or column",
    "description": "Split an Apify dataset or a CSV/JSON/NDJSON file into parts by row count, number of parts, column value or file size, or draw a random sample. Saves CSV/JSON/NDJSON/XLSX files and datasets. Empty input = free demo. $0.10 per 1,000 rows.",
    "version": "0.1",
    "x-build-id": "MJ5RCXDWUFEkf5oCr"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/ucchiii~dataset-splitter/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-ucchiii-dataset-splitter",
        "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-splitter/runs": {
      "post": {
        "operationId": "runs-sync-ucchiii-dataset-splitter",
        "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-splitter/run-sync": {
      "post": {
        "operationId": "run-sync-ucchiii-dataset-splitter",
        "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": "Dataset to split (the 'defaultDatasetId' of a finished run). You can paste a dataset URL from Apify Console too. Up to 2,000,000 rows. Use this OR a file URL. Leave both empty to run a free demo."
          },
          "fileUrl": {
            "title": "File URL",
            "type": "string",
            "description": "Public http(s) link to a CSV, TSV, JSON or NDJSON file (up to 200 MB). Links to internal networks are blocked. Use this OR an Apify dataset. Leave both empty to run a free demo on a built-in sample (not charged)."
          },
          "splitMode": {
            "title": "Split mode",
            "enum": [
              "rows",
              "parts",
              "column",
              "size",
              "sample"
            ],
            "type": "string",
            "description": "How to cut the data. rows: 'Rows per part'. parts: 'Number of parts'. column: 'Column'. size: 'Target size'. sample: 'Sample rows' or 'Sample percent'. Default: rows.",
            "default": "rows"
          },
          "rowsPerPart": {
            "title": "Rows per part",
            "minimum": 1,
            "maximum": 2000000,
            "type": "integer",
            "description": "Mode 'rows': maximum rows in each part (the last part may be smaller). Example 10000 for CRM imports. A run makes at most 500 parts. Default when empty: 10,000."
          },
          "partCount": {
            "title": "Number of parts",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "Mode 'parts': how many parts of nearly equal size to make (up to 500). With fewer rows than parts you get one row per part. Default when empty: 2."
          },
          "column": {
            "title": "Column",
            "type": "string",
            "description": "Mode 'column': name of the column whose values define the parts (matched case-insensitively if needed). Rows with an empty value go to a part named 'empty'. For dataset items only top-level fields are columns."
          },
          "maxParts": {
            "title": "Max parts (split by column)",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "Mode 'column': if the column has more different values than this, the run fails before anything is written or charged. Hard limit 500. Default: 500.",
            "default": 500
          },
          "targetSizeMb": {
            "title": "Target size per part (MB)",
            "minimum": 0.01,
            "maximum": 1000,
            "type": "number",
            "description": "Mode 'size': approximate size of each part in MB, estimated from the output format (XLSX is estimated at about 40% of the CSV size). Real files can differ by some percent. Default: 5.",
            "default": 5
          },
          "sampleRows": {
            "title": "Sample rows",
            "minimum": 1,
            "maximum": 2000000,
            "type": "integer",
            "description": "Mode 'sample': number of rows to draw at random. Takes precedence over 'Sample percent'. Rows keep their original order."
          },
          "samplePercent": {
            "title": "Sample percent",
            "minimum": 0.0001,
            "maximum": 100,
            "type": "number",
            "description": "Mode 'sample': share of rows to draw, for example 10 for 10 percent (at least one row). Used when 'Sample rows' is empty."
          },
          "seed": {
            "title": "Random seed",
            "minimum": 0,
            "maximum": 2147483647,
            "type": "integer",
            "description": "Mode 'sample': the same seed and the same data always give the same sample. Empty = a random seed, which is reported in the output (field seed) so you can repeat the sample."
          },
          "outputFormat": {
            "title": "Output format",
            "enum": [
              "csv",
              "json",
              "ndjson",
              "xlsx"
            ],
            "type": "string",
            "description": "Format of the part files saved to the key-value store. Default: csv.",
            "default": "csv"
          },
          "saveToKeyValueStore": {
            "title": "Save part files",
            "type": "boolean",
            "description": "Save every part as a file in the key-value store, with a public download link. Turn off to write only datasets. Default: on.",
            "default": true
          },
          "saveToDatasets": {
            "title": "Also save parts as new datasets",
            "type": "boolean",
            "description": "Write every part into its own new named dataset (prefix-001, prefix-002, ...). Named datasets stay until you delete them. The run fails before writing if one of them already has items. Default: off.",
            "default": false
          },
          "datasetNamePrefix": {
            "title": "Dataset name prefix",
            "type": "string",
            "description": "Prefix for the new datasets: lowercase letters, digits and dashes (max 40). Empty = 'split-' plus the run ID, which is always new."
          },
          "inputFormat": {
            "title": "Input format",
            "enum": [
              "auto",
              "csv",
              "tsv",
              "json",
              "ndjson"
            ],
            "type": "string",
            "description": "Format of the source file. 'auto' uses the file extension, the content type and the content. Ignored for Apify datasets. Default: auto.",
            "default": "auto"
          },
          "encoding": {
            "title": "Input text encoding",
            "enum": [
              "auto",
              "utf-8",
              "utf-8-sig",
              "cp1252",
              "shift_jis"
            ],
            "type": "string",
            "description": "Character encoding of the source file. Output is always UTF-8. Default: auto (UTF-8, then Shift_JIS if kana are found, then Windows-1252).",
            "default": "auto"
          },
          "detectNumbers": {
            "title": "Detect numbers in CSV",
            "type": "boolean",
            "description": "Turn plain numbers in a CSV into real numbers (useful for XLSX and JSON output). Values with leading zeros, more than 15 digits or exponents stay text. Default: off, values are kept exactly as in the file.",
            "default": false
          },
          "csvBom": {
            "title": "CSV: add UTF-8 BOM for Excel",
            "type": "boolean",
            "description": "Add a byte-order mark to CSV parts so Excel opens non-English text (for example Japanese) correctly. Leave off for databases and most code.",
            "default": false
          },
          "fileName": {
            "title": "File name",
            "type": "string",
            "description": "Start of every part file name, for example 'leads' gives leads-part-001.csv. Only letters, digits, dot, dash and underscore are kept. Empty = taken from the source."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}