Skip to main content
POST /traces/query streams the spans of every authorized trace matched by a structured filter within a time window. LightShip applies role policies at the trace level: if any span in a trace satisfies a policy, that trace’s spans are returned in full. Follow the next_cursor in each response to paginate.

Endpoint

Authentication: session cookie or Authorization: Bearer lsk_....

Request body

string (RFC3339)
Start of the time range. Optional. Defaults to 24 hours before to.
string (RFC3339)
End of the time range. Optional. Defaults to now.
object
Structured filter object. See Filters for shape and operators. Omit or send an empty conditions array to match everything the caller is authorized to see.
integer
Maximum traces per page. Defaults to 50 and is capped at 200. A page may contain more than 200 spans because each selected trace is returned whole.
string
Pagination cursor from a previous response. Omit on the first call. A cursor is bound to the filter that produced it; changing the filter and reusing an old cursor returns an error.
array of strings
Optional projection. When set, spans are returned with only these columns (plus the required structural columns). Omit to return every column from the bound table.

Example request

Response

object
The current schema binding, echoed so clients can identify which column holds the trace id, span id, timestamp, and parent span id without knowing the customer’s table names ahead of time.
array
Span objects from every authorized trace in the page. Each span carries the columns from the bound table, subject to the optional columns projection.
string
Cursor to pass in the next request. Omitted when there are no more pages.

Example response

Example

Coding agents should use LightShip MCP for bulk exports. Direct API clients can continue requesting pages with next_cursor until the response omits it.