{
  "openapi": "3.0.1",
  "info": {
    "title": "Dataset Merge, Dedupe & Transform - Apify Datasets",
    "description": "Merge Apify datasets into one: remove duplicates by any fields, filter records, sort, pick, rename or flatten fields. Keeps the first or the last duplicate. Streams large datasets. Export to Excel, CSV or API.",
    "version": "0.1",
    "x-build-id": "9jHJeBOODDmGiGWh7"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/pshivam~dataset-merge-dedupe/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-pshivam-dataset-merge-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/pshivam~dataset-merge-dedupe/runs": {
      "post": {
        "operationId": "runs-sync-pshivam-dataset-merge-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/pshivam~dataset-merge-dedupe/run-sync": {
      "post": {
        "operationId": "run-sync-pshivam-dataset-merge-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",
            "type": "array",
            "description": "The datasets to merge, in order. Each entry is a dataset id, username~name or a link to the dataset in the Console (the dataset of an Actor run: Storage > Dataset). The datasets must be yours or shared with you. Leave empty to merge three small example datasets."
          },
          "dedupeBy": {
            "title": "Remove duplicates by",
            "type": "array",
            "description": "The fields that make a record unique, one per line: email, url, seller.name (a field of an object), tags.0 (the first item of a list). Two records with the same values in all these fields are duplicates. Spaces and capital letters are ignored (see 'Ignore case'). A record that lacks one of the fields is kept. Leave empty to keep every record.",
            "items": {
              "type": "string"
            }
          },
          "dedupeIdentical": {
            "title": "Remove identical records",
            "type": "boolean",
            "description": "Also remove records that are exactly the same in every field. Use it when you have no field that identifies a record.",
            "default": false
          },
          "keep": {
            "title": "Which duplicate to keep",
            "enum": [
              "first",
              "last"
            ],
            "type": "string",
            "description": "From each group of duplicates: the first record in the order of your datasets, or the last. The last needs all records in memory before the first is returned.",
            "default": "first"
          },
          "ignoreCase": {
            "title": "Ignore capital letters and spaces",
            "type": "boolean",
            "description": "Compare text without regard to capital letters and extra spaces, for the duplicates and the filters. Turn it off to compare exactly.",
            "default": true
          },
          "filters": {
            "title": "Filters",
            "type": "array",
            "description": "Keep only the records that pass every condition. A list of objects: [{\"field\": \"price\", \"op\": \">=\", \"value\": 10}, {\"field\": \"seller.country\", \"op\": \"in\", \"value\": [\"US\", \"UK\"]}]. Operators: ==, !=, >, >=, <, <=, contains, notContains, startsWith, endsWith, in, notIn, exists, notExists, matches. exists and notExists need no value. Numbers in text (\"49.50\") are compared as numbers."
          },
          "includeFields": {
            "title": "Fields to keep",
            "type": "array",
            "description": "Return only these fields of each record, one per line (seller.name is a field of an object). Leave empty to keep all fields.",
            "items": {
              "type": "string"
            }
          },
          "excludeFields": {
            "title": "Fields to drop",
            "type": "array",
            "description": "Remove these fields from each record.",
            "items": {
              "type": "string"
            }
          },
          "renameFields": {
            "title": "Rename fields",
            "type": "object",
            "description": "Rename fields: {\"sku\": \"id\", \"title\": \"name\"}. Applied last."
          },
          "flattenObjects": {
            "title": "Flatten nested objects",
            "type": "boolean",
            "description": "Turn nested objects into one level of fields with dotted names: {\"seller\": {\"name\": \"Acme\"}} becomes \"seller.name\": \"Acme\". All the other options then use these names.",
            "default": false
          },
          "sortBy": {
            "title": "Sort by",
            "type": "string",
            "description": "Sort the records by this field. Numbers (also in text) sort as numbers, text without regard to case, records without the field come last. Sorting needs all records in memory."
          },
          "sortOrder": {
            "title": "Sort order",
            "enum": [
              "asc",
              "desc"
            ],
            "type": "string",
            "description": "Ascending or descending.",
            "default": "asc"
          },
          "addSourceFields": {
            "title": "Add source fields",
            "type": "boolean",
            "description": "Add _sourceDatasetId and _sourceIndex to each record: where it came from.",
            "default": false
          },
          "maxItemsPerDataset": {
            "title": "Maximum records per dataset",
            "minimum": 1,
            "type": "integer",
            "description": "Read at most this many records of each dataset. Leave empty to read all."
          },
          "maxItems": {
            "title": "Maximum records returned",
            "minimum": 1,
            "maximum": 100000000,
            "type": "integer",
            "description": "Stop after returning this many records. You are charged per record returned.",
            "default": 1000000
          },
          "onlyNew": {
            "title": "Only new records",
            "type": "boolean",
            "description": "Skip records that earlier runs of this same input already returned, so you get and pay for new ones only. The first run works as usual and remembers what it returned, in your key-value store 'dataset-merge-dedupe-only-new'.",
            "default": false
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}