{
  "openapi": "3.0.1",
  "info": {
    "title": "Merge & Dedup Datasets: Remove Duplicates | $0.10/1K",
    "description": "Merge Apify datasets and JSON, JSON Lines or CSV files into one clean dataset and remove duplicate rows by any fields (nested too), case- and space-insensitive. Keep the first or last copy, or list only the duplicates. Pay only per row delivered.",
    "version": "1.0",
    "x-build-id": "G3SBhHmImMG2ghTuT"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/keel-data~dataset-merge-dedup/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-keel-data-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/keel-data~dataset-merge-dedup/runs": {
      "post": {
        "operationId": "runs-sync-keel-data-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/keel-data~dataset-merge-dedup/run-sync": {
      "post": {
        "operationId": "run-sync-keel-data-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": "Datasets to merge",
            "type": "array",
            "description": "Pick datasets from your account (for example the results of several scraper runs). They are merged in this order. You can also paste dataset IDs, names or dataset URLs."
          },
          "fileUrls": {
            "title": "Files to merge (URLs)",
            "type": "array",
            "description": "Public links to JSON, JSON Lines or CSV/TSV files (up to 300 MB each), for example an exported dataset or a CSV from another tool. Merged after the datasets.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "deduplicate": {
            "title": "Remove duplicates",
            "type": "boolean",
            "description": "Turn off to only merge the sources.",
            "default": true
          },
          "dedupFields": {
            "title": "Fields that make a row unique",
            "type": "array",
            "description": "Rows with the same values in all these fields are duplicates, e.g. url, or name + address. Nested fields use dots: location.city. Leave empty to remove only rows that are identical in every field.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "keep": {
            "title": "Which copy to keep",
            "enum": [
              "first",
              "last"
            ],
            "type": "string",
            "description": "First = the copy from the earliest source. Last = the newest copy (useful when later runs have fresher data).",
            "default": "first"
          },
          "output": {
            "title": "Output",
            "enum": [
              "unique",
              "duplicates"
            ],
            "type": "string",
            "description": "Unique rows (the clean, merged dataset) or only the duplicates that would be removed (to check your data).",
            "default": "unique"
          },
          "ignoreCase": {
            "title": "Ignore upper/lower case",
            "type": "boolean",
            "description": "\"ACME Inc\" and \"acme inc\" count as the same.",
            "default": true
          },
          "trimWhitespace": {
            "title": "Ignore extra spaces",
            "type": "boolean",
            "description": "Leading, trailing and repeated spaces are ignored when comparing.",
            "default": true
          },
          "missingKeys": {
            "title": "Rows with an empty key field",
            "enum": [
              "keep",
              "drop",
              "dedupe"
            ],
            "type": "string",
            "description": "What to do with rows where one of the fields above is missing or empty.",
            "default": "keep"
          },
          "fieldsToKeep": {
            "title": "Keep only these fields",
            "type": "array",
            "description": "Output only these fields (dots for nested fields). Leave empty to keep every field.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "fieldsToOmit": {
            "title": "Remove these fields",
            "type": "array",
            "description": "Drop these fields from the output, e.g. large HTML or debug fields.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "addSource": {
            "title": "Add the source to each row",
            "type": "boolean",
            "description": "Adds a _source field with the dataset ID or file URL the row came from.",
            "default": false
          },
          "maxItemsPerSource": {
            "title": "Max rows read per source",
            "minimum": 0,
            "type": "integer",
            "description": "Read at most this many rows from each dataset or file. 0 = all.",
            "default": 0
          },
          "maxOutputItems": {
            "title": "Max rows delivered",
            "minimum": 0,
            "type": "integer",
            "description": "Stop after delivering this many rows. 0 = no limit.",
            "default": 0
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}