{
  "openapi": "3.0.1",
  "info": {
    "title": "Dataset Transform: Rename, Flatten, Filter & Sort Columns",
    "description": "Dataset transform tool: rename columns, flatten JSON, filter rows, sort, sample, split, add computed columns and cast types on Apify datasets, CSV, JSON, JSONL and Excel files. Ordered JSON pipeline, no code. Export CSV or Excel.",
    "version": "0.1",
    "x-build-id": "qoWIX8gQXwhojL23E"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/data-done-right~dataset-transform/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-data-done-right-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/data-done-right~dataset-transform/runs": {
      "post": {
        "operationId": "runs-sync-data-done-right-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/data-done-right~dataset-transform/run-sync": {
      "post": {
        "operationId": "run-sync-data-done-right-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",
        "required": [
          "operations"
        ],
        "properties": {
          "items": {
            "title": "Pasted items (JSON rows)",
            "type": "array",
            "description": "Rows pasted straight into the input, as a JSON array of objects. Nested objects and lists are fine. Example: [{\"name\": \"Ann\", \"address\": {\"city\": \"Oslo\"}}]. Works offline, so it is the quickest way to try a pipeline. Leave empty when you use datasets or files."
          },
          "datasetIds": {
            "title": "Apify datasets",
            "type": "array",
            "description": "Datasets to transform. Pick them from the list, or paste dataset IDs. Reads go through your run, so datasets of other Actors and runs that you can read work. Example: [\"aBcD1234eFgH5678i\", \"username~my-named-dataset\"]."
          },
          "datasetUrls": {
            "title": "Dataset links or IDs",
            "type": "array",
            "description": "Dataset IDs, \"username~name\" names or Apify links, one per line. Example: https://console.apify.com/storage/datasets/aBcD1234eFgH5678i. A dataset that is only given here may be unreadable when the run has limited permissions: pick it in \"Apify datasets\" instead.",
            "items": {
              "type": "string"
            }
          },
          "fileUrls": {
            "title": "File URLs (CSV, JSON, JSONL, Excel)",
            "type": "array",
            "description": "Direct links to .csv, .tsv, .json, .jsonl or .xlsx files, one per line. The type is detected from the extension or the content. Example: https://example.com/export/products.csv. Links to localhost and private networks are blocked.",
            "items": {
              "type": "string"
            }
          },
          "inlineSources": {
            "title": "Pasted CSV or JSON text",
            "type": "array",
            "description": "CSV, JSON or JSONL text pasted into the input. Each item is {\"name\": ..., \"format\": \"csv\" | \"json\" | \"jsonl\", \"text\": ...}. Example: [{\"name\": \"leads\", \"format\": \"csv\", \"text\": \"email,name\\na@x.com,Ann\"}]."
          },
          "operations": {
            "title": "Transform steps (ordered pipeline)",
            "type": "array",
            "description": "The steps to run, in order, as JSON data (no code). Each step is {\"op\": ..., settings}. Operations: select, drop, rename, reorder, flatten, unflatten, filter, sort, sample, limit, skip, add_column, text, cast, fill, split, explode. Example: [{\"op\": \"rename\", \"mapping\": {\"old\": \"new\"}}, {\"op\": \"sort\", \"by\": [\"price:desc\"]}]. Unknown steps or settings are rejected with a clear message before any row is charged."
          },
          "onError": {
            "title": "When a value cannot be computed or cast",
            "enum": [
              "null",
              "dropRow"
            ],
            "type": "string",
            "description": "null: set that value to null and count the problem in the SUMMARY record. dropRow: leave out the whole row. A step can override this with its own onError. Example: null.",
            "default": "null"
          },
          "exports": {
            "title": "Export files",
            "type": "array",
            "description": "Also write the result as downloadable files in the key-value store, each with a link in the SUMMARY record. Every file is charged once. Leave empty for the dataset only. Example: [\"csv\", \"xlsx\"].",
            "items": {
              "type": "string",
              "enum": [
                "csv",
                "xlsx",
                "json",
                "jsonl"
              ],
              "enumTitles": [
                "CSV (UTF-8, opens in Excel)",
                "Excel (.xlsx)",
                "JSON array",
                "JSON Lines"
              ]
            },
            "default": []
          },
          "exportName": {
            "title": "Export file name",
            "type": "string",
            "description": "Base name of the export files, e.g. transformed gives transformed.csv and transformed.xlsx.",
            "default": "transformed"
          },
          "escapeFormulas": {
            "title": "Protect CSV from spreadsheet formulas",
            "type": "boolean",
            "description": "In the CSV export, text that starts with = + - or @ gets a leading apostrophe so Excel and Sheets cannot run it as a formula. Excel files always store such text as plain text. Turn off only if you need the raw values.",
            "default": true
          },
          "maxItems": {
            "title": "Max rows to read",
            "minimum": 1,
            "maximum": 2000000,
            "type": "integer",
            "description": "Hard cap on input rows read across all sources, in rows. You are charged per input row read, so this also caps cost. Example: 10000. It also bounds memory for sort and random sample.",
            "default": 100000
          },
          "maxOutputRows": {
            "title": "Max output rows",
            "minimum": 1,
            "maximum": 5000000,
            "type": "integer",
            "description": "Stop writing after this many output rows. A safety cap for the explode step, which can turn one row into many. Example: 500000.",
            "default": 1000000
          },
          "maxFileSizeMb": {
            "title": "Max file size (MB)",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "Files larger than this are rejected (that source fails, the others continue). A JSON array file is loaded whole and is limited to 100 MB; use JSONL or CSV for bigger files. Example: 50.",
            "default": 50
          },
          "csvInferTypes": {
            "title": "Detect numbers and booleans in CSV",
            "type": "boolean",
            "description": "Turn CSV text like 42, 3.5 or true into numbers and booleans. Values with leading zeros (007), plus signs or very long digit strings stay text.",
            "default": true
          },
          "xlsxSheet": {
            "title": "Excel sheet",
            "type": "string",
            "description": "Sheet name or number (1 = first) to read from every Excel file. Leave empty for the first sheet. Example: Sheet2."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}