{
  "openapi": "3.0.1",
  "info": {
    "title": "Duplicate Record Detection And Merging",
    "description": "Recurring CRM, customer, lead, supplier, procurement, and inventory exports contain exact and near-duplicate rows. Teams need to consolidate them without manually comparing every record or losing better values during a merge.",
    "version": "0.0",
    "x-build-id": "9b92pjJcAalHGgrow"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/first_watch~duplicate-record-detection-and-merging/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-first_watch-duplicate-record-detection-and-merging",
        "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/first_watch~duplicate-record-detection-and-merging/runs": {
      "post": {
        "operationId": "runs-sync-first_watch-duplicate-record-detection-and-merging",
        "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/first_watch~duplicate-record-detection-and-merging/run-sync": {
      "post": {
        "operationId": "run-sync-first_watch-duplicate-record-detection-and-merging",
        "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": {
          "sources": {
            "title": "Data sources",
            "maxItems": 20,
            "type": "array",
            "description": "Required. Supply 1-20 objects with a unique id, format (records, csv, json or xlsx), and exactly one payload: records, text, base64 or url. XLSX accepts an optional sheet name or one-based index. Total decoded input is limited to 4 MB. Remote URLs are restricted to HTTPS on apify.com or stackoverflow.com; inline inputs make no document requests.",
            "items": {
              "type": "object"
            }
          },
          "identityFields": {
            "title": "Identity matching rules",
            "maxItems": 20,
            "type": "array",
            "description": "Required. Each rule requires field and matchType (exact, email, phone or fuzzy), with optional weight greater than zero and at most 10. Field names are normalized. Missing values score zero. Every configured identity field must have a usable value somewhere in the batch.",
            "items": {
              "type": "object"
            }
          },
          "blockingFields": {
            "title": "Additional blocking fields",
            "maxItems": 100,
            "uniqueItems": true,
            "type": "array",
            "description": "Column names (1-100 characters each). Rows sharing any normalized blocking value become candidates. Exact identity-value matches are always candidates. When empty, fuzzy identity fields also use their first three normalized characters as a block.",
            "items": {
              "type": "string"
            },
            "default": []
          },
          "matchThreshold": {
            "title": "Automatic merge threshold",
            "minimum": 0,
            "maximum": 1,
            "type": "number",
            "description": "Every pair within an automatically merged cluster must meet this weighted similarity score. Scores are similarities, not calibrated probabilities.",
            "default": 0.9
          },
          "reviewThreshold": {
            "title": "Review threshold",
            "minimum": 0,
            "maximum": 1,
            "type": "number",
            "description": "Positive candidate scores at or above this value connect possible duplicates for review. Must not exceed the automatic merge threshold.",
            "default": 0.75
          },
          "neverMergeFields": {
            "title": "Fields that must not conflict",
            "maxItems": 100,
            "uniqueItems": true,
            "type": "array",
            "description": "Column names whose different non-empty cleaned values prevent automatic merging. Candidate conflicts enter review even if their similarity is low. Comparisons preserve case and punctuation.",
            "items": {
              "type": "string"
            },
            "default": []
          },
          "excludedFields": {
            "title": "Fields excluded from output",
            "maxItems": 100,
            "uniqueItems": true,
            "type": "array",
            "description": "Column names removed from canonical and normalized audit values after matching. This does not remove original data from the Apify INPUT record.",
            "items": {
              "type": "string"
            },
            "default": []
          },
          "hashFields": {
            "title": "Fields hashed in output",
            "maxItems": 100,
            "uniqueItems": true,
            "type": "array",
            "description": "Column names whose non-empty output values are replaced with SHA-256 hashes of normalized comparison values. Matching happens first. Hashing is deterministic pseudonymization and does not remove original INPUT data.",
            "items": {
              "type": "string"
            },
            "default": []
          },
          "survivorship": {
            "title": "Canonical value selection",
            "maxProperties": 100,
            "type": "object",
            "description": "Map field names to first_source, longest, most_complete, newest or oldest, or to {strategy: preferred_source, sourceOrder: [source IDs]}. Newest and oldest compare ISO dates in that column. Ties retain source order.",
            "default": {}
          },
          "includeAuditRecords": {
            "title": "Write separate audit JSON",
            "type": "boolean",
            "description": "Save MERGE_AUDIT in addition to the source mappings and explanations always present in OUTPUT.",
            "default": true
          },
          "includeMergedXlsx": {
            "title": "Create Excel output",
            "type": "boolean",
            "description": "Write a real XLSX workbook containing the canonical export rows, including source references and review status.",
            "default": true
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}