POST
/
analytics
curl --request POST \
  --url https://api.vapi.ai/analytics \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "queries": [
    {
      "table": "call",
      "groupBy": [
        "type"
      ],
      "name": "<string>",
      "timeRange": {
        "step": "minute",
        "start": "2023-11-07T05:31:56Z",
        "end": "2023-11-07T05:31:56Z",
        "timezone": "<string>"
      },
      "operations": [
        {
          "operation": "sum",
          "column": "id",
          "alias": "<string>"
        }
      ]
    }
  ]
}'
[
  {
    "name": "<string>",
    "timeRange": {
      "step": "minute",
      "start": "2023-11-07T05:31:56Z",
      "end": "2023-11-07T05:31:56Z",
      "timezone": "<string>"
    },
    "result": [
      {}
    ]
  }
]

Authorizations

Authorization
string
headerrequired

Retrieve your API Key from Dashboard.

Body

application/json
queries
object[]
required

This is the list of metric queries you want to perform.

Response

200 - application/json
name
string
required

This is the unique key for the query.

timeRange
object
required

This is the time range for the query.

result
object[]
required

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 ]