Menu

Expand
Rate this page:

Workflow Statistics Resource

TaskRouter provides real time and historical statistics for Workflows. Historical statistics allow you to analyze Workflow data from the past 30 days.

These resources may not be accessible if your Workspace exceeds 100 workers. Please contact support for additional assistance.

Workflow Statistics

Resource URI

GET /v1/Workspaces/{WorkspaceSid}/Workflows/{WorkflowSid}/Statistics
Loading Code Sample...
        
        

        Retrieve Workflow 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 Workflow 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
        TasksByStatus The Tasks broken down by status (for example: pending: 1, reserved = 3, assigned = 2, completed = 5)

        Cumulative

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

        Property Description
        TasksEntered The total number of Tasks that entered this Workflow
        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.

        Workflow RealTime Statistics

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

        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.

        Resource URI

        GET /v1/Workspaces/{WorkspaceSid}/Workflows/{WorkflowSid}/RealTimeStatistics
        
        Loading Code Sample...
              
              

              Retrieve Workflow RealTime Statistics

              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 Workflow 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
              TasksByStatus The Tasks broken down by status (for example: pending: 1, reserved = 3, assigned = 2, completed = 5)

              Workflow Cumulative Statistics

              If you are only concerned with the cumulative statistics over a certain time period, you can utilize the below endpoint. Cumulative statistics allow you to analyze data from the past 30 days.

              Resource URI

              GET /v1/Workspaces/{WorkspaceSid}/Workflows/{WorkflowSid}/CumulativeStatistics
              
              Loading Code Sample...
                    
                    

                    Retrieve Workflow Cumulative 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 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

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

                    Property Description
                    TasksEntered The total number of Tasks that entered this Workflow
                    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.
                    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