---
title: "Get spans by project_name or project_id and optionally by trace_id and/or type"
method: GET
path: "/v1/private/spans"
tags: ["Spans"]
---

# Get spans by project_name or project_id and optionally by trace_id and/or type

`GET /v1/private/spans`

Get spans by project_name or project_id and optionally by trace_id and/or type

## Query parameters

- `page` integer
- `size` integer
- `project_name` string
- `project_id` string, uuid
- `trace_id` string, uuid
- `type` 'general' | 'tool' | 'llm' | 'guardrail'
- `filters` string
- `truncate` boolean — Truncate input, output and metadata to slim payloads
- `strip_attachments` boolean — If true, returns attachment references like [file.png]; if false, downloads and reinjects stripped attachments
- `sorting` string
- `exclude` 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`

Spans resource

- SpanPagePublic
  - `page` integer
  - `size` integer
  - `total` integer
  - `content` SpanPublic[]
    - `id` string, uuid
    - `project_name` string — If null, the default project is used
    - `project_id` string, uuid
    - `trace_id` string, uuid
    - `parent_span_id` string, uuid
    - `name` string
    - `type` 'general' | 'tool' | 'llm' | 'guardrail'
    - `start_time` string, date-time, required
    - `end_time` string, date-time
    - `input` JsonListStringPublic
    - `output` JsonListStringPublic
    - `metadata` JsonListStringPublic
    - `model` string
    - `provider` string
    - `tags` string[]
    - `usage` object
    - `error_info` ErrorInfoPublic
      - `exception_type` string, required
      - `message` string
      - `traceback` string, required
    - `created_at` string, date-time
    - `last_updated_at` string, date-time
    - `created_by` string
    - `last_updated_by` string
    - `feedback_scores` FeedbackScorePublic[]
      - `name` string, required
      - `category_name` string
      - `value` number, required
      - `reason` string
      - `source` 'ui' | 'sdk' | 'online_scoring', required
      - `source_queue_id` string, uuid
      - `created_at` string, date-time
      - `last_updated_at` string, date-time
      - `created_by` string
      - `last_updated_by` string
      - `value_by_author` object
    - `comments` CommentPublic[]
      - `id` string, uuid
      - `text` string, required
      - `source_queue_id` string, uuid
      - `created_at` string, date-time
      - `last_updated_at` string, date-time
      - `created_by` string
      - `last_updated_by` string
    - `total_estimated_cost` number
    - `total_estimated_cost_version` string
    - `duration` number, double — Duration in milliseconds as a decimal number to support sub-millisecond precision
    - `ttft` number, double — Time to first token in milliseconds
    - `source` 'sdk' | 'experiment' | 'playground' | 'optimization' | 'evaluator'
    - `environment` string
  - `sortableBy` string[]

## Changes

- **2026-07-02** `3144ea40dac0` — 1 warning
  - added the new `evaluator` enum value to the `content/items/source` response property for the response status `200`
- **2026-06-30** `20a1a33446d1` — 2 info
  - added the optional property `content/items/feedback_scores/items/value_by_author/additionalProperties/author` to the response with the `200` status
  - added the optional property `content/items/feedback_scores/items/value_by_author/additionalProperties/source_queue_id` to the response with the `200` status
- **2026-06-19** `580e3bc69e8a` — 2 info
  - added the optional property `content/items/comments/items/source_queue_id` to the response with the `200` status
  - added the optional property `content/items/feedback_scores/items/source_queue_id` to the response with the `200` status
- **2026-05-08** `b9100cf75dd3` — 1 info
  - added the optional property `content/items/environment` to the response with the `200` status
- …earlier changes not shown

[Full history](https://skmtc.dev/comet-ml/apis/opik-rest-api/changes/v1/private/spans/get.md)

---

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