{
  "openapi": "3.0.1",
  "info": {
    "title": "Dataset Merge, Dedupe & Only New Items",
    "description": "Merge Apify datasets, remove duplicates on normalized fields (URLs, case, spaces) and output only items not seen in earlier runs. Works with limited permissions, schedules and integrations. CSV/Excel export.",
    "version": "1.0",
    "x-build-id": "SiNge2e8cBS4fHpp1"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/genesis.labs.co~dataset-merge-dedupe/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-genesis.labs.co-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/genesis.labs.co~dataset-merge-dedupe/runs": {
      "post": {
        "operationId": "runs-sync-genesis.labs.co-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/genesis.labs.co~dataset-merge-dedupe/run-sync": {
      "post": {
        "operationId": "run-sync-genesis.labs.co-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": "Datasets to merge, in priority order (when two items share a key, the one from the earlier dataset is kept). Pick from your runs or paste dataset IDs."
          },
          "datasetId": {
            "title": "Dataset from an integration",
            "type": "string",
            "description": "For integrations: set to {{resource.defaultDatasetId}} in \"Run another Actor when a run succeeds\" to process each finished scraper run. Merged after \"Datasets\"."
          },
          "mode": {
            "title": "Mode",
            "enum": [
              "dedupe",
              "onlyNew",
              "merge"
            ],
            "type": "string",
            "description": "Only new items: outputs items whose key was never output by an earlier run with the same Memory name. Great for scheduled scrapers and alerts.",
            "default": "dedupe"
          },
          "dedupeFields": {
            "title": "Key fields",
            "type": "array",
            "description": "Fields that identify an item, e.g. url, or title + price. Dot paths work (e.g. location.city). Leave empty to compare whole items.",
            "items": {
              "type": "string"
            }
          },
          "memoryName": {
            "title": "Memory name (only new items)",
            "pattern": "^[a-zA-Z0-9-]{0,40}$",
            "type": "string",
            "description": "Letters, digits and hyphens. Each name keeps its own list of seen keys in a key-value store in your account, so runs with the same name never output the same item twice."
          },
          "resetMemory": {
            "title": "Reset memory",
            "type": "boolean",
            "description": "Forget all keys stored under this Memory name and start over.",
            "default": false
          },
          "emptyKeyItems": {
            "title": "Items with an empty key",
            "enum": [
              "keep",
              "drop"
            ],
            "type": "string",
            "description": "What to do when all key fields of an item are empty.",
            "default": "keep"
          },
          "trim": {
            "title": "Trim spaces",
            "type": "boolean",
            "description": "Ignore leading and trailing spaces when comparing keys.",
            "default": true
          },
          "collapseWhitespace": {
            "title": "Collapse inner whitespace",
            "type": "boolean",
            "description": "Treat runs of spaces, tabs and newlines as one space.",
            "default": true
          },
          "caseInsensitive": {
            "title": "Ignore letter case",
            "type": "boolean",
            "description": "\"iPhone 15\" and \"IPHONE 15\" match.",
            "default": true
          },
          "normalizeUrls": {
            "title": "Normalize URLs",
            "type": "boolean",
            "description": "http/https, www., trailing slashes, #fragments, parameter order and tracking parameters (utm_*, fbclid, gclid...) don't create duplicates.",
            "default": true
          },
          "stripUrlQuery": {
            "title": "Ignore all URL parameters",
            "type": "boolean",
            "description": "Compare URLs without any ?query parameters.",
            "default": false
          },
          "removeDiacritics": {
            "title": "Ignore accents",
            "type": "boolean",
            "description": "\"Café\" and \"Cafe\" match.",
            "default": false
          },
          "pickFields": {
            "title": "Keep only these fields",
            "type": "array",
            "description": "Output only these fields (dot paths allowed). Leave empty to keep all.",
            "items": {
              "type": "string"
            }
          },
          "omitFields": {
            "title": "Remove fields",
            "type": "array",
            "description": "Top-level fields to drop, e.g. #debug, html.",
            "items": {
              "type": "string"
            }
          },
          "renameFields": {
            "title": "Rename fields",
            "type": "object",
            "description": "Map of old name to new name, e.g. {\"url\": \"productUrl\", \"price.value\": \"price\"}."
          },
          "addSourceField": {
            "title": "Add source dataset ID",
            "type": "boolean",
            "description": "Adds _sourceDatasetId to every output item.",
            "default": false
          },
          "maxItems": {
            "title": "Max output items",
            "minimum": 1,
            "type": "integer",
            "description": "Stop after this many output items."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}