The query endpoint
Request body
| Field | Type | Required | Notes |
|---|---|---|---|
org_id | string | ✅ | Your tenant id (from login). |
language | string | ✅ | sql or promql. |
statement | string | ✅ | The query text. |
time_range | object | ✅ | { "start": <us>, "end": <us> } — microseconds since epoch. |
stream | object | — | { "name": "app", "stream_type": "logs" }. stream_type ∈ logs/metrics/traces/enrichment. |
limit | integer | — | Row cap. |
Response
The response carriesrows, columns, scanned_rows, took_ms, and cache_hit.
Send
Accept: application/x-ndjson to stream results row-by-row. Streaming bypasses the
query_result cache.SQL
trace_id:
PromQL
Setlanguage: "promql" to run PromQL over metric streams. Both instant and range queries are
supported (range steps through [start, end] and returns a matrix). Coverage is broad — the rate
family and all *_over_time, the standard aggregations (incl. topk / limitk),
histogram_quantile, label_replace / label_join, math & trig, the and / or / unless set
operators with on / ignoring + group_left / group_right matching, selector @ / offset,
and subqueries.
PromQL support matrix
The full list of supported functions, operators, and modifiers — plus the known gaps
(native-histogram functions, the binary
default fill-in).Search around an event
To pull the N events immediately before and after a given one (log context view), usePOST /api/v1/query/search_around with event_timestamp_us, stream, stream_type, and optional
before / after counts (default 50 each).
Caching
Queries flow through a 3-level cache —file_meta, parquet_meta, and query_result — plus a
parquet disk cache enabled by default (./data/cache/parquet, 10 GB LRU). The cache_hit field in
the response tells you whether the result came from cache.