{
  "openapi": "3.0.1",
  "info": {
    "title": "Dataset Deduplicator & Merger: Merge, Dedupe CSV/JSON",
    "description": "Merge several Apify datasets and CSV/JSON files into one, remove duplicate items on the fields you choose, with trim, lowercase and URL/email normalization. Streams in pages, so 1M+ items work. $0.0002 per 1,000 input items.",
    "version": "0.1",
    "x-build-id": "vZkuMp0amd0ycuoaL"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/datagleaner~dataset-dedup-merge/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-datagleaner-dataset-dedup-merge",
        "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/datagleaner~dataset-dedup-merge/runs": {
      "post": {
        "operationId": "runs-sync-datagleaner-dataset-dedup-merge",
        "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/datagleaner~dataset-dedup-merge/run-sync": {
      "post": {
        "operationId": "run-sync-datagleaner-dataset-dedup-merge",
        "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": {
          "datasetId": {
            "title": "Dataset (picker)",
            "type": "string",
            "description": "Optional. Pick one of your datasets here. Use the list below to merge several. Leave every source empty to run a built-in 8-contact example."
          },
          "datasetIds": {
            "title": "Dataset IDs",
            "type": "array",
            "description": "Dataset IDs (or `username~dataset-name`), one per line. They are read in this order, so with Keep first the earlier dataset wins a tie. Datasets must be on your own account or shared with it. Leave every source empty to run a built-in 8-contact example.",
            "items": {
              "type": "string"
            }
          },
          "urls": {
            "title": "CSV / JSON file URLs",
            "type": "array",
            "description": "Public http(s) links to CSV, JSON (array of objects) or JSON Lines files, for example a file in your own key-value store or storage bucket. Files up to 500 MB (a JSON array up to 150 MB; use JSON Lines for bigger). Only files you have the right to process.",
            "items": {
              "type": "string"
            }
          },
          "dedupeFields": {
            "title": "Fields that define a duplicate",
            "type": "array",
            "description": "Two items are duplicates when all of these fields are equal after normalization. Dotted paths work (`contact.email`). Empty means the whole item must be equal.",
            "items": {
              "type": "string"
            }
          },
          "keep": {
            "title": "Which copy to keep",
            "enum": [
              "first",
              "last"
            ],
            "type": "string",
            "description": "Keep the first or the last copy of each duplicate. Output order follows the sources.",
            "default": "first"
          },
          "normalize": {
            "title": "Normalization before comparing",
            "type": "array",
            "description": "Applied to the values being compared only; your items are output unchanged. Default when omitted: trim.",
            "items": {
              "type": "string",
              "enum": [
                "trim",
                "collapseWhitespace",
                "emailLowercase",
                "stripUrl",
                "lowercase"
              ],
              "enumTitles": [
                "Trim spaces",
                "Collapse repeated whitespace",
                "Lowercase email addresses",
                "Strip URL protocol, www, #fragment and trailing slash",
                "Lowercase everything (case-insensitive match)"
              ]
            }
          },
          "dropItemsWithoutKey": {
            "title": "Drop items with no value in the dedupe fields",
            "type": "boolean",
            "description": "Items whose dedupe fields are all missing or empty cannot be judged duplicates. Off (default): keep them. On: drop them.",
            "default": false
          },
          "includeSourceDataset": {
            "title": "Add _sourceDataset to each item",
            "type": "boolean",
            "description": "Adds a `_sourceDataset` field with the dataset id or file URL each kept item came from.",
            "default": true
          },
          "maxItems": {
            "title": "Maximum input items",
            "minimum": 1,
            "maximum": 50000000,
            "type": "integer",
            "description": "Stop reading after this many input items. You pay per 1,000 input items read. Memory use is about 100 bytes per distinct item, so keep 512 MB for up to 3 million and raise the run memory beyond that.",
            "default": 5000000
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}