Worker Statistics Resource
TaskRouter provides real-time, cumulative, and historical statistics for Workers. Historical statistics allow you to analyze data from the past 30 days. There are various APIs for retrieving the data that is meaningful to your business.
These resources may not be accessible if your Workspace exceeds 100 workers. Please contact support for additional assistance.
WorkerStatistics Properties
Resource Properties in REST API format | |
---|---|
realtime
|
An object that contains the real-time statistics for the Worker. |
cumulative
|
An object that contains the cumulative statistics for the Worker. |
account_sid
|
The SID of the Account that created the Worker resource. |
workspace_sid
|
The SID of the Workspace that contains the Worker. |
url
|
The absolute URL of the Worker statistics resource. |
Minutes cannot be used in combination with StartDate and EndDate parameters. If no parameters are passed, 15 minutes will be the default.
Fetch All Worker Statistics
GET /v1/Workspaces/{WorkspaceSid}/Workers/Statistics
Parameters in REST API format | |
---|---|
workspace_sid
Path
|
The SID of the Workspace with the Worker to fetch. |
minutes
Optional
|
Only calculate statistics since this many minutes in the past. The default 15 minutes. This is helpful for displaying statistics for the last 15 minutes, 240 minutes (4 hours), and 480 minutes (8 hours) to see trends. |
start_date
Optional
|
Only calculate statistics from this date and time and later, specified in ISO 8601 format. |
end_date
Optional
|
Only calculate statistics from this date and time and earlier, specified in GMT as an ISO 8601 date-time. |
task_queue_sid
Optional
|
The SID of the TaskQueue for which to fetch Worker statistics. |
task_queue_name
Optional
|
The |
friendly_name
Optional
|
Only include Workers with |
task_channel
Optional
|
Only calculate statistics on this TaskChannel. Can be the TaskChannel's SID or its |
Fetch Real-Time Worker Statistics
We recommended leveraging caching when utilizing this endpoint from your backend application to ensure this endpoint can support your scaling needs.
In scenarios where this endpoint would be used from a client application, we recommend implementing a sync layer, e.g., via Twilio Sync, to help synchronize this endpoint’s state across all clients, and to ensure this endpoint can scale with your user growth.
GET /v1/Workspaces/{WorkspaceSid}/Workers/RealTimeStatistics
Parameters in REST API format | |
---|---|
workspace_sid
Path
|
The SID of the Workspace with the resource to fetch. |
task_channel
Optional
|
Only calculate real-time statistics on this TaskChannel. Can be the TaskChannel's SID or its |
Real-time statistics relating to a list of Workers include the following:
Property | Description |
---|---|
TotalWorkers | The total number of Workers |
ActivityStatistics | The current Worker status count breakdown by Activity |
Fetch Cumulative Worker Statistics
Cumulative statistics allow you to analyze Worker data from the past 30 days.
GET /v1/Workspaces/{WorkspaceSid}/Workers/CumulativeStatistics
Parameters in REST API format | |
---|---|
workspace_sid
Path
|
The SID of the Workspace with the resource to fetch. |
end_date
Optional
|
Only calculate statistics from this date and time and earlier, specified in ISO 8601 format. |
minutes
Optional
|
Only calculate statistics since this many minutes in the past. The default 15 minutes. This is helpful for displaying statistics for the last 15 minutes, 240 minutes (4 hours), and 480 minutes (8 hours) to see trends. |
start_date
Optional
|
Only calculate statistics from this date and time and later, specified in ISO 8601 format. |
task_channel
Optional
|
Only calculate cumulative statistics on this TaskChannel. Can be the TaskChannel's SID or its |
Cumulative statistics relating to a list of Workers include the following over the interval:
Property | Description |
---|---|
ReservationsCreated | The total number of Reservations that were created |
ReservationsAccepted | The total number of Reservations that were accepted |
ReservationsRejected | The total number of Reservations that were rejected |
ReservationsTimedOut | The total number of Reservations that were timed out |
ReservationsCanceled | The total number of Reservations that were canceled |
ReservationsRescinded | The total number of Reservations that were rescinded |
ActivityDurations | The minimum, average, maximum and total time (in seconds) Workers spent in each Activity |
Fetch A Specific Worker's Statistics
GET /v1/Workspaces/{WorkspaceSid}/Workers/{WorkerSid}/Statistics
Parameters in REST API format | |
---|---|
workspace_sid
Path
|
The SID of the Workspace with the WorkerChannel to fetch. |
worker_sid
Path
|
The SID of the Worker with the WorkerChannel to fetch. |
minutes
Optional
|
Only calculate statistics since this many minutes in the past. The default 15 minutes. This is helpful for displaying statistics for the last 15 minutes, 240 minutes (4 hours), and 480 minutes (8 hours) to see trends. |
start_date
Optional
|
Only calculate statistics from this date and time and later, specified in ISO 8601 format. |
end_date
Optional
|
Only include usage that occurred on or before this date, specified in GMT as an ISO 8601 date-time. |
task_channel
Optional
|
Only calculate statistics on this TaskChannel. Can be the TaskChannel's SID or its |
Need some help?
We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd by visiting Twilio's Stack Overflow Collective or browsing the Twilio tag on Stack Overflow.