Configure webhook settings
Public Beta
The Webhooks configuration API, including the Webhook Settings and Webhook Rules resources, has been released as a Public Beta product. Before Twilio declares this product as Generally Available, the information contained in this document might change. Twilio might implement additional features or change others. No Twilio SLA covers Public Beta products.
A Webhook Setting sets one complete delivery configuration, including:
- how Twilio authenticates itself to your endpoint.
- how Twilio signs the request.
- what the connection timeouts and retries Twilio uses.
- Which edge zones Twilio uses to deliver responses.
A Setting takes effect only when a Webhook Rule points a matching webhook URL at it.
| Property | Type | Necessity | Description |
|---|---|---|---|
id | string | read-only | The Setting's identifier, in the form webhooks_setting_ plus 26 characters. |
type | enum | read-only | SYSTEM for Settings Twilio manages, or CUSTOMER for Settings you create. |
friendlyName | string | optional | A name to identify the Setting. Up to 255 characters. Defaults to blank. |
description | string | optional | What the Setting is for. Up to 1024 characters. |
auth | object | required | How Twilio authenticates itself to your endpoint. |
signature | object | optional | How Twilio signs the request. |
connection | object | optional | Timeouts and retry behavior. Twilio applies defaults when omitted. |
edgeZones | object | optional | Which edge zones Twilio delivers from. All zones are eligible when omitted. |
createdAt | string | read-only | When the Setting was created, as an ISO 8601 timestamp. |
updatedAt | string | read-only | When the Setting last changed, as an ISO 8601 timestamp. |
System settings
Twilio creates SYSTEM Settings to simplify onboarding. You can read them and point Rules at them, but PATCH and DELETE return 409 Conflict.
auth is required on every Setting. It takes one of two shapes, selected by source.
To embed the credentials in the Setting, use "source": "INLINE". Twilio recommends inline for most cases.
To set the authentication type, set value.scheme to OAUTH2, BASIC, DIGEST, or NONE.
1{2"auth": {3"source": "INLINE",4"value": {5"scheme": "OAUTH2",6"tokenUrl": "https://auth.example.com/oauth2/token",7"clientId": "{CLIENT_ID}",8"clientSecret": "{CLIENT_SECRET}",9"scope": "webhooks:write",10"clientCredentialsAuthMethod": "CLIENT_SECRET_POST"11}12}13}
1{2"auth": { "source": "INLINE", "value": { "scheme": "NONE" } }3}
To state explicitly that Twilio shouldn't authenticate itself, set "scheme": "NONE" as the auth object is required.
To share credentials across multiple Settings, use "source": "REFERENCE". This points to an AuthProfile. The AuthProfile determines the scheme.
1{2"auth": {3"source": "REFERENCE",4"authProfileId": "webhooks_sharedauth_01j9x8k2m4n6p8r0s2t4v6w8y0"5}6}
If you point to a non-existent or non-associated AuthProfile, Twilio returns error 59201.
signature is optional and selects how Twilio signs the request, by type.
type | Fields | Notes |
|---|---|---|
SHARED_KEY | sharedKeyId, algorithm | Signs with a SharedKey you manage. Preferred. |
ACCOUNT_AUTH_TOKEN | algorithm | Signs with your account authentication token. Legacy. |
NONE | — | Twilio doesn't sign the request. |
algorithm is required for SHARED_KEY and ACCOUNT_AUTH_TOKEN, accepts HMAC_SHA1 or HMAC_SHA256, and can't be changed after you create the Setting.
connection sets how long Twilio waits and whether it retries. Twilio applies system defaults when you omit it.
| Property | Necessity | Accepted values | Description |
|---|---|---|---|
connectTimeoutMs | required | 100 to 15000 | How long Twilio waits to establish the TCP connection. |
readTimeoutMs | required | 100 to 15000 | How long Twilio waits for the response. |
totalTimeoutMs | optional | 100 to 60000 | Total time allowed including retries. |
retryPolicy | optional | object | Retry behavior. No retries when omitted. |
retryPolicy takes retryCount (0 to 5, default 0) and retryOn, an array of HTTP_4XX, HTTP_5XX, CONNECTION_TIMEOUT, READ_TIMEOUT, or ALL.
1{2"connection": {3"connectTimeoutMs": 5000,4"readTimeoutMs": 10000,5"totalTimeoutMs": 30000,6"retryPolicy": {7"retryCount": 3,8"retryOn": ["HTTP_5XX", "CONNECTION_TIMEOUT", "READ_TIMEOUT"]9}10}11}
Voice calls cap at 15 seconds
Twilio imposes a hard 15-second upper timeout on all call-related HTTP requests. That limit overrides a longer totalTimeoutMs on call-processing requests.
Setting connection on a Setting isn't the same as a URL connection override, the #ct=… fragment you append to a webhook URL. When a Rule applies a Setting to a webhook, that Setting takes precedence over any URL override on the same request.
The edgeZones property restricts the edge zones from which Twilio can deliver a response. Without this property, Twilio can use all zones.
1{2"edgeZones": {3"zones": ["eu-west", "eu-central"],4"allowZoneFallback": false5}6}
To manage Settings, make HTTP requests to the Settings resource.
To create a Setting, make a POST request to the Settings resource.
1curl -X POST https://webhooks.twilio.com/v1/Webhooks/Settings \2-H 'Content-Type: application/json' \3-u {API_KEY_SID}:{API_KEY_SECRET} \4-d '{5"friendlyName": "Production webhooks",6"description": "OAuth 2.0 plus shared key signing for api.example.com",7"auth": {8"source": "REFERENCE",9"authProfileId": "{AUTH_PROFILE_ID}"10},11"signature": {12"type": "SHARED_KEY",13"sharedKeyId": "{SHARED_KEY_ID}",14"algorithm": "HMAC_SHA256"15},16"connection": {17"connectTimeoutMs": 5000,18"readTimeoutMs": 1000019}20}'
If successful, this request returns 201 Created.
To list all Settings in an account, make a GET request to the Settings resource.
To filter Settings by the credentials or key a Setting uses, add the authProfileId or sharedKeyId query parameter.
1curl -X GET 'https://webhooks.twilio.com/v1/Webhooks/Settings?authProfileId={AUTH_PROFILE_ID}' \2-u {API_KEY_SID}:{API_KEY_SECRET}
To return one Setting from an account, make a GET request to the Settings resource.
1curl -X GET https://webhooks.twilio.com/v1/Webhooks/Settings/{SETTING_ID} \2-u {API_KEY_SID}:{API_KEY_SECRET}
This request doesn't return clientSecret, password, or a SharedKey's secret.
To update the friendlyName and description properties of one Setting, make a PUT request to the Settings resource.
1curl -X PATCH https://webhooks.twilio.com/v1/Webhooks/Settings/{SETTING_ID} \2-H 'Content-Type: application/json' \3-u {API_KEY_SID}:{API_KEY_SECRET} \4-d '{ "friendlyName": "Production webhooks (EU)" }'
To change auth, signature, connection, or edgeZones, create another Setting and update your Rule to point at it.
To remove one Setting from an account, make a DELETE request to the Settings resource.
1curl -X DELETE https://webhooks.twilio.com/v1/Webhooks/Settings/{SETTING_ID} \2-u {API_KEY_SID}:{API_KEY_SECRET}
- If successful, this request returns
204 No Content. - If a Rule still references the Setting or the Setting is
SYSTEM, this request returns409 Conflict. To resolve a conflict:- Find the dependent Rules.
1curl -X GET 'https://webhooks.twilio.com/v1/Webhooks/Rules?settingId={SETTING_ID}' \2-u {API_KEY_SID}:{API_KEY_SECRET}
- Repoint or delete them.
- Find the dependent Rules.
Because Settings are immutable, changing a configuration means swapping which Setting a Rule points at.
- Create the replacement Setting with the new configuration.
- Test it against your endpoint.
PATCHyour Rule so itssettingsarray names the new Setting at100percent. To validate on a slice of live traffic first, split the array across both Settings. See Shift traffic between settings.- Wait for the Rule's Operation to reach
COMPLETED. - Delete the old Setting.
- Test webhook delivery, to validate the Setting before live traffic uses it
- Configure webhook rules, to apply the Setting to your webhooks
- Choose webhook edge zones, to restrict where webhooks egress from
- Configuration API FAQs