Execution Resource
An Execution represents a specific person’s run through a Flow. An execution is active while the user is in the Flow, and it is considered ended when they stop or are kicked out of the Flow.
HTTP requests to Studio's REST API are protected with HTTP Basic authentication. To learn more about how Twilio handles authentication, please see our security documentation. You will use your Twilio account SID as the username and your auth token as the password for HTTP Basic authentication.
Important: When triggering flows with the API, don't forget to also configure your Twilio Phone Number with your Studio Flow. If you don't configure the phone number, users won't be able to reply to your messages or call back to your IVR.
Deprecation Notice: The contact_sid
property has been deprecated and will be replaced with a static placeholder value in the v1 API. Use contact_channel_address
instead to uniquely track contacts. For the best experience and latest features, upgrade to the v2 API.
Subscribe to Real-time Studio Events
Try Studio EventsYou can now subscribe to Studio Events for Executions and Steps instead of polling via the REST API. Simplify your data ingestion with Event Streams for Studio.
Execution properties
Resource Properties in REST API format | |
---|---|
sid
|
The unique string that we created to identify the Execution resource. |
account_sid
|
The SID of the Account that created the Execution resource. |
flow_sid
|
The SID of the Flow. |
contact_sid
|
The SID of the Contact. |
contact_channel_address
|
The phone number, SIP address or Client identifier that triggered the Execution. Phone numbers are in E.164 format (e.g. +16175551212). SIP addresses are formatted as |
context
|
The current state of the Flow's Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution. |
status
|
The status of the Execution. Can be: |
date_created
|
The date and time in GMT when the resource was created specified in ISO 8601 format. |
date_updated
|
The date and time in GMT when the resource was last updated specified in ISO 8601 format. |
url
|
The absolute URL of the resource. |
links
|
The URLs of nested resources. |
Create a new execution
https://studio.twilio.com/v1/Flows/{FlowSid}/Executions
Studio Rate Limits
Be sure to review Studio's rate limits when building your application.
Parameters
Parameters in REST API format | |
---|---|
flow_sid
Path
|
The SID of the Excecution's Flow. |
to
Required
|
The Contact phone number to start a Studio Flow Execution, available as variable |
from
Required
|
The Twilio phone number to send messages or initiate calls from during the Flow's Execution. Available as variable |
parameters
Optional
|
JSON data that will be added to the Flow's context and that can be accessed as variables inside your Flow. For example, if you pass in |
Example 1
Example 2
Fetch a single execution
https://studio.twilio.com/v1/Flows/{FlowSid}/Executions/{Sid}
Parameters
Parameters in REST API format | |
---|---|
flow_sid
Path
|
The SID of the Flow with the Execution resource to fetch |
sid
Path
|
The SID of the Execution resource to fetch. |
Example 1
Read a list of executions
https://studio.twilio.com/v1/Flows/{FlowSid}/Executions
Execution resources are listed in reverse chronological order (most recent is first).
Parameters
Parameters in REST API format | |
---|---|
flow_sid
Path
|
The SID of the Flow with the Execution resources to read. |
date_created_from
Optional
|
Only show Execution resources starting on or after this ISO 8601 date-time, given as |
date_created_to
Optional
|
Only show Execution resources starting before this ISO 8601 date-time, given as |
Example 1
Example 2
Update an Execution
https://studio.twilio.com/v1/Flows/{FlowSid}/Executions/{Sid}
An active Execution can be updated to "ended" using the REST API. Once ended, subsequent widgets in the Flow are not processed, and any new events that Studio receives for that Execution are rejected.
Parameters
Parameters in REST API format | |
---|---|
flow_sid
Path
|
The SID of the Flow with the Execution resources to update. |
sid
Path
|
The SID of the Execution resource to update. |
status
Required
|
The status of the Execution. Can only be |
Example 1
Delete an execution
https://studio.twilio.com/v1/Flows/{FlowSid}/Executions/{Sid}
Parameters
Parameters in REST API format | |
---|---|
flow_sid
Path
|
The SID of the Flow with the Execution resources to delete. |
sid
Path
|
The SID of the Execution resource to delete. |
Example 1
Need some help?
We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd by visiting Twilio's Stack Overflow Collective or browsing the Twilio tag on Stack Overflow.