Stats -- Initiate Processing

Begins processing statistics asynchronously, returning a request id to get the status and retrieve the results by calling GET /stats/{request_id}.

Stats for the whole company will be processed by default. An office_id can be provided to limit stats to a single office. A target_id and target_type can be provided to limit stats to a single target.

A company-wide export, meaning a request with no office_id and no target, requires either a company admin's API key or a company-level API key. Without that permission the request fails with a 403 response. The coaching_group and coaching_team flags do not limit the scope on their own, so a request with only those flags still asks for company-wide data and needs the same permission.

Call records (stat_type calls with export_type records) can be limited to a time of day on each day in the date range by passing start_time_of_day and end_time_of_day, for example 17:00 and 20:00. They are evaluated in the request timezone. The start is inclusive and the end is exclusive, and an end_time_of_day earlier than start_time_of_day describes a window that crosses midnight.

Requires scope: stats:export (included by default for unrestricted API keys)

Rate limit: 200 per hour.

Body Params
boolean | null

Whether or not the statistics should be for trainees of the coach group with the given target_id.

boolean | null

Whether or not the statistics should be for trainees of the coach team with the given target_id.

int64 | null
Defaults to 30

End of the date range to get statistics for.

This is the number of days to look back relative to the current day. Used in conjunction with days_ago_start to specify a range.

int64 | null
Defaults to 1

Start of the date range to get statistics for.

This is the number of days to look back relative to the current day. Used in conjunction with days_ago_end to specify a range.

string | null

End of a time-of-day window applied to every day in the date range, as HH:MM or HH:MM:SS in 24-hour time.

Evaluated in the request timezone and exclusive. Only supported for stat_type "calls" with export_type "records". An end_time_of_day earlier than start_time_of_day describes a window that crosses midnight, such as 22:00 to 06:00. The two values must differ.

string
enum
required

Whether to return aggregated statistics (stats), or individual rows for each record (records).

NOTE: For stat_type "csat", "dispositions" or "custom_moments", only "records" is supported.

Allowed:
string | null
enum

This param is only applicable when the stat_type is specified as call. For call stats, group calls by user per day (default), get total metrics by day, or break down by department and call center (office only).

Allowed:
boolean | null

Whether or not the statistics are for the current day.

NOTE: days_ago_start and days_ago_end are ignored if this is passed in.

int64 | null

ID of the office to get statistics for.

If a target_id and target_type are passed in this value is ignored and instead the target is used.

string | null

Start of a time-of-day window applied to every day in the date range, as HH:MM or HH:MM:SS in 24-hour time.

Evaluated in the request timezone and inclusive. Only supported for stat_type "calls" with export_type "records", where it keeps the calls that started at or after this time of day.

string
enum
required

The type of statistics to be returned.

NOTE: if the value is "csat" or "dispositions", target_id and target_type must be specified.

NOTE: "custom_moments" lists every custom moment occurrence, including the trigger phrase that matched. It can be requested for the entire company, a contact center or a user. Offices and departments are not supported, and neither is the coaching_group flag. Only the most recent 90 days are available. The feature must be enabled for the company, otherwise the request fails with "Feature is not enabled."

int64 | null

The target's id.

string | null
enum

Target's type.

string | null
Defaults to UTC

Timezone using a tz database name.

Response

Language
Credentials
Bearer
URL
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json