{
  "openapi": "3.0.1",
  "info": {
    "title": "Merge & Dedup Datasets, CSV, JSON & Excel Files",
    "description": "Merge Apify datasets, CSV, JSON, JSON Lines and Excel files into one clean dataset. Remove duplicates on any fields, ignoring case, spaces and URL variants; keep the first, last or most complete row; filter, pick and rename fields. No code. Duplicates and filtered rows are free.",
    "version": "0.1",
    "x-build-id": "T9Gn5fJt2sb8NQC1n"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/wrentools~dataset-merge-dedup/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-wrentools-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/wrentools~dataset-merge-dedup/runs": {
      "post": {
        "operationId": "runs-sync-wrentools-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/wrentools~dataset-merge-dedup/run-sync": {
      "post": {
        "operationId": "run-sync-wrentools-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": "Your Apify datasets to merge, for example the results of several scraper runs. Only the datasets you pick here are read, and only for reading."
          },
          "fileUrls": {
            "title": "File URLs (CSV, TSV, JSON, JSON Lines, Excel)",
            "type": "array",
            "description": "Links to files you are allowed to use: CSV or TSV with a header row, a JSON array, JSON Lines, or an .xlsx workbook (first sheet, first row as header). Each file is downloaded once; the site's robots.txt is respected.",
            "items": {
              "type": "string"
            }
          },
          "items": {
            "title": "Rows as JSON",
            "type": "array",
            "description": "Rows pasted in directly: a JSON array of objects. Read after the datasets and files."
          },
          "dedupFields": {
            "title": "Deduplicate on these fields",
            "type": "array",
            "description": "Rows whose values in all these fields match are duplicates; only one is kept. Use dotted paths for nested fields (address.city). [\"*\"] compares whole rows. Leave empty to merge without deduplicating.",
            "items": {
              "type": "string"
            }
          },
          "keep": {
            "title": "Which duplicate to keep",
            "enum": [
              "first",
              "last",
              "mostComplete"
            ],
            "type": "string",
            "description": "Kept rows stay in the order they were read. 'last' and 'most complete' read every source before writing.",
            "default": "first"
          },
          "trimValues": {
            "title": "Ignore leading and trailing spaces",
            "type": "boolean",
            "description": "' ann@example.com ' matches 'ann@example.com'.",
            "default": true
          },
          "ignoreCase": {
            "title": "Ignore upper and lower case",
            "type": "boolean",
            "description": "'Ann@Example.com' matches 'ann@example.com'. Turn off for case-sensitive codes or IDs.",
            "default": true
          },
          "collapseWhitespace": {
            "title": "Treat runs of spaces as one",
            "type": "boolean",
            "description": "'Harbor  Supply' matches 'Harbor Supply'; tabs and line breaks count as spaces.",
            "default": false
          },
          "normalizeUrls": {
            "title": "Compare URLs loosely",
            "type": "boolean",
            "description": "In values that are URLs, ignore http/https, 'www.', a default port, a trailing slash, the #fragment, tracking parameters (utm_*, gclid, fbclid ...) and the order of query parameters.",
            "default": false
          },
          "emptyKeyRows": {
            "title": "Rows with empty dedup fields",
            "enum": [
              "keep",
              "dedup",
              "drop"
            ],
            "type": "string",
            "description": "What to do with rows in which every dedup field is empty or missing.",
            "default": "keep"
          },
          "filters": {
            "title": "Filters",
            "type": "array",
            "description": "Keep only rows that match: a list of {\"field\": \"country\", \"op\": \"equals\", \"value\": \"US\"}. Operators: equals, notEquals, contains, notContains, startsWith, endsWith, in, notIn (value is a list), gt, gte, lt, lte (numbers), matches, notMatches (regular expression), isEmpty, isNotEmpty. Filters run before deduplication, on the original field names."
          },
          "filterMode": {
            "title": "Rows must match",
            "enum": [
              "all",
              "any"
            ],
            "type": "string",
            "description": "Combine the filters with AND (all) or OR (any).",
            "default": "all"
          },
          "filtersCaseSensitive": {
            "title": "Case-sensitive filters",
            "type": "boolean",
            "description": "Off: 'us' matches 'US' in text filters and regular expressions.",
            "default": false
          },
          "fields": {
            "title": "Output only these fields",
            "type": "array",
            "description": "Write only these fields, in this order (dotted paths allowed; a missing field is written as null). Empty writes every field. For datasets, only the fields needed are downloaded.",
            "items": {
              "type": "string"
            }
          },
          "omitFields": {
            "title": "Drop these fields",
            "type": "array",
            "description": "Top-level fields to leave out of the output.",
            "items": {
              "type": "string"
            }
          },
          "renameFields": {
            "title": "Rename fields",
            "type": "object",
            "description": "Old name to new name, e.g. {\"e-mail\": \"email\", \"Company Name\": \"company\"}. Applied last, to the written rows."
          },
          "addSourceField": {
            "title": "Add a source field",
            "type": "string",
            "description": "If set, each written row gets a field of this name saying where it came from (dataset:<id>, the file URL, or 'items')."
          },
          "maxOutputRows": {
            "title": "Maximum rows to write",
            "minimum": 0,
            "maximum": 100000000,
            "type": "integer",
            "description": "Stop after writing this many rows (0 = no limit). Rows are charged as written.",
            "default": 0
          },
          "fileFormat": {
            "title": "File format",
            "enum": [
              "auto",
              "csv",
              "json",
              "jsonl",
              "xlsx"
            ],
            "type": "string",
            "description": "Applies to every file URL. Detection reads the file's first bytes, its name and its content type.",
            "default": "auto"
          },
          "csvDelimiter": {
            "title": "CSV delimiter",
            "enum": [
              "auto",
              "comma",
              "semicolon",
              "tab",
              "pipe"
            ],
            "type": "string",
            "description": "The character between CSV columns.",
            "default": "auto"
          },
          "maxFileSizeMb": {
            "title": "Maximum file size (MB)",
            "minimum": 1,
            "maximum": 200,
            "type": "integer",
            "description": "Larger downloads are stopped and reported as file-too-large, without charge. A file needs about 4 times its size in memory.",
            "default": 50
          },
          "requestDelayMs": {
            "title": "Delay between downloads from one site (ms)",
            "minimum": 0,
            "maximum": 60000,
            "type": "integer",
            "description": "Minimum pause between two downloads from the same site.",
            "default": 500
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}