{
  "openapi": "3.0.1",
  "info": {
    "title": "Output to Dataset",
    "description": "Merges outputs from multiple actors into a single dataset. Execute actors in series or parallel, combine data from datasets, key-value stores, webhooks, and export the final output in various formats.",
    "version": "0.0",
    "x-build-id": "glfBkCTmiWhKv1MQn"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/njoylab~apify-output-to-dataset/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-njoylab-apify-output-to-dataset",
        "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/njoylab~apify-output-to-dataset/runs": {
      "post": {
        "operationId": "runs-sync-njoylab-apify-output-to-dataset",
        "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/njoylab~apify-output-to-dataset/run-sync": {
      "post": {
        "operationId": "run-sync-njoylab-apify-output-to-dataset",
        "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": {
          "sources": {
            "title": "Data Sources",
            "type": "array",
            "description": "List of data sources to merge (datasets, key-value stores, or actor runs)",
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "title": "Source Type",
                  "type": "string",
                  "description": "Type of data source",
                  "enum": [
                    "dataset",
                    "keyValueStore",
                    "actorRun",
                    "webhook"
                  ],
                  "enumTitles": [
                    "Dataset",
                    "Key-Value Store",
                    "Actor Run",
                    "Webhook URL"
                  ]
                },
                "id": {
                  "title": "Source ID",
                  "type": "string",
                  "description": "ID of the dataset, key-value store, or actor run. For webhooks, provide the URL.",
                  "editor": "textfield"
                },
                "key": {
                  "title": "Key (for Key-Value Store)",
                  "type": "string",
                  "description": "Key name if source type is keyValueStore",
                  "editor": "textfield"
                }
              },
              "required": [
                "type",
                "id"
              ]
            }
          },
          "actorRuns": {
            "title": "Actor Runs to Execute",
            "type": "array",
            "description": "List of actors to run before merging their outputs",
            "items": {
              "type": "object",
              "properties": {
                "actorId": {
                  "title": "Actor ID",
                  "type": "string",
                  "description": "ID or name of the actor to run (e.g., 'apify/web-scraper')",
                  "editor": "textfield"
                },
                "input": {
                  "title": "Actor Input",
                  "type": "object",
                  "description": "Input configuration for the actor",
                  "editor": "json"
                },
                "outputType": {
                  "title": "Output Type",
                  "type": "string",
                  "description": "Choose `dataset` to read items from the actor's default dataset (no outputKey needed). Choose `keyValueStore` to fetch a record saved to the default key-value store; provide outputKey to tell the actor which record to read.",
                  "enum": [
                    "dataset",
                    "keyValueStore"
                  ],
                  "enumTitles": [
                    "Dataset (default dataset items)",
                    "Key-Value Store (record saved via setValue)"
                  ],
                  "default": "dataset"
                },
                "outputKey": {
                  "title": "Output Key",
                  "type": "string",
                  "description": "Required only when outputType is keyValueStore. Set the record key to read (e.g., 'OUTPUT' or 'MERGED_RUN'). Ignored for dataset outputs.",
                  "editor": "textfield"
                }
              },
              "required": [
                "actorId"
              ]
            }
          },
          "executionMode": {
            "title": "Execution Mode",
            "enum": [
              "series",
              "parallel"
            ],
            "type": "string",
            "description": "How to execute multiple actors",
            "default": "parallel"
          },
          "mergeStrategy": {
            "title": "Merge Strategy",
            "enum": [
              "append",
              "deduplicate"
            ],
            "type": "string",
            "description": "How to merge data from different sources",
            "default": "append"
          },
          "deduplicateBy": {
            "title": "Deduplicate By Fields",
            "type": "array",
            "description": "Fields to use for deduplication (only used if mergeStrategy is 'deduplicate')",
            "items": {
              "type": "string"
            }
          },
          "transformations": {
            "title": "Transformations",
            "type": "array",
            "description": "Optional list of transformations to run sequentially before merging. Useful for filtering, remapping fields, trimming payloads, or enriching data.",
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "title": "Transformation Type",
                  "type": "string",
                  "description": "Select which transformation to apply to each item",
                  "enum": [
                    "filter",
                    "mapFields",
                    "pickFields",
                    "setField"
                  ],
                  "enumTitles": [
                    "Filter items",
                    "Map or rename fields",
                    "Pick specific fields",
                    "Set or overwrite a field"
                  ],
                  "editor": "select"
                },
                "field": {
                  "title": "Field Path",
                  "type": "string",
                  "description": "Dot-notation path used by filter, pickFields, and setField transformations",
                  "editor": "textfield"
                },
                "operator": {
                  "title": "Operator",
                  "type": "string",
                  "description": "Comparison operator for filter transformations",
                  "enum": [
                    "equals",
                    "notEquals",
                    "contains",
                    "greaterThan",
                    "lessThan",
                    "exists"
                  ],
                  "default": "equals",
                  "editor": "select"
                },
                "mapping": {
                  "title": "Field Mapping",
                  "type": "object",
                  "description": "Key/value pairs of source -> target field paths for mapFields",
                  "additionalProperties": true,
                  "editor": "json"
                },
                "removeOriginal": {
                  "title": "Remove Original Fields",
                  "type": "boolean",
                  "description": "Delete the source field after copying in mapFields",
                  "default": false,
                  "editor": "checkbox"
                },
                "fields": {
                  "title": "Fields to Keep",
                  "type": "array",
                  "description": "List of fields to keep when using pickFields",
                  "items": {
                    "type": "string"
                  },
                  "editor": "stringList"
                },
                "dropUndefined": {
                  "title": "Drop Missing Values",
                  "type": "boolean",
                  "description": "When true, omit keys whose values are undefined in pickFields",
                  "default": false,
                  "editor": "checkbox"
                },
                "overwrite": {
                  "title": "Overwrite Existing",
                  "type": "boolean",
                  "description": "Set to true to replace existing values in setField",
                  "default": false,
                  "editor": "checkbox"
                }
              },
              "required": [
                "type"
              ]
            }
          }
        }
      },
      "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
                  }
                }
              },
              "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}