{
  "openapi": "3.0.1",
  "info": {
    "title": "Dataset Merge & Dedupe: Remove Duplicates, Only New Items",
    "description": "Merge Apify datasets and remove duplicates by any fields, with trim, case-insensitive and URL-normalized matching. Keep first, last or most complete. Output only items not seen in earlier runs. Works with limited permissions. Duplicates are free.",
    "version": "0.1",
    "x-build-id": "thGFm9TdPbb1wMNot"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/vikasmaur13~dataset-merge-dedupe/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-vikasmaur13-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/vikasmaur13~dataset-merge-dedupe/runs": {
      "post": {
        "operationId": "runs-sync-vikasmaur13-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/vikasmaur13~dataset-merge-dedupe/run-sync": {
      "post": {
        "operationId": "run-sync-vikasmaur13-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",
        "required": [
          "datasetIds"
        ],
        "properties": {
          "datasetIds": {
            "title": "Datasets to merge and dedupe",
            "minItems": 1,
            "type": "array",
            "description": "One or more datasets (pick them, or paste dataset IDs or names). Items are read in this order. From an integration or API call pass IDs, e.g. [\"{{resource.defaultDatasetId}}\"]. The actor gets read access to exactly these datasets and nothing else in your account."
          },
          "dedupeFields": {
            "title": "Dedupe key fields",
            "type": "array",
            "description": "Fields that identify a duplicate, e.g. \"url\" or \"name\" + \"address\". Items are duplicates when ALL listed fields match. Nested fields use dots: \"author.id\", \"images.0.url\". Leave empty to compare whole items.",
            "items": {
              "type": "string"
            }
          },
          "keep": {
            "title": "Which duplicate to keep",
            "enum": [
              "first",
              "last",
              "most-complete"
            ],
            "type": "string",
            "description": "first: the earliest occurrence (one pass, fastest). last: the latest occurrence, e.g. the freshest price when the newest dataset is listed last. most-complete: the occurrence with the most non-empty values (ties go to the earliest). last and most-complete read the data twice.",
            "default": "first"
          },
          "trimWhitespace": {
            "title": "Ignore extra whitespace",
            "type": "boolean",
            "description": "\"  Acme  Inc \" matches \"Acme Inc\". Applies only to matching; output values are unchanged.",
            "default": true
          },
          "ignoreCase": {
            "title": "Ignore upper/lower case",
            "type": "boolean",
            "description": "\"ACME\" matches \"acme\" (Unicode case folding).",
            "default": false
          },
          "normalizeUrls": {
            "title": "Normalize URLs",
            "type": "boolean",
            "description": "URL values match when they differ only by http/https, www., letter case of the domain, a trailing slash, #fragment, default port, query parameter order or tracking parameters (utm_*, fbclid, gclid, msclkid and similar). Path letter case still matters.",
            "default": false
          },
          "itemsWithoutKey": {
            "title": "Items with no value in the key fields",
            "enum": [
              "keep",
              "drop"
            ],
            "type": "string",
            "description": "What to do with items where every key field is missing or empty. keep: output each of them (they can't be compared). drop: leave them out.",
            "default": "keep"
          },
          "seenItemsStoreName": {
            "title": "Seen-items memory (name)",
            "pattern": "^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$",
            "type": "string",
            "description": "Give a name, e.g. \"my-shop-monitor\", and the actor remembers the keys it has output in a key-value store with that name. Later runs with the same name output only items never output before: ideal for scheduled scrapers and monitoring. Only 8-byte key hashes are stored, never your data. Leave empty to disable."
          },
          "resetSeenItems": {
            "title": "Reset seen-items memory",
            "type": "boolean",
            "description": "Forget everything remembered under this name and start over (needed after changing key fields or matching options).",
            "default": false
          },
          "excludeDatasetIds": {
            "title": "Exclude items found in these datasets",
            "type": "array",
            "description": "Optional reference datasets. Items whose key also appears in any of these are left out (reference items themselves are never output). Example: compare today's scrape with yesterday's to get only the new listings."
          },
          "outputFields": {
            "title": "Output only these fields",
            "type": "array",
            "description": "Keep only these fields in the output, in this order. Nested fields use dots (\"author.name\") and become one column named after the path. Leave empty to keep all fields.",
            "items": {
              "type": "string"
            }
          },
          "renameFields": {
            "title": "Rename fields",
            "type": "object",
            "description": "Map of old name to new name, applied after field selection, e.g. {\"author.name\": \"author\", \"url\": \"link\"}."
          },
          "addSourceDataset": {
            "title": "Add source dataset to each item",
            "type": "boolean",
            "description": "Adds a \"sourceDataset\" field with the dataset ID or name the item came from.",
            "default": false
          },
          "batchSize": {
            "title": "Read batch size",
            "minimum": 100,
            "maximum": 50000,
            "type": "integer",
            "description": "Items downloaded per request. Lower it if your items are very large (over 50 KB each).",
            "default": 5000
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}