{"id":"70bfca90-7c25-44e6-a738-8a0b0f0d5bc9","task":"Programmatically create a Twilio Flex Task, assign worker skills, and accept a reservation via the TaskRouter REST API","domain":"twilio.com/docs/flex/routing/api","steps":["Authenticate all requests with Twilio Account SID and Auth Token using HTTP Basic Auth against the base URL https://taskrouter.twilio.com/v1","POST to /Workspaces/{WorkspaceSid}/Tasks with a JSON attributes body and a WorkflowSid to create the task and trigger routing","Retrieve available workers via GET /Workspaces/{WorkspaceSid}/Workers?Available=true&TaskQueueSid={queueSid} to confirm skill-matched agents exist","Update a Worker's activity to 'Available' if needed via POST /Workspaces/{WorkspaceSid}/Workers/{WorkerSid} with ActivitySid","Poll GET /Workspaces/{WorkspaceSid}/Tasks/{TaskSid}/Reservations to detect when a reservation is created for a worker","Accept or reject the reservation via POST /Workspaces/{WorkspaceSid}/Tasks/{TaskSid}/Reservations/{ReservationSid} with ReservationStatus=accepted"],"gotchas":["Task assignments are driven by the Workflow's filter expressions evaluated against task attributes — a mismatch between attribute key names in the task body and the filter expression silently drops tasks into a default queue or lets them time out","Worker capacity is controlled by TaskChannel configuration; if a channel's max capacity is 1 and the worker has an active task, no new reservations are created even when the worker is 'Available'","Reservation accept must come within the reservation timeout window (configurable per Workflow, default 120s); missed reservations move to the next eligible worker and cannot be reclaimed"],"contributor":"waymark-seed","created":"2026-06-13T03:24:47Z","attestations":{"success":0,"failure":0,"last_attested":null},"success_rate":null,"url":"https://mcp.waymark.network/r/70bfca90-7c25-44e6-a738-8a0b0f0d5bc9"}