v10

latestOpenAPI 3.1.02026-08-0375143791.1 KB
Batches

Batch settled

Sent to a batch's webhookUrl once it reaches a final status, whether it completed, was cancelled, or failed. Delivery is best effort and at most once: one attempt, a 10 second timeout, no retries, and any response status is treated as acknowledged. Polling GET /batch/{batch_id} remains the authoritative completion signal. The embedded batch carries signed result URLs that expire, so download them promptly or re-read the batch.

postWebhookbatchSettled

Headers

User-Agentstring required
Example:Context.dev-Webhooks/1.0

Identifies the Context.dev webhook sender.

X-Context-Event'batch.completed' | 'batch.cancelled' | 'batch.failed' required

Which final status the batch reached. Matches the event field in the request body.

X-Context-Idstring required
Example:evt_123

Unique event ID. Matches the top-level id field in the request body.

X-Context-Signaturestring
Example:t=1783620012,v1=087d98aada1e39f9d24d65951f51e672da12b2f9ea1c02c7c8c5ef254f5d4068

HMAC signature in the form t=<unix>,v1=<hmac>. The HMAC is SHA-256 over "{t}.{rawRequestBody}", keyed with the webhook_secret from the submit response. Sent only when the batch was submitted with a webhookUrl. Verify the unmodified request body with a constant-time comparison and reject stale timestamps.

Payload

event'batch.completed' | 'batch.cancelled' | 'batch.failed' required

Which final status the batch reached. Mirrors the X-Context-Event header.

idstring required

Unique event ID. Mirrors the X-Context-Id header.

created_atstring date-time required

When the delivery was generated.

Example payload

{
  "id": "evt_123",
  "created_at": "2026-07-09T18:00:12.000Z",
  "data": {
    "batch": {
      "id": "batch_9f2c8a",
      "tags": [
        "docs"
      ],
      "crawl": {
        "source": {
          "url": "https://example.com/docs"
        },
        "max_pages": 500,
        "url_pattern": "^https://example\\.com/docs/"
      },
      "input": {
        "reserved": 24817,
        "submitted": 25000,
        "duplicates": 183
      },
      "progress": {
        "succeeded": 18091,
        "failed": 311,
        "pending": 6415
      },
      "credits": {
        "reserved": 24817,
        "refunded": 6726,
        "net": 18091
      },
      "page_errors": [
        {
          "code": "WEBSITE_ACCESS_ERROR",
          "count": 204
        }
      ],
      "failure": {
        "code": "stalled",
        "message": "Batch stopped reporting progress and was finalized automatically"
      }
    }
  }
}

Response

Webhook accepted.