{
  "openapi": "3.0.1",
  "info": {
    "title": "Data Formatter & Converter: CSV, Excel, JSON, NDJSON, XML, YAML",
    "description": "Convert CSV, Excel, JSON, NDJSON, XML, YAML or HTML tables into JSON, CSV, Excel, SQL, Markdown or HTML. Merge up to 10 files, dedupe, filter, sort, flatten nested JSON, repair broken JSON, auto-detect delimiters and encodings, and validate rows against your example. Pay per valid row.",
    "version": "0.1",
    "x-build-id": "xCqvgL5k77vysc62h"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/forlab~csv-json-schema-formatter/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-forlab-csv-json-schema-formatter",
        "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/forlab~csv-json-schema-formatter/runs": {
      "post": {
        "operationId": "runs-sync-forlab-csv-json-schema-formatter",
        "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/forlab~csv-json-schema-formatter/run-sync": {
      "post": {
        "operationId": "run-sync-forlab-csv-json-schema-formatter",
        "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": {
          "text": {
            "title": "CSV, TSV, JSON, NDJSON, XML, YAML, HTML table or text",
            "type": "string",
            "description": "Paste CSV (or TSV), JSON (common syntax errors repaired automatically), NDJSON/JSONL, XML, YAML, an HTML <table> (with format html), or plain text (one record per line, with format text). Use this OR records, fileUrl, fileUrls, datasetId, datasetIds. Up to 1,000 rows and 2 MiB per run."
          },
          "records": {
            "title": "JSON records",
            "type": "array",
            "description": "An array of JSON objects. Use this OR text, fileUrl, fileUrls, datasetId, datasetIds. Up to 1,000 records and 2 MiB per run."
          },
          "fileUrl": {
            "title": "File upload or URL",
            "type": "string",
            "description": "Upload a CSV, TSV, Excel (.xlsx), JSON, NDJSON/JSONL (.ndjson, .jsonl), XML, YAML, or HTML (.html, .htm) file, or paste its http(s) URL. Use this OR text, records, fileUrls, datasetId, datasetIds. Up to 1,000 rows and 2 MiB."
          },
          "fileUrls": {
            "title": "Files to merge (URLs)",
            "maxItems": 10,
            "type": "array",
            "description": "Up to 10 http(s) URLs of CSV, TSV, Excel (.xlsx), JSON, NDJSON/JSONL, XML, YAML, or HTML files (mixed types allowed) to append into one table, in the order given. Each file is read on its own (own delimiter and encoding detection) and must be 2 MiB or less; the merged result is capped at 1,000 rows. Rows with different columns get the union of columns. Combine with Deduplicate by fields to merge and dedupe. Use this OR text, records, fileUrl, datasetId, datasetIds.",
            "items": {
              "type": "string"
            }
          },
          "targetExample": {
            "title": "Output example",
            "type": "object",
            "description": "One example object in the shape you want back. Every key becomes a required output field; the value's type sets the field type (a URL value means a web address, an email value an email). Leave both this and Format spec empty to convert the input directly without schema checks. Use this OR the advanced format spec."
          },
          "useAi": {
            "title": "Use AI for columns whose names don't match",
            "type": "boolean",
            "description": "AI maps columns whose names don't match; paying users only; $0.01 per mapping. It runs only when name matching leaves a field unmapped, sees the headers and at most 5 sample rows, and only proposes which column feeds which field: it never writes values. Charged once per run, only when its mapping was used and at least one valid row came out.",
            "default": true
          },
          "explode": {
            "title": "Explode array field",
            "type": "string",
            "description": "Top-level array field to expand into one row per element (for example \"items\"). An empty list keeps the row once with null; rows where the field is missing or not an array stay as is. Output is still capped at 1,000 rows."
          },
          "flatten": {
            "title": "Flatten nested objects",
            "type": "boolean",
            "description": "Turn nested objects into top-level keys joined by dots (for example address.city).",
            "default": false
          },
          "unflatten": {
            "title": "Unflatten dotted keys",
            "type": "boolean",
            "description": "Turn dotted top-level keys (such as address.city) back into nested objects. Fails with INVALID_REQUEST on key clashes (for example a and a.b).",
            "default": false
          },
          "filter": {
            "title": "Filter rows",
            "type": "array",
            "description": "Conditions that every kept row must satisfy (JSON array of {field, op, value?, ignore_case?}). Supported ops: eq, ne, contains, not_contains, empty, not_empty, gt, gte, lt, lte, in. Example: [{\"field\": \"country\", \"op\": \"eq\", \"value\": \"TR\", \"ignore_case\": true}, {\"field\": \"score\", \"op\": \"gte\", \"value\": 50}]. Removed rows are never pushed or charged."
          },
          "dedupeBy": {
            "title": "Deduplicate by fields",
            "type": "array",
            "description": "Field names used to detect duplicates; keeps the first matching row. Removed duplicates are never pushed or charged. (When Flatten is enabled, use dotted keys such as address.city.)",
            "items": {
              "type": "string"
            }
          },
          "sortBy": {
            "title": "Sort rows by fields",
            "type": "array",
            "description": "Field names to sort by in priority order. Prefix a field name with - for descending order (for example -score). Nulls and missing values sort last; numbers sort before strings.",
            "items": {
              "type": "string"
            }
          },
          "select": {
            "title": "Select & order columns",
            "type": "array",
            "description": "Keep only these fields in the given order. Missing fields on a row are omitted.",
            "items": {
              "type": "string"
            }
          },
          "drop": {
            "title": "Drop columns",
            "type": "array",
            "description": "Field names to remove from every row.",
            "items": {
              "type": "string"
            }
          },
          "rename": {
            "title": "Rename columns",
            "type": "object",
            "description": "JSON map of old column names to new names, for example {\"old_name\": \"new_name\"}. Renaming onto an existing column fails with INVALID_REQUEST."
          },
          "format": {
            "title": "Source format",
            "enum": [
              "csv",
              "xlsx",
              "json",
              "ndjson",
              "xml",
              "yaml",
              "html",
              "text"
            ],
            "type": "string",
            "description": "Leave empty to auto-detect: records means JSON, text means CSV, fileUrl and fileUrls use each file's extension (.csv, .tsv, .xlsx, .json, .ndjson, .jsonl, .xml, .yaml, .html, .htm, .txt). Choose explicitly for json, ndjson, yaml, xml, html, text, or extensionless URLs. With several files, one choice applies to all of them."
          },
          "datasetId": {
            "title": "Apify dataset ID",
            "type": "string",
            "description": "Select a dataset or paste its ID from another Apify run (up to 1,000 items). Use this OR text, records, fileUrl, fileUrls, datasetIds."
          },
          "datasetIds": {
            "title": "Apify datasets to merge",
            "maxItems": 10,
            "type": "array",
            "description": "Select up to 10 datasets (or paste their IDs) from other Apify runs to append into one table, in the order given. The merged result is capped at 1,000 rows. Rows with different fields get the union of fields. Combine with Deduplicate by fields to merge and dedupe. Use this OR text, records, fileUrl, fileUrls, datasetId."
          },
          "delimiter": {
            "title": "CSV/TSV delimiter",
            "type": "string",
            "description": "One character. When omitted for CSV (except .tsv URLs), auto-detected from , ; \\t | over the first 20 records, falling back to comma."
          },
          "encoding": {
            "title": "File encoding",
            "enum": [
              "utf-8",
              "windows-1254",
              "windows-1252",
              "iso-8859-9",
              "iso-8859-1"
            ],
            "type": "string",
            "description": "Character encoding for fileUrl and fileUrls when it is not UTF-8 or UTF-16. Leave empty to guess Turkish Windows-1254 first, then Windows-1252."
          },
          "outputFiles": {
            "title": "Extra output files",
            "uniqueItems": true,
            "type": "array",
            "description": "Additional files to write alongside results.csv and results.xlsx: json (pretty-printed JSON array), jsonl (one JSON object per line), md (Markdown table), html (HTML table), sql (ANSI INSERT statements), and schema (inferred JSON Schema 2020-12).",
            "items": {
              "type": "string",
              "enum": [
                "json",
                "jsonl",
                "md",
                "html",
                "sql",
                "schema"
              ],
              "enumTitles": [
                "JSON (results.json)",
                "JSONL / NDJSON (results.jsonl)",
                "Markdown table (results.md)",
                "HTML table (results.html)",
                "SQL INSERTs (results.sql)",
                "JSON Schema 2020-12 (results.schema.json)"
              ]
            }
          },
          "sqlTable": {
            "title": "SQL table name",
            "type": "string",
            "description": "Table name for SQL INSERT statements when outputFiles includes sql (1–63 characters, no NUL, default \"data\").",
            "default": "data"
          },
          "formatSpec": {
            "title": "Format spec (instead of output example)",
            "type": "object",
            "description": "The full format_spec of the Formatter API: a JSON Schema target (target_schema) or target_example, explicit mapping rules with transform steps (including parse_datetime, parse_currency, title/snake/camel/kebab), and policies (row_error collect or fail). OUTPUT's added_mapping can be saved here to pin the mapping for later files."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}