Skip to main content
GET
/
spans
curl -X GET "https://app.tracia.io/api/v1/spans?promptSlug=welcome-email&limit=20" \
  -H "Authorization: Bearer tr_your_api_key"
{
  "spans": [
    {
      "id": "clx1abc123",
      "spanId": "sp_abc123def456",
      "traceId": "tr_session123",
      "promptSlug": "welcome-email",
      "model": "gpt-4o",
      "status": "SUCCESS",
      "latencyMs": 1250,
      "inputTokens": 150,
      "outputTokens": 320,
      "totalTokens": 470,
      "cost": 0.0234,
      "createdAt": "2024-01-15T10:30:00.000Z"
    }
  ],
  "nextCursor": "clx2def456"
}

Request

Authorization
string
required
Bearer token with your API key: Bearer tr_your_api_key
promptSlug
string
Filter by prompt slug
status
string
Filter by status: SUCCESS or ERROR
startDate
string
Filter spans created after this ISO 8601 date
endDate
string
Filter spans created before this ISO 8601 date
userId
string
Filter by end user ID
sessionId
string
Filter by session ID
tags
string
Comma-separated list of tags (AND logic)
limit
number
Number of results per page (max 100, default 50)
cursor
string
Cursor for pagination (from previous response)

Response

spans
array
Array of span objects
nextCursor
string | null
Cursor for the next page of results
curl -X GET "https://app.tracia.io/api/v1/spans?promptSlug=welcome-email&limit=20" \
  -H "Authorization: Bearer tr_your_api_key"
{
  "spans": [
    {
      "id": "clx1abc123",
      "spanId": "sp_abc123def456",
      "traceId": "tr_session123",
      "promptSlug": "welcome-email",
      "model": "gpt-4o",
      "status": "SUCCESS",
      "latencyMs": 1250,
      "inputTokens": 150,
      "outputTokens": 320,
      "totalTokens": 470,
      "cost": 0.0234,
      "createdAt": "2024-01-15T10:30:00.000Z"
    }
  ],
  "nextCursor": "clx2def456"
}

Authorizations

Authorization
string
header
required

API key starting with tr_

Query Parameters

promptSlug
string

Filter by prompt slug

status
enum<string>

Filter by status

Available options:
SUCCESS,
ERROR
startDate
string<date-time>

Filter spans created after this ISO 8601 date

endDate
string<date-time>

Filter spans created before this ISO 8601 date

userId
string

Filter by end user ID

sessionId
string

Filter by session ID

tags
string

Comma-separated list of tags (AND logic)

limit
integer
default:50

Number of results per page (max 100, default 50)

Required range: x <= 100
cursor
string

Cursor for pagination (from previous response)

Response

Successful response

spans
object[]
nextCursor
string | null

Cursor for the next page of results