Skip to contentSkip to navigationSkip to topbar
Page tools
Useful for sharing or LLM
Accelerate development with AI

On this page
Looking for more inspiration?Visit the

Configure webhook settings


(new)

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(link takes you to an external page) 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.


Setting properties

setting-properties page anchor
PropertyTypeNecessityDescription
idstringread-onlyThe Setting's identifier, in the form webhooks_setting_ plus 26 characters.
typeenumread-onlySYSTEM for Settings Twilio manages, or CUSTOMER for Settings you create.
friendlyNamestringoptionalA name to identify the Setting. Up to 255 characters. Defaults to blank.
descriptionstringoptionalWhat the Setting is for. Up to 1024 characters.
authobjectrequiredHow Twilio authenticates itself to your endpoint.
signatureobjectoptionalHow Twilio signs the request.
connectionobjectoptionalTimeouts and retry behavior. Twilio applies defaults when omitted.
edgeZonesobjectoptionalWhich edge zones Twilio delivers from. All zones are eligible when omitted.
createdAtstringread-onlyWhen the Setting was created, as an ISO 8601 timestamp.
updatedAtstringread-onlyWhen the Setting last changed, as an ISO 8601 timestamp.
(information)

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.

Authentication

authentication page anchor

auth is required on every Setting. It takes one of two shapes, selected by source.

Inline credentials

inline-credentials page anchor

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.

Referencing an AuthProfile

referencing-an-authprofile page anchor
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.

typeFieldsNotes
SHARED_KEYsharedKeyId, algorithmSigns with a SharedKey you manage. Preferred.
ACCOUNT_AUTH_TOKENalgorithmSigns with your account authentication token. Legacy.
NONETwilio 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.

Signing with a shared key

signing-with-a-shared-key page anchor
1
{
2
"signature": {
3
"type": "SHARED_KEY",
4
"sharedKeyId": "webhooks_sharedkey_01j9x8k2m4n6p8r0s2t4v6w8y0",
5
"algorithm": "HMAC_SHA256"
6
}
7
}
(information)

Prefer shared keys over the account authentication token

ACCOUNT_AUTH_TOKEN ties signing to your master account credential. SHARED_KEY isolates it and lets you rotate signing keys without touching account credentials.

connection sets how long Twilio waits and whether it retries. Twilio applies system defaults when you omit it.

PropertyNecessityAccepted valuesDescription
connectTimeoutMsrequired100 to 15000How long Twilio waits to establish the TCP connection.
readTimeoutMsrequired100 to 15000How long Twilio waits for the response.
totalTimeoutMsoptional100 to 60000Total time allowed including retries.
retryPolicyoptionalobjectRetry 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.

Connection settings with retries

connection-settings-with-retries page anchor
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
}
(warning)

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.

Preferring European zones

preferring-european-zones page anchor
1
{
2
"edgeZones": {
3
"zones": ["eu-west", "eu-central"],
4
"allowZoneFallback": false
5
}
6
}

To manage Settings, make HTTP requests to the Settings resource.

To create a Setting, make a POST request to the Settings resource.

1
curl -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": 10000
19
}
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.

1
curl -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.

1
curl -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.

Update a setting name or description

update-a-setting-name-or-description page anchor

To update the friendlyName and description properties of one Setting, make a PUT request to the Settings resource.

1
curl -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.

1
curl -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 returns 409 Conflict. To resolve a conflict:
    1. Find the dependent Rules.
      1
      curl -X GET 'https://webhooks.twilio.com/v1/Webhooks/Rules?settingId={SETTING_ID}' \
      2
      -u {API_KEY_SID}:{API_KEY_SECRET}
    2. Repoint or delete them.

Replace a setting with no downtime

replace-a-setting-with-no-downtime page anchor

Because Settings are immutable, changing a configuration means swapping which Setting a Rule points at.

  1. Create the replacement Setting with the new configuration.
  2. Test it against your endpoint.
  3. PATCH your Rule so its settings array names the new Setting at 100 percent. To validate on a slice of live traffic first, split the array across both Settings. See Shift traffic between settings.
  4. Wait for the Rule's Operation to reach COMPLETED.
  5. Delete the old Setting.