spicrawlspicrawlDocs
Webhooks

Register a webhook endpoint

Registers an HTTPS URL that receives signed notifications: `batch.completed` and `batch.failed` for batch jobs, and `monitor.changed` and `monitor.failed` for monitors.

Requires scope: webhooks

POST
/v1/webhooks

Registers an HTTPS URL that receives signed notifications: batch.completed and batch.failed for batch jobs, and monitor.changed and monitor.failed for monitors. Notify-only: the payload carries the job or monitor summary, and you fetch anything else yourself.

The response is the endpoint plus secret, the signing secret. It is returned here and from rotate-secret only, and is never shown again. Store it before you return from the call. Verify every delivery with it (see the webhooks guide, "Verify signatures").

events defaults to ["batch.completed", "batch.failed"]. format defaults to json. Use slack or discord to post a one-line summary to a Slack or Discord incoming-webhook URL; the signature headers are sent in every format.

A ping delivery is always sent by POST /v1/webhooks/{webhookID}/test and is not listed in events.

The URL must be https://, at most 2,048 characters, and must not point at a private or internal address. An organization may hold at most 20 endpoints.

Authorization

bearerAuth
AuthorizationBearer <token>

Authorization: Bearer <key>. Read the key from the SPICRAWL_API_KEY environment variable; never hard-code or log it. spicrawl_test_… keys can never spend live credits. Scopes: scrape, batch, sessions (granted by default), browser and read (granted deliberately), and partner (only on a partner account's key). A missing scope is 403 ERR::AUTH::INSUFFICIENT_SCOPE naming the scope.

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Body of POST /v1/webhooks. Unknown fields are a 400.

Response Body

application/json

application/problem+json

application/problem+json

application/problem+json

application/problem+json

application/problem+json

curl -X POST "https://example.com/v1/webhooks" \  -H "Content-Type: application/json" \  -d '{    "url": "https://hooks.example.com/spicrawl",    "name": "nightly-catalog",    "events": [      "batch.completed",      "batch.failed"    ]  }'
{  "id": "0190f3a2-7c1e-7d4b-9a2f-3b8e5c6d7e80",  "name": "string",  "url": "http://example.com",  "events": [    "batch.completed"  ],  "format": "json",  "enabled": true,  "disabled_reason": "string",  "consecutive_failures": 0,  "last_success_at": "2019-08-24T14:15:22Z",  "last_failure_at": "2019-08-24T14:15:22Z",  "secret_version": 1,  "created_at": "2019-08-24T14:15:22Z",  "updated_at": "2019-08-24T14:15:22Z",  "secret": "string"}