{
  "openapi": "3.0.1",
  "info": {
    "title": "Merge & Deduplicate Datasets - Remove Duplicates",
    "description": "Merge Apify datasets and JSON items, remove duplicates by key fields, then pick, rename or cast fields. Reads only the datasets you pick.",
    "version": "0.1",
    "x-build-id": "YYAgPaWfjgpph1IIS"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/luxe_tasks~dataset-dedupe/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-luxe_tasks-dataset-dedupe",
        "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/luxe_tasks~dataset-dedupe/runs": {
      "post": {
        "operationId": "runs-sync-luxe_tasks-dataset-dedupe",
        "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/luxe_tasks~dataset-dedupe/run-sync": {
      "post": {
        "operationId": "run-sync-luxe_tasks-dataset-dedupe",
        "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",
            "maxItems": 20,
            "type": "array",
            "description": "Pick up to 20 datasets with the picker or paste their IDs. They are read in this order; with \"Keep\" = first, earlier datasets win. This Actor can read only the datasets you pick here (read-only)."
          },
          "items": {
            "title": "Inline items (JSON)",
            "type": "array",
            "description": "Optional JSON array of objects (up to 10,000), read after the datasets. Example: [{\"url\": \"https://example.com/a\", \"name\": \"A\"}]. Leave this and the datasets empty to process a built-in 6-row sample, which has no per-row charge; the per-run start fee still applies."
          },
          "dedupeFields": {
            "title": "Dedupe on fields",
            "type": "array",
            "description": "Rows with equal values in ALL of these fields are duplicates. Dot paths reach nested fields (e.g. \"seller.id\"). Leave empty to compare whole rows.",
            "items": {
              "type": "string"
            }
          },
          "keep": {
            "title": "Keep",
            "enum": [
              "first",
              "last"
            ],
            "type": "string",
            "description": "Which row of each duplicate group to keep: the first one read, or the last one (reads the sources twice).",
            "default": "first"
          },
          "trimWhitespace": {
            "title": "Ignore leading/trailing spaces when comparing",
            "type": "boolean",
            "description": "\" Lamp \" and \"Lamp\" match. Output values are not changed.",
            "default": true
          },
          "caseInsensitive": {
            "title": "Ignore letter case when comparing",
            "type": "boolean",
            "description": "\"LAMP\" and \"lamp\" match. Output values are not changed.",
            "default": false
          },
          "missingKeyPolicy": {
            "title": "Rows with no key value",
            "enum": [
              "keep",
              "drop",
              "group"
            ],
            "type": "string",
            "description": "What to do with rows where every dedupe field is missing (or empty, see below): keep them all, drop them, or treat them as one group (keep one).",
            "default": "keep"
          },
          "emptyCountsAsMissing": {
            "title": "Treat null and empty text as missing",
            "type": "boolean",
            "description": "null and \"\" count as no value in the key fields.",
            "default": true
          },
          "pickFields": {
            "title": "Keep only these fields",
            "type": "array",
            "description": "Top-level field names to keep in the output (input names). Leave empty to keep all.",
            "items": {
              "type": "string"
            }
          },
          "omitFields": {
            "title": "Remove these fields",
            "type": "array",
            "description": "Top-level field names to remove (input names).",
            "items": {
              "type": "string"
            }
          },
          "renameFields": {
            "title": "Rename fields",
            "type": "object",
            "description": "Object of old name to new name, e.g. {\"title\": \"name\"}. A renamed field replaces an existing field with the new name."
          },
          "castFields": {
            "title": "Cast field types",
            "type": "object",
            "description": "Object of field name (after renaming) to type: string, number, integer or boolean, e.g. {\"price\": \"number\"}. Values that cannot be cast are kept unchanged and counted in RUN_SUMMARY."
          },
          "escapeFormulas": {
            "title": "Protect against spreadsheet formulas",
            "type": "boolean",
            "description": "Prefix a single quote (') to text values that start with = + - @, tab or carriage return, so CSV/Excel exports do not run them as formulas. Turn off to keep values byte-for-byte.",
            "default": true
          },
          "addSourceFields": {
            "title": "Add source fields",
            "type": "boolean",
            "description": "Add _sourceType, _sourceDatasetId and _sourceIndex to every output row.",
            "default": false
          },
          "maxOutputRows": {
            "title": "Max output rows",
            "minimum": 0,
            "maximum": 2000000,
            "type": "integer",
            "description": "Stop after this many unique rows (0 or empty = no limit). Reading stops at 2,000,000 rows per run in any case."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}