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.
Twilio supports HTTP Basic authentication. Include the Basic Authentication header, where the username:password pair is one of the following:
| Username | Password | Best practice |
|---|---|---|
| API Key | API Key Secret | Recommended: When a key is compromised or no longer in use, revoke it to prevent unauthorized access. |
| Account SID | AuthToken | Limits 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 | Value type | Description |
|---|---|---|
I-Twilio-Auth-Account | ACCOUNT_SID | Your account SID |
The following example shows a request to create a Flex instance:
1{2"conversations": {3"default": true4}5}
| Input | Type | Description |
|---|---|---|
conversations.default | Boolean | If 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"
| Header | Value type | Description |
|---|---|---|
I-Twilio-Auth-Account | ACCOUNT_SID | Your 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}