Skip to main content
GET
/
spans
/
{spanId}
curl -X GET https://app.tracia.io/api/v1/spans/sp_abc123def456 \
  -H "Authorization: Bearer tr_your_api_key"
{
  "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"
}

Request

Authorization
string
required
Bearer token with your API key: Bearer tr_your_api_key
spanId
string
required
The span ID (e.g., sp_abc123def456)

Response

id
string
Internal identifier
spanId
string
External span ID
traceId
string | null
Trace session ID if part of a multi-turn conversation
parentSpanId
string | null
Parent span ID for chained conversations
promptSlug
string | null
Slug of the prompt that was run (null for runLocal spans)
promptVersion
number | null
Version of the prompt used
model
string
Model used (e.g., gpt-4o)
provider
string
Provider name (e.g., openai)
input
object
Input messages sent to the model
variables
object | null
Template variables used in the prompt
output
string | null
Model response text
status
string
SUCCESS or ERROR
error
string | null
Error message if status is ERROR
latencyMs
number
Execution time in milliseconds
inputTokens
number
Number of input tokens
outputTokens
number
Number of output tokens
totalTokens
number
Total tokens used
cost
number | null
Cost in USD
tags
string[]
Tags associated with this span
userId
string | null
End user ID
sessionId
string | null
Session ID
createdAt
string
ISO 8601 timestamp
curl -X GET https://app.tracia.io/api/v1/spans/sp_abc123def456 \
  -H "Authorization: Bearer tr_your_api_key"
{
  "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"
}

Authorizations

Authorization
string
header
required

API key starting with tr_

Path Parameters

spanId
string
required

The span ID (e.g., sp_abc123def456)

Response

Successful response

id
string

Internal identifier

spanId
string

External span ID (e.g., sp_abc123)

traceId
string | null

Session/trace ID for multi-turn conversations

parentSpanId
string | null

Parent span ID for chained conversations

promptSlug
string | null

Slug of the prompt that was run (null for runLocal spans)

promptVersion
integer | null

Version of the prompt used

model
string

Model used (e.g., gpt-4o)

provider
string

Provider name (e.g., openai)

input
object
variables
object

Template variables used in the prompt

output
string | null

Model response text

status
enum<string>
Available options:
SUCCESS,
ERROR
error
string | null

Error message if status is ERROR

latencyMs
integer

Execution time in milliseconds

inputTokens
integer
outputTokens
integer
totalTokens
integer
cost
number | null

Cost in USD

tags
string[]
userId
string | null
sessionId
string | null
createdAt
string<date-time>