---
title: "Get Trace"
method: GET
path: "/traces/{trace_id}"
tags: ["traces"]
---

# Get Trace

`GET /traces/{trace_id}`

Get a trace by its id

## Path parameters

- `trace_id` string, uuid, required — The id of the trace to get

## Response `200`

Successful Response

- GetTraceResponse
  - `id` string, uuid, required — The id of the trace
  - `start_time` string, date-time, nullable — The start time of the trace
  - `end_time` string, date-time, nullable — The end time of the trace
  - `duration_ms` integer, nullable — The duration of the trace
  - `status` string, nullable — The status of the trace
  - `name` string, nullable — The name of the trace, set to the name of the root span of the trace
  - `input` string, nullable — The input of the trace, set to the input of the root span of the trace
  - `output` string, nullable — The output of the trace, set to the output of the root span of the trace
  - `total_tokens` integer, nullable — The total tokens of the trace
  - `span_count` integer, nullable — Total number of spans in the trace
  - `generation_count` integer, nullable — Number of LLM generation spans in the trace
  - `tool_count` integer, nullable — Number of tool/function call spans in the trace
  - `has_error` boolean, nullable — Whether any span in the trace has an error
  - `spans` SpanSchema[], nullable — The spans of the trace
    - `id` string, uuid, nullable — The id of the span, set to the uuid of the span
    - `name` string, nullable — The name of the span
    - `start_time` string, date-time, nullable — The start time of the span
    - `type` string, nullable — The type of the span
    - `parent_id` string, uuid, nullable — The id of the parent span
    - `end_time` string, date-time, nullable — The end time of the span
    - `duration_ms` integer, nullable — The duration of the span in milliseconds
    - `error` string, nullable — Optional error of the span
    - `meta` object, nullable — The metadata of the span, can be used to add additional information about the span
    - `data` SpanData
      - `input` string, nullable — The input of the span
      - `output` string, nullable — The output of the span
      - `total_tokens` integer, nullable — The total tokens of the span
      - `model` string, nullable — The model of the span
      - `instructions` string, nullable — The instructions of the span in case of a generation span
      - `function` string, nullable — The function of the span
      - `tags` string[], nullable — The tags of the span
      - `score` integer, nullable — The score of the span, by default set to the evaluation score of the generation of the span
      - `generation_id` string, uuid, nullable — The id of the generation of the span
      - `observations` string, nullable — The observations of the span in case of a generation span
      - `scorer_context` object, nullable — Detailed scorer breakdown with individual scorer results for expandable view
    - `metrics` SpanMetricData[], nullable — The metrics of the span
      - `id` string, uuid, required — The id of the metric
      - `dimension` string, required — The dimension of the metric
      - `value` number, required — The value of the metric
      - `created_at` string, date-time, required — The timestamp when the metric was created
      - `comment` string, nullable — The comment of the metric, can be used to add additional information about the metric
    - `score` integer, nullable — The score of the span

## Other responses

- `400` — Bad Request
- `401` — Unauthorized
- `402` — Payment Required (out of credits)
- `404` — Not Found
- `422` — Request Validation Error

---

[API](https://skmtc.dev/opper/apis/opper-api-v2.md) · [All operations](https://skmtc.dev/opper/apis/opper-api-v2/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/opper/opper-api-v2/revisions/d3ccdaa15678/schema)
