Prepaid AIDocsv1
StatusSign in

Webhooks

Webhooks

Signed POSTs to your server when things happen, and how to receive, verify and retry them.

2 min read

Add an endpoint in Settings → Webhooks, pick the events you want, and we POST each one to your URL as JSON. Every endpoint has its own signing secret.

The envelope

idstringalways present
Stable for the event: a retry carries the same id. Deduplicate on it.
typestringalways present
One of the events.
createdstringalways present
When we first built the event.
dataobjectalways present
The event’s own fields.
A delivery
{  "id": "evt_5f2c9a0b1d3e4f6a7b8c9d0e",  "type": "call.ended",  "created": "2026-10-28T02:15:47.512Z",  "data": {    "call_id": "v3:u5OAKGEPT3Dx8SZSSDRWEMdNH2Oriq",    "from": "+64211234567",    "to": "+6448872813",    "caller_name": "Aroha Ngata",    "outcome": "booked",    "duration_seconds": 96,    "started_at": "2026-10-28T02:14:09.000Z"  }}

Verifying a delivery

Each request carries an x-signature header: t=<unix seconds>,n=<nonce>,v1=<hex>. v1 is HMAC-SHA256, keyed with your endpoint’s secret, over the string t.n.body, where body is the payload in canonical form: keys sorted at every depth, no whitespace.

  • Parse the raw body, re-serialise it canonically, and recompute. A proxy that reorders your JSON cannot break this.
  • Reject a timestamp more than 300 seconds from your clock.
  • Compare in constant time.
verifyWebhook
const crypto = require('node:crypto');// Sort object keys at every depth — the payload is signed in canonical form,// so a proxy that re-orders your JSON cannot break verification.function sortDeep(value) {  if (Array.isArray(value)) return value.map(sortDeep);  if (value !== null && typeof value === 'object') {    return Object.fromEntries(Object.keys(value).sort().map((k) => [k, sortDeep(value[k])]));  }  return value;}function verifyWebhook(rawBody, header, secret, toleranceSec = 300) {  const fields = {};  for (const part of String(header || '').split(',')) {    const [key, value] = part.split('=');    fields[key] = value;  }  const { t, n, v1 } = fields;  if (!t || !n || !v1) return false;  if (Math.abs(Date.now() / 1000 - Number(t)) > toleranceSec) return false;  const canonical = JSON.stringify(sortDeep(JSON.parse(rawBody)));  const expected = crypto    .createHmac('sha256', secret)    .update(`${t}.${n}.${canonical}`)    .digest('hex');  return (    expected.length === v1.length &&    crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(v1))  );}
Verify the signature rather than allowlisting IP addresses. Our sending addresses are not fixed.

Answering

Answer with any 2xx within 10 seconds. Redirects are not followed, so a 3xx counts as a failure. Do slow work after you have answered.

Retries

We try a failed delivery up to 6 times, backing off over about 35 hours.

AttemptSent
1As the event happens
25 minutes after attempt 1 fails
330 minutes after attempt 2 fails
42 hours after attempt 3 fails
58 hours after attempt 4 fails
624 hours after attempt 5 fails
  • An endpoint that fails 12 times in a row is paused, and the console says so. Fix it, then press Resume on the endpoint.
  • Every attempt, delivered or not, is in the delivery log, with the status code and the start of your response.
  • Failed deliveries can be replayed from the delivery log.