Overview
Twilio uses two credentials to determine which account an API request is coming from: The Account SID, which acts as a username, and the Auth Token which acts as a password. This guide explains how to find your Auth Token, and how to change it.
Notice: If another user gets access to your Auth Token and Account SID, they will have full access to your account, and use of the Twilio API as if they were you. All users should take steps to keep their Auth Token private. For more recommendations, see Is Someone Else Using Your Twilio Account? Best Practices to Protect Your Auth Token (Twilio Blog).
If you are concerned someone has unauthorized use of your Twilio credentials, see Proactive Steps for Customers Experiencing Account Takeover.
Product
Account Management
Environment
legacy Twilio Console
Frequently Asked Questions
Where is my Auth Token?
You can find the Auth Token in the Account Info pane of the Twilio Console Dashboard page, under Account Info.
Your account's Auth Token is hidden by default. Click show to display the token, and hide to conceal it again.
What is a Secondary Auth Token?
A secondary Auth Token is a backup to your primary Auth Token. The secondary token works the same as your primary token and can be used to keep your applications running during a token rotation. This allows you to seamlessly transition your services from one token to another with zero downtime. When ready, Secondary tokens can be promoted to the primary token, replacing the previous primary token.
How do I change my Auth Token?
Notice: Promoting a secondary Auth Token to the primary Auth Token instantly and automatically removes your old existing primary Auth Token from your account. Immediately after promoting the new token, all requests to Twilio using your old Auth Token will result in an error. Any existing Twilio apps using your old token will need to be updated with the new token before they will successfully work again. To make this change without incurring downtime, we recommend users update their apps with the secondary token prior to promoting it to primary.
- Access the Admin dropown menu and select Account management. Then click on the API keys & tokens page in Console.
- From the top right, select the Region you'd like to change the Auth Token for:
- Scroll down to the "Auth Tokens" section, and then click Request a secondary token.
- In the pop-up dialog box, click Request Token.
- Click the Eye icon to view your new secondary token, and use it to update your existing Twilio applications. Be certain your applications are updated with your new secondary token prior to promoting it.
-
Click Promote to Primary to make your newly created Auth Token the main token for your account. A dialog box will pop-up asking you to acknowledge the consequences. Once confirmed, the old primary token will stop working.
Note: If you decide you don’t need the second token and want to keep using the primary one, click Delete this Token to remove it.
Can I change my Auth Token using the API?
Yes. As well as the Console, you can rotate Auth Tokens with the Accounts API. This is useful if you manage many subaccounts and want to rotate credentials from a script rather than one account at a time. Authenticate these requests with your Account SID and Auth Token. API Keys are not accepted for Auth Token rotation, and requests using them fail with error 20003.
To rotate an Auth Token:
- Create a secondary Auth Token. It works immediately, alongside your existing primary token.
- Update your applications to use the new token. Be certain this is complete before you promote it.
- Promote the secondary token to primary. The same consequences described above apply: your old primary token stops working immediately.
For full request and response details, see the Secondary Auth Token and Auth Token API reference.
What if I need to rotate Auth Tokens for many accounts?
Notice: Every Auth Token change sends an email notification to each owner and administrator on the account. Rotating across a large number of subaccounts generates a high volume of email to the same recipients, which can be rate limited. That delays both the rotation notifications and other time-sensitive email Twilio sends to those addresses, such as Console verification codes.
We recommend setting SuppressEmailNotification to true on each request when you rotate Auth Tokens in bulk. The parameter is available on all auth token endpoints.
The parameter defaults to false, so Twilio sends the email notifications unless you explicitly suppress them. Existing scripts keep their current behavior if you change nothing.
When you suppress the notifications, tell the affected users about the rotation through your own channels. They still need to know their credentials changed.
How can I check that nothing still uses my Primary Auth Token before I promote the Secondary Auth Token?
Twilio does not show which Auth Token, Primary or Secondary, was used for an individual request, so this check has to be done on your side. Because promoting the Secondary Auth Token removes the old Primary Auth Token immediately, review the following before you promote.
Check your own systems
Search your applications, environment variables, secret managers, deployment pipelines, scheduled jobs, Twilio CLI profiles and third party integrations for the old Primary Auth Token. Anything that authenticates with your Account SID and Auth Token must be switched to the Secondary Auth Token. Your own application and API logs show which credentials each system sends.
Webhook signature validation
Twilio signs the requests it sends to your webhook URLs with your account's Primary Auth Token. After you promote the Secondary Auth Token, requests are signed with the new Primary Auth Token, so code that validates the signature with the old token will start rejecting valid requests. Update that code first. See the Twilio webhook security documentation.
After you promote
Any request that still uses the old Primary Auth Token fails with a 401 response and error 20003. Promote during a low traffic period and watch your logs for 401 responses so you can find and fix any system you missed.
Reduce the impact of future rotations
Use API keys instead of the Auth Token for REST API requests where possible. You can then delete or replace one key without affecting the other systems that use your account.