Skip to main content
Crawls, batches and monitors can POST their results to your server as they happen, so you don’t have to poll. This page covers what every Prefetch webhook has in common.

Events

A .page event carries one result: a crawled page, or one URL’s answer in a batch. Failed pages are sent too, with ok: false.

Configure a webhook

Pass an https:// URL, or an object:
Webhooks aren’t available through RapidAPI, which can only bill a response. Poll the status endpoint instead.

Payload

Crawl and batch deliveries share one envelope:
data is the same object the status endpoint returns for that page. Monitor payloads are described on the monitor.page and monitor.check.completed pages.

Verify signatures

Every delivery carries an X-Prefetch-Signature header:
v1 is the hex HMAC-SHA256 of <t>.<raw request body>, keyed with the webhook’s secret. The timestamp is signed too, so a captured request can’t be replayed with a fresh header. Reject anything older than five minutes. Verify against the raw body, before you parse the JSON. Re-serializing it changes the bytes and breaks the signature.

Where the secret comes from

Respond and retry

Answer with any 2xx within 10 seconds, then do slow work afterward. A timeout, a 4xx or 5xx, or a redirect counts as a failure and is retried: Crawl and batch deliveries go out in order. Monitor retries carry the same id, also sent as the X-Prefetch-Delivery header, so store the ids you’ve handled and skip repeats. Webhooks are a notification, not the record. The status endpoint always has every page, and a monitor’s checks are readable with GET /monitor/{id}/checks/{checkId}.

Monitor headers

Any headers you set on the webhook are sent as well.

Testing locally

Prefetch only calls public https:// addresses, so localhost won’t work. Use a tunnel such as ngrok or Cloudflare Tunnel, or a request inspector, while you build your handler.