REST API: Workspace Statistics
TaskRouter provides real time and historical statistics for Workspaces.
Workspace Statistics
Resource URI
GET /v1/Workspaces/{WorkspaceSid}/Statistics
Parameter | Description |
---|---|
Minutes | Filter cumulative statistics by up to ‘x’ minutes in the past. This is helpful for statistics for the last 15 minutes, 240 minutes (4 hours), and 480 minutes (8 hours) to see trends. Defaults to 15 minutes. |
StartDate | Filter cumulative statistics by a start date. This is helpful for defining a range of statistics to capture. Input is a GMT ISO 8601 Timestamp |
EndDate | Filter cumulative statistics by an end date. This is helpful for defining a range of statistics to capture. Input is a GMT ISO 8601 Timestamp |
TaskChannel | Filter real-time and cumulative statistics by TaskChannel. Takes in a Unique Name ("voice", "sms", "default", etc.) or a TaskChannelSid. |
SplitByWaitTime | A comma separated values for viewing splits of tasks canceled and accepted above the given threshold in seconds. Ex: "5,30" would show splits of tasks that were canceled or accepted before or after 5 seconds and respectively, 30 seconds. This is great for showing short abandoned tasks or tasks that failed to meet your SLA. |
Note: Minutes cannot be used in combination with StartDate and EndDate parameters. If no parameters are passed, 15 minutes will be the default.
Real Time
Real time statistics relating to a Workspace include the following:
Property | Description |
---|---|
LongestTaskWaitingSid | The ID of the longest waiting Task |
LongestTaskWaitingAge | The age of the longest waiting Task |
TotalTasks | The total number of Tasks |
TotalWorkers | The total number of Workers in the workspace |
TasksByStatus | The Tasks broken down by status (for example: pending: 1, reserved = 3, assigned = 2, completed = 5) |
ActivityStatistics | A breakdown of Workers by Activity (for example: Idle : 0, Busy: 5, Reserved = 0, Offline = 2) |
Cumulative
Cumulative statistics relating to a Workspace include the following over the interval:
Property | Description |
---|---|
TasksCreated | The total number of Tasks created |
TasksCanceled | The total number of Tasks that were canceled |
TasksCompleted | The total number of Tasks that were completed |
TasksDeleted | The total number of Tasks that were deleted |
TasksMoved | The total number of Tasks that were moved from one queue to another |
TasksTimedOutInWorkflow | The total number of Tasks that were timed out of their Workflows (and deleted) |
AvgTaskAcceptanceTime | The average time (in seconds) from Task creation to acceptance |
ReservationsCreated | The total number of Reservations that were created for Workers |
ReservationsAccepted | The total number of Reservations accepted by Workers |
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 |
WaitDurationUntilCanceled | The wait duration stats (avg, min, max, total) for tasks that were canceled. |
WaitDurationUntilAccepted | The wait duration stats (avg, min, max, total) for tasks that were accepted. |
SplitByWaitTime | The splits of the tasks canceled and accepted based on the provided SplitByWaitTime parameter. |
Workspace RealTime Statistics
If you are only concerned with the real time statistics of your workspace, you can utilize the below endpoint.
Resource URI
GET /v1/Workspaces/{WorkspaceSid}/RealTimeStatistics
Parameter | Description |
---|---|
TaskChannel | Filter real-time statistics by TaskChannel. Takes in a Unique Name ("voice", "sms", "default", etc.) or a TaskChannelSid. |
Real Time
Real time statistics relating to a Workspace include the following:
Property | Description |
---|---|
LongestTaskWaitingSid | The ID of the longest waiting Task |
LongestTaskWaitingAge | The age of the longest waiting Task |
TotalTasks | The total number of Tasks |
TotalWorkers | The total number of Workers in the workspace |
TasksByStatus | The Tasks broken down by status (for example: pending: 1, reserved = 3, assigned = 2, completed = 5) |
ActivityStatistics | A breakdown of Workers by Activity (for example: Idle : 0, Busy: 5, Reserved = 0, Offline = 2) |
Workspace Cumulative Statistics
If you are only concerned with the cumulative statistics over a certain time period, you can utilize the below endpoint.
Resource URI
GET /v1/Workspaces/{WorkspaceSid}/CumulativeStatistics
Parameter | Description |
---|---|
Minutes | Filter cumulative statistics by up to ‘x’ minutes in the past. This is helpful for statistics for the last 15 minutes, 240 minutes (4 hours), and 480 minutes (8 hours) to see trends. Defaults to 15 minutes. |
StartDate | Filter cumulative statistics by a start date. This is helpful for defining a range of statistics to capture. Input is a GMT ISO 8601 Timestamp |
EndDate | Filter cumulative statistics by an end date. This is helpful for defining a range of statistics to capture. Input is a GMT ISO 8601 Timestamp |
TaskChannel | Filter cumulative statistics by TaskChannel. Takes in a Unique Name ("voice", "sms", "default", etc.) or a TaskChannelSid. |
SplitByWaitTime | A comma separated values for viewing splits of tasks canceled and accepted above the given threshold in seconds. Ex: "5,30" would show splits of tasks that were canceled or accepted before or after 5 seconds and respectively, 30 seconds. This is great for showing short abandoned tasks or tasks that failed to meet your SLA. |
Note: Minutes cannot be used in combination with StartDate and EndDate parameters. If no parameters are passed, 15 minutes will be the default.
Cumulative statistics relating to a Workspace include the following over the interval:
Property | Description |
---|---|
TasksCreated | The total number of Tasks created |
TasksCanceled | The total number of Tasks that were canceled |
TasksCompleted | The total number of Tasks that were completed |
TasksDeleted | The total number of Tasks that were deleted |
TasksMoved | The total number of Tasks that were moved from one queue to another |
TasksTimedOutInWorkflow | The total number of Tasks that were timed out of their Workflows (and deleted) |
AvgTaskAcceptanceTime | The average time (in seconds) from Task creation to acceptance |
ReservationsCreated | The total number of Reservations that were created for Workers |
ReservationsAccepted | The total number of Reservations accepted by Workers |
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 |
WaitDurationUntilCanceled | The wait duration stats (avg, min, max, total) for tasks that were canceled. |
WaitDurationUntilAccepted | The wait duration stats (avg, min, max, total) for tasks that were accepted. |
SplitByWaitTime | The splits of the tasks canceled and accepted based on the provided SplitByWaitTime parameter. |
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 browsing the Twilio tag on Stack Overflow.