Get Spans
Warehouse
Get Spans
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-4string
Sort order for results. Accepted values:
ASC or DESC. Defaults to ASC.string
Field to sort by. Supported values:
timestamp- Span creation timeduration_ms- Span duration in millisecondsspan_name- Name of the spantrace_id- Trace identifiertotal_tokens- Total token counttraceloop_workflow_name- Workflow nametraceloop_entity_name- Entity namellm_usage_total_tokens- LLM token usagellm_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 Supported operators:
id, value, and operator fields. Filters must be URL-encoded JSON.Filter structure: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:- Make an initial request without a cursor
- Use the
next_cursorvalue from the response in subsequent requests - Continue until
next_cursoris empty or you’ve retrieved all needed data

