{
  "openapi": "3.0.1",
  "info": {
    "title": "Webhook Replay & Batch Dispatcher",
    "description": "Fan out a batch of JSON events to multiple webhook URLs with retries, cross-run business-key dedupe, failure replay, and one audit row per delivery.",
    "version": "0.1",
    "x-build-id": "vyHjo0xZhOCq2yLEY"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/joe1981~webhook-replay-dispatcher/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-joe1981-webhook-replay-dispatcher",
        "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/joe1981~webhook-replay-dispatcher/runs": {
      "post": {
        "operationId": "runs-sync-joe1981-webhook-replay-dispatcher",
        "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/joe1981~webhook-replay-dispatcher/run-sync": {
      "post": {
        "operationId": "run-sync-joe1981-webhook-replay-dispatcher",
        "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",
        "required": [
          "destinations"
        ],
        "properties": {
          "destinations": {
            "title": "Destination URLs",
            "type": "array",
            "description": "Each event is POSTed to every URL here. Accepts bare URL strings or {\"url\": \"...\", \"id\": \"label\"} objects. Each (event, destination) pair retries independently and gets its own audit row.",
            "default": [
              "https://httpbin.org/post"
            ]
          },
          "events": {
            "title": "Events (JSON array)",
            "type": "array",
            "description": "Arbitrary JSON payloads. Objects with an event_id field are deduplicated by that value; otherwise a sha256 of the payload is used.",
            "default": [
              {
                "event_id": "sample-1",
                "type": "order.created",
                "order_id": "A-1001",
                "amount": 49.9
              },
              {
                "event_id": "sample-2",
                "type": "order.paid",
                "order_id": "A-1001",
                "amount": 49.9
              }
            ]
          },
          "sourceUrl": {
            "title": "Source URL (optional)",
            "type": "string",
            "description": "Fetch extra events from a JSON endpoint. Accepts a bare array, {\"events\": [...]}, or a GlueHub /echo/<token> response with an items array. Merged with the events above.",
            "default": ""
          },
          "dedupeKey": {
            "title": "Deduplication field",
            "type": "string",
            "description": "Field used as the business idempotency key. Successful (event, destination) pairs are remembered in the Key-Value Store, so re-running the Actor will not double-deliver.",
            "default": "event_id"
          },
          "maxAttempts": {
            "title": "Max attempts per delivery",
            "minimum": 1,
            "maximum": 10,
            "type": "integer",
            "description": "1–10. Retries use the backoff schedule below.",
            "default": 3
          },
          "backoffSeconds": {
            "title": "Backoff schedule (seconds)",
            "type": "array",
            "description": "Wait before each retry. Defaults to [1, 4, 10], the same schedule as the GlueHub webhook relay.",
            "default": [
              1,
              4,
              10
            ]
          },
          "timeoutSeconds": {
            "title": "Per-request timeout",
            "minimum": 1,
            "maximum": 120,
            "type": "integer",
            "description": "Seconds to wait for a single POST before counting it as a failed attempt and retrying. Applies per (event, destination) pair.",
            "default": 10
          },
          "concurrency": {
            "title": "Concurrent deliveries",
            "minimum": 1,
            "maximum": 32,
            "type": "integer",
            "description": "Maximum number of (event, destination) pairs in flight at once. Higher values speed up large batches but increase load on your receiving endpoints.",
            "default": 8
          },
          "maxEvents": {
            "title": "Safety cap on deliveries per run",
            "minimum": 1,
            "maximum": 100000,
            "type": "integer",
            "description": "Hard cap on (event × destination) pairs in one run, to bound cost.",
            "default": 1000
          },
          "hmacSecret": {
            "title": "HMAC secret (optional)",
            "type": "string",
            "description": "If set, each POST carries X-Glue-Signature: sha256=<hmac of raw body> and X-Glue-Event-Id."
          },
          "dryRun": {
            "title": "Dry run",
            "type": "boolean",
            "description": "Compute the plan and emit audit rows, but send no HTTP requests and do not charge.",
            "default": false
          },
          "replayFailed": {
            "title": "Replay previously failed events",
            "type": "boolean",
            "description": "If no events are supplied, reload the events that failed in the previous run from the Key-Value Store and retry them.",
            "default": false
          },
          "chargeEventName": {
            "title": "Pay-Per-Event charge name (optional)",
            "type": "string",
            "description": "Pay-Per-Event event name used for billing; defaults to the Actor primary event (\"delivery-ok\"). Only change this for local testing.",
            "default": "delivery-ok"
          },
          "allowPrivateTargets": {
            "title": "Allow private / loopback destinations (local testing only)",
            "type": "boolean",
            "description": "OFF by default: the Actor refuses localhost, private IPs, link-local metadata addresses and non-http(s) URLs to prevent SSRF. Enable ONLY when testing against a local sink.",
            "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}