VX Agents

API directory · Messaging & SMS

Twilio Studio Flows & Executions

v1.0.0 · 12 endpoints · 0 connections · shared by vx.ai

When a customer should get a call or text from a Studio flow you already built, trigger it with their number and JSON parameters, then follow the run step by step: which widget it reached, the flow context it collected, and whether it ended. Also lists flows and their published revisions, and ends stuck executions.

Connect this API to an AI agent Browse all specs

What you can do with Twilio Studio Flows & Executions via MCP

Every endpoint below becomes a governed tool your AI agent (Claude, ChatGPT, or a customer-facing VX agent) can call — with scoped permissions, sandbox testing, and audit logs.

MethodPathOperationDescription
GET /v2/Flows listFlows List Studio flows with their status and revision
GET /v2/Flows/{Sid} getFlow Get a flow, including its JSON definition
GET /v2/Flows/{Sid}/Revisions listFlowRevisions List the saved revisions of a flow
GET /v2/Flows/{Sid}/Revisions/{Revision} getFlowRevision Get one revision of a flow
POST /v2/Flows/{FlowSid}/Executions createExecution Start the flow for a contact (outbound call or message)
GET /v2/Flows/{FlowSid}/Executions listExecutions List runs of a flow, optionally within a date range
GET /v2/Flows/{FlowSid}/Executions/{Sid} getExecution Get one run of a flow and its status
POST /v2/Flows/{FlowSid}/Executions/{Sid} endExecution End an active run (set status to ended)
GET /v2/Flows/{FlowSid}/Executions/{ExecutionSid}/Context getExecutionContext Get the data a run has collected so far
GET /v2/Flows/{FlowSid}/Executions/{ExecutionSid}/Steps listExecutionSteps List the widgets a run passed through
GET /v2/Flows/{FlowSid}/Executions/{ExecutionSid}/Steps/{Sid} getExecutionStep Get one step of a run
GET /v2/Flows/{FlowSid}/Executions/{ExecutionSid}/Steps/{StepSid}/Context getExecutionStepContext Get the data captured at one step

Authentication

accountSid_authToken

HTTP Basic

HTTP basic auth: your Twilio Account SID as the username and Auth Token as the password (or an API key SID and secret).

How to get a credential

  1. Sign in to the Twilio Console (console.twilio.com).
  2. On the account dashboard, copy the Account SID (starts with AC) and reveal the Auth Token.
  3. Safer option: open Account > API keys & tokens, click Create API key (type Standard), and use the key SID (SK...) as the username and the secret as the password.

Permissions used

Standard API keys and the Auth Token can call every operation below. Restricted API keys need these permissions:

Permission Operations
Studio Flows read listFlows, getFlow, listFlowRevisions, getFlowRevision
Studio Executions read listExecutions, getExecution, getExecutionContext, listExecutionSteps, getExecutionStep, getExecutionStepContext
Studio Executions write createExecution, endExecution

Common errors

  • 401 Unauthorized (code 20003): wrong SID/token pair, or the API key belongs to another account. Re-copy both values.
  • 403 Forbidden: a restricted API key lacks the Studio permission listed above.
  • 400 Bad Request: To or From is not in E.164 format, From is not a number on your account, or Parameters is not valid JSON.
  • 404 Not Found: the flow SID (FW...) or execution SID (FN...) does not exist in this account.
  • 429 Too Many Requests: slow down and retry with backoff.

Store the SID and secret as a VX Agents credential so they are never pasted into chat.

Usage guide

Setup

  • Add a basic-auth credential: Twilio Account SID (or API key SID SK...) as username, Auth Token (or API key secret) as password.
  • Call listFlows once and pin the flow SID (FW...) you trigger most often, plus the Twilio number or Messaging Service SID you send From.

Trigger a flow for a contact

  1. listFlows to find the flow; check status is published (drafts cannot run).
  2. Show the user the flow name, To, From and Parameters, and wait for confirmation: starting a flow places a real call or sends real messages and costs money.
  3. createExecution with To (E.164, e.g. +14155550100), From (your Twilio number or MG... Messaging Service SID) and optional Parameters as a JSON string, e.g. {"appointment_time":"3pm"}. Inside the flow these appear as {{flow.data.appointment_time}}.
  4. Keep the returned execution SID (FN...).

Follow a run

  1. getExecution for status (active or ended).
  2. listExecutionSteps to see which widgets ran and the transitions taken (e.g. incomingMessage, noMatch).
  3. getExecutionContext for everything collected so far (replies, HTTP widget results, flow.data); getExecutionStepContext for the data at one widget.
  4. A run stuck waiting for a reply can be ended with endExecution and Status=ended (confirm with the user first).

Review history

  • listExecutions with DateCreatedFrom / DateCreatedTo (ISO 8601) to audit recent runs of a flow.
  • listFlowRevisions / getFlowRevision to see what changed between published versions.

Good to know

  • Bodies are form-encoded; Parameters must be a JSON string.
  • A contact can only be in one active execution of a flow at a time; if a new trigger fails for that reason, check listExecutions and end the old run first.
  • Lists are paged with PageSize; follow meta.next_page_url.
  • This spec cannot create, edit or delete flows, or delete executions.

Source: Twilio Studio REST API v2 reference (https://www.twilio.com/docs/studio/rest-api/v2), checked 2026-10-21.

How to use this spec

  1. Create a free VX Agents account (sandbox tools included).
  2. Open the marketplace and connect “Twilio Studio Flows & Executions” to an agent.
  3. Expose it as an MCP server for Claude/ChatGPT, or chat with it directly.

Related APIs