Skip to content

Webhooks guide

Webhooks let Staying API push events to your service the moment they happen. Every delivery is signed with an HMAC so you can verify it came from us.

Events

EventPayload
stay.refreshedA cached stay was refreshed (id, new _fetched_at).
stay.cache_missA real-time fetch was triggered (id, latency).
job.completedAn async job finished. Payload has job_id, dataset_id, rows.
job.failedAn async job failed. Payload has job_id, error.
credit.thresholdYou crossed 50% or 100% of granted credits this cycle.
key.created / key.revokedAudit events for key lifecycle.

Register

From the dashboard: Webhooks → New webhook. Pick which events to subscribe to; we’ll show your signing secret exactly once.

Or via the API:

Terminal window
curl -X POST https://api.stayingapi.com/v1/webhooks \
-H "Authorization: Bearer sk_live_..." \
-H "content-type: application/json" \
-d '{"url":"https://example.com/hooks/staying","events":["stay.refreshed","job.completed"]}'

Delivery shape

POST /your-hook HTTP/1.1
host: example.com
x-stayingapi-signature: t=1716040800,v1=8b8c2bdac9...
content-type: application/json
{
"event": "stay.refreshed",
"id": "evt_abc",
"created_at": "2026-05-16T22:30:00Z",
"data": { "id": "1135700964697993602" }
}

We retry twice on non-2xx (1s and 6s delay) and time out after 10 seconds per attempt. Persistent failures are recorded for forensics; you can replay from the dashboard.

Verify signatures

See recipes/verify-webhook for a full Node example.

Next