---
title: "Get span stats"
method: GET
path: "/v1/private/spans/stats"
tags: ["Spans"]
---

# Get span stats

`GET /v1/private/spans/stats`

Get span stats

## Query parameters

- `project_id` string, uuid
- `project_name` string
- `trace_id` string, uuid
- `type` 'general' | 'tool' | 'llm' | 'guardrail'
- `filters` string
- `search` string — Full-text search across span fields
- `from_time` string, date-time — Filter spans created from this time (ISO-8601 format).
- `to_time` string, date-time — Filter spans created up to this time (ISO-8601 format). If not provided, defaults to current time. Must be after 'from_time'.

## Response `200`

Span stats resource

- ProjectStatsPublic
  - `stats` ProjectStatItemObjectPublic[]
    - `name` string
    - `type` 'COUNT' | 'PERCENTAGE' | 'AVG'

---

[API](https://skmtc.net/comet-ml/apis/opik-rest-api.md) · [All operations](https://skmtc.net/comet-ml/apis/opik-rest-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/comet-ml/opik-rest-api/revisions/4ed2fbc97cc3/schema)
