{
  "openapi": "3.0.1",
  "info": {
    "title": "Merge & Dedup Datasets — Combine, Remove Duplicates, Diff",
    "description": "Merge Apify datasets and CSV, JSON or Excel files into one, deduplicate by key fields (case, accents, URL, email and phone aware), keep only new items since the last run, or diff two runs: new, changed and removed rows. Export to JSON, CSV or Excel, or via API.",
    "version": "1.0",
    "x-build-id": "gWvh3L6cNBYPlvmrl"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/steadyscrape~merge-dedup-datasets/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-steadyscrape-merge-dedup-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/steadyscrape~merge-dedup-datasets/runs": {
      "post": {
        "operationId": "runs-sync-steadyscrape-merge-dedup-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/steadyscrape~merge-dedup-datasets/run-sync": {
      "post": {
        "operationId": "run-sync-steadyscrape-merge-dedup-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": {
          "datasets": {
            "title": "Datasets",
            "type": "array",
            "description": "Pick the datasets to merge: the results of your scraper runs, imports, earlier merges. Picking a dataset here is what lets this run read it. Through the API, give dataset ids (or username~name)."
          },
          "fileUrls": {
            "title": "File links",
            "type": "array",
            "description": "Links to data files: CSV, TSV, JSON, JSON Lines, Excel .xlsx, also gzipped. A shared Google Sheet link is read as its CSV export; an Apify Console link to a dataset is read as that dataset.",
            "items": {
              "type": "string"
            }
          },
          "keyValueStore": {
            "title": "Key-value store with data files",
            "type": "string",
            "description": "Pick a key-value store whose records are data files (CSV, JSON, Excel…). Its records named below are read; with none named, every data record (not its INPUT nor its images)."
          },
          "recordKeys": {
            "title": "Records of that store",
            "type": "array",
            "description": "The keys of the records to read from the store picked above. Leave empty to read every data record.",
            "items": {
              "type": "string"
            }
          },
          "keyFields": {
            "title": "Key fields",
            "type": "array",
            "description": "Rows with the same values in these fields are duplicates. Dotted paths reach into nested objects (search.query, address.city). Leave empty to drop only rows identical in every field.",
            "items": {
              "type": "string"
            }
          },
          "normalize": {
            "title": "Normalise key values",
            "type": "array",
            "description": "How key values are compared. Whitespace trims and squeezes spaces; case ignores upper/lower case; accents ignores diacritics (é = e); url compares links whatever their scheme, www, trailing slash or tracking parameters (utm_*, fbclid, gclid…); email lower-cases and drops mailto:; phone keeps digits only.",
            "items": {
              "type": "string",
              "enum": [
                "whitespace",
                "case",
                "accents",
                "url",
                "email",
                "phone"
              ],
              "enumTitles": [
                "Whitespace",
                "Ignore case",
                "Ignore accents",
                "Links (URL canonical form)",
                "Emails",
                "Phone numbers (digits only)"
              ]
            },
            "default": [
              "whitespace"
            ]
          },
          "fieldNormalization": {
            "title": "Normalisation per key field",
            "type": "array",
            "description": "Key fields that need their own normalisation: the field, then the names from the list above separated by commas (website → url; email → email; name → case, accents, whitespace). Fields not named here use the setting above.",
            "items": {
              "type": "object",
              "required": [
                "key",
                "value"
              ],
              "properties": {
                "key": {
                  "type": "string",
                  "title": "Key"
                },
                "value": {
                  "type": "string",
                  "title": "Value"
                }
              }
            }
          },
          "keep": {
            "title": "Which duplicate to keep",
            "enum": [
              "first",
              "last",
              "mostFilled",
              "newest"
            ],
            "type": "string",
            "description": "First seen follows the order of the sources (datasets, then file links, then records) and of the rows in each.",
            "default": "first"
          },
          "dateField": {
            "title": "Date field (for the newest)",
            "type": "string",
            "description": "The field to compare when keeping the newest: ISO dates, written dates and epoch seconds or milliseconds are understood."
          },
          "fillEmptyFields": {
            "title": "Fill empty fields from the duplicates",
            "type": "boolean",
            "description": "The row kept takes the values of fields it lacks or has empty (null, blank, []) from the duplicates it replaces: one fuller row out of several partial ones.",
            "default": false
          },
          "sourceField": {
            "title": "Field naming each row's source",
            "type": "string",
            "description": "Each row written says where it came from (dataset id, file link with any token masked, or record) in this field. Clear it to add no field.",
            "default": "_source"
          },
          "mode": {
            "title": "Mode",
            "enum": [
              "merge",
              "onlyNew",
              "diff"
            ],
            "type": "string",
            "description": "Merge writes every unique row. Only new writes the unique rows whose key no earlier run of the same history saw. Diff compares with the previous run of the same history and writes each row as new, changed (with the fields that changed and their previous values) or removed.",
            "default": "merge"
          },
          "historyName": {
            "title": "History name",
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,99}$",
            "type": "string",
            "description": "Runs with the same history name share their seen keys and snapshot; use one name per monitor (a search, a client, a grid). Letters, digits, dots, dashes and underscores. Kept in a store of your account named steadyscrape-merge-dedup-datasets-state.",
            "default": "default"
          },
          "diffIgnoreFields": {
            "title": "Fields a diff ignores",
            "type": "array",
            "description": "Top-level fields that never make a row changed, such as the time a scraper read it.",
            "default": [
              "scrapedAt",
              "crawledAt",
              "checkedAt",
              "fetchedAt"
            ],
            "items": {
              "type": "string"
            }
          },
          "includeUnchanged": {
            "title": "Also write unchanged rows (diff)",
            "type": "boolean",
            "description": "Write the rows that did not change too, tagged unchanged, for a full picture of each run.",
            "default": false
          },
          "renameFields": {
            "title": "Rename fields",
            "type": "array",
            "description": "Renamed as each row is read, so key fields and filters can use the new names across sources with different column names. A dotted path moves a nested value to a top-level field.",
            "items": {
              "type": "object",
              "required": [
                "key",
                "value"
              ],
              "properties": {
                "key": {
                  "type": "string",
                  "title": "Key"
                },
                "value": {
                  "type": "string",
                  "title": "Value"
                }
              }
            }
          },
          "filters": {
            "title": "Filters",
            "type": "array",
            "description": "Rows must pass every filter to be kept, e.g. [{\"field\": \"rating\", \"operator\": \"greaterThan\", \"value\": 4.5}]. Operators: equals, notEquals, contains, notContains (any case), isEmpty, isNotEmpty, greaterThan, lessThan (numbers, also inside text such as \"$1,299\", or dates such as \"2026-01-01\").",
            "default": []
          },
          "pickFields": {
            "title": "Keep only these fields",
            "type": "array",
            "description": "Fields written to the output, dotted paths allowed. Empty keeps every field.",
            "items": {
              "type": "string"
            }
          },
          "omitFields": {
            "title": "Leave out these fields",
            "type": "array",
            "description": "Fields dropped from the output, dotted paths allowed.",
            "items": {
              "type": "string"
            }
          },
          "flatten": {
            "title": "Flatten nested fields",
            "type": "boolean",
            "description": "Nested objects and lists become dotted columns (address.city, images.0.url), ready for a spreadsheet.",
            "default": false
          },
          "maxRows": {
            "title": "Most rows to read",
            "minimum": 1,
            "maximum": 10000000,
            "type": "integer",
            "description": "Reading stops after this many rows from all sources together.",
            "default": 1000000
          },
          "maxFileMegabytes": {
            "title": "Most megabytes per file",
            "minimum": 1,
            "maximum": 1024,
            "type": "integer",
            "description": "A larger file or record is reported and not read.",
            "default": 100
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}