pydo.insights.post_spans_search()
Generated on 13 Nov 2026
from pydo version
v0.46.0
Usage
client.insights.post_spans_search(
region="nyc3",
body={
"time_range": {...},
"filter": {...},
"order_by": [...],
...,
},
)Description
To search spans in a region, send a POST request to /v2/insights/query/{region}/spans/search with a JSON body describing the time range, optional filter, ordering, and pagination.
The time range must not exceed 7 days. pagination.limit defaults to 100 and must be between 1 and 1000. Results are ordered by start_time descending by default. Cursor-based pagination is not yet supported; pagination.has_more indicates whether additional spans matched beyond the returned page.
Parameters
regionstring requiredThe datacenter region slug for the query.
time_rangeobject requiredAn inclusive query time window. The window must not exceed 7 days.
Show child properties
fromobject requiredA single time bound. Exactly one of
relativeorabsoluteis set.Show child properties
relativestring optionalExample:
1hA relative time. Use
nowfor the current time, a bare duration such as1hor7dto look back from now, or an offset such asnow-15mornow+30m. Supported units ares,m,h,d, andw.absolutestring optionalExample:
2026-09-30T00:00:00ZAn absolute timestamp. Accepts an RFC3339/RFC3339Nano string or a Unix timestamp (seconds, milliseconds, microseconds, or nanoseconds) encoded as a decimal string.
toobject requiredA single time bound. Exactly one of
relativeorabsoluteis set.Show child properties
relativestring optionalExample:
1hA relative time. Use
nowfor the current time, a bare duration such as1hor7dto look back from now, or an offset such asnow-15mornow+30m. Supported units ares,m,h,d, andw.absolutestring optionalExample:
2026-09-30T00:00:00ZAn absolute timestamp. Accepts an RFC3339/RFC3339Nano string or a Unix timestamp (seconds, milliseconds, microseconds, or nanoseconds) encoded as a decimal string.
filterobject optionalA boolean filter tree for spans queries. Exactly one node is set per message. Trees may be nested at most 16 levels deep and contain at most 256 nodes in total.
Show child properties
conditionobject optionalA single field comparison in a spans filter expression.
Show child properties
fieldobject requiredA reference to a searchable span field.
Show child properties
namestring requiredExample:
service.nameThe field name. Well-known span fields include
trace_id,span_id,parent_span_id,start_time,end_time,duration_ns,name,service_name,kind,status_code, andstatus_message. Any other value is treated as a span or resource attribute key.scopestring optionalOptional attribute scope, matched case-insensitively. Use
FIELD_SCOPE_RESOURCEto match a resource attribute orFIELD_SCOPE_ATTRIBUTESto match a span attribute. The aliasesresourceandresource.attributesare accepted for resource attributes;attribute,attributes, andspan.attributesare accepted for span attributes. Omit for well-known fields or to search both attribute maps.
operatorstring requiredvalueobject optionalA typed literal or list value for a spans filter condition. Exactly one kind is set per message.
Show child properties
string_valuestring optionalExample:
api-gatewaynumber_valuenumber optionalExample:
42string_array_valueobject optionalnumber_array_valueobject optional
andobject optionalShow child properties
expressionsarray of objects requiredShow child properties
conditionobject optionalA single field comparison in a spans filter expression.
andobject optionalorobject optionalnotobject optionalA boolean filter tree for spans queries. Exactly one node is set per message. Trees may be nested at most 16 levels deep and contain at most 256 nodes in total.
text_searchobject optionalA substring search across the span name, service name, and status message.
orobject optionalShow child properties
expressionsarray of objects requiredShow child properties
conditionobject optionalA single field comparison in a spans filter expression.
andobject optionalorobject optionalnotobject optionalA boolean filter tree for spans queries. Exactly one node is set per message. Trees may be nested at most 16 levels deep and contain at most 256 nodes in total.
text_searchobject optionalA substring search across the span name, service name, and status message.
notobject optionalA boolean filter tree for spans queries. Exactly one node is set per message. Trees may be nested at most 16 levels deep and contain at most 256 nodes in total.
Show child properties
conditionobject optionalA single field comparison in a spans filter expression.
Show child properties
fieldobject requiredA reference to a searchable span field.
operatorstring requiredvalueobject optionalA typed literal or list value for a spans filter condition. Exactly one kind is set per message.
andobject optionalShow child properties
expressionsarray of objects required
orobject optionalShow child properties
expressionsarray of objects required
notobject optionalA boolean filter tree for spans queries. Exactly one node is set per message. Trees may be nested at most 16 levels deep and contain at most 256 nodes in total.
Show child properties
conditionobject optionalA single field comparison in a spans filter expression.
andobject optionalorobject optionalnotobject optionalA boolean filter tree for spans queries. Exactly one node is set per message. Trees may be nested at most 16 levels deep and contain at most 256 nodes in total.
text_searchobject optionalA substring search across the span name, service name, and status message.
text_searchobject optionalA substring search across the span name, service name, and status message.
Show child properties
querystring requiredExample:
timeoutThe search string. Leading and trailing whitespace is trimmed, and the remaining string must not be empty.
text_searchobject optionalA substring search across the span name, service name, and status message.
Show child properties
querystring requiredExample:
timeoutThe search string. Leading and trailing whitespace is trimmed, and the remaining string must not be empty.
order_byarray of objects optionalSort clauses applied to the result set. Defaults to
start_timedescending when omitted.Show child properties
fieldobject requiredA reference to a searchable span field.
Show child properties
namestring requiredExample:
service.nameThe field name. Well-known span fields include
trace_id,span_id,parent_span_id,start_time,end_time,duration_ns,name,service_name,kind,status_code, andstatus_message. Any other value is treated as a span or resource attribute key.scopestring optionalOptional attribute scope, matched case-insensitively. Use
FIELD_SCOPE_RESOURCEto match a resource attribute orFIELD_SCOPE_ATTRIBUTESto match a span attribute. The aliasesresourceandresource.attributesare accepted for resource attributes;attribute,attributes, andspan.attributesare accepted for span attributes. Omit for well-known fields or to search both attribute maps.
directionstring optionalThe sort direction, matched case-insensitively. Omit to use the server default.
paginationobject optionalLimits the number of spans returned.
Show child properties
limitinteger optionalExample:
100Maximum number of spans to return. Defaults to 100 and must be between 1 and 1000.
Request Sample
Response Example
More Information
See /v2/insights/query/{region}/spans/search in the API reference for additional detail on responses, headers, parameters, and more.