TaskRouter logs Events for each state change in the Workspace for the purpose of historical reporting and auditing; it keeps that data for 30 days. To learn more about what events to expect and how they work, please visit the Event Reference page.
Pagination is not supported under this resource. Please avoid usage of the page
query parameter.
The SID of the Account that created the Event resource.
^AC[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The SID of the resource that triggered the event.
^[a-zA-Z]{2}[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The time the event was sent, specified in ISO 8601 format.
The SID of the object the event is most relevant to, such as a TaskSid, ReservationSid, or a WorkerSid.
^[a-zA-Z]{2}[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The type of object the event is most relevant to, such as a Task, Reservation, or a Worker).
The unique string that we created to identify the Event resource.
^EV[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The SID of the Workspace that contains the Event.
^WS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
GET https://taskrouter.twilio.com/v1/Workspaces/{WorkspaceSid}/Events/{Sid}
The SID of the Workspace with the Event to fetch.
^WS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The SID of the Event resource to fetch.
^EV[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function fetchEvent() {11const event = await client.taskrouter.v112.workspaces("WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.events("EVaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")14.fetch();1516console.log(event.accountSid);17}1819fetchEvent();
1{2"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"actor_sid": "WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",4"actor_type": "workspace",5"actor_url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",6"description": "Worker JustinWorker updated to Idle Activity",7"event_data": {8"worker_activity_name": "Offline",9"worker_activity_sid": "WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",10"worker_attributes": "{}",11"worker_name": "JustinWorker",12"worker_sid": "WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",13"worker_time_in_previous_activity": "26",14"worker_time_in_previous_activity_ms": "26123",15"workspace_name": "WorkspaceName",16"workspace_sid": "WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"17},18"event_date": "2015-02-07T00:32:41Z",19"event_date_ms": 987654321111,20"event_type": "worker.activity",21"resource_sid": "WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",22"resource_type": "worker",23"resource_url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",24"sid": "EVaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",25"source": "twilio",26"source_ip_address": "1.2.3.4",27"workspace_sid": "WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",28"url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Events/EVaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"29}
GET https://taskrouter.twilio.com/v1/Workspaces/{WorkspaceSid}/Events
The SID of the Workspace with the Events to read. Returns only the Events that pertain to the specified Workspace.
^WS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
Only include Events that occurred on or before this date, specified in GMT as an ISO 8601 date-time.
The type of Events to read. Returns only Events of the type specified.
The period of events to read in minutes. Returns only Events that occurred since this many minutes in the past. The default is 15
minutes. Task Attributes for Events occuring more 43,200 minutes ago will be redacted.
The SID of the Reservation with the Events to read. Returns only Events that pertain to the specified Reservation.
^WR[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
Only include Events from on or after this date and time, specified in ISO 8601 format. Task Attributes for Events older than 30 days will be redacted.
The SID of the TaskQueue with the Events to read. Returns only the Events that pertain to the specified TaskQueue.
^WQ[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The SID of the Task with the Events to read. Returns only the Events that pertain to the specified Task.
^WT[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The SID of the Worker with the Events to read. Returns only the Events that pertain to the specified Worker.
^WK[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The SID of the Workflow with the Events to read. Returns only the Events that pertain to the specified Workflow.
^WW[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The TaskChannel with the Events to read. Returns only the Events that pertain to the specified TaskChannel.
The SID of the Event resource to read.
^EV[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
How many resources to return in each list page. The default is 50, and the maximum is 1000.
1
Maximum: 1000
The page token. This is provided by the API.
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function listEvent() {11const events = await client.taskrouter.v112.workspaces("WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.events.list({ limit: 20 });1415events.forEach((e) => console.log(e.accountSid));16}1718listEvent();
1{2"events": [3{4"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",5"actor_sid": "WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",6"actor_type": "workspace",7"actor_url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",8"description": "Worker JustinWorker updated to Idle Activity",9"event_data": {10"worker_activity_name": "Offline",11"worker_activity_sid": "WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",12"worker_attributes": "{}",13"worker_name": "JustinWorker",14"worker_sid": "WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",15"worker_time_in_previous_activity": "26",16"worker_time_in_previous_activity_ms": "26123",17"workspace_name": "WorkspaceName",18"workspace_sid": "WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"19},20"event_date": "2015-02-07T00:32:41Z",21"event_date_ms": 987654321111,22"event_type": "worker.activity",23"resource_sid": "WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",24"resource_type": "worker",25"resource_url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",26"sid": "EVaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",27"source": "twilio",28"source_ip_address": "1.2.3.4",29"workspace_sid": "WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",30"url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Events/EVaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"31}32],33"meta": {34"first_page_url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Events?TaskQueueSid=WQaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&StartDate=2008-01-02T00%3A00%3A00Z&EndDate=2008-01-03T00%3A00%3A00Z&WorkerSid=WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&EventType=reservation.created&TaskSid=WTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&WorkflowSid=WWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&ReservationSid=WRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&PageSize=50&Page=0",35"key": "events",36"next_page_url": null,37"page": 0,38"page_size": 50,39"previous_page_url": null,40"url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Events?TaskQueueSid=WQaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&StartDate=2008-01-02T00%3A00%3A00Z&EndDate=2008-01-03T00%3A00%3A00Z&WorkerSid=WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&EventType=reservation.created&TaskSid=WTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&WorkflowSid=WWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&ReservationSid=WRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&PageSize=50&Page=0"41}42}
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function listEvent() {11const events = await client.taskrouter.v112.workspaces("WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.events.list({14startDate: new Date("2008-03-18 00:00:00"),15limit: 20,16});1718events.forEach((e) => console.log(e.accountSid));19}2021listEvent();
1{2"events": [3{4"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",5"actor_sid": "WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",6"actor_type": "workspace",7"actor_url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",8"description": "Worker JustinWorker updated to Idle Activity",9"event_data": {10"worker_activity_name": "Offline",11"worker_activity_sid": "WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",12"worker_attributes": "{}",13"worker_name": "JustinWorker",14"worker_sid": "WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",15"worker_time_in_previous_activity": "26",16"worker_time_in_previous_activity_ms": "26123",17"workspace_name": "WorkspaceName",18"workspace_sid": "WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"19},20"event_date": "2015-02-07T00:32:41Z",21"event_date_ms": 987654321111,22"event_type": "worker.activity",23"resource_sid": "WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",24"resource_type": "worker",25"resource_url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",26"sid": "EVaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",27"source": "twilio",28"source_ip_address": "1.2.3.4",29"workspace_sid": "WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",30"url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Events/EVaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"31}32],33"meta": {34"first_page_url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Events?TaskQueueSid=WQaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&StartDate=2008-01-02T00%3A00%3A00Z&EndDate=2008-01-03T00%3A00%3A00Z&WorkerSid=WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&EventType=reservation.created&TaskSid=WTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&WorkflowSid=WWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&ReservationSid=WRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&PageSize=50&Page=0",35"key": "events",36"next_page_url": null,37"page": 0,38"page_size": 50,39"previous_page_url": null,40"url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Events?TaskQueueSid=WQaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&StartDate=2008-01-02T00%3A00%3A00Z&EndDate=2008-01-03T00%3A00%3A00Z&WorkerSid=WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&EventType=reservation.created&TaskSid=WTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&WorkflowSid=WWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&ReservationSid=WRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&PageSize=50&Page=0"41}42}
If the StartDate
of the Events request is greater than 30 days in the past then the query will be serviced a 400
-error response.