{
  "openapi": "3.0.1",
  "info": {
    "title": "Merge, Dedupe & Transform Datasets",
    "description": "Merge any number of Apify datasets, remove duplicates by your own fields (exact, normalised or fuzzy), keep the first, last or most complete copy, filter and reshape items. Streams page by page, so millions of items work.",
    "version": "1.0",
    "x-build-id": "sViggSQnWJ1ERCBIh"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/solidactors~merge-dedupe-datasets/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-solidactors-merge-dedupe-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/solidactors~merge-dedupe-datasets/runs": {
      "post": {
        "operationId": "runs-sync-solidactors-merge-dedupe-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/solidactors~merge-dedupe-datasets/run-sync": {
      "post": {
        "operationId": "run-sync-solidactors-merge-dedupe-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": {
          "datasetIds": {
            "title": "Datasets to merge",
            "type": "array",
            "description": "Empty: a free 5-item built-in sample runs, to show what the Actor does (nothing is charged). One or more datasets. Items are read in this order, page by page, so very large datasets work."
          },
          "dedupe": {
            "title": "Remove duplicates",
            "type": "boolean",
            "description": "Off: only merge (and filter or transform).",
            "default": true
          },
          "dedupFields": {
            "title": "Fields that define a duplicate",
            "type": "array",
            "description": "Two items with the same values in these fields are duplicates, for example url, or name and city. Nested fields use dots: address.city. Empty means the whole item must be identical.",
            "items": {
              "type": "string"
            }
          },
          "keepWhich": {
            "title": "Which duplicate to keep",
            "enum": [
              "first",
              "last",
              "mostComplete"
            ],
            "type": "string",
            "description": "first: the first one found (datasets in the order given). last: the newest one. mostComplete: the one with the most filled-in fields.",
            "default": "first"
          },
          "keepItemsWithEmptyKey": {
            "title": "Keep items whose key fields are empty",
            "type": "boolean",
            "description": "On: items with no value in all key fields are kept (they cannot be compared). Off: they are removed.",
            "default": true
          },
          "ignoreCase": {
            "title": "Ignore upper and lower case",
            "type": "boolean",
            "description": "ACME and acme count as the same.",
            "default": false
          },
          "ignoreAccents": {
            "title": "Ignore accents",
            "type": "boolean",
            "description": "Café and Cafe count as the same.",
            "default": false
          },
          "collapseWhitespace": {
            "title": "Ignore extra spaces",
            "type": "boolean",
            "description": "Several spaces, tabs or line breaks count as one space.",
            "default": false
          },
          "normalizeUrls": {
            "title": "Normalise URLs",
            "type": "boolean",
            "description": "http vs https, www., a trailing slash, #anchors and utm_ tracking parameters are ignored.",
            "default": false
          },
          "digitsOnly": {
            "title": "Compare digits only",
            "type": "boolean",
            "description": "Keeps only digits before comparing. Useful for phone numbers: +351 912-345-678 equals 351912345678.",
            "default": false
          },
          "fuzzyField": {
            "title": "Fuzzy match on this field (optional)",
            "type": "string",
            "description": "Also removes near duplicates on this text field, for example company names Acme Inc and ACME Inc. Works with keepWhich = first."
          },
          "fuzzyThreshold": {
            "title": "Fuzzy similarity (0 to 100)",
            "minimum": 50,
            "maximum": 100,
            "type": "integer",
            "description": "How similar two values must be to count as duplicates. 90 is strict, 80 is loose.",
            "default": 90
          },
          "fuzzyBlockFields": {
            "title": "Fuzzy: only compare items with the same",
            "type": "array",
            "description": "Fields that must match exactly before two items are compared, for example city or country. Makes fuzzy matching faster and safer.",
            "items": {
              "type": "string"
            }
          },
          "fuzzyPrefixLength": {
            "title": "Fuzzy: first letters that must match",
            "minimum": 0,
            "maximum": 10,
            "type": "integer",
            "description": "Only values that start with the same N letters are compared (speed). 0 compares everything inside a block.",
            "default": 2
          },
          "filters": {
            "title": "Filters (all must pass)",
            "type": "array",
            "description": "Keep only items that match. Each filter: {\"field\": \"price\", \"op\": \"gt\", \"value\": 10}. Ops: eq, ne, contains, notContains, gt, gte, lt, lte, exists, notExists, regex, in. No code is run."
          },
          "fieldsToKeep": {
            "title": "Keep only these fields",
            "type": "array",
            "description": "If set, output items have only these fields. Nested fields with dots, for example address.city.",
            "items": {
              "type": "string"
            }
          },
          "fieldsToDrop": {
            "title": "Drop these fields",
            "type": "array",
            "description": "Top-level fields removed from every item. Ignored when Keep only these fields is set.",
            "items": {
              "type": "string"
            }
          },
          "renameMap": {
            "title": "Rename fields",
            "type": "object",
            "description": "Old name to new name, for example {\"title\": \"name\"}."
          },
          "addSourceDatasetId": {
            "title": "Add the source dataset ID to each item",
            "type": "boolean",
            "description": "Adds a field _sourceDatasetId.",
            "default": false
          },
          "outputDatasetName": {
            "title": "Save to a named dataset",
            "type": "string",
            "description": "Optional. Results go to a named dataset (kept forever, reusable) instead of the run's default dataset."
          },
          "appendToDatasetId": {
            "title": "Or append to an existing dataset",
            "type": "string",
            "description": "Optional. Results are added to this dataset."
          },
          "limitPerDataset": {
            "title": "Max items read per dataset",
            "minimum": 1,
            "type": "integer",
            "description": "Empty means all."
          },
          "maxOutputItems": {
            "title": "Max output items",
            "minimum": 1,
            "type": "integer",
            "description": "Stop after this many items are written. Empty means no limit."
          },
          "pageSize": {
            "title": "Items per page when reading",
            "minimum": 1000,
            "maximum": 100000,
            "type": "integer",
            "description": "Bigger is faster but uses more memory.",
            "default": 10000
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}