Skip to main content
GET
/
v1
/
traces
/
{id}
Get trace detail with spans and events
curl --request GET \
  --url https://api.trulayer.ai/v1/traces/{id} \
  --header 'Authorization: Bearer <token>'
{
  "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "project_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "error": "<string>",
  "tags": [
    "<string>"
  ],
  "started_at": "2023-11-07T05:31:56Z",
  "session_id": "<string>",
  "external_id": "<string>",
  "name": "<string>",
  "input": "<string>",
  "output": "<string>",
  "model": "<string>",
  "latency_ms": 123,
  "cost": 123,
  "total_token_count": 123,
  "prompt_tokens_total": 123,
  "completion_tokens_total": 123,
  "tag_map": {},
  "metadata": {},
  "span_count": 123,
  "control_loop_depth": 123,
  "spans": [
    {
      "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "created_at": "2023-11-07T05:31:56Z",
      "tenant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "trace_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "name": "<string>",
      "type": "llm",
      "parent_span_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "input": "<string>",
      "output": "<string>",
      "model": "<string>",
      "latency_ms": 123,
      "cost": 123,
      "error": "<string>",
      "prompt_tokens": 123,
      "completion_tokens": 123,
      "metadata": {},
      "start_time": "2023-11-07T05:31:56Z",
      "end_time": "2023-11-07T05:31:56Z",
      "otel_trace_id": "<string>",
      "otel_span_id": "<string>"
    }
  ],
  "ended_at": "2023-11-07T05:31:56Z"
}

Documentation Index

Fetch the complete documentation index at: https://docs.trulayer.ai/llms.txt

Use this file to discover all available pages before exploring further.

Authorizations

Authorization
string
header
required

SDK API key (tl_...) or Clerk session JWT

Path Parameters

id
string<uuid>
required

Response

Trace detail

id
string<uuid>
required
project_id
string<uuid>
required
error
string | null
required
tags
string[]
required
started_at
string<date-time>
required
session_id
string | null
external_id
string | null
name
string | null
input
string | null
output
string | null
model
string | null
latency_ms
integer | null
cost
number | null
total_token_count
integer | null

Sum of prompt_tokens + completion_tokens across every span on the trace, computed at ingest time (TRU-250). Zero when no span reports token usage. Traces ingested before the column existed remain at zero until re-ingested. Queryable via token_count_min / token_count_max on GET /v1/traces.

prompt_tokens_total
integer | null

Sum of prompt tokens across every span on the trace, computed at ingest time.

completion_tokens_total
integer | null

Sum of completion tokens across every span on the trace, computed at ingest time.

tag_map
object

User-defined key→value tag map persisted to the dedicated tags column (TRU-215). Omitted when the trace has no tags. Pre-TRU-215 traces stay without this field until re-ingested.

metadata
object
span_count
integer
control_loop_depth
integer | null

Number of executed retry control_actions rows attached to this trace (TRU-362). Escalations are excluded from the count — once an attempt is auto-converted to escalate, it does not advance the depth. Omitted on the trace list response; populated only on the trace detail response.

spans
object[]
ended_at
string<date-time> | null