{
  "openapi": "3.0.1",
  "info": {
    "title": "Dataset Merge, Dedup & Transform – Clean Data",
    "description": "Merge several Apify datasets, remove duplicates by any field, filter, rename, pick or flatten columns, and write one clean dataset. Limited permissions.",
    "version": "1.0",
    "x-build-id": "9gK69Z03pdDCKwfdl"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/innovative_cookie~dataset-merge-dedup/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-innovative_cookie-dataset-merge-dedup",
        "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/innovative_cookie~dataset-merge-dedup/runs": {
      "post": {
        "operationId": "runs-sync-innovative_cookie-dataset-merge-dedup",
        "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/innovative_cookie~dataset-merge-dedup/run-sync": {
      "post": {
        "operationId": "run-sync-innovative_cookie-dataset-merge-dedup",
        "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": "Pick one or more datasets (for example the results of several scraper runs). The Actor only gets READ access to the datasets you pick. Items are read in this order."
          },
          "items": {
            "title": "Items (JSON)",
            "type": "array",
            "description": "Optional items pasted as a JSON array. They are processed before the datasets. Handy for a quick test or for small lists.",
            "default": []
          },
          "dedupFields": {
            "title": "Deduplicate by fields",
            "type": "array",
            "description": "Items with the same values in all these fields are duplicates. Use dot paths for nested fields (address.city). Leave empty to keep everything.",
            "items": {
              "type": "string"
            },
            "default": []
          },
          "dedupWholeItem": {
            "title": "Deduplicate identical items",
            "type": "boolean",
            "description": "When no field is given above, remove items that are exactly identical (all fields).",
            "default": false
          },
          "keep": {
            "title": "Which duplicate to keep",
            "enum": [
              "first",
              "last",
              "merge"
            ],
            "type": "string",
            "description": "first = keep the first item seen (streaming, low memory). last = keep the most recent one. merge = keep the first and fill its empty fields from the duplicates.",
            "default": "first"
          },
          "caseInsensitive": {
            "title": "Ignore letter case when comparing",
            "type": "boolean",
            "description": "Treat 'Example.com' and 'example.com' as the same value.",
            "default": false
          },
          "trimValues": {
            "title": "Ignore extra spaces when comparing",
            "type": "boolean",
            "description": "Trim and collapse whitespace in text values before comparing.",
            "default": true
          },
          "filters": {
            "title": "Filters (JSON)",
            "type": "array",
            "description": "Keep only items matching ALL conditions. Each condition is {\"field\": \"price\", \"op\": \"lt\", \"value\": 20}. Ops: eq, neq, contains, notContains, startsWith, endsWith, regex, gt, gte, lt, lte (numbers or dates), exists, notExists, empty, notEmpty, in, notIn (value = array).",
            "default": []
          },
          "pickFields": {
            "title": "Keep only these fields",
            "type": "array",
            "description": "Output only these fields, in this order (dot paths allowed). Leave empty to keep all fields.",
            "items": {
              "type": "string"
            },
            "default": []
          },
          "omitFields": {
            "title": "Remove these fields",
            "type": "array",
            "description": "Fields to drop from the output (dot paths allowed).",
            "items": {
              "type": "string"
            },
            "default": []
          },
          "renameFields": {
            "title": "Rename fields",
            "type": "object",
            "description": "Map old name to new name, applied last. Example: {\"title\": \"name\", \"stock.count\": \"stock_count\"}",
            "default": {}
          },
          "flattenNested": {
            "title": "Flatten nested objects",
            "type": "boolean",
            "description": "Turn {\"stock\": {\"count\": 2}} into {\"stock.count\": 2}. Useful for CSV and Google Sheets.",
            "default": false
          },
          "flattenArrays": {
            "title": "Flatten arrays too",
            "type": "boolean",
            "description": "With flattening on, also turn arrays into numbered keys (images.0, images.1...).",
            "default": false
          },
          "skipHiddenFields": {
            "title": "Skip hidden fields",
            "type": "boolean",
            "description": "Drop fields starting with # (debug data) when reading datasets.",
            "default": false
          },
          "addSourceField": {
            "title": "Add the source dataset ID",
            "type": "boolean",
            "description": "Add a _source field with the dataset ID each item came from (or 'inline').",
            "default": false
          },
          "maxOutputItems": {
            "title": "Max items to write",
            "minimum": 0,
            "type": "integer",
            "description": "Stop after writing this many items. 0 = no limit.",
            "default": 0
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}