Skip to main content
GET
/
v1
/
traces
/
{traceId}
Get Trace
curl --request GET \
  --url https://api.agentmark.co/v1/traces/{traceId} \
  --header 'Authorization: <api-key>' \
  --header 'X-Agentmark-App-Id: <x-agentmark-app-id>'
{
  "trace": {
    "id": "<string>",
    "name": "<string>",
    "data": {
      "id": "abc123-def456",
      "name": "chat-completion",
      "status": "1",
      "latency": 1234.5,
      "cost": 0.0032,
      "tokens": 450,
      "start": 1712764245123,
      "end": 1712764246357
    },
    "spans": [
      {
        "id": "span_abc123",
        "name": "openai.chat.completions",
        "duration": 823.5,
        "parentId": "span_parent123",
        "timestamp": 1712764245123,
        "traceId": "abc123-def456",
        "status": "1",
        "data": {
          "type": "GENERATION",
          "model": "gpt-4o",
          "inputTokens": 120,
          "outputTokens": 330,
          "cost": 0.0032,
          "input": "What is the weather today?",
          "output": "I'd be happy to help, but I don't have access to real-time weather data."
        }
      }
    ]
  }
}

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 to retrieve.

Query Parameters

type
enum<string>

Filter spans by type.

Available options:
SPAN,
GENERATION,
EVENT
status
enum<string>

Filter spans by status.

Available options:
0,
1,
2
name
string

Partial match on span name.

model
string

Partial match on model name.

minDuration
integer

Return spans with duration greater than or equal to this value (milliseconds).

Required range: x >= 0
maxDuration
integer

Return spans with duration less than or equal to this value (milliseconds).

Required range: x >= 0
limit
integer
default:100

Maximum number of spans to return.

Required range: 1 <= x <= 500
offset
integer
default:0

Number of spans to skip for pagination.

Required range: x >= 0

Response

The trace with its spans.

trace
object