Skip to main content
GET
/
v1
/
traces
/
{traceId}
/
spans
List Spans for a Trace
curl --request GET \
  --url https://api.agentmark.co/v1/traces/{traceId}/spans \
  --header 'Authorization: <api-key>' \
  --header 'X-Agentmark-App-Id: <x-agentmark-app-id>'
{
  "data": [
    {
      "id": "span_abc123",
      "trace_id": "abc123-def456",
      "parent_id": "span_parent123",
      "name": "openai.chat.completions",
      "status": "OK",
      "duration_ms": 823.5,
      "timestamp": "2026-04-10T15:30:45.123Z",
      "type": "GENERATION",
      "model": "gpt-4o",
      "input_tokens": 120,
      "output_tokens": 330,
      "tokens": 450,
      "cost": 0.0032
    }
  ]
}

Authorizations

Authorization
string
header
required

Your AgentMark API key. Create one in the dashboard under Settings > API Keys.

Example: Authorization: Bearer am_live_abc123

Headers

X-Agentmark-App-Id
string
required

Your application ID. Found in the dashboard under Settings > General.

Example:

"app_abc123"

Path Parameters

traceId
string
required

The trace ID whose spans to retrieve.

Response

All spans for the trace.

data
object[]