VocalDocscontracts 1.65.0

Calls, minutes, ended reasons, Outcomes and transfers over a window

GET /v1/analytics/calls

PropertyValue
Operationget_call_analytics
GroupCall trace and analytics
Scopeanalytics:read
Route classread
IdempotencyNo Idempotency-Key
AuditNot audited: A metadata read; the analytics carry counts only.
Released in1.57.0
Phase 0 hostServed (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"

Parameters

NameInTypeRequiredDescription
windowqueryAnalyticsWindowno
fromqueryRequestTimestampnoWith window=custom, the start of the range, inclusive (1.57.0).
toqueryRequestTimestampnoWith window=custom, the end of the range, exclusive (1.57.0).
agent_idqueryAgentIdnoOnly the Calls of this Agent.
agent_versionqueryintegernoOnly the Calls pinned to this version of agent_id (1.57.0).
transportqueryCallTransportno
directionqueryCallDirectionnoOnly inbound or outbound Calls (1.57.0).
languagequeryLanguageTagnoOnly the Calls in this language (1.57.0).
environmentqueryEnvironmentnoOnly 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_byqueryarray of stringnoThe 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

StatusContent typeShapeError codes
200application/jsonCallAnalytics
400application/jsonErrorEnvelopeinvalid_request
401application/jsonErrorEnvelopeunauthenticated
403application/jsonErrorEnvelopeforbidden
422application/jsonErrorEnvelopevalidation_failed
429application/jsonErrorEnveloperate_limited
500application/jsonErrorEnvelopeinternal_error

Fields of the 200 answer

The shape is CallAnalytics.

FieldTypeRequiredDescription
answered_callsintegeryes
callsintegeryesEnded Calls in the range.
compliance_tagged_firingsintegeryesThe firings of compliance-tagged Policies in the counted Calls.
ended_reasonsmap of integeryesThe 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.
fromstringyesThe start of the range, RFC 3339.
granularityAnalyticsGranularityyes
groupsarray of CallAnalyticsGroupyesOne item per group of group_by; empty when the read named none.
minutesnumberyesThe billable Call minutes.
object"call_analytics"yes
outcomesCallOutcomeRates or nullyesNull when no counted Call has a rollup Outcome value.
tostringyesThe end of the range, RFC 3339.
transfersintegeryesThe Calls that ended transferred.
windowAnalyticsWindowyes