curl -X GET https://app.tracia.io/api/v1/spans/sp_abc123def456 \
-H "Authorization: Bearer tr_your_api_key"
const span = await tracia.spans.get('sp_abc123def456');
{
"id": "clx1abc123",
"spanId": "sp_abc123def456",
"traceId": "tr_session123",
"parentSpanId": null,
"promptSlug": "welcome-email",
"promptVersion": 3,
"model": "gpt-4o",
"provider": "openai",
"input": {
"messages": [
{
"role": "system",
"content": "You are a helpful assistant that writes professional emails."
},
{
"role": "user",
"content": "Write a welcome email for Alice who just signed up for Tracia."
}
]
},
"variables": {
"name": "Alice",
"product": "Tracia"
},
"output": "Subject: Welcome to Tracia, Alice!\n\nDear Alice,\n\nThank you for signing up...",
"status": "SUCCESS",
"error": null,
"latencyMs": 1250,
"inputTokens": 150,
"outputTokens": 320,
"totalTokens": 470,
"cost": 0.0234,
"tags": ["production", "v2"],
"userId": "user_123",
"sessionId": "session_456",
"createdAt": "2024-01-15T10:30:00.000Z"
}
{
"error": {
"code": "NOT_FOUND",
"message": "Span not found: sp_abc123def456"
}
}
Spans
Get Span
Get full details of a single span
GET
/
spans
/
{spanId}
curl -X GET https://app.tracia.io/api/v1/spans/sp_abc123def456 \
-H "Authorization: Bearer tr_your_api_key"
const span = await tracia.spans.get('sp_abc123def456');
{
"id": "clx1abc123",
"spanId": "sp_abc123def456",
"traceId": "tr_session123",
"parentSpanId": null,
"promptSlug": "welcome-email",
"promptVersion": 3,
"model": "gpt-4o",
"provider": "openai",
"input": {
"messages": [
{
"role": "system",
"content": "You are a helpful assistant that writes professional emails."
},
{
"role": "user",
"content": "Write a welcome email for Alice who just signed up for Tracia."
}
]
},
"variables": {
"name": "Alice",
"product": "Tracia"
},
"output": "Subject: Welcome to Tracia, Alice!\n\nDear Alice,\n\nThank you for signing up...",
"status": "SUCCESS",
"error": null,
"latencyMs": 1250,
"inputTokens": 150,
"outputTokens": 320,
"totalTokens": 470,
"cost": 0.0234,
"tags": ["production", "v2"],
"userId": "user_123",
"sessionId": "session_456",
"createdAt": "2024-01-15T10:30:00.000Z"
}
{
"error": {
"code": "NOT_FOUND",
"message": "Span not found: sp_abc123def456"
}
}
Request
string
required
Bearer token with your API key:
Bearer tr_your_api_keystring
required
The span ID (e.g.,
sp_abc123def456)Response
string
Internal identifier
string
External span ID
string | null
Trace session ID if part of a multi-turn conversation
string | null
Parent span ID for chained conversations
string | null
Slug of the prompt that was run (null for runLocal spans)
number | null
Version of the prompt used
string
Model used (e.g.,
gpt-4o)string
Provider name (e.g.,
openai, amazon_bedrock)object
Input messages sent to the model
Show Input object
Show Input object
array
Array of message objects with
role and contentobject | null
Template variables used in the prompt
string | null
Model response text
string
SUCCESS or ERRORstring | null
Error message if status is
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[]
Tags associated with this span
string | null
End user ID
string | null
Session ID
string
ISO 8601 timestamp
curl -X GET https://app.tracia.io/api/v1/spans/sp_abc123def456 \
-H "Authorization: Bearer tr_your_api_key"
const span = await tracia.spans.get('sp_abc123def456');
{
"id": "clx1abc123",
"spanId": "sp_abc123def456",
"traceId": "tr_session123",
"parentSpanId": null,
"promptSlug": "welcome-email",
"promptVersion": 3,
"model": "gpt-4o",
"provider": "openai",
"input": {
"messages": [
{
"role": "system",
"content": "You are a helpful assistant that writes professional emails."
},
{
"role": "user",
"content": "Write a welcome email for Alice who just signed up for Tracia."
}
]
},
"variables": {
"name": "Alice",
"product": "Tracia"
},
"output": "Subject: Welcome to Tracia, Alice!\n\nDear Alice,\n\nThank you for signing up...",
"status": "SUCCESS",
"error": null,
"latencyMs": 1250,
"inputTokens": 150,
"outputTokens": 320,
"totalTokens": 470,
"cost": 0.0234,
"tags": ["production", "v2"],
"userId": "user_123",
"sessionId": "session_456",
"createdAt": "2024-01-15T10:30:00.000Z"
}
{
"error": {
"code": "NOT_FOUND",
"message": "Span not found: sp_abc123def456"
}
}
Authorizations
API key starting with tr_
Path Parameters
The span ID (e.g., sp_abc123def456)
Response
Successful response
Internal identifier
External span ID (e.g., sp_abc123)
Session/trace ID for multi-turn conversations
Parent span ID for chained conversations
Slug of the prompt that was run (null for runLocal spans)
Version of the prompt used
Model used (e.g., gpt-4o)
Provider name (e.g., openai, amazon_bedrock)
Show child attributes
Show child attributes
Template variables used in the prompt
Show child attributes
Show child attributes
Model response text
Available options:
SUCCESS, ERROR Error message if status is ERROR
Execution time in milliseconds
Cost in USD

