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 tokens are JSON Web Encryption (JWE) tokens issued to authenticate users and grant them secure access to the Flex application.
| Name | Type | Description | PII? |
|---|---|---|---|
| InstanceSid (required) | String | A 34-character string that identifies the Flex instance. | Not PII |
| FlexUserSid (required) | String | A 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 page.
Encoding type:application/json
| Name | Type | Description | PII? |
|---|---|---|---|
| ttl | Integer | The time to live of the token in seconds. Default is 3600 seconds (1 hour). | Not PII |
| Schema name | Type | Description | PII? |
|---|---|---|---|
| access_token | String | The Flex JWE token. | Not PII |
| token_info | Object | JSON blob containing info about the token. | PII MTL: 30 days |
POST request
1curl -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":36006}'
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}