Skip to main content
GET
/
v1
/
spans
List Spans
curl --request GET \
  --url https://api.agentmark.co/v1/spans \
  --header 'Authorization: <api-key>' \
  --header 'X-Agentmark-App-Id: <x-agentmark-app-id>'
{
  "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"

Query Parameters

type
enum<string>

Filter by span type.

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

Filter by span status.

Available options:
STATUS_CODE_UNSET,
STATUS_CODE_OK,
STATUS_CODE_ERROR
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

A list of spans.

spans
object[]