Menu

Expand
Rate this page:

Thanks for rating this page!

We are always striving to improve our documentation quality, and your feedback is valuable to us. How could this documentation serve you better?

REST API: Worker Statistics

TaskRouter provides real time and historical statistics for Workers.

Actions


Workers Statistics

Retrieve statistics for all workers in workspace.

Resource URI

GET /v1/Workspaces/{WorkspaceSid}/Workers/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 string of the format: yyyy-MM-dd’T’HH:mm:ss’Z’.
        EndDate Filter cumulative statistics by a end date. This is helpful for defining a range of statistics to capture. Input is a string of the format: yyyy-MM-dd’T’HH:mm:ss’Z’.
        TaskQueueSid Filter the real-time and cumulative statistics based on Workers tied to a particular queue
        TaskQueueName Filter the real-time and cumulative statistics based on Workers tied to a particular queue
        TaskChannel Filter cumulative statistics by TaskChannel. Takes in a Unique Name ("voice", "sms", "default", etc.) or a TaskChannelSid.

        Important: This resource is not accessible if your Workspace exceeds 100 workers. Please contact support for additional assistance.

        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 list of Workers include the following:

        Field Description
        TotalWorkers The total number of Workers
        ActivityStatistics The current Worker status count breakdown by Activity

        Cumulative

        Cumulative statistics relating to a list of Workers include the following over the interval:

        Field 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

        Workers RealTime Statistics

        If you are only concerned with the real time statistics of the workers in your workspace, you can utilize the below endpoint.

        Resource URI

        GET /v1/Workspaces/{WorkspaceSid}/Workers/RealTimeStatistics
        
              
              
              
              
              Parameter Description
              TaskQueueSid Filter the real-time statistics based on Workers tied to a particular queue
              TaskQueueName Filter the real-time statistics based on Workers tied to a particular queue

              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 list of Workers include the following:

              Field Description
              TotalWorkers The total number of Workers
              ActivityStatistics The current Worker status count breakdown by Activity

              Workers 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}/Workers/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 string of the format: yyyy-MM-dd’T’HH:mm:ss’Z’.
                    EndDate Filter cumulative statistics by a end date. This is helpful for defining a range of statistics to capture. Input is a string of the format: yyyy-MM-dd’T’HH:mm:ss’Z’.
                    TaskQueueSid Filter cumulative statistics based on Workers tied to a particular queue
                    TaskQueueName Filter cumulative statistics based on Workers tied to a particular queue
                    TaskChannel Filter cumulative statistics by TaskChannel. Takes in a Unique Name ("voice", "sms", "default", etc.) or a TaskChannelSid.

                    Note: Minutes cannot be used in combination with StartDate and EndDate parameters. If no parameters are passed, 15 minutes will be the default.

                    Cumulative

                    Cumulative statistics relating to a list of Workers include the following over the interval:

                    Field 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

                    Worker Statistics

                    Resource URI

                    GET /v1/Workspaces/{WorkspaceSid}/Workers/{WorkerSid}/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 a 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.

                          Note: Minutes cannot be used in combination with StartDate and EndDate parameters. If no parameters are passed, 15 minutes will be the default.

                          Cumulative

                          Cumulative statistics relating to a Worker include the following over the interval:

                          Field 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
                          ActivityDurations The minimum, average, maximum and total time (in seconds) this Worker spent in each Activity
                          Rate this page:

                          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.