Skip to contentSkip to navigationSkip to topbar
Page toolsOn this page
Looking for more inspiration?Visit the

Flex User Token API (public beta)


(new)

Flex User Token API in public beta

The Flex User Token API is currently available as a public beta product and the information contained in this document is subject to change. This means that some features are not yet implemented and others may be changed before the product is declared as generally available. Public beta products are not covered by an SLA.


Flex User Token resource

flex-user-token-resource page anchor

Flex user tokens are JSON Web Encryption (JWE) tokens issued to authenticate users and grant them secure access to the Flex application.


Generate a Flex user token

generate-a-flex-user-token page anchor

Path parameters

path-parameters page anchor
NameTypeDescriptionPII?
InstanceSid
(required)
StringA 34-character string that identifies the Flex instance.Not PII
FlexUserSid
(required)
StringA 34-character string that identifies the Flex user.Not PII

Your Flex instance is the container that holds your Flex resources. You can find your Flex instance SID in Console on the Flex overview(link takes you to an external page) page.

Encoding type:application/json

NameTypeDescriptionPII?
ttlIntegerThe time to live of the token in seconds. Default is 3600 seconds (1 hour).Not PII

Flex User Token response schema

flex-user-token-response-schema page anchor
Schema nameTypeDescriptionPII?
access_tokenStringThe Flex JWE token.Not PII
token_infoObjectJSON blob containing info about the token.PII MTL: 30 days

Example request and response

example-request-and-response page anchor

POST request

1
curl -X POST "https://flex-api.twilio.com/v4/Instances/{InstanceSid}/Users/{FlexUserSid}/Tokens" \
2
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN \
3
-H "Content-Type: application/json" \
4
--data-raw '{
5
"ttl":3600
6
}'

Response

1
{
2
"access_token": "flex_jwe_token_string_here",
3
"token_info": {
4
"account_sid": "AC00000000000000000000000000000000",
5
"expiration": "2025-10-23T16:22:26Z",
6
"flex_instance_sid": "GO00000000000000000000000000000000",
7
"flex_user_sid": "FU00000000000000000000000000000000",
8
"identity": "Jane",
9
"permissions": [
10
"FPN9999",
11
"FPN0000"
12
],
13
"roles": [
14
"agent"
15
],
16
"username": "Jane"
17
}
18
}