{
  "openapi": "3.0.1",
  "info": {
    "title": "Merge CSV Files & Datasets: Remove Duplicates, Excel, JSON",
    "description": "Extract one clean table from many CSV files, Excel files, JSON files or Apify datasets at $0.02 per 1,000 unique rows: merge, remove duplicates by any fields with URL, email and number matching, keep first or last, only-new mode. A bad source never fails the run.",
    "version": "0.3",
    "x-build-id": "Fpk7wT5vOmNljiskr"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/aurelix~dataset-merge-dedup/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-aurelix-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/aurelix~dataset-merge-dedup/runs": {
      "post": {
        "operationId": "runs-sync-aurelix-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/aurelix~dataset-merge-dedup/run-sync": {
      "post": {
        "operationId": "run-sync-aurelix-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",
            "type": "array",
            "description": "Apify datasets to merge, e.g. the results of several scraper runs. Pick them here or paste dataset IDs or names; Apify then lets this Actor read them. In an integration use the run's defaultDatasetId."
          },
          "fileUrls": {
            "title": "File links",
            "type": "array",
            "description": "Public links to CSV, TSV, JSON, JSON Lines or Excel (.xlsx) files, e.g. https://example.com/leads.csv: up to 200 MB each (Excel up to 30 MB with up to 40 MB of text). Google Sheets links work when the sheet is shared 'anyone with the link'. Your own Apify datasets go in 'Datasets'; a dataset link here works only if anyone with the link may read it.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "rows": {
            "title": "Rows",
            "type": "array",
            "description": "Rows pasted as a JSON array of objects, e.g. [{\"name\": \"Acme\", \"website\": \"acme.com\"}]. Handy for tests and AI agents.",
            "default": []
          },
          "dedupeFields": {
            "title": "Dedupe by fields",
            "type": "array",
            "description": "Rows with the same values in these fields are duplicates, e.g. 'website', or 'name' plus 'city'. Dots reach nested values ('company.domain'). Field names are matched forgiving case and spaces. Empty: rows are duplicates when every field is equal, ignoring timestamps such as scraped_at.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "smartMatch": {
            "title": "Smart matching",
            "type": "boolean",
            "description": "Compare values the way people mean them: URLs (with or without http(s)://) ignoring www., the host's case, one trailing slash and utm_*, gclid and fbclid tags (every other parameter, the path's case and #fragments still count); emails in any case; numbers such as 5 and 5.0 as one. Nothing else is guessed: phone numbers, dates and IDs must be written the same way to match.",
            "default": true
          },
          "ignoreCase": {
            "title": "Ignore upper/lower case",
            "type": "boolean",
            "description": "'ACME Inc' and 'acme inc' count as the same value.",
            "default": true
          },
          "keep": {
            "title": "Which duplicate to keep",
            "enum": [
              "first",
              "last"
            ],
            "type": "string",
            "description": "Which row of each duplicate group stays. 'Last' reads the sources twice, so it takes about twice as long.",
            "default": "first"
          },
          "emptyKeyRows": {
            "title": "Rows with empty dedupe fields",
            "enum": [
              "keep",
              "drop"
            ],
            "type": "string",
            "description": "What to do with rows that have no value in any dedupe field. Kept rows are never merged with each other, so missing data does not wipe rows out.",
            "default": "keep"
          },
          "onlyNewEntries": {
            "title": "Only rows new since the last run",
            "type": "boolean",
            "description": "Also skip rows whose dedupe key an earlier run with the same memory name already returned. Use after a scheduled scraper to pass on only new rows.",
            "default": false
          },
          "stateKey": {
            "title": "Memory name (optional)",
            "type": "string",
            "description": "Name for the 'only new' memory, e.g. 'daily-leads'. Runs with different names keep separate memories."
          },
          "outputFields": {
            "title": "Output fields",
            "type": "array",
            "description": "Keep only these fields, in this order, e.g. 'name', 'website', 'company.domain' (a nested value becomes its own column). Empty: every field.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "addSource": {
            "title": "Add a _source field",
            "type": "boolean",
            "description": "Tag each row with where it came from: dataset:<ID>, file:<link> or rows.",
            "default": true
          },
          "maxRows": {
            "title": "Max rows",
            "minimum": 0,
            "type": "integer",
            "description": "Stop after writing this many rows, e.g. 1000. 0 = no limit.",
            "default": 0
          },
          "excelSheet": {
            "title": "Excel sheet name",
            "type": "string",
            "description": "Worksheet to read in Excel files, e.g. 'Leads'. Empty: the first sheet."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}