{
  "openapi": "3.0.1",
  "info": {
    "title": "Dataset Merge, Fuzzy Dedupe & Cross-Join Pro",
    "description": "Merge Apify Datasets, CSV/TSV/JSON/NDJSON/XLSX files & inline rows with exact/normalized/fuzzy deduplication, coalesce survivorship, SQL-style cross-joins, stateful incremental mode, and Standby MCP.",
    "version": "1.0",
    "x-build-id": "F6m0QjhwDQY3xsezb"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/forgekit~dataset-merge-dedupe-pro/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-forgekit-dataset-merge-dedupe-pro",
        "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/forgekit~dataset-merge-dedupe-pro/runs": {
      "post": {
        "operationId": "runs-sync-forgekit-dataset-merge-dedupe-pro",
        "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/forgekit~dataset-merge-dedupe-pro/run-sync": {
      "post": {
        "operationId": "run-sync-forgekit-dataset-merge-dedupe-pro",
        "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 Dataset IDs",
            "maxItems": 50,
            "type": "array",
            "description": "Apify Dataset IDs to merge in order (local emulation or Apify Cloud).",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "fileUrls": {
            "title": "Public File URLs",
            "maxItems": 50,
            "type": "array",
            "description": "Public CSV, TSV, JSON, NDJSON, XML, or XLSX file URLs to ingest (SSRF-protected).",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "kvsRecords": {
            "title": "Key-Value Store Records",
            "maxItems": 50,
            "type": "array",
            "description": "Optional Key-Value Store records [{ storeId?, key }] containing JSON/CSV/XLSX payloads.",
            "default": []
          },
          "rows": {
            "title": "Inline Rows or Source Batches",
            "maxItems": 50000,
            "type": "array",
            "description": "Inline JSON array of row objects or source batches [{ source, rows }] for direct API/MCP runs.",
            "default": []
          },
          "addSourceField": {
            "title": "Source Provenance Field",
            "maxLength": 64,
            "type": "string",
            "description": "If set (e.g. \"_source\"), injects the source dataset ID, filename, or batch label into every row.",
            "default": ""
          },
          "dedupeMode": {
            "title": "Deduplication Mode",
            "enum": [
              "none",
              "exact",
              "normalized",
              "fuzzy"
            ],
            "type": "string",
            "description": "Strategy used to identify duplicate records across merged sources.",
            "default": "normalized"
          },
          "dedupeFields": {
            "title": "Deduplication Key Fields",
            "maxItems": 20,
            "type": "array",
            "description": "Dot-notation field paths used as deduplication keys (empty hashes the full canonicalized row).",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "keepRowsWithoutKey": {
            "title": "Keep Rows Missing Dedupe Key",
            "type": "boolean",
            "description": "Preserve rows whose dedupe key fields are all missing/empty instead of collapsing them together.",
            "default": true
          },
          "fuzzyAlgorithm": {
            "title": "Fuzzy Similarity Algorithm",
            "enum": [
              "jaro-winkler",
              "levenshtein",
              "token-jaccard",
              "dice"
            ],
            "type": "string",
            "description": "String similarity metric used when dedupeMode is set to \"fuzzy\".",
            "default": "jaro-winkler"
          },
          "similarityThreshold": {
            "title": "Fuzzy Similarity Threshold",
            "minimum": 0.5,
            "maximum": 1,
            "type": "number",
            "description": "Minimum similarity score (0.50 to 1.00) required to treat two rows as duplicates.",
            "default": 0.88
          },
          "fuzzyBlockingField": {
            "title": "Fuzzy Blocking Field",
            "maxLength": 64,
            "type": "string",
            "description": "Optional exact/prefix blocking field (e.g. \"country\" or \"domain\") to accelerate large fuzzy merges.",
            "default": ""
          },
          "keepStrategy": {
            "title": "Duplicate Survivorship Strategy",
            "enum": [
              "first",
              "last",
              "richest",
              "merge-coalesce"
            ],
            "type": "string",
            "description": "Determines how winning values are chosen within each duplicate cluster.",
            "default": "first"
          },
          "mergeArrays": {
            "title": "Union Arrays on Coalesce",
            "type": "boolean",
            "description": "When keepStrategy is \"merge-coalesce\", union array values across duplicate records.",
            "default": false
          },
          "normalizeUrlFields": {
            "title": "Normalize URL Fields",
            "maxItems": 20,
            "type": "array",
            "description": "Field paths whose URLs are canonicalized (strip protocol, www., UTM params, trailing slash) before dedupe/join.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "outputDuplicatesToKvs": {
            "title": "Save Duplicates Report to KV Store",
            "type": "boolean",
            "description": "Write rejected duplicate rows and cluster metadata to Key-Value Store key DUPLICATES_REPORT.",
            "default": false
          },
          "join": {
            "title": "Cross-Join Configuration",
            "type": "object",
            "description": "Optional SQL-style cross-join specification: { rightDatasetId?, rightFileUrl?, rightRows?, leftKeys[], rightKeys[], type: inner|left|right|full|anti, prefix?, ignoreCase?, cardinality?: first-match|all-matches }."
          },
          "filters": {
            "title": "Row Filter Predicates",
            "maxItems": 50,
            "type": "array",
            "description": "Filter predicates [{ field, op, value }] supporting eq, neq, gt, gte, lt, lte, contains, regex, in, exists, isEmpty.",
            "default": []
          },
          "filterLogic": {
            "title": "Filter Boolean Logic",
            "enum": [
              "AND",
              "OR"
            ],
            "type": "string",
            "description": "Combine multiple filter predicates with AND or OR.",
            "default": "AND"
          },
          "onlyNew": {
            "title": "Stateful Incremental Mode (Only New)",
            "type": "boolean",
            "description": "Emit only keys unseen in previous runs persisted in stateStoreName.",
            "default": false
          },
          "stateStoreName": {
            "title": "Incremental State KV Store Name",
            "maxLength": 63,
            "type": "string",
            "description": "Named Apify Key-Value Store used to persist seen hashes when onlyNew is enabled.",
            "default": "dataset-merge-state"
          },
          "selectFields": {
            "title": "Select Fields (Whitelist)",
            "maxItems": 200,
            "type": "array",
            "description": "Explicit list of output column names to retain (empty keeps all columns).",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "dropFields": {
            "title": "Drop Fields (Blacklist)",
            "maxItems": 200,
            "type": "array",
            "description": "Output column names to exclude from emitted records.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "renameFields": {
            "title": "Rename Fields Map",
            "type": "object",
            "description": "Map of { \"oldField\": \"newField\" } column renames applied before export.",
            "default": {}
          },
          "sortBy": {
            "title": "Sort Specification",
            "maxItems": 5,
            "type": "array",
            "description": "Multi-key sort specification [{ field, direction: \"asc\"|\"desc\" }].",
            "default": []
          },
          "exportFormats": {
            "title": "KV Export Formats",
            "maxItems": 4,
            "type": "array",
            "description": "Output file formats to export to the Key-Value Store (json, ndjson, csv, xlsx).",
            "items": {
              "type": "string"
            },
            "default": [
              "json"
            ]
          },
          "exportFilePrefix": {
            "title": "Export File Prefix",
            "pattern": "^[a-zA-Z0-9._-]{1,48}$",
            "maxLength": 48,
            "type": "string",
            "description": "Sanitized filename prefix for exported KV Store artifacts (e.g. \"merged\" -> merged_CSV, merged_XLSX).",
            "default": "merged"
          },
          "failOnSourceError": {
            "title": "Fail Run on Partial Source Error",
            "type": "boolean",
            "description": "When false (default), unreadable/404 sources are isolated in SUMMARY.sourceErrors[] while valid sources still merge.",
            "default": false
          },
          "csvFormulaSafe": {
            "title": "CSV/XLSX Formula Injection Protection",
            "type": "boolean",
            "description": "Prefix cells starting with =, +, -, @, tab, or CR with an apostrophe in CSV/XLSX exports.",
            "default": true
          },
          "maxRows": {
            "title": "Max Output Rows",
            "minimum": 1,
            "maximum": 500000,
            "type": "integer",
            "description": "Hard upper cap on emitted output records.",
            "default": 100000
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}