Skip to main content
POST
Search spans

Authorizations

x-api-key
string
header
required

Headers

x-selected-account-id
string | null

Query Parameters

starting_after
string | null
ending_before
string | null
limit
integer
default:100
Required range: 1 <= x <= 10000
sort_by
string | null
sort_order
enum<string> | null
default:asc
Available options:
asc,
desc
from_ts
string<date-time> | null

The starting (oldest) timestamp in ISO format.

to_ts
string<date-time> | null

The ending (most recent) timestamp in ISO format.

Body

application/json
parents_only
boolean

Only fetch spans that are the top-level (ie. have no parent_id)

span_ids
string[]

Filter by span IDs

trace_ids
string[]

Filter by trace IDs. The combined count of trace_ids, span_ids, excluded_span_ids, excluded_trace_ids, and parent_ids may not exceed 10000. A request over that returns 422.

excluded_span_ids
string[]

List of span IDs to exclude from results

excluded_trace_ids
string[]

List of trace IDs to exclude from results

group_id
string

Filter by group ID

parent_ids
string[]

Filter to the direct children of any of these parent span IDs

names
string[]

Filter by trace/span name

statuses
enum<string>[]

Filter on span status

Available options:
SUCCESS,
ERROR,
CANCELED
types
enum<string>[]
Available options:
TEXT_INPUT,
TEXT_OUTPUT,
COMPLETION_INPUT,
COMPLETION,
KB_RETRIEVAL,
KB_INPUT,
RERANKING,
EXTERNAL_ENDPOINT,
PROMPT_ENGINEERING,
DOCUMENT_INPUT,
MAP_REDUCE,
DOCUMENT_SEARCH,
DOCUMENT_PROMPT,
CUSTOM,
CODE_EXECUTION,
DATA_MANIPULATION,
EVALUATION,
FILE_RETRIEVAL,
KB_ADD_CHUNK,
KB_MANAGEMENT,
GUARDRAIL,
OUTPUT_GUARDRAIL,
TRACER,
AGENT_TRACER,
AGENT_WORKFLOW,
STANDALONE
search_texts
string[]

Case-insensitive substring search across span name, input, output, and metadata (no tokenization or stemming). Multiple terms are ANDed, and UUID-shaped terms match trace IDs instead. Substring means mid-word fragments match, while an inflected form such as a plural matches only where it appears literally. A span must match every non-UUID term, and each term may match any of the searched fields. UUID matches are ORed onto the text match. Each term must be at least 2 characters. For exact trace ID lookup, use the trace_ids filter. Accounts still served by the legacy trace store match differently until migrated: terms match as stemmed whole words rather than substrings, only input and output are searched, the 2-character minimum is not enforced, and characters like :, |, or ! inside a term may be interpreted as query operators or cause an error.

extra_metadata
Extra Metadata · object

Filter on custom metadata key-value pairs

application_variant_ids
string[]

Filter by application variant IDs

assessment_types
string[]

Filter to spans that have at least one assessment of these types

acp_types
string[]

Filter by ACP types

agentex_agent_names
string[]

Filter by Agentex agent names

agentex_agent_ids
string[]

Filter by Agentex agent IDs

min_duration_ms
integer

Minimum span duration in milliseconds (inclusive). An in-flight span with no end time has no known duration and is treated as unbounded, so it matches every minimum.

max_duration_ms
integer

Maximum span duration in milliseconds (inclusive). An in-flight span with no end time has no known duration and is treated as unbounded, so it never falls within a maximum and is excluded.

Response

Successful Response

Span search page carrying sgp-traces' opaque pagination cursors.

The Postgres path keyset-paginates on the span id and leaves these unset. The ClickHouse path returns opaque cursors that clients must round-trip.

items
Items · object[]
required
total
integer
required

The total of items that match the query. This is greater than or equal to the number of items returned.

has_more
boolean
required

Whether there are more items left to be fetched.

object
string
default:list
Allowed value: "list"
limit
integer
default:100

The maximum number of items to return.

next_cursor
string

Pass as starting_after to fetch the next page. None when there is no next page.

prev_cursor
string

Pass as ending_before to fetch the previous page. None when on the first page.

window_truncated
boolean

True when the requested window exceeded the 90 day maximum and was clamped, so results cover only effective_from_ts..effective_to_ts. null when no clamp occurred.

effective_from_ts
string<date-time>

Resolved start of the searched window. null when no clamp occurred.

effective_to_ts
string<date-time>

Resolved end of the searched window. null when no clamp occurred.