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.Documentation Index
Fetch the complete documentation index at: https://www.traceloop.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
Request Parameters
Start time in Unix seconds timestamp.
End time in Unix seconds timestamp.
Filter spans by workflow name.
Filter spans by span name.
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-4Sort order for results. Accepted values:
ASC or DESC. Defaults to ASC.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
Pagination cursor for fetching the next set of results. Use the
next_cursor value from the previous response.Maximum number of spans to return per page.
Array of filter conditions to apply to the query. Each filter should have Supported operators:
Example - Filter by LLM vendor:
id, value, and operator fields. Filters must be URL-encoded JSON.Filter structure:| Operator | Description |
|---|---|
equals | Exact match |
not_equals | Not equal to value |
greater_than | Greater than (numeric) |
greater_than_or_equal | Greater than or equal (numeric) |
less_than | Less than (numeric) |
less_than_or_equal | Less than or equal (numeric) |
contains | String contains value |
starts_with | String starts with value |
in | Value in list (use with array) |
not_in | Value not in list (use with array) |
exists | Field exists (no value needed) |
not_exists | Field does not exist (no value needed) |
Response
Returns a paginated response containing span objects:Span Object
The environment where the span was captured.
The timestamp when the span was created (Unix milliseconds).
The unique trace identifier.
The unique span identifier.
The parent span identifier.
The trace state information.
The name of the span.
The kind of span (e.g.,
SPAN_KIND_CLIENT, SPAN_KIND_INTERNAL).The name of the service that generated the span.
Key-value pairs of resource attributes.
The instrumentation scope name.
The instrumentation scope version.
Key-value pairs of span attributes (e.g.,
llm.vendor, llm.request.model).The duration of the span in milliseconds.
The status code of the span (e.g.,
STATUS_CODE_UNSET, STATUS_CODE_ERROR).The status message providing additional context.
Prompt data associated with the span (for LLM calls).
Completion data associated with the span (for LLM calls).
Input data for the span.
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

