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

Create a Flex instance programmatically


This page outlines how to authenticate and get started with the Flex Instances APIs. The Instances API lets you programmatically install Flex for existing Twilio accounts.


Authentication

authentication page anchor

Twilio supports HTTP Basic authentication. Include the Basic Authentication header, where the username:password pair is one of the following:

UsernamePasswordBest practice
API KeyAPI Key SecretRecommended: When a key is compromised or no longer in use, revoke it to prevent unauthorized access.
Account SIDAuthTokenLimits your use to local testing.

For more information, see Twilio API requests.


https://flex-api.twilio.com

Create a Flex instance by sending a POST request to the following endpoint:

POST "https://flex-api.twilio.com/v2/Instances"
header page anchor
HeaderValue typeDescription
I-Twilio-Auth-AccountACCOUNT_SIDYour account SID

The following example shows a request to create a Flex instance:

1
{
2
"conversations": {
3
"default": true
4
}
5
}
InputTypeDescription
conversations.defaultBooleanIf true, the Flex conversation service created during provisioning is set as the account's default conversation service.

A successful request returns a 201 Created status code and the following response:

1
{
2
"flex_instance_sid": "GOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
3
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
4
"status": "creation-in-progress",
5
"date_created": "2016-08-01T22:10:40Z",
6
"date_updated": "2016-08-01T22:10:40Z"
7
}

Fetch information about a Flex instance by sending a GET request to the following endpoint:

GET "https://flex-api.twilio.com/v2/Instances/INSTANCE_SID"
HeaderValue typeDescription
I-Twilio-Auth-AccountACCOUNT_SIDYour account SID

A successful request returns a 200 OK status code and the following response:

1
{
2
"flex_instance_sid": "GOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
3
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
4
"status": "ready",
5
"date_created": "2016-08-01T22:10:40Z",
6
"date_updated": "2016-08-01T22:10:40Z"
7
}