Skip to main content
GET
Get Spans
Retrieve spans from the data warehouse with flexible filtering and pagination options. This endpoint returns spans from the environment associated with your API key. You can filter by time ranges, workflows, attributes, and more.

Request Parameters

int64
required
Start time in Unix seconds timestamp.
int64
End time in Unix seconds timestamp.
string
Filter spans by workflow name.
string
Filter spans by span name.
map[string]string
Simple key-value attribute filtering. Any query parameter not matching a known field is treated as an attribute filter.Example: ?llm.vendor=openai&llm.request.model=gpt-4
string
Sort order for results. Accepted values: ASC or DESC. Defaults to ASC.
string
Field to sort by. Supported values:
  • timestamp - Span creation time
  • duration_ms - Span duration in milliseconds
  • span_name - Name of the span
  • trace_id - Trace identifier
  • total_tokens - Total token count
  • traceloop_workflow_name - Workflow name
  • traceloop_entity_name - Entity name
  • llm_usage_total_tokens - LLM token usage
  • llm_response_model - LLM model used
string
Pagination cursor for fetching the next set of results. Use the next_cursor value from the previous response.
int
Maximum number of spans to return per page.
FilterCondition[]
Array of filter conditions to apply to the query. Each filter should have id, value, and operator fields. Filters must be URL-encoded JSON.Filter structure:
Supported operators:Example - Filter by LLM vendor:

Response

Returns a paginated response containing span objects:
object

Span Object

string
The environment where the span was captured.
int64
The timestamp when the span was created (Unix milliseconds).
string
The unique trace identifier.
string
The unique span identifier.
string
The parent span identifier.
string
The trace state information.
string
The name of the span.
string
The kind of span (e.g., SPAN_KIND_CLIENT, SPAN_KIND_INTERNAL).
string
The name of the service that generated the span.
map
Key-value pairs of resource attributes.
string
The instrumentation scope name.
string
The instrumentation scope version.
map
Key-value pairs of span attributes (e.g., llm.vendor, llm.request.model).
int64
The duration of the span in milliseconds.
string
The status code of the span (e.g., STATUS_CODE_UNSET, STATUS_CODE_ERROR).
string
The status message providing additional context.
map
Prompt data associated with the span (for LLM calls).
map
Completion data associated with the span (for LLM calls).
string
Input data for the span.
string
Output data for the span.

Example Response

Pagination

To paginate through results:
  1. Make an initial request without a cursor
  2. Use the next_cursor value from the response in subsequent requests
  3. Continue until next_cursor is empty or you’ve retrieved all needed data