{
  "openapi": "3.0.1",
  "info": {
    "title": "Merge Datasets & Remove Duplicates: Combine Runs, CSVs, Sheets",
    "description": "Returns one de-duplicated list from many Apify datasets, CSV, Excel or JSON files and Google Sheets, with blanks filled from the copies and each row's source labelled. Inputs: datasetIds, fileUrls, dedupKeys. Charged per merged row written ($0.001). Agent-ready via x402 and MCP.",
    "version": "0.1",
    "x-build-id": "Yvha0FI3mldDNsqd5"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/nerolabs~dataset-merge-dedupe/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-nerolabs-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/nerolabs~dataset-merge-dedupe/runs": {
      "post": {
        "operationId": "runs-sync-nerolabs-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/nerolabs~dataset-merge-dedupe/run-sync": {
      "post": {
        "operationId": "run-sync-nerolabs-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 to merge",
            "type": "array",
            "description": "Pick any number of Apify datasets to combine into one list, for example the results of the same scraper run once per city, keyword or date. Rows from all of them are stacked in the order you list them, then duplicates between them are removed. Declared this way so the Actor runs with limited permissions: it may read the datasets you pick and nothing else on your account."
          },
          "fileUrls": {
            "title": "Files or Google Sheets to merge",
            "type": "array",
            "description": "Links to CSV, TSV, Excel (.xlsx, first sheet), JSON or JSON Lines files, or Google Sheets (normal sheet link, shared as 'Anyone with the link can view'). One link per line. Merged together with any datasets above. Downloads are never charged; up to 100 MB per file.",
            "items": {
              "type": "string"
            }
          },
          "data": {
            "title": "Inline data",
            "type": "array",
            "description": "Optional. A JSON array of rows, merged in as one more list (labelled 'inline data')."
          },
          "fileFormat": {
            "title": "File format",
            "enum": [
              "auto",
              "csv",
              "tsv",
              "json",
              "jsonl",
              "xlsx"
            ],
            "type": "string",
            "description": "Only needed if automatic detection reads a file link in the wrong format. Applies to every file link.",
            "default": "auto"
          },
          "dedupKeys": {
            "title": "Match duplicates on these fields",
            "type": "array",
            "description": "Field (column) names that identify the same record across lists, for example 'phone', 'website', 'placeId' or 'url'. Rows with the same values in all of these fields count as duplicates. Leave empty to compare whole rows. Names must match exactly, including capital letters. Rows with no value in these fields are always kept.",
            "items": {
              "type": "string"
            }
          },
          "dedupMode": {
            "title": "How strictly to match",
            "enum": [
              "normalized",
              "exact",
              "fuzzy",
              "none"
            ],
            "type": "string",
            "description": "Normalized treats '0117 496 0012' and '01174960012', or 'https://www.acme.com/' and 'acme.com', as the same. Fuzzy also matches small spelling differences, using the threshold below. None merges the lists without removing anything.",
            "default": "normalized"
          },
          "similarityThreshold": {
            "title": "Fuzzy match threshold",
            "minimum": 0.5,
            "maximum": 1,
            "type": "number",
            "description": "Only used with Fuzzy matching. 1.0 means identical; 0.9 allows about one character in ten to differ.",
            "default": 0.9
          },
          "keepStrategy": {
            "title": "Which duplicate to keep",
            "enum": [
              "most_complete",
              "first",
              "last"
            ],
            "type": "string",
            "description": "When the same record appears more than once, which copy becomes the merged row. Lists are read in the order given, datasets first, then files, then inline data.",
            "default": "most_complete"
          },
          "fillBlanksFromDuplicates": {
            "title": "Fill blanks from the duplicates",
            "type": "boolean",
            "description": "When on, any field that is empty in the kept row is filled in from the duplicates it replaced, so an email found in one run and a rating found in another end up on the same row. Values that are already filled are never overwritten.",
            "default": true
          },
          "addSourceInfo": {
            "title": "Add source columns",
            "type": "boolean",
            "description": "Adds three columns to every row: _source (the list the kept row came from: a dataset's name or ID, or a file's name), _foundInSources (every list the record appeared in, separated by ' | ') and _duplicatesMerged (how many copies were merged into it).",
            "default": true
          },
          "maxItems": {
            "title": "Max output rows",
            "minimum": 1,
            "type": "integer",
            "description": "Optional cap on merged rows written (and charged). Up to 300,000 rows are read across all sources per run."
          },
          "outputDatasetName": {
            "title": "Also append to a named dataset",
            "type": "string",
            "description": "Optional. A dataset name (3 to 63 letters, digits or hyphens) that keeps growing across runs, for a scheduled pipeline. Not charged again."
          },
          "exportFormats": {
            "title": "Download files",
            "type": "array",
            "description": "Ready-to-open files of the merged list, saved in the run's key-value store. Charged per file.",
            "items": {
              "type": "string",
              "enum": [
                "csv",
                "xlsx"
              ],
              "enumTitles": [
                "CSV",
                "Excel (.xlsx)"
              ]
            },
            "default": [
              "csv",
              "xlsx"
            ]
          },
          "webhookUrl": {
            "title": "Webhook URL",
            "type": "string",
            "description": "Optional. The merged rows (up to 5,000 inline) and download links are POSTed here as JSON when the run finishes, for Zapier, Make, n8n or your own API. Charged only on a 2xx response."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}