---
title: "Call Stats"
method: POST
path: "/calls/stats"
tags: ["Calls"]
---

# Call Stats

`POST /calls/stats`

## Request body

- CallStatsReq — Request for aggregated call statistics over a time range.
  - `project_id` string, required
  - `start` string, date-time, required — Inclusive start time (UTC, ISO 8601).
  - `end` string, date-time, nullable — Exclusive end time (UTC, ISO 8601). Defaults to now if omitted.
  - `granularity` integer, nullable — Bucket size in seconds (e.g., 3600 for 1 hour). If omitted, auto-selected based on time range. Will be adjusted if it would produce more than 10,000 buckets.
  - `usage_metrics` UsageMetricSpec[], nullable — Usage metrics (tokens, cost) to compute. Grouped by timestamp and model.
    - `metric` 'input_tokens' | 'output_tokens' | 'total_tokens' | 'input_cost' | 'output_cost' | 'total_cost', required — Metric to aggregate. Token metrics are normalized across providers.
    - `aggregations` AggregationType[] — Basic aggregation functions to apply
    - `percentiles` number[] — Percentile values to compute (0-100). E.g., [50, 95, 99] for p50, p95, p99
  - `call_metrics` CallMetricSpec[], nullable — Call-level metrics (latency, counts) to compute. Grouped by timestamp only.
    - `metric` 'latency_ms' | 'call_count' | 'error_count', required — Metric to aggregate.
    - `aggregations` AggregationType[] — Basic aggregation functions to apply
    - `percentiles` number[] — Percentile values to compute (0-100). E.g., [50, 95, 99] for p50, p95, p99
  - `filter` CallsFilter
    - `op_names` string[], nullable
    - `input_refs` string[], nullable
    - `output_refs` string[], nullable
    - `parent_ids` string[], nullable
    - `trace_ids` string[], nullable
    - `call_ids` string[], nullable
    - `thread_ids` string[], nullable
    - `turn_ids` string[], nullable
    - `trace_roots_only` boolean, nullable
    - `wb_user_ids` string[], nullable
    - `wb_run_ids` string[], nullable
  - `timezone` string — IANA timezone for bucket alignment (e.g., 'America/New_York')

## Response `200`

Successful Response

- CallStatsRes — Response containing time-series call statistics.
  - `start` string, date-time, required — Resolved start time (UTC)
  - `end` string, date-time, required — Resolved end time (UTC)
  - `granularity` integer, required — Bucket size used (in seconds)
  - `timezone` string, required — Timezone used for bucket alignment
  - `usage_buckets` object[] — Usage metrics by model. Each bucket contains 'timestamp', 'model', and aggregated metric values.
  - `call_buckets` object[] — Call-level metrics. Each bucket contains 'timestamp' and aggregated metric values.

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/wandb/apis/fastapi.md) · [All operations](https://skmtc.net/wandb/apis/fastapi/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/wandb/fastapi/versions/56745769989b/schema)
