{
  "openapi": "3.0.1",
  "info": {
    "title": "Merge & Dedupe Datasets: CSV, JSON, Excel Converter",
    "description": "Merge Apify datasets and CSV, JSON or JSON Lines files into one clean table. Remove duplicates by any fields (exact or fuzzy: case, accents, URLs, phones), rename and pick columns, export to CSV, Excel, JSON. Streams millions of rows. $0.10 per 1,000 rows.",
    "version": "1.0",
    "x-build-id": "gCOJ7e6AEN2x4fqBQ"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/4b47~merge-dedupe-datasets/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-4b47-merge-dedupe-datasets",
        "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/4b47~merge-dedupe-datasets/runs": {
      "post": {
        "operationId": "runs-sync-4b47-merge-dedupe-datasets",
        "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/4b47~merge-dedupe-datasets/run-sync": {
      "post": {
        "operationId": "run-sync-4b47-merge-dedupe-datasets",
        "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, in order (pick them from your storage or past runs). Picking a dataset here gives this actor read access to it; nothing else in your account is readable."
          },
          "sourceUrls": {
            "title": "File URLs",
            "type": "array",
            "description": "Data files to merge, one per line: JSON arrays, JSON Lines (.jsonl/.ndjson), CSV or TSV, optionally gzipped. Also works: Apify API items URLs with your token (e.g. https://api.apify.com/v2/datasets/ID/items?token=...; read page by page), Google Sheets links shared as \"anyone with the link\" (read as CSV). Up to 1,000 sources in total.",
            "items": {
              "type": "string"
            }
          },
          "dedupeFields": {
            "title": "Deduplicate by fields",
            "type": "array",
            "description": "Rows with the same values in these fields count as duplicates (e.g. url, or name + city). Nested fields: address.city. Empty = whole-row duplicates. Rows where all these fields are empty are always kept.",
            "items": {
              "type": "string"
            }
          },
          "dedupeMode": {
            "title": "Matching",
            "enum": [
              "normalized",
              "exact",
              "none"
            ],
            "type": "string",
            "description": "Normalized: ignores case, accents, punctuation and extra spaces; URLs compared without http/https, www, trailing slash and utm_ tracking; emails lowercased; phone numbers by digits. Exact: values must be identical. Off: just merge and convert.",
            "default": "normalized"
          },
          "keep": {
            "title": "Which duplicate to keep",
            "enum": [
              "first",
              "last"
            ],
            "type": "string",
            "description": "First: the earliest row wins (sources are read in order: datasets, then URLs). Last: the latest row wins, e.g. to keep the freshest copy when merging old and new runs.",
            "default": "first"
          },
          "renameFields": {
            "title": "Rename fields",
            "type": "object",
            "description": "Old name → new name, applied first (so different sources can share column names before deduplication), e.g. {\"link\": \"url\", \"address.city\": \"city\"}. If a row already has the new name filled, it is kept."
          },
          "fields": {
            "title": "Keep only these fields",
            "type": "array",
            "description": "Output only these fields, in this order (nested paths allowed). Empty = all fields.",
            "items": {
              "type": "string"
            }
          },
          "omitFields": {
            "title": "Remove fields",
            "type": "array",
            "description": "Fields to drop from the output (e.g. large HTML or debug fields).",
            "items": {
              "type": "string"
            }
          },
          "requireFields": {
            "title": "Required fields",
            "type": "array",
            "description": "Drop rows where any of these fields is empty (not charged).",
            "items": {
              "type": "string"
            }
          },
          "outputFormats": {
            "title": "Output formats",
            "type": "array",
            "description": "Where the result goes: the run's dataset, and/or files in the key-value store (merged.csv, merged.xlsx, merged.json, merged.jsonl). The price is per row, however many formats you pick.",
            "items": {
              "type": "string",
              "enum": [
                "dataset",
                "csv",
                "xlsx",
                "json",
                "jsonl"
              ],
              "enumTitles": [
                "Dataset",
                "CSV file",
                "Excel (XLSX) file",
                "JSON file",
                "JSON Lines file"
              ]
            },
            "default": [
              "dataset",
              "csv"
            ]
          },
          "onlyNewItems": {
            "title": "Only new items (across runs)",
            "type": "boolean",
            "description": "Remember the rows output by this run and skip them in later runs with the same memory name: schedule it after a scraper and get only rows you have not seen before. Already-seen rows are free. Uses the dedupe fields as the identity (whole row if empty).",
            "default": false
          },
          "memoryName": {
            "title": "Memory name",
            "type": "string",
            "description": "Separate memories for separate pipelines (e.g. \"shop-a-products\"). Lowercase letters, digits and dashes. Stored in a named key-value store in your account (merge-dedupe-memory-<name>); delete it to start over."
          },
          "compareDatasetIds": {
            "title": "Compare with datasets (delta mode)",
            "type": "array",
            "description": "Output only rows that are NOT in these datasets, e.g. the previous run of your scraper: today's run minus yesterday's = what is new. Rows are matched by \"Deduplicate by fields\" (empty = whole row, so changed rows count as new). Skipped rows are free. Picking a dataset gives this actor read access to it only."
          },
          "compareUrls": {
            "title": "Compare with files (delta mode)",
            "type": "array",
            "description": "Same as above for files: JSON, JSON Lines, CSV or Google Sheets links of the previous export (e.g. the sheet you append to).",
            "items": {
              "type": "string"
            }
          },
          "maxItems": {
            "title": "Max rows in the result",
            "minimum": 1,
            "type": "integer",
            "description": "Stop after this many unique rows. Empty = no limit."
          },
          "inputFormat": {
            "title": "File format",
            "enum": [
              "auto",
              "json",
              "jsonl",
              "csv"
            ],
            "type": "string",
            "description": "Auto detects JSON, JSON Lines and CSV/TSV (and the CSV delimiter) from the extension, Content-Type and content. Force a format if detection gets it wrong.",
            "default": "auto"
          },
          "addSourceField": {
            "title": "Add source column",
            "type": "boolean",
            "description": "Add a _source field with the dataset ID or URL each row came from.",
            "default": false
          },
          "flattenDataset": {
            "title": "Flatten nested fields in the dataset and JSON",
            "type": "boolean",
            "description": "CSV and Excel are always flat (address/city columns). Turn this on to flatten the dataset and JSON outputs the same way.",
            "default": false
          },
          "arrayFormat": {
            "title": "Arrays in CSV and Excel",
            "enum": [
              "join",
              "columns",
              "json"
            ],
            "type": "string",
            "description": "Join: [\"a\",\"b\"] becomes \"a; b\" (lists of objects become JSON). Columns: tags/0, tags/1, ... (like Apify's own export). JSON: the array as JSON text.",
            "default": "join"
          },
          "csvDelimiter": {
            "title": "CSV delimiter (output)",
            "type": "string",
            "description": "Delimiter of merged.csv: , (default), ; (Excel in many European locales) or \\t (tab).",
            "default": ","
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}