Menu

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: Workflow Statistics

TaskRouter provides real time and historical statistics for Workflows.

Workflow Statistics

Resource URI

GET /v1/Workspaces/{WorkspaceSid}/Workflows/{WorkflowSid}/Statistics
Loading Code Sample...
      
      
      
      
      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:

      Field 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:

      Field 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.

      Resource URI

      GET /v1/Workspaces/{WorkspaceSid}/Workflows/{WorkflowSid}/RealTimeStatistics
      
      Loading Code Sample...
          
          
          
          
          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:

          Field 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.

          Resource URI

          GET /v1/Workspaces/{WorkspaceSid}/Workflows/{WorkflowSid}/CumulativeStatistics
          
          Loading Code Sample...
              
              
              
              
              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:

              Field 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.

              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.

              Loading Code Sample...