{
  "openapi": "3.0.1",
  "info": {
    "title": "Merge, Dedupe & Transform Datasets to CSV & JSON",
    "description": "Merge Apify datasets and CSV, JSON or Excel files, remove duplicates, filter rows, rename and select columns, flatten nested JSON and export clean CSV, JSONL or XLSX. No code, limited permissions, built for scraping pipelines, n8n and AI agents. Pay per row.",
    "version": "1.0",
    "x-build-id": "nwFK9ZgpLPkSryQEl"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/mcpkit~merge-dedup-datasets/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-mcpkit-merge-dedup-datasets",
        "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/mcpkit~merge-dedup-datasets/runs": {
      "post": {
        "operationId": "runs-sync-mcpkit-merge-dedup-datasets",
        "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/mcpkit~merge-dedup-datasets/run-sync": {
      "post": {
        "operationId": "run-sync-mcpkit-merge-dedup-datasets",
        "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": {
          "datasets": {
            "title": "Datasets",
            "type": "array",
            "description": "Apify datasets to merge, by ID or name. Pick them here or pass IDs via API, e.g. [\"aBcD1234efGH5678i\"]. The Actor can read only datasets passed in this field. Required unless fileUrls is provided."
          },
          "fileUrls": {
            "title": "File URLs",
            "type": "array",
            "description": "Public URLs of CSV, TSV, JSON, JSONL or XLSX files (up to 100 MB each), merged after the datasets. Apify dataset export links work too. Example: [\"https://example.com/leads.csv\"]. Required unless datasets is provided.",
            "items": {
              "type": "string"
            }
          },
          "addSource": {
            "title": "Add _source field",
            "type": "boolean",
            "description": "Add a _source field to every row with the dataset ID or file URL it came from. Example: true",
            "default": false
          },
          "flatten": {
            "title": "Flatten nested objects",
            "type": "boolean",
            "description": "Turn nested objects into flat columns with dot names, e.g. {\"address\": {\"city\": \"Paris\"}} becomes {\"address.city\": \"Paris\"}. Useful before CSV or Excel export. Example: true",
            "default": false
          },
          "flattenArrays": {
            "title": "Arrays when flattening",
            "enum": [
              "json",
              "index"
            ],
            "type": "string",
            "description": "How to flatten arrays: json keeps each array as a JSON string in one column; index makes a column per item (tags.0, tags.1). Example: json",
            "default": "json"
          },
          "filters": {
            "title": "Filters",
            "type": "array",
            "description": "Keep only rows matching these conditions: {field, op, value, ignoreCase}. op: eq, ne, gt, gte, lt, lte, contains, not_contains, regex, exists, not_exists, empty, not_empty, in. Dot paths work (address.city). Example: [{\"field\": \"phone\", \"op\": \"not_empty\"}, {\"field\": \"rating\", \"op\": \"gte\", \"value\": 4}]",
            "default": []
          },
          "filterLogic": {
            "title": "Filter logic",
            "enum": [
              "all",
              "any"
            ],
            "type": "string",
            "description": "all: a row must match every filter (AND). any: at least one filter (OR). Example: all",
            "default": "all"
          },
          "dedup": {
            "title": "Remove duplicates",
            "type": "boolean",
            "description": "Remove duplicate rows. Duplicates are found by dedupFields, or by the whole row when dedupFields is empty. Example: true",
            "default": true
          },
          "dedupFields": {
            "title": "Dedup fields",
            "type": "array",
            "description": "Fields that identify a duplicate, e.g. [\"placeId\"] or [\"name\", \"address\"]. Empty = compare whole rows (the _source field is ignored). Rows where all these fields are empty are always kept.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "dedupMode": {
            "title": "Which duplicate to keep",
            "enum": [
              "keepFirst",
              "keepLast"
            ],
            "type": "string",
            "description": "keepFirst keeps the first row seen (in source order); keepLast keeps the last one, e.g. the newest scrape when datasets are listed oldest first. Example: keepFirst",
            "default": "keepFirst"
          },
          "dedupNormalize": {
            "title": "Ignore case and spaces",
            "type": "boolean",
            "description": "Compare dedup values ignoring letter case and leading/trailing spaces, so \"ACME \" and \"acme\" are duplicates. Example: false",
            "default": false
          },
          "fields": {
            "title": "Fields to keep",
            "type": "array",
            "description": "Keep only these fields, in this order; missing fields become null. Dot paths work (address.city). Empty = keep all fields. Example: [\"title\", \"phone\", \"website\"]",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "renameFields": {
            "title": "Rename fields",
            "type": "object",
            "description": "Rename output fields: {\"old name\": \"new name\"}. Applied after fields and omitFields. Example: {\"title\": \"name\", \"totalScore\": \"rating\"}",
            "default": {}
          },
          "omitFields": {
            "title": "Fields to remove",
            "type": "array",
            "description": "Remove these fields from every row. Dot paths work. Example: [\"reviews\", \"imageUrls\"]",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "sortBy": {
            "title": "Sort by field",
            "type": "string",
            "description": "Sort the result by this field (output or original name). Numbers sort as numbers; empty values go last. Up to 1,000,000 rows after filtering. Example: rating"
          },
          "sortOrder": {
            "title": "Sort order",
            "enum": [
              "asc",
              "desc"
            ],
            "type": "string",
            "description": "asc = A to Z, smallest first; desc = Z to A, largest first. Example: desc",
            "default": "asc"
          },
          "limit": {
            "title": "Max rows",
            "minimum": 1,
            "type": "integer",
            "description": "Write at most this many rows (after sort). Empty = no limit. Example: 1000"
          },
          "outputFile": {
            "title": "Also save as file",
            "enum": [
              "none",
              "csv",
              "jsonl",
              "xlsx"
            ],
            "type": "string",
            "description": "Save the result as one CSV, JSONL or XLSX file in the key-value store and return its link in OUTPUT. Required when outputTo is file or both. Example: csv",
            "default": "none"
          },
          "outputTo": {
            "title": "Where to write rows",
            "enum": [
              "dataset",
              "file",
              "both"
            ],
            "type": "string",
            "description": "dataset: rows go to the dataset (plus the file, if outputFile is set). file: rows go only to the outputFile file and the dataset gets one summary row with the link. Use file for large exports: faster and no dataset write limits. both: dataset and file. Example: file",
            "default": "dataset"
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}