curl -X GET "https://app.tracia.io/api/v1/spans?promptSlug=welcome-email&limit=20" \
-H "Authorization: Bearer tr_your_api_key"
const { spans, nextCursor } = await tracia.spans.list({
promptSlug: 'welcome-email',
limit: 20
});
{
"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"
}
{
"error": {
"code": "UNAUTHORIZED",
"message": "Invalid or missing API key"
}
}
Spans
List Spans
Get spans with optional filters and pagination
GET
/
spans
curl -X GET "https://app.tracia.io/api/v1/spans?promptSlug=welcome-email&limit=20" \
-H "Authorization: Bearer tr_your_api_key"
const { spans, nextCursor } = await tracia.spans.list({
promptSlug: 'welcome-email',
limit: 20
});
{
"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"
}
{
"error": {
"code": "UNAUTHORIZED",
"message": "Invalid or missing API key"
}
}
Request
string
required
Bearer token with your API key:
Bearer tr_your_api_keystring
Filter by prompt slug
string
Filter by status:
SUCCESS or ERRORstring
Filter spans created after this ISO 8601 date
string
Filter spans created before this ISO 8601 date
string
Filter by end user ID
string
Filter by session ID
string
Comma-separated list of tags (AND logic)
number
Number of results per page (max 100, default 50)
string
Cursor for pagination (from previous response)
Response
array
Array of span objects
Show Span object
Show Span object
string
Internal identifier
string
External span ID (e.g.,
sp_abc123)string | null
Trace session ID if part of a multi-turn conversation
string | null
Slug of the prompt that was run (null for runLocal spans)
string
Model used (e.g.,
gpt-4o)string
SUCCESS or ERRORnumber
Execution time in milliseconds
number
Number of input tokens
number
Number of output tokens
number
Total tokens used
number | null
Cost in USD
string
ISO 8601 timestamp
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"
const { spans, nextCursor } = await tracia.spans.list({
promptSlug: 'welcome-email',
limit: 20
});
{
"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"
}
{
"error": {
"code": "UNAUTHORIZED",
"message": "Invalid or missing API key"
}
}
Authorizations
API key starting with tr_
Query Parameters
Filter by prompt slug
Filter by status
Available options:
SUCCESS, ERROR Filter spans created after this ISO 8601 date
Filter spans created before this ISO 8601 date
Filter by end user ID
Filter by session ID
Comma-separated list of tags (AND logic)
Number of results per page (max 100, default 50)
Required range:
x <= 100Cursor for pagination (from previous response)

