Create Analytics Queries

Runs one or more metric queries against call or subscription data using the requested time range, groupings, and aggregate operations.

Authentication

AuthorizationBearer
Authenticate server-side requests with a private Vapi API key. Create or copy a key from the [Vapi Dashboard](https://dashboard.vapi.ai) and send it in the `Authorization` header as `Bearer <token>`. Keep private API keys out of client-side code and public repositories.

Request

This endpoint expects an object.
querieslist of objectsRequired
This is the list of metric queries you want to perform.

Response

namestring
This is the unique key for the query.
timeRangeobject
This is the time range for the query.
resultlist of objects

This is the result of the query, a list of unique groups with result of their aggregations.

Example: “result”: [ { “date”: “2023-01-01”, “assistantId”: “123”, “endedReason”: “customer-ended-call”, “sumDuration”: 120, “avgCost”: 10.5 }, { “date”: “2023-01-02”, “assistantId”: “123”, “endedReason”: “customer-did-not-give-microphone-permission”, “sumDuration”: 0, “avgCost”: 0 }, // Additional results ]