Calls, minutes, ended reasons, Outcomes and transfers over a window
GET /v1/analytics/calls
| Property | Value |
|---|---|
| Operation | get_call_analytics |
| Group | Call trace and analytics |
| Scope | analytics:read |
| Route class | read |
| Idempotency | No Idempotency-Key |
| Audit | Not audited: A metadata read; the analytics carry counts only. |
| Released in | 1.57.0 |
| Phase 0 host | Served (the hosted api pins 1.65.0) |
Counts the ended Calls of a window or range from the Call rollups (1.57.0, observability-and-analytics.md section 8.1): Calls, answered Calls, billable minutes, ended reasons, transfers, compliance-tagged Policy firings and the Outcome rates of the Calls whose Agent version declares a rollup Outcome field, about two minutes behind finalize (a target). group_by takes the fixed dimensions of ANALYTICS_DIMENSIONS_BY_REPORT.calls; any other answers 422 validation_failed with the issue dimension_not_supported, and a range over 760 days range_too_long.
Request
Set VOCAL_API to the base URL of your API and VOCAL_API_KEY to an API key with the analytics:read scope (Authentication and keys). Replace each placeholder, such as agt_... or <name>, with your own value.
curl "$VOCAL_API/v1/analytics/calls" \
-H "Authorization: Bearer $VOCAL_API_KEY"const response = await fetch(`${process.env.VOCAL_API}/v1/analytics/calls`, {
headers: {
Authorization: `Bearer ${process.env.VOCAL_API_KEY}`,
},
});
console.log(response.status, await response.text());import os
import requests
response = requests.get(
f"{os.environ['VOCAL_API']}/v1/analytics/calls",
headers={
"Authorization": f"Bearer {os.environ['VOCAL_API_KEY']}",
},
)
print(response.status_code, response.text)Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
window | query | AnalyticsWindow | no | |
from | query | RequestTimestamp | no | With window=custom, the start of the range, inclusive (1.57.0). |
to | query | RequestTimestamp | no | With window=custom, the end of the range, exclusive (1.57.0). |
agent_id | query | AgentId | no | Only the Calls of this Agent. |
agent_version | query | integer | no | Only the Calls pinned to this version of agent_id (1.57.0). |
transport | query | CallTransport | no | |
direction | query | CallDirection | no | Only inbound or outbound Calls (1.57.0). |
language | query | LanguageTag | no | Only the Calls in this language (1.57.0). |
environment | query | Environment | no | Only the Calls of this environment (1.57.0). Absent: the API key's environment, or live for a Member session; an API key reads its own environment only. test Calls are rated as live ones and never billed or counted. |
group_by | query | array of string | no | The fixed dimensions to group by, comma-separated, at most three (1.57.0). A dimension the route does not take is refused with 422 validation_failed and the issue dimension_not_supported. |
Responses
| Status | Content type | Shape | Error codes |
|---|---|---|---|
200 | application/json | CallAnalytics | |
400 | application/json | ErrorEnvelope | invalid_request |
401 | application/json | ErrorEnvelope | unauthenticated |
403 | application/json | ErrorEnvelope | forbidden |
422 | application/json | ErrorEnvelope | validation_failed |
429 | application/json | ErrorEnvelope | rate_limited |
500 | application/json | ErrorEnvelope | internal_error |
Fields of the 200 answer
The shape is CallAnalytics.
| Field | Type | Required | Description |
|---|---|---|---|
answered_calls | integer | yes | |
calls | integer | yes | Ended Calls in the range. |
compliance_tagged_firings | integer | yes | The firings of compliance-tagged Policies in the counted Calls. |
ended_reasons | map of integer | yes | The ended Calls by ended reason, every reason present, 0 for one no Call ended with; from 1.58.0 workflow_complete, prompt_compose_failed and max_turns too, and from 1.61.0 refused_opted_out, refused_destination, refused_compliance, schedule_expired and busy, so a reader on an older version must take the version that added a reason first. |
from | string | yes | The start of the range, RFC 3339. |
granularity | AnalyticsGranularity | yes | |
groups | array of CallAnalyticsGroup | yes | One item per group of group_by; empty when the read named none. |
minutes | number | yes | The billable Call minutes. |
object | "call_analytics" | yes | |
outcomes | CallOutcomeRates or null | yes | Null when no counted Call has a rollup Outcome value. |
to | string | yes | The end of the range, RFC 3339. |
transfers | integer | yes | The Calls that ended transferred. |
window | AnalyticsWindow | yes |