Rate this page:

REST API: Network Traversal Service Tokens

Network Traversal Service Tokens are ephemeral credentials that let you access TURN resources from WebRTC and VoIP clients. They are a secure way to create communication sessions with web browsers or mobile apps without exposing credentials in a client-side environment. All tokens have a limited lifetime to protect you from abuse. The lifetime is configurable up to 24 hours (which is also the default value) but you should make it as short as possible for your application.

Token List Resource

Resource URI


Resource Properties

A Token instance resource has the following properties

Property Description
Username The temporary username that uniquely identifies a Token.
Password The temporary password that the username will use when authenticating with Twilio.
Ttl The duration in seconds for which the username and password are valid, the default value is 86,400 (24 hours)
AccountSid The unique id of the Account that created this Token.
IceServers An array representing the ephemeral credentials and the STUN and TURN server URIs.
DateCreated The date that this resource was created, given in RFC 2822 format.
DateUpdated The date that this resource was last updated, given in RFC 2822 format.


Not Supported


You can create a new Token resource by POSTing to the Tokens list resource. Since the purpose of tokens is to provide short-lived credentials, usernames and passwords are always auto-generated and not intended to be stored long term.

Optional Parameters

You may POST the following parameters:

Parameter Description
Ttl The duration in seconds for which the generated credentials are valid, the default value is 86400 (24 hours).
Loading Code Sample...

        Create a Token Resource

        Loading Code Sample...

              Create Token Resource during 1 hour

              HTTP PUT

              Not Supported.

              HTTP DELETE

              Not Supported.

              Rate this page:

              Need some help?

              We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd by visiting Twilio's Stack Overflow Collective or browsing the Twilio tag on Stack Overflow.

              Loading Code Sample...

                    Thank you for your feedback!

                    Please select the reason(s) for your feedback. The additional information you provide helps us improve our documentation:

                    Sending your feedback...
                    🎉 Thank you for your feedback!
                    Something went wrong. Please try again.

                    Thanks for your feedback!