Menu

Expand
Rate this page:

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
object Not PII

An object that contains the real-time statistics for the Worker.

cumulative
object Not PII

An object that contains the cumulative statistics for the Worker.

account_sid
sid<AC> Not PII

The SID of the Account that created the Worker resource.

workspace_sid
sid<WS> Not PII

The SID of the Workspace that contains the Worker.

url
url Not PII

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
get sid<WS> Not PII

The SID of the Workspace with the Worker to fetch.

minutes
Optional
get integer Not PII

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
get date_time<iso8601> Not PII

Only calculate statistics from this date and time and later, specified in ISO 8601 format.

end_date
Optional
get date_time<iso8601> Not PII

Only calculate statistics from this date and time and earlier, specified in GMT as an ISO 8601 date-time.

task_queue_sid
Optional
get sid<WQ> Not PII

The SID of the TaskQueue for which to fetch Worker statistics.

task_queue_name
Optional
get string Not PII

The friendly_name of the TaskQueue for which to fetch Worker statistics.

friendly_name
Optional
get string Not PII

Only include Workers with friendly_name values that match this parameter.

task_channel
Optional
get string Not PII

Only calculate statistics on this TaskChannel. Can be the TaskChannel's SID or its unique_name, such as voice, sms, or default.

Loading Code Sample...
        
        

        Fetch a Worker Statistics Resource

        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
        get sid<WS> Not PII

        The SID of the Workspace with the resource to fetch.

        task_channel
        Optional
        get string Not PII

        Only calculate real-time statistics on this TaskChannel. Can be the TaskChannel's SID or its unique_name, such as voice, sms, or default.

        Loading Code Sample...
              
              

              Retrieve Real-Time Worker Statistics

              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
              get sid<WS> Not PII

              The SID of the Workspace with the resource to fetch.

              end_date
              Optional
              get date_time<iso8601> Not PII

              Only calculate statistics from this date and time and earlier, specified in ISO 8601 format.

              minutes
              Optional
              get integer Not PII

              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
              get date_time<iso8601> Not PII

              Only calculate statistics from this date and time and later, specified in ISO 8601 format.

              task_channel
              Optional
              get string Not PII

              Only calculate cumulative statistics on this TaskChannel. Can be the TaskChannel's SID or its unique_name, such as voice, sms, or default.

              Loading Code Sample...
                    
                    

                    Retrieve Cumulative Worker Statistics

                    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
                    get sid<WS> Not PII

                    The SID of the Workspace with the WorkerChannel to fetch.

                    worker_sid
                    Path
                    get sid<WK> Not PII

                    The SID of the Worker with the WorkerChannel to fetch.

                    minutes
                    Optional
                    get integer Not PII

                    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
                    get date_time<iso8601> Not PII

                    Only calculate statistics from this date and time and later, specified in ISO 8601 format.

                    end_date
                    Optional
                    get date_time<iso8601> Not PII

                    Only include usage that occurred on or before this date, specified in GMT as an ISO 8601 date-time.

                    task_channel
                    Optional
                    get string Not PII

                    Only calculate statistics on this TaskChannel. Can be the TaskChannel's SID or its unique_name, such as voice, sms, or default.

                    Loading Code Sample...
                          
                          

                          Retrieve a Specific Worker's Statistics

                          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 by visiting Twilio's Stack Overflow Collective or browsing the Twilio tag on Stack Overflow.

                          Loading Code Sample...
                                
                                
                                

                                Thank you for your feedback!

                                Please select the reason(s) for your feedback. The additional information you provide helps us improve our documentation:

                                Sending your feedback...
                                🎉 Thank you for your feedback!
                                Something went wrong. Please try again.

                                Thanks for your feedback!

                                thanks-feedback-gif