{
  "openapi": "3.0.1",
  "info": {
    "title": "Merge & Deduplicate Datasets: Remove Duplicates, Only New Rows",
    "description": "Merge Apify datasets with CSV, TSV, JSON and JSON Lines files and drop duplicate rows by any fields or whole rows, matching URLs, e-mails, case and spacing smartly. Scheduled runs can return only rows that earlier runs did not. $0.05 per 1,000 unique rows, $0.001 per 1,000 rows read.",
    "version": "0.1",
    "x-build-id": "BEOGxjusH5GIwc1mm"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/greenrun~dataset-merge-dedup/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-greenrun-dataset-merge-dedup",
        "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/greenrun~dataset-merge-dedup/runs": {
      "post": {
        "operationId": "runs-sync-greenrun-dataset-merge-dedup",
        "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/greenrun~dataset-merge-dedup/run-sync": {
      "post": {
        "operationId": "run-sync-greenrun-dataset-merge-dedup",
        "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": "Apify datasets",
            "type": "array",
            "description": "Datasets to merge, in this order, for example the output of scraper runs. Pick them here, or give dataset IDs through the API (in an integration: {{resource.defaultDatasetId}}). The Actor runs with limited permissions, so it reads only the datasets given in this field, read-only."
          },
          "fileUrls": {
            "title": "File links (CSV, JSON, JSON Lines)",
            "type": "array",
            "description": "Public links to CSV, TSV, JSON (an array, or one object with the rows inside) or JSON Lines files, plain or gzip-compressed, one per line. Read after the datasets. The format is detected from the link, the content type and the first bytes. robots.txt of each site is respected.",
            "items": {
              "type": "string"
            }
          },
          "items": {
            "title": "Rows (JSON)",
            "type": "array",
            "description": "Rows given directly as a JSON array of objects, read after the datasets and files. Handy for AI agents and quick tests."
          },
          "dedupeFields": {
            "title": "Remove duplicates by these fields",
            "type": "array",
            "description": "Rows with the same values in all these fields are duplicates, for example url, or name and city. Dots reach nested fields (seller.id). Empty: whole rows are compared. The first copy is kept, in the order datasets, files, rows.",
            "items": {
              "type": "string"
            }
          },
          "normalizeUrls": {
            "title": "Compare web addresses and e-mails smartly",
            "type": "boolean",
            "description": "Web addresses match without http or https, www., the default port, the #fragment, a trailing slash and tracking parameters (utm_*, gclid, fbclid and similar), with query parameters in any order; e-mail addresses match in any letter case. Only for comparing: the output keeps the original values.",
            "default": true
          },
          "dedupeIgnoreCase": {
            "title": "Ignore upper and lower case",
            "type": "boolean",
            "description": "'ACME Inc' and 'acme inc' count as the same value.",
            "default": true
          },
          "trimWhitespace": {
            "title": "Ignore extra whitespace",
            "type": "boolean",
            "description": "Spaces, tabs and line breaks at the ends and repeated inside a value are ignored when comparing.",
            "default": true
          },
          "keepRowsWithoutKey": {
            "title": "Keep rows where these fields are empty",
            "type": "boolean",
            "description": "Rows where every field to remove duplicates by is empty cannot be compared. On: keep each of them (for example leads without an e-mail). Off: keep only the first one.",
            "default": true
          },
          "requiredFields": {
            "title": "Skip rows without these fields",
            "type": "array",
            "description": "Rows where any of these fields is missing or empty are skipped (read, not written).",
            "items": {
              "type": "string"
            }
          },
          "onlyNew": {
            "title": "Only rows not written by earlier runs",
            "type": "boolean",
            "description": "Remember the key of every written row and skip rows already written by earlier runs with the same memory name (they are read, not written). Ideal after a scheduled scraper: you get only new listings, jobs or products. The memory costs one 'memory-keys' event per started 100,000 remembered keys per run.",
            "default": false
          },
          "memoryName": {
            "title": "Memory name",
            "type": "string",
            "description": "Runs with the same name share their memory: a key-value store named dataset-merge-dedup-<name> in your account (12 bytes per remembered row). Use one name per project; a new name starts empty. Letters, digits and hyphens.",
            "default": "default"
          },
          "outputFields": {
            "title": "Output only these fields",
            "type": "array",
            "description": "Keep only these fields, in this order; a dot path becomes a field with the dotted name (seller.id). Empty: every field.",
            "items": {
              "type": "string"
            }
          },
          "addSourceField": {
            "title": "Add the source of each row",
            "type": "boolean",
            "description": "Add a _source field with dataset:<ID>, the file link or 'input items'.",
            "default": false
          },
          "maxRows": {
            "title": "Max rows",
            "minimum": 0,
            "type": "integer",
            "description": "Stop after this many unique rows. 0: no limit. The maximum cost per run in the run options also stops the run cleanly.",
            "default": 0
          },
          "csvDelimiter": {
            "title": "CSV delimiter",
            "type": "string",
            "description": "Character between CSV columns: , ; | or tab. Empty: detected from the header line."
          },
          "itemsPath": {
            "title": "Rows inside a JSON object",
            "type": "string",
            "description": "For a JSON file that is one object: the dotted path to its list of rows, for example data.items. Empty: the longest list of objects in the first three levels."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}