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.
Retrieve your Flex Workspace SID with GET https://taskrouter.twilio.com/v1/Workspaces — note the SID of the workspace Flex uses.
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'.
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.
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.
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
The Workflow 'Configuration' is a JSON string (not a nested object) within the POST body — it must be serialized to a string before submission; submitting a raw JSON object for this field will cause a validation error.
Worker expressions in 'TargetWorkers' use TaskRouter's expression language (e.g., 'skills HAS "english"') — syntax errors in expressions cause the task queue to match zero workers silently; test expressions using the TaskRouter expression evaluator.
Twilio Flex uses a specific Workspace per account — creating routing changes in the wrong workspace will have no effect on Flex; always verify you are targeting the Flex workspace SID.
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp