TaskrouterTask

Create Task

POST
/v1/Workspaces/{WorkspaceSid}/Tasks

Authorization

accountSid_authToken
AuthorizationBasic <token>

In: header

Path Parameters

WorkspaceSid*string

The SID of the Workspace that the new Task belongs to.

Match^WS[0-9a-fA-F]{32}$
Length34 <= length <= 34

Request Body

application/x-www-form-urlencoded

Timeout?integer

The amount of time in seconds the new task can live before being assigned. Can be up to a maximum of 2 weeks (1,209,600 seconds). The default value is 24 hours (86,400 seconds). On timeout, the task.canceled event will fire with description Task TTL Exceeded.

Priority?integer

The priority to assign the new task and override the default. When supplied, the new Task will have this priority unless it matches a Workflow Target with a Priority set. When not supplied, the new Task will have the priority of the matching Workflow Target. Value can be 0 to 2^31^ (2,147,483,647).

TaskChannel?string

When MultiTasking is enabled, specify the TaskChannel by passing either its unique_name or sid. Default value is default.

WorkflowSid?string

The SID of the Workflow that you would like to handle routing for the new Task. If there is only one Workflow defined for the Workspace that you are posting the new task to, this parameter is optional.

Match^WW[0-9a-fA-F]{32}$
Length34 <= length <= 34
Attributes?string

A JSON string with the attributes of the new task. This value is passed to the Workflow's assignment_callback_url when the Task is assigned to a Worker. For example: { "task_type": "call", "twilio_call_sid": "CAxxx", "customer_ticket_number": "12345" }.

VirtualStartTime?string

The virtual start time to assign the new task and override the default. When supplied, the new task will have this virtual start time. When not supplied, the new task will have the virtual start time equal to date_created. Value can't be in the future or before the year of 1900.

Formatdate-time
RoutingTarget?string

A SID of a Worker, Queue, or Workflow to route a Task to

IgnoreCapacity?string

A boolean that indicates if the Task should respect a Worker's capacity and availability during assignment. This field can only be used when the RoutingTarget field is set to a Worker SID. By setting IgnoreCapacity to a value of true, 1, or yes, the Task will be routed to the Worker without respecting their capacity and availability. Any other value will enforce the Worker's capacity and availability. The default value of IgnoreCapacity is true when the RoutingTarget is set to a Worker SID.

TaskQueueSid?string

The SID of the TaskQueue in which the Task belongs

Match^WQ[0-9a-fA-F]{32}$
Length34 <= length <= 34

Response Body

application/json

curl -X POST "https://example.com/v1/Workspaces/stringstringstringstringstringstri/Tasks" \  -H "Content-Type: application/x-www-form-urlencoded" \  -d 'Attributes=%7B%22body%22%3A+%22attributes%22%7D&Priority=1&Timeout=1&WorkflowSid=WWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&TaskChannel=channel&VirtualStartTime=2014-05-14T18%3A50%3A02Z&IgnoreCapacity=false&RoutingTarget=WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&TaskQueueSid=WQaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
{  "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",  "age": 25200,  "assignment_status": "pending",  "attributes": "{\"body\": \"attributes\"}",  "date_created": "2014-05-14T18:50:02Z",  "date_updated": "2014-05-15T07:26:06Z",  "task_queue_entered_date": null,  "virtual_start_time": "2014-05-14T18:50:02Z",  "priority": 1,  "reason": "Test Reason",  "sid": "WTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",  "task_queue_sid": "WQaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",  "task_channel_sid": "TCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",  "task_channel_unique_name": "unique",  "timeout": 60,  "url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Tasks/WTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",  "workspace_sid": "WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",  "workflow_sid": "WWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",  "workflow_friendly_name": "Example Workflow",  "task_queue_friendly_name": "Example Task Queue",  "ignore_capacity": false,  "routing_target": "WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",  "addons": "{}",  "links": {    "task_queue": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TaskQueues/WQaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",    "workflow": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workflows/WWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",    "workspace": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",    "reservations": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Tasks/WTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Reservations"  }}