{
  "openapi": "3.0.1",
  "info": {
    "title": "Dataset Filter & Transform",
    "description": "Returns rows of any Apify dataset, CSV/Excel/JSON file URL or Google Sheet that pass filter rules (25 operators, AND/OR) after transforms (rename, cast, compute, regex, dates, replace, split, hash), then sort, dedupe, limit, export CSV/Excel or webhook. Agent-ready: pay per event (x402, MCP).",
    "version": "0.1",
    "x-build-id": "n6FQIo8E93KYPE0EG"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/nerolabs~dataset-filter-transform/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-nerolabs-dataset-filter-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/nerolabs~dataset-filter-transform/runs": {
      "post": {
        "operationId": "runs-sync-nerolabs-dataset-filter-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/nerolabs~dataset-filter-transform/run-sync": {
      "post": {
        "operationId": "run-sync-nerolabs-dataset-filter-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": {
          "datasetId": {
            "title": "Dataset to process",
            "type": "string",
            "description": "Pick an existing Apify dataset (for example the output of any scraper run). Use this OR 'File URL' OR 'Data (inline)' below. Declaring it this way is what lets this Actor run with limited permissions: it may read the dataset you point at, and nothing else on your account."
          },
          "fileUrl": {
            "title": "File URL (CSV, Excel, JSON or JSON Lines)",
            "type": "string",
            "description": "Instead of a dataset, download the rows from a public link: a CSV or TSV file, an Excel .xlsx file (first sheet, header row), a JSON array or JSON Lines file, or a Google Sheet (paste the normal sheet link, sharing set to 'Anyone with the link can view'). The format is detected automatically. Up to 100 MB per run. The download is never charged; only rows you keep are."
          },
          "fileFormat": {
            "title": "File format",
            "enum": [
              "auto",
              "csv",
              "tsv",
              "json",
              "jsonl",
              "xlsx"
            ],
            "type": "string",
            "description": "Only needed if automatic detection gets the file URL's format wrong.",
            "default": "auto"
          },
          "data": {
            "title": "Data (inline)",
            "type": "array",
            "description": "A JSON array of records to filter and transform, for ad-hoc data instead of a dataset ID or file URL."
          },
          "transforms": {
            "title": "Transform steps (applied in order, before filtering)",
            "type": "array",
            "description": "A list of steps applied to every row, top to bottom, before any filtering happens. Each step writes a top-level field; dotted paths like 'address.city' can be READ anywhere a field is named. Steps: rename {from,to}; drop {fields}; keep {fields} (drop everything else); copy {from,to}; setField {field,value}; default {field,value} (fill blanks); addField {field,template} ({{a}} {{b.c}} placeholders); compute {field,expression,round} (arithmetic + - * / over numeric fields); cast {field,to: number|string|boolean}; trim / uppercase / lowercase {field}; replace {field,search,replacement,regex,into}; regexExtract {field,pattern,group,into}; split {field,separator,index,into}; joinArray {field,separator}; substring {field,start,length,into}; round {field,decimals}; coalesce {fields,into} (first non-blank); dateFormat {field,format: iso|date|unix|unixMs|'DD/MM/YYYY',into}; dateDiff {from,to (a field or 'now'),unit: days|hours|minutes|seconds,into}; extractDomain {field,into} (from an email or URL); mapValues {field,map,default,into} (look up values in a {from: to} table); hash {fields,algorithm,into} (a stable id for dedupe); parseJson {field}; length {field,into}."
          },
          "filters": {
            "title": "Filter conditions (applied after transforms)",
            "type": "array",
            "description": "Rows are kept only if they pass these conditions (combined per 'Combine filters with' below). Each item: {\"field\": \"revenue\", \"operator\": \"greaterOrEqual\", \"value\": 1000}. Operators: equals, notEquals, contains, notContains, startsWith, endsWith, greaterThan, lessThan, greaterOrEqual, lessOrEqual, between (value = [min, max]), isEmpty, isNotEmpty, isTrue, isFalse, matchesRegex (value = pattern), in, notIn (value = array), arrayContains, lengthGreaterThan, lengthLessThan, dateAfter, dateBefore (value = a date, 'today' or 'now'), withinLastDays, olderThanDays (value = number of days). Leave empty to keep every row (transform-only mode). 'caseSensitive' can be set per-condition to override the global default below."
          },
          "filterCombineMode": {
            "title": "Combine filters with",
            "enum": [
              "AND",
              "OR"
            ],
            "type": "string",
            "description": "AND: a row must pass every condition. OR: a row passes if it matches any one condition.",
            "default": "AND"
          },
          "caseSensitiveFilters": {
            "title": "Case-sensitive filters by default",
            "type": "boolean",
            "description": "Off (default) treats 'US', 'us' and ' US ' as the same value for equals/contains/startsWith/endsWith/in, which is what scraped or hand-entered data usually needs. Turn on to require an exact, byte-for-byte match. Override per-condition with a 'caseSensitive' key on that condition.",
            "default": false
          },
          "lenientNumbers": {
            "title": "Lenient numbers",
            "type": "boolean",
            "description": "Read numbers stored as text, like '$1,234.50', '49 USD' or '(300)', as numbers for numeric filters, sorting, 'cast to number', 'round' and 'compute'. Scraped prices almost always need this. Turn off to only accept real numbers and plain numeric strings.",
            "default": true
          },
          "sortBy": {
            "title": "Sort by",
            "type": "array",
            "description": "Order the kept rows. Each entry is {\"field\": \"revenue\", \"direction\": \"desc\"} or the shorthand \"-revenue\" (a leading minus means descending). Several entries sort by the first, then the next. Numbers sort numerically (with lenient parsing), text sorts case-insensitively, blanks always go last."
          },
          "distinctBy": {
            "title": "Keep one row per distinct value of",
            "type": "array",
            "description": "Field names. Only the first kept row for each distinct combination of these fields is written out; later duplicates are dropped (matched case-insensitively, trimmed, with '$1,200' and 1200 treated as equal). Combine with 'Sort by' to choose which duplicate survives, e.g. sort by date descending and dedupe by email to keep the newest row per email.",
            "items": {
              "type": "string"
            }
          },
          "limit": {
            "title": "Maximum rows to output",
            "minimum": 1,
            "type": "integer",
            "description": "Stop after this many kept rows (after sorting and deduping). Useful for 'top 100 by price' style results and as a cost cap."
          },
          "offset": {
            "title": "Skip the first N rows",
            "minimum": 0,
            "type": "integer",
            "description": "Skip this many kept rows before writing (after sorting and deduping), for paging through a large result."
          },
          "outputDatasetName": {
            "title": "Also append to a named dataset",
            "type": "string",
            "description": "Optional. A name (3 to 63 letters, digits or hyphens, e.g. 'clean-leads'). The kept rows are appended to a dataset with this name in your account, created on the first run, so a scheduled pipeline accumulates into one place instead of one dataset per run. Not charged again."
          },
          "exportFormats": {
            "title": "Export file formats",
            "uniqueItems": true,
            "type": "array",
            "description": "Also save the kept, transformed rows as a real downloadable file in the run's key-value store. CSV opens anywhere; XLSX opens in Excel and Google Sheets with a bold, frozen header row.",
            "items": {
              "type": "string",
              "enum": [
                "csv",
                "xlsx"
              ],
              "enumTitles": [
                "CSV (.csv)",
                "Excel (.xlsx)"
              ]
            }
          },
          "maxItems": {
            "title": "Maximum input rows",
            "minimum": 1,
            "type": "integer",
            "description": "Stop loading after this many rows from the dataset or file (a cost guard for large inputs). There is a hard safety ceiling of 200,000 rows per run regardless."
          },
          "webhookUrl": {
            "title": "Webhook URL (optional)",
            "type": "string",
            "description": "Optional. If set, the kept and transformed rows (plus download links and a summary) are POSTed here as JSON the moment this run finishes, so you don't have to come back and check the dataset yourself. Works with a Zapier/Make/n8n catch-hook, your own API endpoint, or a Slack incoming webhook. Only charged when the endpoint actually confirms receipt (HTTP 2xx); a failed delivery is reported as a warning in the run's output and costs nothing."
          }
        }
      },
      "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
                  }
                }
              },
              "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}