Skip to contentSkip to navigationSkip to topbar
Rate this page:
On this page

REST API: Secondary Auth Token


(warning)

Warning

If you are using Functions(Classic) or Services and have included your auth token directly instead of using a variable, you must redeploy your classic functions and services when you rotate or update your auth token. Otherwise, those functions and services will fail with a "403 Forbidden" error.

Twilio uses the Account SID and Auth Token to authenticate API requests. The Auth Token can be rotated in the Console(link takes you to an external page) or with this API. There are two related endpoints, one to promote the secondary Auth Token and this one to create or delete the secondary Auth Token.


Secondary Auth Token properties

secondary-auth-token-properties page anchor
Resource properties
account_sidtype: SID<AC>Not PII

The SID of the Account(link takes you to an external page) that the secondary Auth Token was created for.


date_createdtype: string<DATE TIME>Not PII

The date and time in UTC when the resource was created specified in ISO 8601(link takes you to an external page) format.


date_updatedtype: string<DATE TIME>Not PII

The date and time in UTC when the resource was last updated specified in ISO 8601(link takes you to an external page) format.


secondary_auth_tokentype: stringPII MTL: 0 days

The generated secondary Auth Token that can be used to authenticate future API requests.


urltype: string<URI>Not PII

The URI for this resource, relative to https://accounts.twilio.com


Create a SecondaryAuthToken resource

create-a-secondaryauthtoken-resource page anchor
POST https://accounts.twilio.com/v1/AuthTokens/Secondary

Parameters

create-parameters page anchor

This action does not accept any parameters.

Create a Secondary Auth Token

create-a-secondary-auth-token page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_10
// Download the helper library from https://www.twilio.com/docs/node/install
_10
// Find your Account SID and Auth Token at twilio.com/console
_10
// and set the environment variables. See http://twil.io/secure
_10
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_10
const authToken = process.env.TWILIO_AUTH_TOKEN;
_10
const client = require('twilio')(accountSid, authToken);
_10
_10
client.accounts.v1.secondaryAuthToken()
_10
.create()
_10
.then(secondary_auth_token => console.log(secondary_auth_token.dateCreated));

Output

_10
{
_10
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_10
"date_created": "2015-07-31T04:00:00Z",
_10
"date_updated": "2015-07-31T04:00:00Z",
_10
"secondary_auth_token": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
_10
"url": "https://accounts.twilio.com/v1/AuthTokens/Secondary"
_10
}


Delete a SecondaryAuthToken resource

delete-a-secondaryauthtoken-resource page anchor
DELETE https://accounts.twilio.com/v1/AuthTokens/Secondary

This action does not accept any parameters.

Delete the Secondary Auth Token

delete-the-secondary-auth-token page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_10
// Download the helper library from https://www.twilio.com/docs/node/install
_10
// Find your Account SID and Auth Token at twilio.com/console
_10
// and set the environment variables. See http://twil.io/secure
_10
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_10
const authToken = process.env.TWILIO_AUTH_TOKEN;
_10
const client = require('twilio')(accountSid, authToken);
_10
_10
client.accounts.v1.secondaryAuthToken().remove();


Rate this page: