Webhooks API
Endpoints that receive events, and their deliveries.
The same operations are in the interactive API reference, and the whole contract is in the OpenAPI document.
GET/v1/webhook_endpoints
List webhook endpoints
Lists the organization's webhook endpoints. Paged, oldest first: limit is 1 to 100 (default 50, out of range values are clamped) and cursor is the next_cursor of the previous page. The cursor is opaque and never built by the client; a cursor this API did not return is a 400. has_more is true while another page exists. There is no total. Use this surface from integrations; the dashed /v1/webhook-endpoints is the console's own view of the same endpoints.
Each endpoint says whether it is enabled, how many deliveries have failed in a row (consecutive_failures) and, if it was switched off, why (disabled_reason). An endpoint switched off for repeated failures stays off until you turn it on with PATCH enabled: true, which also resets the failure count.
The signing secret is never listed; it is shown once when the endpoint is created. Read only and safe to repeat.
Scope webhook_endpoints:read. Accepts: API key or personal access token. Open in the API reference
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
limit | query | integer | No | How many items to return. Default 50, at most 100. |
cursor | query | string | No | The `next_cursor` of the previous page. Opaque; never built by the client. |
POST/v1/webhook_endpoints
Add a webhook endpoint
Registers a URL to receive events and returns the endpoint with its signing secret (whsec_…), shown once. Use it to verify the AirFone-Signature header on every delivery; if lost, delete the endpoint and make another.
The URL must be https and point at a public address. A private or loopback address is refused with 400, and the address is checked again at every delivery after DNS, so a name that later points inside a network is never called. http://localhost is accepted only on development servers. event_types are names such as call.ended or a family such as message.*; an empty list means every event. A name that is not an event type is refused with 400.
An endpoint is enabled as soon as it is made. Send a test event with POST /v1/webhook_endpoints/{id}/test to see it work.
Idempotency. Send Idempotency-Key with an API key; a retry then returns the first response and its secret instead of making a second endpoint that would deliver every event twice. Without it, repeating the call makes another endpoint. Personal tokens and console sessions are not covered by idempotency keys.
Scope webhook_endpoints:write. Accepts: API key or personal access token. Open in the API reference
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
Idempotency-Key | header | string | No | Makes a POST safe to repeat: the same key returns the first result for 24 hours. The same key with a different body is refused with `422 idempotency_key_reused`; while the first request still runs, `409 idempotency_in_progress`. |
PATCH/v1/webhook_endpoints/{id}
Change a webhook endpoint
Changes an endpoint. Send only the fields to change; fields left out keep their value. A field sent as null is treated the same as one left out, so this cannot clear a description; send an empty string instead.
enabled: true turns a switched-off endpoint back on and, in the same step, resets its failure count and clears its disabled_reason. enabled: false pauses delivery: events that happen while it is off are not queued for it and cannot be replayed later, because no delivery exists for them; deliveries already waiting for a retry fail with endpoint disabled. The signing secret never changes; to change it, make a new endpoint.
A new url is checked as when creating: https and public. Event names are checked too. Either failure is a 400 and nothing changes.
Repeating the same PATCH leaves the endpoint in the same state, so it is safe to retry.
Scope webhook_endpoints:write. Accepts: API key or personal access token. Open in the API reference
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string | Yes | The resource id. |
DELETE/v1/webhook_endpoints/{id}
Remove a webhook endpoint
Deletes an endpoint for good. Events stop being sent to it at once. Its past deliveries are removed with it. Deleting is permanent: the secret is gone, and a new endpoint at the same URL gets a new secret.
Prefer PATCH enabled: false if you may want it back. A signed-in person must have entered their password again in the last five minutes (403 reauthentication_required); calls with an API key are not asked.
A 404 means no endpoint with that id in this organization, including one that was already deleted, so repeating the call after success answers 404. Returns 204 with no body.
Scope webhook_endpoints:write. Accepts: API key or personal access token. Open in the API reference
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string | Yes | The resource id. |
POST/v1/webhook_endpoints/{id}/test
Send a test event
Queues a ping event to one endpoint, right now, whether or not the endpoint subscribes to ping. It answers 202 with the id of the delivery that was queued; the call to your URL happens just after, so look the result up in the deliveries list, using that delivery_id, rather than expecting it in this response.
A test goes out like any real delivery: signed with the endpoint's secret, retried on failure, and counted as a delivery in usage when your URL accepts it. On a switched-off endpoint it is queued but fails at once with endpoint disabled; turn the endpoint on first. A failing test counts towards the failures that switch an endpoint off.
Not idempotent. Each call queues another ping. Sending Idempotency-Key with an API key makes a retry return the first delivery id instead of pinging twice.
Scope webhook_endpoints:write. Accepts: API key or personal access token. Open in the API reference
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string | Yes | The resource id. |
Idempotency-Key | header | string | No | Makes a POST safe to repeat: the same key returns the first result for 24 hours. The same key with a different body is refused with `422 idempotency_key_reused`; while the first request still runs, `409 idempotency_in_progress`. |
GET/v1/webhook_deliveries
List webhook deliveries
Lists delivery attempts, newest first, so you can see which events reached your endpoints, which failed and when the next retry is due. Filter with endpoint_id to see one endpoint.
status is pending (waiting for its first or next attempt), succeeded (your URL answered 2xx) or failed (every attempt failed). response_code is your URL's HTTP status on the last attempt and error a short excerpt of why it failed. attempt counts tries so far.
Paged, newest first: limit is 1 to 100 (default 50, out of range values are clamped) and cursor is the next_cursor of the previous page. The cursor is opaque and never built by the client; a cursor this API did not return is a 400. has_more is true while another page exists. There is no total. An endpoint_id that matches nothing returns an empty page, not 404.
Read only and safe to repeat.
Scope webhook_deliveries:read. Accepts: API key or personal access token. Open in the API reference
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
endpoint_id | query | stringnull | No | Only this endpoint's deliveries. |
limit | query | integer | No | How many items to return. Default 50, at most 100. |
cursor | query | string | No | The `next_cursor` of the previous page. Opaque; never built by the client. |
POST/v1/webhook_deliveries/{id}/replay
Send a delivery again
Queues the same event to the same endpoint again, now, as a new delivery with its own id and a fresh set of retries. Use it after you fix your receiver, to catch up on events that failed. The original delivery is left as it was.
The event is sent again unchanged, so your receiver sees the same event id and should treat it as a duplicate-safe event. Replaying works for succeeded and failed deliveries, but not to an endpoint that is switched off: the new delivery is queued and fails at once with endpoint disabled, so turn the endpoint on first. A replay that your URL accepts is counted in usage again, like any delivery.
Answers 202 with the new delivery's id; look the result up in the deliveries list. A 404 means no delivery with that id in this organization.
Not idempotent. Each call makes another delivery. Send Idempotency-Key with an API key to make a retry return the first result.
Scope webhook_deliveries:write. Accepts: API key or personal access token. Open in the API reference
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string | Yes | The resource id. |
Idempotency-Key | header | string | No | Makes a POST safe to repeat: the same key returns the first result for 24 hours. The same key with a different body is refused with `422 idempotency_key_reused`; while the first request still runs, `409 idempotency_in_progress`. |
GET/v1/webhook-endpoints
List endpoints (console)
The developer console's list of webhook endpoints. It is the same data as GET /v1/webhook_endpoints, shaped for display: the events are in events (["*"] means every event), the state is the word enabled or disabled, and results are paged like every list: limit is 1 to 100 (default 50, out of range values are clamped) and cursor is the next_cursor of the previous page. The cursor is opaque and never built by the client; a cursor this API did not return is a 400. has_more is true while another page exists. There is no total.
Integrations should use GET /v1/webhook_endpoints, which also exposes consecutive_failures and disabled_reason. This dashed form exists for the console and may change with it.
An API key's scope for this path is webhook-endpoints, written with a hyphen, which is different from the underscore path's scope. Read only.
Scope webhook-endpoints:read. Accepts: API key or personal access token. Open in the API reference
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
limit | query | integer | No | How many items to return. Default 50, at most 100. |
cursor | query | string | No | The `next_cursor` of the previous page. Opaque; never built by the client. |
POST/v1/webhook-endpoints
Add an endpoint (console)
The developer console's form for adding an endpoint. It makes the same endpoint as POST /v1/webhook_endpoints and returns its signing secret once. Differences: it takes events (not event_types), where ["*"] or an empty list means every event, and it has no description field.
The URL rules are the same: https, public address, known event names, else 400. Integrations should use POST /v1/webhook_endpoints.
Send Idempotency-Key with an API key to make a retry return the first response rather than a second endpoint.
Scope webhook-endpoints:write. Accepts: API key or personal access token. Open in the API reference
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
Idempotency-Key | header | string | No | Makes a POST safe to repeat: the same key returns the first result for 24 hours. The same key with a different body is refused with `422 idempotency_key_reused`; while the first request still runs, `409 idempotency_in_progress`. |
DELETE/v1/webhook-endpoints/{id}
Remove an endpoint (console)
Deletes an endpoint, as DELETE /v1/webhook_endpoints/{id} does: permanently, with its deliveries. Unlike that operation, this one does not ask a signed-in person to enter their password again. Integrations should use the underscore form.
A 404 means no endpoint with that id in this organization, including one already deleted, so repeating the call answers 404. Returns 204.
Scope webhook-endpoints:write. Accepts: API key or personal access token. Open in the API reference
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string | Yes | The resource id. |
POST/v1/webhook-endpoints/{id}/enable
Turn an endpoint on
Turns an endpoint on, the console's button. It also resets the failure count and clears the reason an endpoint was switched off, so a receiver you have just fixed starts with a clean slate. Events that occurred while it was off were never queued for it, so they are not recovered.
Equivalent to PATCH enabled: true on the underscore path. Safe to repeat: enabling an enabled endpoint changes nothing. A 404 means no endpoint with that id in this organization.
Scope webhook-endpoints:write. Accepts: API key or personal access token. Open in the API reference
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string | Yes | The resource id. |
Idempotency-Key | header | string | No | Makes a POST safe to repeat: the same key returns the first result for 24 hours. The same key with a different body is refused with `422 idempotency_key_reused`; while the first request still runs, `409 idempotency_in_progress`. |
POST/v1/webhook-endpoints/{id}/disable
Turn an endpoint off
Turns an endpoint off so that no further events are sent to it. Nothing is deleted, and it keeps its secret and settings. Deliveries already waiting for a retry fail with endpoint disabled. Use it to pause a receiver during maintenance; it is gentler than deleting.
Equivalent to PATCH enabled: false on the underscore path. Safe to repeat. A 404 means no endpoint with that id in this organization.
Scope webhook-endpoints:write. Accepts: API key or personal access token. Open in the API reference
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string | Yes | The resource id. |
Idempotency-Key | header | string | No | Makes a POST safe to repeat: the same key returns the first result for 24 hours. The same key with a different body is refused with `422 idempotency_key_reused`; while the first request still runs, `409 idempotency_in_progress`. |
POST/v1/webhook-endpoints/{id}/test
Send a test event
The console's "send test" button: queues a ping to the endpoint, as POST /v1/webhook_endpoints/{id}/test does. The only difference is the body, which gives the queued delivery's id as id (the underscore form calls it delivery_id).
The call to your URL happens just after the 202; read the outcome from the endpoint's deliveries. Each call queues another ping, so it is not idempotent without Idempotency-Key.
Scope webhook-endpoints:write. Accepts: API key or personal access token. Open in the API reference
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string | Yes | The resource id. |
Idempotency-Key | header | string | No | Makes a POST safe to repeat: the same key returns the first result for 24 hours. The same key with a different body is refused with `422 idempotency_key_reused`; while the first request still runs, `409 idempotency_in_progress`. |
GET/v1/webhook-endpoints/{id}/deliveries
An endpoint's deliveries
The recent deliveries to one endpoint, newest first, shaped for the console: status is your URL's HTTP status (null until it has answered), ok says whether it succeeded, next_retry_at is set only while a retry is waiting, and response_excerpt is what went wrong.
Paged, newest first: limit is 1 to 100 (default 50, out of range values are clamped) and cursor is the next_cursor of the previous page. The cursor is opaque and never built by the client; a cursor this API did not return is a 400. has_more is true while another page exists. There is no total. An unknown endpoint id is a 404.
Integrations should use GET /v1/webhook_deliveries?endpoint_id=. Read only.
Scope webhook-endpoints:read. Accepts: API key or personal access token. Open in the API reference
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string | Yes | The resource id. |
limit | query | integer | No | How many items to return. Default 50, at most 100. |
cursor | query | string | No | The `next_cursor` of the previous page. Opaque; never built by the client. |
POST/v1/webhook-deliveries/{id}/replay
Send a delivery again
The console's replay button; it does what POST /v1/webhook_deliveries/{id}/replay does (a new delivery of the same event to the same endpoint, with fresh retries; metered again when accepted) and answers 202 with the new delivery's id as id.
Not idempotent without Idempotency-Key. A 404 means no delivery with that id in this organization. Integrations should use the underscore form.
Scope webhook-deliveries:write. Accepts: API key or personal access token. Open in the API reference
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string | Yes | The resource id. |
Idempotency-Key | header | string | No | Makes a POST safe to repeat: the same key returns the first result for 24 hours. The same key with a different body is refused with `422 idempotency_key_reused`; while the first request still runs, `409 idempotency_in_progress`. |