Stream the spans of a single trace as CSV or JSONL (sync export)
Cursor-streamed synchronous export of every span belonging to the
trace identified by trace_id. trace_id is required — the
batch “all traces” export path was removed because it was too
expensive to support at hypertable scale. Callers needing trace-
level analytics should use GET /v1/traces for paginated listing
and call this endpoint per trace.
Rows are written directly to the response body — never buffered —
and capped per plan (Starter: 100, Pro/Team/Business: 5000,
Enterprise: unlimited). Hitting the cap sets
X-TruLayer-Truncated: true; the payload is complete up to that row.
CSV columns (in order): trace_id, span_id, name, type, model, created_at, duration_ms, prompt_tokens, completion_tokens, cost_usd, trace_input, trace_output, span_input, span_output, error.
span_id is the unique identifier for the span (renamed from id).
trace_input is the parent trace’s input text joined onto every span
row. span_input is the span’s own input text. trace_output and
span_output are the parent trace’s and span’s output payloads
respectively, so a single download carries the full input/output
context for both the trace and each span.
JSONL emits one JSON object per line with the same keys.
The Content-Disposition filename is
spans-<trace-prefix>-YYYY-MM-DD.{csv,jsonl}.
Authorizations
SDK API key (tl_...) or Clerk session JWT
Query Parameters
Trace to export spans for. Required — the endpoint returns 400 if absent.
csv, jsonl Response
Streamed CSV or JSONL payload.
The response is of type string.