{
  "openapi": "3.0.1",
  "info": {
    "title": "Dataset Merge, Dedupe & Transform",
    "description": "Merge several Apify datasets into one: remove duplicates by any field, filter rows, keep, drop or rename columns, flatten nested data and sort. $0.0005 per row written.",
    "version": "1.0",
    "x-build-id": "J88gChUa8kAc7g99R"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/ensorcelling_melilot~dataset-merge/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-ensorcelling_melilot-dataset-merge",
        "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/ensorcelling_melilot~dataset-merge/runs": {
      "post": {
        "operationId": "runs-sync-ensorcelling_melilot-dataset-merge",
        "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/ensorcelling_melilot~dataset-merge/run-sync": {
      "post": {
        "operationId": "run-sync-ensorcelling_melilot-dataset-merge",
        "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": "The datasets to combine, in order. Pick them from your account (or, when you use this Actor as an integration, set it to {{resource.defaultDatasetId}}). Rows are read in this order, so with 'keep first duplicate' the earlier dataset wins."
          },
          "items": {
            "title": "Raw rows (optional)",
            "type": "array",
            "description": "Optional: paste rows as a JSON array of objects. They are added after the datasets. Handy for quick tests."
          },
          "removeDuplicates": {
            "title": "Remove duplicates",
            "type": "boolean",
            "description": "Drop rows that repeat. If you list fields below, rows with the same values in those fields count as duplicates. With no fields, two rows are duplicates only if every field is identical. Turned on automatically when you list fields.",
            "default": false
          },
          "dedupeBy": {
            "title": "Duplicate if these fields match",
            "type": "array",
            "description": "Field names that identify a row, for example url or email or company.id. Nested fields use dots (address.city). Leave empty to compare whole rows.",
            "items": {
              "type": "string"
            }
          },
          "keepWhichDuplicate": {
            "title": "Which duplicate to keep",
            "enum": [
              "first",
              "last"
            ],
            "type": "string",
            "description": "Keep the first row seen (default) or the last one, for example when newer datasets should overwrite older ones. 'Last' holds rows in memory, up to 1 million rows.",
            "default": "first"
          },
          "dedupeIgnoreCase": {
            "title": "Ignore upper and lower case",
            "type": "boolean",
            "description": "Treat Alice@Example.com and alice@example.com as the same. Spaces at the start, end and doubled spaces are always ignored when comparing.",
            "default": true
          },
          "filters": {
            "title": "Filter rules",
            "type": "array",
            "description": "Keep only rows that pass these rules. Each rule is an object with field, operator and value, for example {\"field\": \"price\", \"operator\": \"lessThan\", \"value\": 20}. Operators: equals, notEquals, contains, notContains, startsWith, endsWith, greaterThan, lessThan, exists, notExists, matches (regular expression). Text comparisons ignore case."
          },
          "filterMode": {
            "title": "Rows must pass",
            "enum": [
              "all",
              "any"
            ],
            "type": "string",
            "description": "All rules, or any one rule.",
            "default": "all"
          },
          "keepFields": {
            "title": "Keep only these fields",
            "type": "array",
            "description": "Output only these columns, in this order. Nested fields use dots. Leave empty to keep everything.",
            "items": {
              "type": "string"
            }
          },
          "omitFields": {
            "title": "Drop these fields",
            "type": "array",
            "description": "Remove these columns from every row.",
            "items": {
              "type": "string"
            }
          },
          "renameFields": {
            "title": "Rename fields",
            "type": "object",
            "description": "Map old names to new names, for example {\"pageUrl\": \"url\", \"companyName\": \"company\"}. Renaming happens last, so use the old names in the other settings."
          },
          "fillMissingFields": {
            "title": "Fill missing 'keep' fields with null",
            "type": "boolean",
            "description": "When you keep specific fields, rows that lack one get null for it so every row has the same columns.",
            "default": true
          },
          "flatten": {
            "title": "Flatten nested objects",
            "type": "boolean",
            "description": "Turn {\"address\": {\"city\": \"Paris\"}} into a column named address.city, handy for spreadsheets.",
            "default": false
          },
          "flattenArrays": {
            "title": "Also flatten arrays",
            "type": "boolean",
            "description": "With flattening on, turn lists into numbered columns like tags.0, tags.1.",
            "default": false
          },
          "trimStrings": {
            "title": "Trim spaces from text",
            "type": "boolean",
            "description": "Remove spaces at the start and end of every text value.",
            "default": false
          },
          "dropEmptyFields": {
            "title": "Drop empty values",
            "type": "boolean",
            "description": "Remove fields that are null, empty text or empty lists from each row.",
            "default": false
          },
          "sortBy": {
            "title": "Sort by field",
            "type": "string",
            "description": "Sort the output by this field. Numbers sort as numbers, text alphabetically, empty values last. Holds rows in memory, up to 1 million rows. Leave empty to keep the original order."
          },
          "sortOrder": {
            "title": "Sort order",
            "enum": [
              "asc",
              "desc"
            ],
            "type": "string",
            "description": "Ascending (A to Z, small to large) or descending.",
            "default": "asc"
          },
          "maxItems": {
            "title": "Max rows to output",
            "minimum": 1,
            "type": "integer",
            "description": "Stop after this many output rows. You are charged only for rows written. Leave empty for no limit."
          },
          "addSourceColumn": {
            "title": "Add a '_source' column",
            "type": "boolean",
            "description": "Adds the ID of the dataset each row came from.",
            "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}