{
  "openapi": "3.0.1",
  "info": {
    "title": "Dataset Filter & Transform: Filter, Pick, Rename, Flatten",
    "description": "Clean any Apify dataset, CSV, Excel or JSON file without code: filter rows, keep or drop columns, rename and flatten fields, remove duplicates, sort by several fields, split lists into rows, then export CSV, Excel or JSON. Chain it between a scraper and Sheets or alerts.",
    "version": "0.0",
    "x-build-id": "kdCDdsWSstpWHXKgY"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/charlesmarkette~dataset-filter-transform-rename-flatten-fields/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-charlesmarkette-dataset-filter-transform-rename-flatten-fields",
        "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/charlesmarkette~dataset-filter-transform-rename-flatten-fields/runs": {
      "post": {
        "operationId": "runs-sync-charlesmarkette-dataset-filter-transform-rename-flatten-fields",
        "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/charlesmarkette~dataset-filter-transform-rename-flatten-fields/run-sync": {
      "post": {
        "operationId": "run-sync-charlesmarkette-dataset-filter-transform-rename-flatten-fields",
        "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": "One or more datasets to clean up, read in order (usually a scraper run's output). In an integration, use [\"{{resource.defaultDatasetId}}\"]. Leave empty to use 'File URLs' or 'Items' below instead."
          },
          "datasetIdList": {
            "title": "Dataset IDs (typed)",
            "type": "array",
            "description": "Optional. Dataset IDs (or username~dataset-name) typed by hand, one per line. Read after the picked datasets.",
            "items": {
              "type": "string"
            }
          },
          "items": {
            "title": "Items (instead of datasets)",
            "type": "array",
            "description": "Optional. A JSON list of objects (pasted rows) to filter and transform, used only when no dataset and no file URL is given. Handy for quick tests and for calling this Actor from code."
          },
          "fileUrls": {
            "title": "File URLs",
            "type": "array",
            "description": "Optional. Public links to CSV, TSV, JSON, JSON Lines or Excel (XLSX/XLS) files, one per line, read after the datasets. Google Sheets, Google Drive and Dropbox share links work when shared as 'Anyone with the link'. Up to 100 files of 100 MB each.",
            "items": {
              "type": "string"
            }
          },
          "fileSheets": {
            "title": "Excel sheets",
            "enum": [
              "first",
              "all"
            ],
            "type": "string",
            "description": "For Excel files and Google Sheets: read only the first sheet, or every sheet (one after the other).",
            "default": "first"
          },
          "fileInferTypes": {
            "title": "Convert numbers and true/false in CSV",
            "type": "boolean",
            "description": "CSV and TSV values are text. On: numeric text becomes numbers, true/false become booleans and empty cells become null (ZIP codes and IDs with leading zeros stay text). Excel and JSON keep their own types either way.",
            "default": false
          },
          "fileSourceFields": {
            "title": "Add file, sheet and row number",
            "type": "boolean",
            "description": "Add _file, _sheet and _row fields to rows read from files, so you can trace each row back to its source.",
            "default": false
          },
          "filters": {
            "title": "Filters",
            "type": "array",
            "description": "Keep only rows that match these conditions. Each condition is {\"field\", \"op\", \"value\"}. Ops: equals, notEquals, contains, notContains, startsWith, endsWith, regex, greaterThan, lessThan, greaterOrEqual, lessOrEqual, in, notIn (value: a list or \"a, b, c\"), and exists, notExists, isEmpty, isNotEmpty (no value). Dots reach nested fields (address.city); on a list, a condition matches if any element matches. Numbers and ISO dates compare as numbers and dates. Leave empty to keep every row."
          },
          "filterMode": {
            "title": "Filter mode",
            "enum": [
              "all",
              "any"
            ],
            "type": "string",
            "description": "How the filter conditions combine: all of them must match (AND), or at least one (OR).",
            "default": "all"
          },
          "caseSensitive": {
            "title": "Case-sensitive text matching",
            "type": "boolean",
            "description": "Off: 'ACME' equals 'acme'. A single condition can override this with \"caseSensitive\": true.",
            "default": false
          },
          "unwindField": {
            "title": "Split a list field into rows",
            "type": "string",
            "description": "Optional. A field holding a list (e.g. emails). Each element becomes its own row, with the other fields copied. Dots for nested fields."
          },
          "pickFields": {
            "title": "Keep only these fields",
            "type": "array",
            "description": "Optional. Output only these fields, in this order (handy for spreadsheet columns). Dots for nested fields; the column is then named 'address.city'. Empty = keep all.",
            "items": {
              "type": "string"
            }
          },
          "omitFields": {
            "title": "Remove these fields",
            "type": "array",
            "description": "Optional. Fields to drop. Dots for nested fields (images.thumbnail removes it from every image).",
            "items": {
              "type": "string"
            }
          },
          "renameFields": {
            "title": "Rename fields",
            "type": "object",
            "description": "Optional. {\"old name\": \"New Name\"}, applied in order. Renamed columns keep their position. Example: {\"title\": \"Company Name\", \"phone\": \"Phone Number\"}."
          },
          "flatten": {
            "title": "Flatten nested fields",
            "type": "boolean",
            "description": "Nested objects become columns like 'address.city'. Lists stay lists unless you join them below.",
            "default": false
          },
          "joinArrays": {
            "title": "Join lists into text",
            "type": "boolean",
            "description": "Lists of plain values (text, numbers) become one text value, e.g. [\"a\", \"b\"] → \"a, b\". Lists of objects are kept.",
            "default": false
          },
          "arrayJoiner": {
            "title": "List separator",
            "type": "string",
            "description": "Text placed between joined list elements.",
            "default": ", "
          },
          "addFields": {
            "title": "Add fields",
            "type": "object",
            "description": "Optional. Fixed values added to every row (overwriting a field with the same name), e.g. {\"source\": \"google-maps\", \"campaign\": \"october\"}."
          },
          "trimStrings": {
            "title": "Trim spaces",
            "type": "boolean",
            "description": "Remove leading and trailing whitespace from every text value.",
            "default": false
          },
          "emptyToNull": {
            "title": "Empty values to null",
            "type": "boolean",
            "description": "Empty text, empty lists and empty objects become null.",
            "default": false
          },
          "lowercaseFields": {
            "title": "Lowercase these fields",
            "type": "array",
            "description": "Optional. Output fields whose text is lowercased, e.g. email. Use the output name (after renaming).",
            "items": {
              "type": "string"
            }
          },
          "dedupeBy": {
            "title": "Remove duplicates by",
            "type": "array",
            "description": "Optional. Output fields (after renaming) that make two rows duplicates, e.g. email, or website and name together. Use * to compare whole rows. Empty = keep duplicates. Applied after filtering and shaping, before sorting and the row limit. Duplicates are free.",
            "items": {
              "type": "string"
            }
          },
          "dedupeKeep": {
            "title": "Which duplicate to keep",
            "enum": [
              "first",
              "last"
            ],
            "type": "string",
            "description": "With several datasets or files, 'last' lets a later source's values win (list older sources first).",
            "default": "first"
          },
          "dedupeIgnoreCase": {
            "title": "Ignore letter case",
            "type": "boolean",
            "description": "'ACME@x.com' and 'acme@x.com' count as the same key.",
            "default": false
          },
          "dedupeTrim": {
            "title": "Ignore extra spaces",
            "type": "boolean",
            "description": "Leading, trailing and repeated spaces don't make keys different.",
            "default": false
          },
          "sortBy": {
            "title": "Sort by field",
            "type": "string",
            "description": "Optional. An output field name (after renaming). Numbers, dates and text sort naturally; empty values go last. Without 'Max results', sorting is limited to 200,000 rows."
          },
          "sortDesc": {
            "title": "Sort descending",
            "type": "boolean",
            "description": "Largest, latest or Z first.",
            "default": false
          },
          "sortFields": {
            "title": "More sort fields",
            "type": "array",
            "description": "Optional. Further sort keys, one per line: a field name, optionally followed by asc or desc, e.g. 'rating desc' then 'name'. Used after 'Sort by field' (or on their own); each key breaks ties of the ones before it. 'Sort descending' applies to 'Sort by field' only.",
            "items": {
              "type": "string"
            }
          },
          "maxResults": {
            "title": "Max results",
            "minimum": 1,
            "type": "integer",
            "description": "Optional cap on output rows."
          },
          "offset": {
            "title": "Skip first rows",
            "minimum": 0,
            "type": "integer",
            "description": "Optional. Skip this many output rows (after filtering and sorting) before writing. Skipped rows are free."
          },
          "exportFormats": {
            "title": "Export files",
            "type": "array",
            "description": "Optional. Also save the output rows as files in the run's key-value store (links in OUTPUT and the status message). CSV and Excel get one column per field seen in any row. Free: you pay only for the rows.",
            "items": {
              "type": "string",
              "enum": [
                "csv",
                "jsonl",
                "json",
                "xlsx"
              ],
              "enumTitles": [
                "CSV",
                "JSON Lines",
                "JSON",
                "Excel (XLSX)"
              ]
            }
          },
          "exportFileName": {
            "title": "File name",
            "type": "string",
            "description": "Name of the exported files without extension: 'rows' gives rows.csv, rows.xlsx and so on.",
            "default": "rows"
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}