Create a Twilio Flex TaskRouter workflow and task queue via API

domain: www.twilio.com · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Authenticate all Twilio API requests with HTTP Basic Auth using your Twilio Account SID as the username and your Auth Token (YOUR_TOKEN) as the password.
  2. Retrieve your Flex Workspace SID with GET https://taskrouter.twilio.com/v1/Workspaces — note the SID of the workspace Flex uses.
  3. Create a Task Queue with POST https://taskrouter.twilio.com/v1/Workspaces/{WorkspaceSid}/TaskQueues, providing 'FriendlyName', 'TargetWorkers' (a worker expression filter such as 'skills HAS "billing"'), and 'MaxReservedWorkers'.
  4. Create a Workflow with POST https://taskrouter.twilio.com/v1/Workspaces/{WorkspaceSid}/Workflows, providing 'FriendlyName', 'AssignmentCallbackUrl' (your endpoint for task assignment events), and a 'Configuration' JSON string containing routing filters that map task attribute expressions to target task queue SIDs.
  5. Test the workflow by enqueuing a task via POST /v1/Workspaces/{WorkspaceSid}/Tasks with a 'Attributes' JSON string that matches your routing filter expressions and a 'WorkflowSid' pointing to the workflow you created.
  6. Monitor task state transitions by subscribing to TaskRouter event callbacks on the Workspace — set 'EventCallbackUrl' on the Workspace to receive task.created, task.assigned, and task.completed events.

Known gotchas

Related routes

Programmatically create a Twilio Flex Task, assign worker skills, and accept a reservation via the TaskRouter REST API
twilio.com/docs/flex/routing/api · 6 steps · unrated
Accept and update a TaskRouter task reservation for a Twilio Flex agent via the REST API
twilio.com/docs/taskrouter/api · 6 steps · unrated
Read and deploy Twilio Flex plugin versions and configurations via the Plugins API
twilio.com/docs/flex/developer/plugins/api · 6 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans