Creating a Twilio OAuth 2.0 app (client credentials)
This guide is part of the Publicus connection catalog. Once you have the credentials, connect the service and Publicus stores them for you.
Distilled from Twilio’s own documentation: OAuth apps overview, Account-level OAuth apps, OAuth Token API, and OAuth apps FAQs. Retrieved 2026-07-03.
The client credentials grant (RFC 6749 §4.4) is for server-to-server access where no user is present — the fit for backend automation. OAuth for Twilio Communications APIs went GA on 2026-04-06 and is currently available only in the US1 region, at no additional cost.
- Log in to the Twilio Console and go to Settings > Account settings > OAuth applications.
- Click Create an OAuth app and enter an application name (and description).
- Set the Token expiration time (configurable between 1 minute and 30 days; default 1 hour).
- On the Scopes & permissions step, select the permissions the app needs (an app can hold up to 100 scopes/permissions). Account-level OAuth apps support only the client credentials grant.
- Click Create. On the credentials page, copy the Client ID and Client Secret and store them somewhere secure, then confirm.
Request an access token:
curl --location 'https://oauth.twilio.com/v2/token' \ --header 'Content-Type: application/x-www-form-urlencoded' \ --data-urlencode 'client_id={CLIENT_ID}' \ --data-urlencode 'client_secret={CLIENT_SECRET}' \ --data-urlencode 'grant_type=client_credentials'The success response is { "access_token": "...", "id_token": null, "token_type": "Bearer", "expires_in": 3600, "refresh_token": null }. There is no refresh token for this grant — request a new token when the old one expires (an expired token returns 401 Unauthorized).
Call the API with the token as a Bearer credential:
curl --location 'https://api.twilio.com/2010-04-01/Accounts/{AccountSID}/Messages.json' \ --header 'Authorization: Bearer {AccessToken}'Operational notes:
- Account-level OAuth apps only work for the account they were created in, not its subaccounts — create a separate app per subaccount.
- You still need the target Account SID (
AC...) for the request URL path.
Connect it to Publicus
Section titled “Connect it to Publicus”Open Connections under Credentials, choose Twilio, and pick Twilio OAuth 2.0 (client credentials). Publicus asks for exactly the fields listed above and keeps them in your workspace’s secret storage.
See also: Twilio in the catalog.
This guide is maintained by Publicus and published under CC BY 4.0.