> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.vapi.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.vapi.ai/_mcp/server.

# Get traffic split metrics

GET https://api.vapi.ai/traffic-allocations/metrics

Per-assistant-version call metrics over a time window: call counts, configured vs actual traffic share, duration, cost per minute, latency, ended reasons, a bucketed timeseries, and optional structured output aggregations. Calls with no assistant version are reported as an 'unversioned' row. Traffic splitting is in beta, rolling out to select organizations; requests from organizations without access receive a 403.

Reference: https://docs.vapi.ai/api-reference/traffic-allocations/traffic-allocation-controller-metrics-get

## Authentication

- `Authorization` header (bearer token, required) — 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

### Query parameters

- `assistantId` (string, required) — The assistant whose per-version traffic metrics to return.
- `from` (datetime, required) — Start of the metrics window (inclusive), ISO 8601 datetime.
- `to` (datetime, required) — End of the metrics window (exclusive), ISO 8601 datetime. Must be later than from, and the window may hold at most 2000 buckets of the requested width.
- `bucket` (enum, optional) — Bucket size for the timeseries. Defaults to 'day'.
  - Allowed values: `hour`, `day`
- `structuredOutputIds` (list of any, optional) — Structured output ids to aggregate per version, as an array or a comma-separated string. At most 5.

## Response

### 200

- `window` (TrafficTabMetricsWindowDTO, required)
- `totalCalls` (double, required) — All calls for the assistant in the window, every version.
- `versions` (list of TrafficTabVersionMetricsDTO, required) — One row per version with calls in the window, plus the unversioned row when it has any. Ordered by calls descending, then by version label (numeric-aware), the unversioned row last among equals.
- `currentAllocation` (TrafficAllocation, optional, nullable) — The allocation currently governing the assistant. Null when traffic splitting was never configured.

## Errors

### 400 Bad Request Error

assistantId is missing or not a UUID, from/to are missing, malformed, or inverted, the window spans more than 2000 buckets, or structuredOutputIds has more than 5 entries or a non-UUID entry.

- `any`

### 403 Forbidden Error

Traffic splitting is not enabled for your organization. The feature is in beta, rolling out to select organizations.

- `any`

## Types

### TrafficTabMetricsWindowDTO

- `from` (string, required) — Start of the window (inclusive), ISO 8601.
- `to` (string, required) — End of the window (exclusive), ISO 8601.
- `bucket` (enum, required)
  - Allowed values: `hour`, `day`

### TrafficTabVersionMetricsDTO

- `calls` (double, required)
- `actualPercentage` (double, required) — calls / totalCalls * 100 over the window, rounded to 3 decimals.
- `durationSeconds` (TrafficTabDurationSecondsDTO, required)
- `costPerMinute` (TrafficTabCostPerMinuteDTO, required)
- `latencyMs` (TrafficTabLatencyMsDTO, required)
- `endedReasons` (list of TrafficTabEndedReasonCountDTO, required) — Full per-reason counts; the UI unions and top-Ns.
- `timeseries` (list of TrafficTabTimeseriesPointDTO, required)
- `assistantVersionId` (string, optional, nullable)
- `assistantVersionLabel` (string, optional, nullable) — The published version label, such as "v7". Null when no version row resolves (unversioned calls, or a since-purged version).
- `unversioned` (boolean, optional) — True for the row aggregating calls with no assistant version (stored as SQL NULL).
- `configuredPercentage` (double, optional, nullable) — The version's share in the currently-governing allocation. Null when the version is not in the current split — never rendered as 0%.
- `structuredOutputs` (list of TrafficTabStructuredOutputDTO, optional) — Present only when structuredOutputIds was given.

### TrafficAllocation

- `id` (string, required) — Unique identifier. The most recently created allocation for an assistant is the one in effect.
- `orgId` (string, required)
- `allocationIntent` (enum, required) — 'explicit' splits calls across this allocation's targets. 'follow-latest' sends every call to the newest published version.
  - Allowed values: `follow-latest`, `explicit`
- `createdAt` (datetime, required) — When this allocation was created, which is also when it took effect.
- `actorType` (enum, required) — Who created this allocation. 'system' means Vapi created it automatically, for example when a publish advances a follow-latest allocation.
  - Allowed values: `user`, `api-key`, `system`
- `targets` (list of TrafficAllocationTarget, required) — The versions this allocation splits calls across, in position order. Empty for follow-latest allocations.
- `assistantId` (string, optional) — The assistant this allocation splits calls for.
- `actorId` (string, optional) — The user id or API key id that created this allocation. Absent for system rows.
- `actorEmail` (string, optional) — Email of the user who created this allocation, as of that time.
- `description` (string, optional) — The note given when this allocation was created, if any.

### TrafficTabDurationSecondsDTO

- `mean` (double, optional, nullable)
- `stddev` (double, optional, nullable)
- `p50` (double, optional, nullable)
- `p95` (double, optional, nullable)

### TrafficTabCostPerMinuteDTO

- `breakdown` (TrafficTabCostBreakdownPerMinuteDTO, required)
- `mean` (double, optional, nullable)

### TrafficTabLatencyMsDTO

- `model` (TrafficTabLatencyStatsDTO, required)
- `voice` (TrafficTabLatencyStatsDTO, required)
- `transcriber` (TrafficTabLatencyStatsDTO, required)
- `turn` (TrafficTabLatencyStatsDTO, required)

### TrafficTabEndedReasonCountDTO

- `reason` (string, required)
- `count` (double, required)

### TrafficTabTimeseriesPointDTO

- `bucketStart` (string, required) — Start of the bucket, ISO 8601 (UTC).
- `calls` (double, required)
- `durationSecondsMean` (double, optional, nullable)
- `costPerMinuteMean` (double, optional, nullable)
- `turnLatencyMsMean` (double, optional, nullable)

### TrafficTabStructuredOutputDTO

- `structuredOutputId` (string, required)
- `type` (enum, required)
  - Allowed values: `number`, `string`, `boolean`, `unknown`
- `present` (double, required) — Calls in the window where this output produced a result.
- `numeric` (TrafficTabStructuredOutputNumericDTO, optional)
- `valueCounts` (list of TrafficTabStructuredOutputValueCountDTO, optional) — Top 10 values by count, for string/boolean outputs.

### TrafficAllocationTarget

- `assistantVersion` (string, required) — The assistant version this target sends calls to, such as "v7".
- `position` (double, required) — The target's place in the split, starting at 0. Set from the order of the targets array.
- `percentage` (double, required) — Share of calls sent to this version, from 0 to 100 with up to three decimal places. Targets add up to exactly 100. A 0% target keeps the version in the split without sending it calls.

### TrafficTabCostBreakdownPerMinuteDTO

- `llm` (double, optional, nullable)
- `stt` (double, optional, nullable)
- `tts` (double, optional, nullable)
- `vapi` (double, optional, nullable)
- `transport` (double, optional, nullable)

### TrafficTabLatencyStatsDTO

- `mean` (double, optional, nullable)
- `p50` (double, optional, nullable)
- `p95` (double, optional, nullable)

### TrafficTabStructuredOutputNumericDTO

- `mean` (double, optional, nullable)
- `stddev` (double, optional, nullable)
- `p50` (double, optional, nullable)
- `p95` (double, optional, nullable)
- `sum` (double, optional, nullable)

### TrafficTabStructuredOutputValueCountDTO

- `value` (string, required)
- `count` (double, required)

## Examples

**Response**

```json
{
  "window": {
    "from": "string",
    "to": "string",
    "bucket": "hour"
  },
  "totalCalls": 1.1,
  "versions": [
    {
      "calls": 1.1,
      "actualPercentage": 1.1,
      "durationSeconds": {
        "mean": 1.1,
        "stddev": 1.1,
        "p50": 1.1,
        "p95": 1.1
      },
      "costPerMinute": {
        "breakdown": {
          "llm": 1.1,
          "stt": 1.1,
          "tts": 1.1,
          "vapi": 1.1,
          "transport": 1.1
        },
        "mean": 1.1
      },
      "latencyMs": {
        "model": {
          "mean": 1.1,
          "p50": 1.1,
          "p95": 1.1
        },
        "voice": {
          "mean": 1.1,
          "p50": 1.1,
          "p95": 1.1
        },
        "transcriber": {
          "mean": 1.1,
          "p50": 1.1,
          "p95": 1.1
        },
        "turn": {
          "mean": 1.1,
          "p50": 1.1,
          "p95": 1.1
        }
      },
      "endedReasons": [
        {
          "reason": "string",
          "count": 1.1
        }
      ],
      "timeseries": [
        {
          "bucketStart": "string",
          "calls": 1.1,
          "durationSecondsMean": 1.1,
          "costPerMinuteMean": 1.1,
          "turnLatencyMsMean": 1.1
        }
      ],
      "assistantVersionId": "string",
      "assistantVersionLabel": "string",
      "unversioned": true,
      "configuredPercentage": 1.1,
      "structuredOutputs": [
        {
          "structuredOutputId": "string",
          "type": "number",
          "present": 1.1,
          "numeric": {
            "mean": 1.1,
            "stddev": 1.1,
            "p50": 1.1,
            "p95": 1.1,
            "sum": 1.1
          },
          "valueCounts": [
            {
              "value": "string",
              "count": 1.1
            }
          ]
        }
      ]
    }
  ],
  "currentAllocation": {
    "id": "string",
    "orgId": "string",
    "allocationIntent": "follow-latest",
    "createdAt": "2024-01-15T09:30:00Z",
    "actorType": "user",
    "targets": [
      {
        "assistantVersion": "string",
        "position": 1.1,
        "percentage": 1.1
      }
    ],
    "assistantId": "string",
    "actorId": "string",
    "actorEmail": "string",
    "description": "string"
  }
}
```