Skip to contentSkip to navigationSkip to topbar
Rate this page:
On this page

Event Resource


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.


Event Properties

event-properties page anchor
(warning)

Warning

Pagination is not supported under this resource. Please avoid usage of the page query parameter.

Resource properties
account_sidtype: SID<AC>
Not PII

The SID of the Account(link takes you to an external page) that created the Event resource.

Pattern:
^AC[0-9a-fA-F]{32}$
Min length:
34
Max length:
34

actor_sidtype: SID

The SID of the resource that triggered the event.

Pattern:
^[a-zA-Z]{2}[0-9a-fA-F]{32}$
Min length:
34
Max length:
34

actor_typetype: string

The type of resource that triggered the event.


actor_urltype: string<uri>

The absolute URL of the resource that triggered the event.


descriptiontype: string

A description of the event.


event_datatype: object

Data about the event. For more information, see Event types(link takes you to an external page).


event_datetype: string<date-time>

The time the event was sent, specified in ISO 8601(link takes you to an external page) format.


event_date_mstype: integer<int64>

The time the event was sent in milliseconds.


event_typetype: string

The identifier for the event.


resource_sidtype: SID

The SID of the object the event is most relevant to, such as a TaskSid, ReservationSid, or a WorkerSid.

Pattern:
^[a-zA-Z]{2}[0-9a-fA-F]{32}$
Min length:
34
Max length:
34

resource_typetype: string

The type of object the event is most relevant to, such as a Task, Reservation, or a Worker).


resource_urltype: string<uri>

The URL of the resource the event is most relevant to.


sidtype: SID<EV>

The unique string that we created to identify the Event resource.

Pattern:
^EV[0-9a-fA-F]{32}$
Min length:
34
Max length:
34

sourcetype: string

Where the Event originated.


source_ip_addresstype: string

The IP from which the Event originated.


urltype: string<uri>

The absolute URL of the Event resource.


workspace_sidtype: SID<WS>

The SID of the Workspace that contains the Event.

Pattern:
^WS[0-9a-fA-F]{32}$
Min length:
34
Max length:
34

GET https://taskrouter.twilio.com/v1/Workspaces/{WorkspaceSid}/Events/{Sid}

Parameters

fetch-parameters page anchor
URI parameters
WorkspaceSidtype: SID<WS>
Path ParameterNot PII

The SID of the Workspace with the Event to fetch.

Pattern:
^WS[0-9a-fA-F]{32}$
Min length:
34
Max length:
34

Sidtype: SID<EV>
Path ParameterNot PII

The SID of the Event resource to fetch.

Pattern:
^EV[0-9a-fA-F]{32}$
Min length:
34
Max length:
34
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_11
// Download the helper library from https://www.twilio.com/docs/node/install
_11
// Find your Account SID and Auth Token at twilio.com/console
_11
// and set the environment variables. See http://twil.io/secure
_11
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_11
const authToken = process.env.TWILIO_AUTH_TOKEN;
_11
const client = require('twilio')(accountSid, authToken);
_11
_11
client.taskrouter.v1.workspaces('WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11
.events('EVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11
.fetch()
_11
.then(event => console.log(event.actorSid));

Output

_29
{
_29
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_29
"actor_sid": "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_29
"actor_type": "workspace",
_29
"actor_url": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_29
"description": "Worker JustinWorker updated to Idle Activity",
_29
"event_data": {
_29
"worker_activity_name": "Offline",
_29
"worker_activity_sid": "WAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_29
"worker_attributes": {},
_29
"worker_name": "JustinWorker",
_29
"worker_sid": "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_29
"worker_time_in_previous_activity": "26",
_29
"worker_time_in_previous_activity_ms": "26123",
_29
"workspace_name": "WorkspaceName",
_29
"workspace_sid": "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_29
},
_29
"event_date": "2015-02-07T00:32:41Z",
_29
"event_date_ms": 987654321111,
_29
"event_type": "worker.activity",
_29
"resource_sid": "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_29
"resource_type": "worker",
_29
"resource_url": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers/WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_29
"sid": "EVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_29
"source": "twilio",
_29
"source_ip_address": "1.2.3.4",
_29
"workspace_sid": "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_29
"url": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Events/EVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_29
}


GET https://taskrouter.twilio.com/v1/Workspaces/{WorkspaceSid}/Events

URI parameters
WorkspaceSidtype: SID<WS>
Path ParameterNot PII

The SID of the Workspace with the Events to read. Returns only the Events that pertain to the specified Workspace.

Pattern:
^WS[0-9a-fA-F]{32}$
Min length:
34
Max length:
34

EndDatetype: string<date-time>
Query ParameterNot PII

Only include Events that occurred on or before this date, specified in GMT as an ISO 8601(link takes you to an external page) date-time.


EventTypetype: string
Query ParameterNot PII

The type of Events to read. Returns only Events of the type specified.


Minutestype: integer
Query ParameterNot PII

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.


ReservationSidtype: SID<WR>
Query ParameterNot PII

The SID of the Reservation with the Events to read. Returns only Events that pertain to the specified Reservation.

Pattern:
^WR[0-9a-fA-F]{32}$
Min length:
34
Max length:
34

StartDatetype: string<date-time>
Query ParameterNot PII

Only include Events from on or after this date and time, specified in ISO 8601(link takes you to an external page) format. Task Attributes for Events older than 30 days will be redacted.


TaskQueueSidtype: SID<WQ>
Query ParameterNot PII

The SID of the TaskQueue with the Events to read. Returns only the Events that pertain to the specified TaskQueue.

Pattern:
^WQ[0-9a-fA-F]{32}$
Min length:
34
Max length:
34

TaskSidtype: SID<WT>
Query ParameterNot PII

The SID of the Task with the Events to read. Returns only the Events that pertain to the specified Task.

Pattern:
^WT[0-9a-fA-F]{32}$
Min length:
34
Max length:
34

WorkerSidtype: SID<WK>
Query ParameterNot PII

The SID of the Worker with the Events to read. Returns only the Events that pertain to the specified Worker.

Pattern:
^WK[0-9a-fA-F]{32}$
Min length:
34
Max length:
34

WorkflowSidtype: SID<WW>
Query ParameterNot PII

The SID of the Workflow with the Events to read. Returns only the Events that pertain to the specified Workflow.

Pattern:
^WW[0-9a-fA-F]{32}$
Min length:
34
Max length:
34

TaskChanneltype: string
Query ParameterNot PII

The TaskChannel with the Events to read. Returns only the Events that pertain to the specified TaskChannel.


Sidtype: SID<EV>
Query ParameterNot PII

The SID of the Event resource to read.

Pattern:
^EV[0-9a-fA-F]{32}$
Min length:
34
Max length:
34

PageSizetype: integer
Query ParameterNot PII

How many resources to return in each list page. The default is 50, and the maximum is 1000.

Minimum:
1

Pagetype: integer
Query ParameterNot PII

The page index. This value is simply for client state.

Minimum:
0

PageTokentype: string
Query ParameterNot PII

The page token. This is provided by the API.

List all Events from the last 15 minutes

list-all-events-from-the-last-15-minutes page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_11
// Download the helper library from https://www.twilio.com/docs/node/install
_11
// Find your Account SID and Auth Token at twilio.com/console
_11
// and set the environment variables. See http://twil.io/secure
_11
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_11
const authToken = process.env.TWILIO_AUTH_TOKEN;
_11
const client = require('twilio')(accountSid, authToken);
_11
_11
client.taskrouter.v1.workspaces('WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11
.events
_11
.list({limit: 20})
_11
.then(events => events.forEach(e => console.log(e.sid)));

Output

_42
{
_42
"events": [
_42
{
_42
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_42
"actor_sid": "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_42
"actor_type": "workspace",
_42
"actor_url": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_42
"description": "Worker JustinWorker updated to Idle Activity",
_42
"event_data": {
_42
"worker_activity_name": "Offline",
_42
"worker_activity_sid": "WAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_42
"worker_attributes": {},
_42
"worker_name": "JustinWorker",
_42
"worker_sid": "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_42
"worker_time_in_previous_activity": "26",
_42
"worker_time_in_previous_activity_ms": "26123",
_42
"workspace_name": "WorkspaceName",
_42
"workspace_sid": "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_42
},
_42
"event_date": "2015-02-07T00:32:41Z",
_42
"event_date_ms": 987654321111,
_42
"event_type": "worker.activity",
_42
"resource_sid": "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_42
"resource_type": "worker",
_42
"resource_url": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers/WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_42
"sid": "EVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_42
"source": "twilio",
_42
"source_ip_address": "1.2.3.4",
_42
"workspace_sid": "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_42
"url": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Events/EVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_42
}
_42
],
_42
"meta": {
_42
"first_page_url": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Events?TaskQueueSid=WQXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&StartDate=2008-01-02T00%3A00%3A00Z&EndDate=2008-01-03T00%3A00%3A00Z&WorkerSid=WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&EventType=reservation.created&TaskSid=WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&WorkflowSid=WWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&ReservationSid=WRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&PageSize=50&Page=0",
_42
"key": "events",
_42
"next_page_url": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Events?TaskQueueSid=WQXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&StartDate=2008-01-02T00%3A00%3A00Z&EndDate=2008-01-03T00%3A00%3A00Z&WorkerSid=WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&EventType=reservation.created&TaskSid=WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&WorkflowSid=WWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&ReservationSid=WRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&PageSize=50&Page=1",
_42
"page": 0,
_42
"page_size": 50,
_42
"previous_page_url": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Events?TaskQueueSid=WQXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&StartDate=2008-01-02T00%3A00%3A00Z&EndDate=2008-01-03T00%3A00%3A00Z&WorkerSid=WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&EventType=reservation.created&TaskSid=WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&WorkflowSid=WWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&ReservationSid=WRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&PageSize=50&Page=0",
_42
"url": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Events?TaskQueueSid=WQXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&StartDate=2008-01-02T00%3A00%3A00Z&EndDate=2008-01-03T00%3A00%3A00Z&WorkerSid=WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&EventType=reservation.created&TaskSid=WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&WorkflowSid=WWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&ReservationSid=WRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&PageSize=50&Page=0"
_42
}
_42
}

List all events from a specified start date

list-all-events-from-a-specified-start-date page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_14
// Download the helper library from https://www.twilio.com/docs/node/install
_14
// Find your Account SID and Auth Token at twilio.com/console
_14
// and set the environment variables. See http://twil.io/secure
_14
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_14
const authToken = process.env.TWILIO_AUTH_TOKEN;
_14
const client = require('twilio')(accountSid, authToken);
_14
_14
client.taskrouter.v1.workspaces('WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_14
.events
_14
.list({
_14
startDate: new Date(Date.UTC(2008, 2, 18, 0, 0, 0)),
_14
limit: 20
_14
})
_14
.then(events => events.forEach(e => console.log(e.sid)));

Output

_42
{
_42
"events": [
_42
{
_42
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_42
"actor_sid": "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_42
"actor_type": "workspace",
_42
"actor_url": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_42
"description": "Worker JustinWorker updated to Idle Activity",
_42
"event_data": {
_42
"worker_activity_name": "Offline",
_42
"worker_activity_sid": "WAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_42
"worker_attributes": {},
_42
"worker_name": "JustinWorker",
_42
"worker_sid": "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_42
"worker_time_in_previous_activity": "26",
_42
"worker_time_in_previous_activity_ms": "26123",
_42
"workspace_name": "WorkspaceName",
_42
"workspace_sid": "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_42
},
_42
"event_date": "2015-02-07T00:32:41Z",
_42
"event_date_ms": 987654321111,
_42
"event_type": "worker.activity",
_42
"resource_sid": "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_42
"resource_type": "worker",
_42
"resource_url": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers/WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_42
"sid": "EVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_42
"source": "twilio",
_42
"source_ip_address": "1.2.3.4",
_42
"workspace_sid": "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_42
"url": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Events/EVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_42
}
_42
],
_42
"meta": {
_42
"first_page_url": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Events?TaskQueueSid=WQXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&StartDate=2008-01-02T00%3A00%3A00Z&EndDate=2008-01-03T00%3A00%3A00Z&WorkerSid=WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&EventType=reservation.created&TaskSid=WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&WorkflowSid=WWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&ReservationSid=WRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&PageSize=50&Page=0",
_42
"key": "events",
_42
"next_page_url": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Events?TaskQueueSid=WQXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&StartDate=2008-01-02T00%3A00%3A00Z&EndDate=2008-01-03T00%3A00%3A00Z&WorkerSid=WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&EventType=reservation.created&TaskSid=WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&WorkflowSid=WWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&ReservationSid=WRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&PageSize=50&Page=1",
_42
"page": 0,
_42
"page_size": 50,
_42
"previous_page_url": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Events?TaskQueueSid=WQXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&StartDate=2008-01-02T00%3A00%3A00Z&EndDate=2008-01-03T00%3A00%3A00Z&WorkerSid=WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&EventType=reservation.created&TaskSid=WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&WorkflowSid=WWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&ReservationSid=WRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&PageSize=50&Page=0",
_42
"url": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Events?TaskQueueSid=WQXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&StartDate=2008-01-02T00%3A00%3A00Z&EndDate=2008-01-03T00%3A00%3A00Z&WorkerSid=WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&EventType=reservation.created&TaskSid=WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&WorkflowSid=WWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&ReservationSid=WRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&PageSize=50&Page=0"
_42
}
_42
}

(warning)

Warning

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.


Rate this page: