{
  "openapi": "3.0.1",
  "info": {
    "title": "Merge & Deduplicate Datasets - Only New Items, Join, CSV/XLSX",
    "description": "Merge Apify datasets, CSV, JSON, JSONL or Excel files and pasted rows into one clean dataset: remove duplicates by any fields (case and whitespace normalised), keep only items new since your last run, left/inner join on a key, flatten nested JSON. $0.05 per 1,000 rows out.",
    "version": "0.1",
    "x-build-id": "m6V5yTnJ7EbBRLedP"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/actor-forge~dataset-merge-dedupe/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-actor-forge-dataset-merge-dedupe",
        "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/actor-forge~dataset-merge-dedupe/runs": {
      "post": {
        "operationId": "runs-sync-actor-forge-dataset-merge-dedupe",
        "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/actor-forge~dataset-merge-dedupe/run-sync": {
      "post": {
        "operationId": "run-sync-actor-forge-dataset-merge-dedupe",
        "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": "Apify datasets to merge (pick them, or pass dataset IDs via the API). Picking a dataset here gives this run read access to it; nothing else on your account is readable. Read in the order given, after any pasted rows."
          },
          "fileUrls": {
            "title": "File URLs (CSV, JSON, JSONL, Excel)",
            "type": "array",
            "description": "Public URLs of CSV/TSV (delimiter auto-detected, first row = column names), JSON (an array, or an object with an items/data/results array), JSON Lines or XLSX (first visible sheet) files, up to 100 MB each. Read after the datasets.",
            "items": {
              "type": "string"
            }
          },
          "rows": {
            "title": "Rows (JSON)",
            "type": "array",
            "description": "Rows pasted as a JSON array of objects. Read first."
          },
          "dedupeFields": {
            "title": "Deduplicate on fields",
            "type": "array",
            "description": "Rows with the same values in all of these fields are duplicates; the first one is kept. Dot paths reach nested values (e.g. address.postcode). Leave empty to compare whole rows. Rows where all these fields are empty are always kept.",
            "items": {
              "type": "string"
            }
          },
          "normalizeValues": {
            "title": "Normalise values before comparing",
            "type": "boolean",
            "description": "Compare text case-insensitively with leading/trailing and repeated whitespace ignored (\" ACME  Ltd\" = \"acme ltd\"), and a number equal to its text form (42 = \"42\"). The rows themselves are not changed.",
            "default": true
          },
          "onlyNewItems": {
            "title": "Only new items since the last run",
            "type": "boolean",
            "description": "Remember the dedupe keys of every delivered row (in a key-value store on your own account) and skip rows already delivered by an earlier run with the same history name. Ideal for scheduled scrapes: each run outputs only what is new.",
            "default": false
          },
          "historyKey": {
            "title": "History name",
            "type": "string",
            "description": "Separate 'only new items' memories for different pipelines, e.g. jobs-london or competitor-prices. Letters, digits, - and _.",
            "default": "default"
          },
          "joinDatasetId": {
            "title": "Join: lookup dataset",
            "type": "string",
            "description": "Optional. A dataset whose rows are joined onto the merged rows (e.g. company details by domain). Up to 500,000 lookup rows; the first row per key is used."
          },
          "joinFileUrl": {
            "title": "Join: lookup file URL",
            "type": "string",
            "description": "Optional, instead of a lookup dataset: a CSV, JSON, JSONL or XLSX file URL with the lookup rows."
          },
          "joinOn": {
            "title": "Join on field",
            "type": "string",
            "description": "Field of the merged rows to match on (dot paths allowed). Required for a join."
          },
          "joinLookupField": {
            "title": "Lookup key field",
            "type": "string",
            "description": "Field of the lookup rows to match on. Defaults to the same name as 'Join on field'."
          },
          "joinPrefix": {
            "title": "Prefix for joined fields",
            "type": "string",
            "description": "Optional prefix for the fields copied from the lookup row, e.g. company_. Lookup fields only fill fields that are missing or empty in the row, so use a prefix to keep both versions.",
            "default": ""
          },
          "joinType": {
            "title": "Join type",
            "enum": [
              "left",
              "inner"
            ],
            "type": "string",
            "description": "Left: keep every row (unmatched rows unchanged). Inner: keep only rows that matched a lookup row.",
            "default": "left"
          },
          "flatten": {
            "title": "Flatten nested JSON",
            "type": "boolean",
            "description": "Turn nested objects and arrays into flat columns (address.city, tags.0), handy for spreadsheets and CRMs.",
            "default": false
          },
          "fields": {
            "title": "Keep only these fields",
            "type": "array",
            "description": "Optional. Output only these fields, in this order (dot paths allowed; the path becomes the column name).",
            "items": {
              "type": "string"
            }
          },
          "omitFields": {
            "title": "Remove these fields",
            "type": "array",
            "description": "Optional. Drop these fields from every row (after flattening, use the flat names).",
            "items": {
              "type": "string"
            }
          },
          "addSourceField": {
            "title": "Add a _source field",
            "type": "boolean",
            "description": "Tag each row with where it came from (input:rows, dataset:<id> or file:<url>).",
            "default": false
          },
          "maxItems": {
            "title": "Max rows out",
            "minimum": 1,
            "maximum": 10000000,
            "type": "integer",
            "description": "Stop after delivering this many rows.",
            "default": 1000000
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}