VocalDocscontracts 1.65.0

Read the Usage events of a Call and their rated total

GET /v1/calls/{call_id}/usage

PropertyValue
Operationget_call_usage
GroupUsage
Scopeusage:read
Route classread
IdempotencyNo Idempotency-Key
AuditNot audited: A metadata read; Usage events and the spend counter carry identifiers, units and amounts, never content.
Released in1.23.0
Phase 0 hostServed (the hosted api pins 1.65.0)

Answers every Usage event of the Call with the sum of the rated amounts and the count of unrated events (1.23.0, FR-usage-1). A Call not yet finalized answers no events and a total of 0. A Call of another Organization, or of the other environment for an API key, answers 404 not_found.

Request

Set VOCAL_API to the base URL of your API and VOCAL_API_KEY to an API key with the usage:read scope (Authentication and keys). Replace each placeholder, such as agt_... or <name>, with your own value.

curl "$VOCAL_API/v1/calls/call_.../usage" \
  -H "Authorization: Bearer $VOCAL_API_KEY"

Parameters

NameInTypeRequiredDescription
call_idpathCallIdyesThe id of a Call: call_ and the row's UUIDv7 in 26 Crockford base32 characters. Opaque and safe to log.

Responses

StatusContent typeShapeError codes
200application/jsonCallUsage
400application/jsonErrorEnvelopeinvalid_request
401application/jsonErrorEnvelopeunauthenticated
403application/jsonErrorEnvelopeforbidden
404application/jsonErrorEnvelopenot_found
429application/jsonErrorEnveloperate_limited
500application/jsonErrorEnvelopeinternal_error

Fields of the 200 answer

The shape is CallUsage.

FieldTypeRequiredDescription
amount_microsintegeryesThe rated total (1.23.0): the sum of amount_micros over the rated events, in whole micro-USD, frozen at finalize; 0 when the Call has no rated event, which includes a Call not yet finalized.
call_idCallIdyes
environmentEnvironmentyesThe environment of the Call (1.23.0); a test Call's total is never billed or counted.
eventsarray of UsageEventyesEvery Usage event of the Call (1.23.0), ordered by stage in the order of CostStage, then by Provider, model and unit; empty until the Call is finalized.
object"call_usage"yes
unrated_eventsintegeryesThe events the price list had no price for (1.23.0); they are listed and are not in amount_micros, so the total is complete only when this is 0.