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

Flex Configuration REST API


The Flex Configuration REST API resource contains a collection of properties that control the appearance and functionality of your Flex instance.

(information)

Info

For self-hosted Flex UI instances, any configuration values specified in your server's appConfig.js object will take precedence over corresponding values in the REST API Configuration resource.


Fetch Your Current Configuration

fetch-your-current-configuration page anchor

To review your account's current Flex Configuration properties, fetch the resource instance by making a GET request to the /Configuration endpoint.

The response contains a complete JSON representation of the configuration.

Example Fetch RequestSample response

_10
curl -X GET "https://flex-api.twilio.com/v1/Configuration" \
_10
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN

(information)

Info

Not sure where to find your account SID or auth token? Check out this intro to using Twilio's REST APIs for help.


Update Your Configuration

update-your-configuration page anchor

Issue a POST request to the /Configuration endpoint to update Flex Configuration values. Include a JSON object in the request body that contains your Twilio account SID along with any configuration items that you wish to update.

The following example request illustrates how to update a single configuration property with a boolean value.


_12
JSON_PAYLOAD=$(cat <<EOF
_12
{
_12
"account_sid": "ACXXXXXXXXXXXXXXXXX",
_12
"call_recording_enabled": true
_12
}
_12
EOF
_12
)
_12
_12
curl -X POST https://flex-api.twilio.com/v1/Configuration \
_12
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN \
_12
-H 'Content-Type: application/json' \
_12
-d $JSON_PAYLOAD

(information)

Info

Some properties expect a simple type as the value (boolean, string, integer, etc), while other properties expect a value that is itself a full JSON object. When updating a JSON type property, the existing value of the property will be completely replaced by the JSON object that you provide as the new value.

To prevent accidentally overriding existing fields of a JSON type property when performing an update, you should always first fetch the existing value of the property first. Then make any desired adjustments to the JSON object before sending it in the body of a POST request to update the property. You'll see an illustration of this in the following example.

Let's see how to update a property that uses a JSON object rather than a scalar as its value.

Suppose we want to update the ui_attributes property in order to disable browser notifications. Since the value of ui_attributes is a JSON object and it might contain fields other than the one we want to modify, we will first fetch the Configuration to get the complete current state of the object. Let's say that the current value of ui_attributes that we see in the response looks like this:


_10
{
_10
"warmTransfers": {
_10
"enabled": true
_10
},
_10
"notifications": {
_10
"browser": true
_10
}
_10
}

Here's how we can send a request to update the property with our adjustment to one field within the JSON object value.


_19
JSON_PAYLOAD=$(cat <<EOF
_19
{
_19
"account_sid": "ACXXXXXXXXXXXXXXXXX",
_19
"ui_attributes": {
_19
"warmTransfers": {
_19
"enabled": true
_19
},
_19
"notifications": {
_19
"browser": false
_19
}
_19
}
_19
}
_19
EOF
_19
)
_19
_19
curl -X POST 'https://flex-api.twilio.com/v1/Configuration' \
_19
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN \
_19
-H 'Content-Type: application/json' \
_19
-d $JSON_PAYLOAD

The existing value for the ui_attributes property will be entirely replaced by the JSON object we provided in the POST request.

(warning)

Warning

Some fields are read-only. If you attempt to update a read-only field, the API will return an HTTP 400 response with an error message:


_10
{
_10
"code": 45004,
_10
"message": "You are not allowed to modify property for [flex_service_instance_sid].",
_10
"more_info": "https://www.twilio.com/docs/errors/45004",
_10
"status": 400
_10
}


Configuration properties reference

configuration-properties-reference page anchor

Following is a description of some of the Configuration properties that you may wish to change.

ui_attributes

ui_attributes page anchor

JSON object

These configuration values control some aspects of the appearance and functionality of the Flex UI web application.

For self-hosted Flex UI instances, properties specified here are merged with any properties present in the server's appConfig.js object. Values specified in appConfig.js take precedence over corresponding values in the ui_attributes field of the REST API Configuration resource.

Check out the appConfig.js guide to learn more about the available Flex UI configuration options.

(information)

Info

Example value


_12
{
_12
"warmTransfers": {
_12
"enabled": true
_12
},
_12
"notifications": {
_12
"browser": true
_12
},
_12
"logLevel": "debug",
_12
"theme": {
_12
"isLight": false
_12
}
_12
}

JSON object

This field allows you to define custom skills-based routing parameters for your Flex instance.

(information)

Info

Example value


_32
[
_32
{
_32
"name": "voice",
_32
"multivalue": false,
_32
"minimum": null,
_32
"maximum": null
_32
},
_32
{
_32
"name": "language_fr",
_32
"multivalue": false,
_32
"minimum": null,
_32
"maximum": null
_32
},
_32
{
_32
"name": "language_ge",
_32
"multivalue": false,
_32
"minimum": null,
_32
"maximum": null
_32
},
_32
{
_32
"name": "messaging",
_32
"multivalue": false,
_32
"minimum": null,
_32
"maximum": null
_32
},
_32
{
_32
"name": "special_language",
_32
"multivalue": true,
_32
"minimum": 1,
_32
"maximum": 10
_32
}
_32
]


Rate this page: