GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing wavehouse.dev — API Reference API ReferenceEvery HTTP endpoint WaveHouse exposes — ingest, query, streaming, and the admin-gated AuthenticationSection titled “Authentication”There is no auth on/off switch — the JWT middleware always runs. A request to Before the token is read, every The JWT must use HMAC signing (HS256/HS384/HS512) or be validated via a JWKS endpoint (configured via For SSE connections where custom headers are not possible, you can pass the token as a query parameter: The Prefer the header wherever you can. Both SDKs always use Authentication is decoupled from authorization. A request with no token, or an invalid/expired/malformed one, is not rejected outright — it falls back to an empty role that resolves to the policy Public (unauthenticated) access is driven by the policy. Define a usable Operator key (non-JWT, break-glass). A separate, role-free credential — It is checked before the Bearer token (so it wins when both are present), compared in constant time, and — unlike a JWT bearing the Roles & Access ControlSection titled “Roles & Access Control”WaveHouse extracts the role from a configurable JWT claim path (
Policies support Hasura™-style row-level and column-level permissions with JWT claim templating (e.g., Response FormatSection titled “Response Format”Error ResponsesSection titled “Error Responses”Error responses from WaveHouse carry a JSON body and the following headers: The body is always a JSON object that includes an Some endpoints attach extra fields alongside This contract holds for:
Historically some error paths defaulted to Every response, success or failure, also carries The per-endpoint error tables below list the bodies you can expect for each status code; the ClickHouse errors on the query pathsSection titled “ClickHouse errors on the query paths”When ClickHouse® fails a query on
A pipe that writes answers with the same status and On Why a missing grant is a EndpointsSection titled “Endpoints”Section titled “GET /livez — Liveness Probe” |
| State | /livez |
/readyz |
|---|---|---|
| Booting, ClickHouse down | 503 | 503 |
| ClickHouse up after retry | 200 | 200 |
| Post-boot, ClickHouse dies | 200 ★ | 503 |
| Post-boot, ClickHouse back | 200 | 200 |
★ Once boot completes, /livez no longer tracks ClickHouse state — a runtime ClickHouse outage, like a queue disconnect, surfaces in /readyz only. This is what keeps a Kubernetes livenessProbe from restart-looping the pod during a transient backend blip (see Deployment → Boot-time degraded mode). Over a nested directory the rows hold per process rather than per tenant: “ClickHouse up” means at least one tenant’s pool answers, and “discovery complete” means one tenant’s has.
GET /v1/health — Liveness ping (public, content-free)Returns 200 OK with an empty body once the gateway is past boot, or 503 Service Unavailable (also empty) while boot-time schema discovery is still failing. Like every /v1 route outside /v1/ops/* it resolves a tenant first, so a malformed or unknown X-Tenant-ID answers 400/404 before the probe runs, and — over a nested settings directory — a tenant whose settings folder was rejected answers a 503 that carries the usual JSON error body rather than this route’s empty one, as does a request carrying a token, with no valid operator key, while that tenant’s JWKS has not been fetched yet (Retry-After: 30; the SDKs send their token on this ping too). No authentication required and no response body — the caller only branches on the status code, so there’s nothing to JSON-encode or cache per request. Resolving the tenant makes the ping an unauthenticated answer to whether a tenant is served, deliberately: every tenant route gives an unknown tenant the same 404 before authenticating, since authenticating takes that tenant’s own verifier, so the ping reveals nothing the others don’t. It also answers a served tenant’s ping from that tenant’s own CORS list, where a tenant-exempt route answers from tenant 0’s, which a nested directory need not have.
This is what the SDKs’ health calls (wh.sys.health(), Go’s Health) use, and the endpoint to use when choosing among multiple servers in a distributed setup. It mirrors /livez under the hood but is intentionally a /v1 API route rather than a Kubernetes probe path: an operator may filter the bare probe paths (/livez, /readyz, /healthz) out at the reverse proxy since they’re internal probes, so the SDKs rely on /v1/health, which is documented public API surface meant to stay reachable. It does not ping ClickHouse — readiness-based load balancing is the proxy/LB’s job (via /readyz), not the client’s.
GET /version — Build InfoReturns the build metadata embedded in the running binary — version, git_commit, and build_time, plus the go_version read from the runtime. No authentication required: these are the same values logged at startup, so the endpoint discloses nothing the logs don’t already. Useful for confirming exactly which build is deployed when troubleshooting.
Response:
{ "version": "1.2.3", "git_commit": "a1b2c3d", "build_time": "2026-06-02T12:00:00Z", "go_version": "go1.26.3"}Where those values come from depends on how the binary was built:
| Build | version |
git_commit / build_time |
|---|---|---|
| Release artifact or container image | The tag without its leading v — GoReleaser injects {{ .Version }}, so v1.2.3 reports 1.2.3 |
Injected |
make build |
Whatever git describe returns, which keeps the v (e.g. v1.2.3-4-gdeadbee, or a bare short SHA before the first tag) |
Injected |
go build inside a checkout |
The module pseudo-version Go derives from the commit (e.g. 0.0.0-20260815021004-1064a4fe6a59) |
Read from the VCS stamps Go embeds |
go install …/cmd/[email protected] |
The module version, so the released tag without its leading v |
"unknown" — a module-cache build carries no VCS stamps |
go install passes no -ldflags, so without the build-info fallback a perfectly good tagged install would report itself as "dev". Ldflags always win when present.
api role — the ops listenerA process whose roles leave out api (an ingest worker, possible with mq.backend: nats) serves only these routes on server.port:
| Route | Notes |
|---|---|
GET /livez (and /healthz, /health) |
200 once booted. It does not wait for schema discovery, which only the API runs. |
GET /readyz (and /ready) |
The mq check (a process without api always runs mq.backend: nats), plus the clickhouse check in a process running ingest, as above. |
GET /version |
As above. |
| The metrics path | When prometheus.port is 0. |
POST /v1/ops/settings/reload |
As below, but it accepts only the operator key: no token verifier runs without the api role, so an admin token is 401. |
Every other route answers 404, including every tenant route. Under /v1/ops, the operator-key check comes first, so a request there gets 403 without a credential, and 401 for a bearer token.
POST /v1/ingest?table={table} — Ingest DataAccepts a single flat JSON object, a JSON array of objects, or a newline-delimited JSON (NDJSON) batch, validates each record against the ClickHouse schema for {table}, and publishes it to the message queue. Returns immediately — ClickHouse insertion happens asynchronously via the batch consumer.
Content-Type is required and authoritative. The format is what the caller declares, not what the bytes look like: a body declared as NDJSON is read as NDJSON whatever its first byte, so a line that isn’t a JSON object fails as a per-record error rather than silently re-framing the whole request. A request with no Content-Type, or one whose media type is not in the accepted list, is rejected with 415 and a message listing the accepted types — nothing is guessed. The one thing the body still decides is arity within the JSON family: the first non-whitespace byte picks a top-level array ([) or a single object. The reverse mis-declaration is not caught: NDJSON sent as application/json is read as the single object it starts with and the remaining lines are ignored — a 200 for one record. Declare application/x-ndjson for anything line-framed (#561).
| Body | Content-Type |
Response |
|---|---|---|
| one flat JSON object | application/json |
{"ok":true} (or {"duplicate":true}) |
| a JSON array of objects (any length, even 1) | application/json |
per-record summary — see Batch Ingest |
| one JSON object per line (NDJSON) | application/x-ndjson (also application/ndjson, application/jsonl, application/jsonlines) |
per-record summary — see Batch Ingest |
The inbound request body is capped at 16 MiB; a body over the cap is rejected with 413 (matching POST /v1/ops/query). The cap applies to every body shape, NDJSON included — the whole body is read before it is parsed, so a line-framed batch is bounded by the same 16 MiB cap as a JSON array (NDJSON carries one additional, tighter bound: a single line over 10 MiB fails the request). The 413 is decided before any record is processed, so nothing is published — including for a single-object body whose trailing bytes push it over the cap, which is now rejected rather than accepted on its first object. Split an upload larger than the cap across several requests, and set your own outer limit at the reverse proxy.
The {table} URL query must match a table that exists in ClickHouse. WaveHouse discovers table schemas on startup and refreshes them periodically.
Request:
{ "url": "https://example.com/dashboard", "user_name": "Alice", "verified": true, "score": 42.5}The body is a flat JSON object whose keys must match column names in the target ClickHouse table. Values must be type-compatible (see schema validation below).
Schema Validation:
Float64 column).MATERIALIZED or ALIAS column is rejected — ClickHouse computes those, and the published row has no slot for one.Nullable(T) DEFAULT … column now stores NULL, not the default. The published row is positional, with one slot per insertable column and no way to express “absent”, so an omitted key rides as an explicit null; input_format_null_as_default rescues that only for a non-nullable column. On a nullable column only an absent key ever took the default, and a positional row cannot express absence. Verified on ClickHouse 26.6.3. (One case changes only on a server explicitly running input_format_null_as_default=0: an explicit null for a non-nullable column with a default now takes the default there rather than failing the row into the DLQ, because WaveHouse pins the setting instead of inheriting it. On a default-configured server this was already the behavior.)String accepts JSON strings, numbers, and booleans (ClickHouse coerces the non-strings); FixedString/UUID accept the same at validation, but ClickHouse rejects a non-string value there, so it surfaces in the DLQ; DateTime/Date/Enum accept JSON strings or numbers; IPv* accepts JSON strings (a number passes validation but ClickHouse rejects it → DLQ); Int*/Float*/Decimal accept JSON numbers or strings — a string lets JavaScript callers avoid 64-bit precision loss, and its contents are ClickHouse’s to judge (a non-numeric string is accepted here and surfaces in the DLQ, not as a 400); Bool accepts JSON booleans and the numbers 0/1 (any other number, and any string — including "true" — passes validation but is rejected by ClickHouse → DLQ); Array accepts JSON arrays; Map accepts JSON objects; Tuple accepts JSON arrays or objects at validation, but ClickHouse takes an array only for an unnamed tuple and an object only for a named one — the other shape surfaces in the DLQ; any other ClickHouse type (JSON, Variant, Dynamic, geo, …) accepts any JSON value — WaveHouse defers to ClickHouse, so a bad value surfaces in the DLQ rather than as a 400.Nullable() and LowCardinality() wrappers are handled transparently.DateTime/DateTime64 values are rewritten to a canonical wire form on ingest — see Timestamp canonicalization.Response (accepted):
{"ok": true}Response (duplicate): (only when dedup is enabled)
{"duplicate": true}Error responses:
| Status | Body | Cause |
|---|---|---|
| 400 | {"error":"invalid request body"} |
The body could not be read at all — a malformed transfer encoding, or a truncated upload (a body cut off in transit). A body that arrived complete but ends mid-value is invalid json |
| 400 | {"error":"invalid json"} |
Malformed request body |
| 400 | {"error":"unknown column ... for table ..."} (also: missing required column ..., type mismatch for column ..., null value for non-nullable column ...) |
Schema validation failure (unknown fields, type mismatches, missing required columns, null in a non-nullable column with no default). The body is the validator’s message verbatim — there is no validation failed: prefix. |
| 400 | {"error":"column \"x\" of table \"t\" is materialized and cannot be inserted"} (also … is alias …) |
The record supplies a value for a column ClickHouse computes. Omit it — the server fills it in. Refused rather than dropped: the published row has one slot per insertable column, so the value would otherwise vanish behind a 200 |
| 400 | {"error":"missing dedupe id field \"event_id\""} |
Only when dedupe is enabled with dedupe.require_id: true and the row lacks the configured id_field or sets it to null. With require_id: false (the default) the row is instead published un-deduped. Either way — reject or publish — the row is logged at WARN and counted by wavehouse_ingest_dedupe_missing_id_total. In a batch this is a per-record failure, not a whole-request error. |
| 401 | {"error":"invalid token"} / {"error":"token expired"} |
A present-but-invalid/expired token was supplied and denied (the gate surfaces the token reason rather than silently falling back to default_role) |
| 403 | {"error":"forbidden"} (empty-role variant: forbidden: request has no role and no public default_role is configured) |
The resolved role lacks insert on the table |
| 403 | {"error":"column \"x\" not allowed for insert"} |
The record names a column the role’s allow_columns/deny_columns forbids (Access control → Column permissions) |
| 403 | {"error":"check failed for column \"x\""} |
The record’s value for a checked column doesn’t satisfy the policy check (_eq/_in), or an _in-checked column is omitted (Access control → Insert checks). On the batch path both this and the column error above are per-record failures reported in results, not whole-request rejections |
| 403 | {"error":"policy check references column \"x\", which table \"t\" does not have"} (also … which is materialized and cannot be inserted, the same for alias, and … which is ephemeral and is never stored) |
A policy misconfiguration, not a bad request: the role’s check names a column the table lacks, one ClickHouse computes, or an EPHEMERAL one. None can be enforced — the published row carries one slot per insertable column, and an ephemeral column is never stored — so the check would have passed silently while enforcing nothing. Like the rejections above this is decided per record, so the status depends on the body shape: a single-object request answers 403, while a batch answers 200 and carries the same message against each record in results. It fires on every insert by that role until the policy or the table is corrected, and names every offending column rather than one of them. wavehouse validate cannot catch it: it never sees the ClickHouse schema |
| 404 | {"error":"unknown table: ..."} |
Table not found in the tenant’s discovered schema |
| 413 | {"error":"request body exceeded 16777216 bytes"} |
Request body over the 16 MiB cap |
| 415 | {"error":"no Content-Type: ingest requires one of application/json, application/x-ndjson, …"} (declared variant: Content-Type "text/plain": ingest requires one of … — see the note above on how declarations are echoed; conflicting variant: conflicting Content-Type declarations "application/json", "application/x-ndjson": ingest reads one format per request, and requires one of …) |
The request declared no Content-Type, one whose media type is unsupported or does not parse, a comma-bearing value that does not parse as a single media type, or repeated header lines that disagree — different formats, or one supported and one not. Checked before the body is parsed |
| 499 | {"error":"client closed request"} |
The client went away (disconnected, timed out on its side, or was stopped) while the dedupe store or the queue was being called, which is likely why the call failed. Nobody reads this response, but it is how the request is recorded: as a 4xx, logged at DEBUG, with its record counted as canceled, rather than as an engine failure. A publish cut short this way may have stored the event, so its id is left to lapse as for the 500 below. A publish the queue refused as full stays the 503 below even then, with its record counted as canceled |
| 500 | {"error":"dedupe failed"} |
Deduplication backend error |
| 503 | {"error":"dedupe store unavailable"} |
Dedupe is on and its store cannot answer now: it is not open (for example, it failed to open on a reload), or a DynamoDB table is throttling, timing out or unreachable; Retry-After: 5. Nothing was published, so the retry is safe |
| 503 | {"error":"schema not loaded yet"} |
The tenant’s first schema discovery has not succeeded yet (its ClickHouse unreachable, or no pool for it), so whether the table exists is not known; Retry-After: 5. Decided before the body is read |
| 500 | {"error":"publish failed"} |
Message queue error whose outcome is unknown, other than a full queue or an unreachable broker (below): the event may have been stored. With dedupe on, the record’s id is left to lapse with the dedupe lease (dedupe.lease, 30 seconds by default) rather than given back: a retry inside the lease answers the in-flight 503, and one after it is published under the same idempotency key, which the queue drops if the first copy was stored. The queue’s duplicate window (two minutes) covers up to ~2×lease plus a margin, not just the lease itself, so a retry timed off Retry-After anywhere in this flow stores no second copy; a much later one is stored again. |
| 503 | {"error":"service unavailable"} |
The tenant’s ingest queue is full (backpressure, for that tenant alone) or not open (see Message Queue). Under mq.backend: nats, the table’s partition stream is full, which refuses every table in it, or the tenant’s table holds as many unwritten rows as the stream allows one subject. Response includes Retry-After: 30 header. With dedupe on, the record’s id is given back, so the retry is published rather than reported as a duplicate. |
| 503 | {"error":"service unavailable"} |
The message queue could not be reached or did not answer in time (mq.ErrUnavailable, a transient broker failure, not a full queue). Only under mq.backend: nats, including a partition stream the operator deleted; the embedded broker never reports this, and its publish failures are the 500 above. As for the 500, the record’s id is left to lapse rather than given back, so a retry cannot land as a second copy; Retry-After is that lease, rounded up to whole seconds, when dedupe was on for the record, else the flat Retry-After: 5. |
| 503 | {"error":"a request with the same dedupe id is in flight"} |
Dedupe is on and another request carrying the same id is still being published — usually a client’s timeout-retry racing its own original. Its outcome decides whether this record is a duplicate, so retry after the Retry-After header (the dedupe lease, dedupe.lease, 30 seconds by default). |
| 503 | {"error":"token verifier not ready: the tenant's JWKS has not been fetched yet"} |
A token was supplied, with no valid operator key, while the tenant’s JWKS has not been fetched yet; refused before any policy runs, with a Retry-After: 30 header — see Authentication |
curl example:
curl -X POST "http://localhost:8080/v1/ingest?table=clicks" \ -H "Content-Type: application/json" \ -d '{"page": "/home", "button": "signup", "score": 42.5}'Send the canonical form — RFC 3339 UTC with the fraction already truncated to the column’s precision and trailing zeros trimmed (spelled out below) — and the value is republished byte-for-byte. A DateTime/DateTime64 column value sent in any other accepted form — including RFC 3339 UTC with extra or trailing-zero fraction digits — is rewritten to that one canonical wire form — RFC 3339 UTC (2026-06-21T04:00:00Z, fraction truncated to the column’s precision) before publishing, so the stored instant never changes but every consumer (the ClickHouse insert, SSE subscribers, the DLQ) sees the same spelling /v1/query renders. The accepted input forms:
.-fractions only — ClickHouse has no , separator).YYYY-MM-DD[ T]HH:MM:SS[.fff] or YYYY-MM-DD, zone-less — interpreted in the column’s time zone, else the ClickHouse server’s, exactly as ClickHouse itself would..fff fraction is honored only for DateTime64 columns, as ClickHouse does).DateTime column, but the column’s raw tick count for DateTime64 (a DateTime64(3) stores milliseconds, so 1750478400500 is the millisecond epoch 2025-06-21T04:00:00.5Z — and 1750478400 is January 1970, not June 2025).Fail-open: a value in none of those forms is published verbatim — ClickHouse’s more liberal parser decides insertability, and a value it too rejects surfaces via the DLQ, as before. Date/Date32 columns pass through untouched.
The canonical form, precisely. This is the one strict timestamp spelling in WaveHouse — the same one /v1/query and /v1/pipes/{name} render for top-level timestamp columns and the SSE stream carries (the raw-SQL proxy /v1/ops/query instead renders server-side via date_time_output_format=iso, which keeps trailing fraction zeros):
YYYY-MM-DDTHH:MM:SSZ, or YYYY-MM-DDTHH:MM:SS.FZ when there is a sub-second part: uppercase T separator, uppercase Z suffix, always UTC — never a numeric offset — and seconds always present.DateTime column (whole seconds) never carries a fraction; a DateTime64(3) column carries at most three digits.time.RFC3339Nano rendering): .120 becomes .12Z, .000 becomes plain Z — byte-for-byte what /v1/query returns for the same stored value.Z.Examples for a DateTime64(3, 'America/New_York') column: "2026-06-21 00:00:00.1239" (zone-less, read in New York) → "2026-06-21T04:00:00.123Z"; "1750478400.5" (Unix-seconds string) → "2025-06-21T04:00:00.5Z"; the integer number 1750478400500 (ticks at the column’s millisecond scale) → "2025-06-21T04:00:00.5Z".
The stream row-filter doesn’t require this spelling. Row-level enforcement compares timestamp operands as instants under the same input grammar, so a filter constant in any accepted spelling — zone-less, RFC 3339, Unix seconds — matches the canonical payload denoting the same instant, and an operand the grammar can’t read withholds the row. Instant comparison also needs the column’s timestamp parser from schema discovery — with no usable schema, or a declared zone that can’t be loaded at runtime, the column falls back to byte-equality, where only an exactly matching spelling admits. See the enforcement caution for per-type comparison rules and the spelling that also works in query-path SQL.
A JSON array of objects ([{…}, {…}]) or an NDJSON body (Content-Type: application/x-ndjson, one JSON object per line) ingests a batch in a single request. Each record is validated, authorized, deduplicated, and published independently, so one malformed or rejected record never blocks the rest of the batch. (The TypeScript® SDK’s insert([...]) and the Go SDK’s Insert use the NDJSON form automatically; both forms return the same response.)
400), but a wrong-typed element (a non-object) is reported per-record like any other rejection. An explicit empty array ([]) is a valid, record-less batch (200, total: 0).Request (JSON array):
POST /v1/ingest?table=clicksContent-Type: application/json
[{"page": "/home", "button": "signup", "score": 42.5}, {"page": "/about", "button": "nav", "score": 3}, {"page": "/pricing", "button": "cta", "score": 7, "referrer": "/home"}]Request (NDJSON):
POST /v1/ingest?table=clicksContent-Type: application/x-ndjson
{"page": "/home", "button": "signup", "score": 42.5}{"page": "/about", "button": "nav", "score": 3}{"page": "/pricing", "button": "cta", "score": 7, "referrer": "/home"}Response (200): a per-record summary. Each results entry mirrors the single-object response (ok / duplicate / error) plus its 1-based index.
{ "total": 3, "succeeded": 2, "failed": 1, "duplicates": 0, "results": [ { "index": 1, "ok": true }, { "index": 2, "ok": true }, { "index": 3, "error": "unknown column \"referrer\" for table \"clicks\"" } ]}| Field | Meaning |
|---|---|
total |
records read from the body |
succeeded |
records validated and published |
failed |
records rejected — see results |
duplicates |
records skipped by dedup (when enabled) |
results |
per-record outcomes, each { index, ok|duplicate|error } with index the 1-based record position. Truncated to the first 10,000 entries for very large batches (the counts stay authoritative). |
A 200 is returned whenever the body was read and the records were processed — even if every record failed, so branch on failed/results, not the status code. Per-record problems (a malformed NDJSON line, a non-object array element, schema validation, column/check permission failures) are reported in results and the batch continues. Whole-request conditions abort with a non-200 instead:
| Status | Body | Cause |
|---|---|---|
| 400 | {"error":"empty body"} / {"error":"empty ndjson body"} |
The body has no records |
| 400 | {"error":"invalid request body"} |
The body could not be read at all — a malformed transfer encoding, or a truncated upload (a body cut off in transit). A body that arrived complete but ends mid-value is invalid json |
| 400 | {"error":"invalid json: ..."} |
A structural JSON syntax error, a single NDJSON line over 10 MiB, or a JSON array that ends before its closing ] — a body that transferred completely but was generated truncated. The whole request fails rather than reporting a partial success |
| 401 | {"error":"invalid token"} / {"error":"token expired"} |
A present-but-invalid/expired token was supplied and denied (same auth gate as the single-object path; surfaces the token reason) |
| 403 | {"error":"forbidden"} (empty-role variant: forbidden: request has no role and no public default_role is configured) |
The resolved role lacks insert on the table (checked once, before any record) |
| 413 | {"error":"request body exceeded 16777216 bytes"} |
Request body over the 16 MiB cap |
| 415 | {"error":"no Content-Type: ingest requires one of application/json, application/x-ndjson, …"} (declared variant: Content-Type "text/plain": ingest requires one of … — see the note above on how declarations are echoed; conflicting variant: conflicting Content-Type declarations "application/json", "application/x-ndjson": ingest reads one format per request, and requires one of …) |
The request declared no Content-Type, one whose media type is unsupported or does not parse, a comma-bearing value that does not parse as a single media type, or repeated header lines that disagree — different formats, or one supported and one not. Checked before the body is parsed |
| 499 | {"error":"client closed request"} |
The client went away while a dedupe reserve or a publish was in flight, mid-batch. Recorded as a 4xx, logged at DEBUG, with the unpublished records of the window it failed in counted as canceled (one rejected or found a duplicate keeps that result), and the records after that window neither read nor counted; the windows before it were published and keep their ids. After a publish cut short, the records of its window before the failing one keep their ids too, and the failing record’s id is left to lapse, as for the 500 below. A publish the queue refused as full stays the 503 below even then |
| 500 | {"error":"publish failed"} / {"error":"dedupe failed"} |
Message-queue or dedup-backend failure mid-batch, other than a full queue or an unreachable broker (below). After a publish failure the records before it keep their ids, so a whole-batch retry reports those as duplicates; the failing record’s id is left to lapse as on the single-object path, and the rest of its window’s ids are given back |
| 503 | {"error":"service unavailable"} |
The tenant’s ingest queue is full (backpressure) or not open, mid-batch; includes Retry-After: 30. The records before the refused one keep their ids, and its id and the rest of its window’s are given back |
| 503 | {"error":"service unavailable"} |
The message queue could not be reached or did not answer in time (mq.ErrUnavailable), mid-batch. Only under mq.backend: nats; the embedded broker never reports this, and its publish failures are the 500 above. As for the 500, the failing record’s id is left to lapse rather than given back — so Retry-After is that record’s dedupe lease, rounded up to whole seconds, when it was deduped; a record published un-deduped has no lapsing claim to wait out, so Retry-After: 5 |
| 503 | {"error":"dedupe store unavailable"} |
Dedupe is on and its store cannot answer now; Retry-After: 5. Nothing in the window being reserved was published; the windows before it were, and keep their ids |
| 503 | {"error":"a request with the same dedupe id is in flight"} |
A record’s dedupe id is held by another request still being published; includes Retry-After (the dedupe lease, dedupe.lease, 30 seconds by default). Nothing in that record’s window was published; the windows before it were |
| 503 | {"error":"token verifier not ready: the tenant's JWKS has not been fetched yet"} |
A token was supplied, with no valid operator key, while the tenant’s JWKS has not been fetched yet; refused before any policy runs, with a Retry-After: 30 header — see Authentication |
curl example (JSON array):
curl -X POST "http://localhost:8080/v1/ingest?table=clicks" \ -H "Content-Type: application/json" \ -d '[{"page":"/home","button":"signup","score":42.5},{"page":"/about","button":"nav","score":3}]'curl example (NDJSON):
curl -X POST "http://localhost:8080/v1/ingest?table=clicks" \ -H "Content-Type: application/x-ndjson" \ --data-binary $'{"page":"/home","button":"signup","score":42.5}\n{"page":"/about","button":"nav","score":3}\n'POST /v1/ops/query — Query ClickHouseExecutes a SQL statement directly against ClickHouse. WaveHouse proxies the SQL string verbatim to ClickHouse’s HTTP interface — any statement ClickHouse accepts works, including arbitrary DDL/DML/SYSTEM verbs and inline FORMAT directives. Multi-statement input (SELECT 1; TRUNCATE t) also works on recent ClickHouse versions where multi-query is enabled by default; older or restrictively-configured servers may reject the second statement with a clear error. Read queries return a JSON array of result rows; mutations/DDL return HTTP 200 with [] on success. DateTime columns are ISO-8601 formatted via the upstream date_time_output_format=iso setting — server-side rendering that keeps trailing fraction zeros, so a DateTime64(3) whole-second value returns .000Z here where /v1/query renders plain Z; other types are returned as ClickHouse renders them under FORMAT JSON.
This endpoint does not cache, does not singleflight, and emits Cache-Control: no-store — every request goes straight to ClickHouse, mutation or read, and downstream HTTP caches are explicitly told not to store the response. Raw SQL is an admin escape hatch with infrequent, ad-hoc traffic, so the cache/singleflight machinery would only add complexity without a real hit-rate win. Use POST /v1/query?table={table} or GET/POST /v1/pipes/{name} for the cached read paths (dashboards, high-QPS clients, etc.) — both go through the query cache (cache.backend: in-process, or a Redis® shared by every instance) with singleflight coalescing.
/v1/ops/query is the only surface for ad-hoc non-insert mutations (the ingest pipeline is insert-only; a pipe that writes runs only the statement an operator authored). Granting raw-SQL access to a non-admin role via the policy engine is no longer supported: authenticate with the admin role (admin_role).
An optional ?tenant=<id> names the tenant whose ClickHouse the SQL runs against — its own database, credentials and HTTP wiring; without it the SQL runs against tenant 0’s, which is the whole settings directory unless it is nested. The parameter is parsed as strictly as on the schema routes: 400 for a query string that does not parse or an empty, repeated or malformed id, 404 for an unknown tenant, 503 for one whose settings folder was rejected — all decided before the body is read. A tenant on no ClickHouse pool (no pool could be opened for it, such as one the connection ceiling refused) answers 503 {"error":"no ClickHouse connection is open for this tenant"} with Retry-After: 30.
Request:
{ "sql": "SELECT * FROM clicks LIMIT 10"}| Field | Type | Required | Description |
|---|---|---|---|
sql |
string | Yes | SQL forwarded verbatim to ClickHouse’s HTTP interface. |
Response:
[ { "page": "/home", "button": "signup", "score": 42.5, "received_timestamp": "2026-03-24T12:00:00.123Z" }]Error responses:
| Status | Body | Cause |
|---|---|---|
| 400 | {"error":"invalid ?tenant: …"} / {"error":"invalid query string: …"} |
The query string does not parse (?tenant=acme;x=1, a bad % escape), or tenant is empty, repeated, or not a tenant id — parsed as strictly as on the pipe reads |
| 404 | {"error":"unknown tenant: <id>"} |
No such tenant |
| 503 | {"error":"tenant settings are invalid"} |
The tenant’s settings folder was rejected |
| 400 | {"error":"invalid json"} |
Malformed request body |
| 400 | {"error":"missing sql"} |
Missing sql field |
| 400 / 403 / 502 / 503 | {"error":"<ClickHouse error message>","code":"clickhouse.…","retryable":…} |
ClickHouse failed the statement. The status and code come from the exception code, not ClickHouse’s HTTP status — see ClickHouse errors on the query paths. The error is ClickHouse’s own text verbatim, e.g. Code: 60. DB::Exception: Table default.x does not exist. (UNKNOWN_TABLE) |
| 401 | {"error":"invalid token"} / {"error":"token expired"} |
The request carried a present-but-invalid/expired token and was denied for lacking permission (the gate surfaces the token reason) |
| 403 | {"error":"forbidden"} |
Caller’s role is not the policy admin_role ("admin" by default) |
| 502 | {"error":"<message>","code":"clickhouse.unknown","retryable":true} |
An answer with no ClickHouse exception code that is not an outage — a 500 from something in front of ClickHouse. A codeless redirect or 4xx such as a 404 (a wrong path) is 502 clickhouse.misconfigured, retryable: false; a codeless 408/429 is 503 clickhouse.unavailable, a 413 is 400 clickhouse.rejected |
| 503 | {"error":"clickhouse request failed: ...","code":"clickhouse.unavailable","retryable":true} |
ClickHouse could not be reached, or the query timed out (connection refused, the upstream went away mid-request); Retry-After: 5. A TLS failure, such as an untrusted certificate, is 502 clickhouse.unknown |
| 502 | {"error":"clickhouse response exceeded N bytes; ...","code":"clickhouse.response_too_large","retryable":false} |
Response body exceeded the 64 MiB memory-safety cap. Narrow the query, add a LIMIT, or use FORMAT JSONEachRow with a streaming client outside WaveHouse. |
| 503 | {"error":"no ClickHouse connection is open for this tenant"} |
The tenant is on no ClickHouse pool — no pool could be opened for it, such as one the connection ceiling refused — so the SQL cannot run; Retry-After: 30, a settings reload retries the pool |
| 503 | {"error":"token verifier not ready: the tenant's JWKS has not been fetched yet"} |
A token was supplied, with no valid operator key, while tenant 0’s JWKS has not been fetched yet (the ops tree verifies as tenant 0); refused before any policy runs, with a Retry-After: 30 header — see Authentication |
curl example:
# Requires an admin-role JWT — see "Generating a JWT for Testing" below.curl -X POST http://localhost:8080/v1/ops/query \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d '{"sql": "SELECT * FROM clicks LIMIT 10"}'POST /v1/query?table={table} — Structured QueryExecutes a type-safe structured query against a table. The query AST is validated against the schema and converted to parameterized SQL. Permissions from the access control policy are enforced (column filtering, row-level security, aggregation restrictions).
Request:
{ "columns": ["page", "button"], "aggregations": [ {"fn": "count", "column": "*", "alias": "total"} ], "filters": [ {"column": "score", "op": "gt", "value": 10} ], "group_by": ["page"], "order_by": [{"column": "total", "dir": "desc"}], "limit": 100, "time_range": { "column": "received_timestamp", "since": "1h", "until": "" }}| Field | Type | Required | Description |
|---|---|---|---|
columns |
string | string[] | No | Columns to SELECT — an array, or a single string for one column. A literal "*" is the column named *, not a wildcard. Omit (or send [] / "") to select nothing; use select_all for a full-row read. Mutually exclusive with select_all. |
select_all |
bool | No | Select every column the role may read (the all-columns wildcard, expanded server-side to the allow/deny set). Mutually exclusive with a non-empty columns, and with aggregations. |
aggregations |
object[] | No | Aggregation functions (fn, column, alias). |
filters |
object[] | No | WHERE conditions (column, op, value). Ops: eq, neq, gt, gte, lt, lte, in, like. |
group_by |
string[] | No | GROUP BY columns. |
order_by |
object[] | No | ORDER BY clauses (column, dir). |
limit |
int | No | Max rows. Omitted or above the configured query.default_max_rows (default 10,000) → silently capped at that value; a policy max_rows can lower it further (see Access Control). |
time_range |
object | No | Time window (column, since, until). since/until accept RFC3339 or Go-duration relative values (“1h”, “30m”, “7d”, “2w” — day and week suffixes expand to hours). Relative values mean that long ago. Each bound is rounded down to query.timestamp_bucket_seconds (60 s by default). The window applies only when column and since are set — an until without since is ignored. |
Response:
JSON array of result rows. Top-level DateTime/DateTime64 values are returned in canonical RFC 3339 UTC (2026-06-21T04:00:00.123Z) — Nullable timestamp columns included (a SQL NULL renders as JSON null), while timestamps nested inside Array/Map/Tuple columns are rendered in the column’s declared zone, else the ClickHouse server’s, as the driver returns them — byte-identical to the SSE stream for values canonicalized at ingest (a fail-open pass-through that ClickHouse accepted still comes back canonical here, though it streamed in the producer’s spelling). The response carries an X-Cache: HIT or X-Cache: MISS header — this endpoint shares the query cache + singleflight machinery (unlike /v1/ops/query, which always hits ClickHouse), keyed by tenant: a request is never served from, or coalesced with, another tenant’s.
The inbound request body is capped at 1 MiB; a body over the cap is rejected with 413. A query AST is bounded by nature (far under 1 MiB even with a large in-list), and the cap blocks a single-request memory-exhaustion vector on this public endpoint. Set a tighter or higher outer limit at your reverse proxy — but it can only narrow the effective limit, not raise it past this cap.
Error responses:
| Status | Body | Cause |
|---|---|---|
| 400 | {"error":"..."} |
Schema validation error (unknown column, bad aggregation, or an unparseable time_range since/until — neither a relative duration nor an RFC3339 timestamp) |
| 403 | {"error":"forbidden"} |
Role lacks select permission on table |
| 403 | {"error":"column \"x\" not allowed"} |
Column denied by policy |
| 403 | {"error":"aggregation \"x\" not allowed"} |
Aggregation fn denied by policy |
| 404 | {"error":"unknown table: x"} |
Table not found in the tenant’s discovered schema |
| 413 | {"error":"request body exceeded 1048576 bytes"} |
Request body over the 1 MiB cap |
| 400 / 403 / 502 / 503 | {"error":"clickhouse query: …","code":"clickhouse.…","retryable":…} |
ClickHouse failed the query: a column dropped since the schema was discovered (400 clickhouse.rejected), the role’s max_rows_to_read/max_memory_usage cap, or a max_execution_time no longer than clickhouse.query_timeout (400 clickhouse.limit_exceeded), ClickHouse down (503 clickhouse.unavailable, Retry-After: 5), … — see ClickHouse errors on the query paths |
| 500 | {"error":"…","code":"clickhouse.unknown","retryable":true} |
A failure with no verdict |
| 503 | {"error":"schema not loaded yet"} |
The tenant’s first schema discovery has not succeeded yet, so whether the table exists is not known; Retry-After: 5 |
| 503 | {"error":"no ClickHouse connection is open for this tenant"} |
The tenant is on no ClickHouse pool — no pool could be opened for it, such as one the connection ceiling refused — so the query cannot run; decided before a cached result is served, so nothing cached before is served either; Retry-After: 30, a settings reload retries the pool |
| 503 | {"error":"token verifier not ready: the tenant's JWKS has not been fetched yet"} |
A token was supplied, with no valid operator key, while the tenant’s JWKS has not been fetched yet; refused before any policy runs, with a Retry-After: 30 header — see Authentication |
GET/POST /v1/pipes/{name} — Execute Named PipeExecutes a pre-defined named query (pipe) with parameter binding. Parameters can be supplied via query string and/or JSON body. A {{ jwt.<path> }} reference in the pipe’s SQL binds a claim of the caller’s verified token, never a request value (Binding token claims). A read’s results are cached in the query cache (cache.backend: in-process, or a Redis shared by every instance) with singleflight coalescing — same machinery as the structured query endpoint, keyed by tenant like it, and again, unlike /v1/ops/query; a pipe that writes is neither cached nor coalesced (see Response).
Query Parameters: Any key matching a pipe parameter name.
POST Body (optional):
{ "start_date": "2024-01-01", "limit": 100}Response:
JSON array of result rows, with X-Cache: HIT or X-Cache: MISS indicating whether the rows came from the query cache. A read pipe that reads a claim the token cannot bind answers 200 with [] and no X-Cache header, without running (Binding token claims). A pipe whose SQL is a write (INSERT, ALTER, WITH … INSERT, …) bypasses the cache and singleflight: it executes on every call, identical calls in flight are not coalesced, and the response is [] with X-Cache: BYPASS and Cache-Control: no-store (so an HTTP cache in front of a GET cannot answer a repeat) — see Pipes that write.
The POST parameter body is capped at 1 MiB; a body over the cap is rejected with 413 (the same 1 MiB parameter/AST-body cap as POST /v1/query — see reverse proxy → body limits). A malformed-but-within-cap body is ignored rather than rejected, since parameters may legitimately come from the query string alone.
Error responses:
| Status | Body | Cause |
|---|---|---|
| 404 | {"error":"pipe not found"} |
Pipe name not registered |
| 503 | {"error":"no ClickHouse connection is open for this tenant"} |
The tenant is on no ClickHouse pool — no pool could be opened for it, such as one the connection ceiling refused; decided before a cached result is served or a query runs; Retry-After: 30 |
| 403 | {"error":"forbidden"} |
Role not in pipe’s allowed_roles (and not the admin role). Fails closed: a request with no role (no token, or a JWT missing auth.role_claim) is denied unless a default_role resolves it into the list; a pipe with no allowed_roles denies everyone but the admin role. |
| 400 | {"error":"missing required parameter: x"} |
Required parameter not supplied |
| 400 | {"error":"parameter \"x\": unsupported parameter type object"} |
A non-scalar value with no SQL literal form — a JSON object, whether supplied directly or nested as an array element. A JSON array is valid and renders as an IN-style (…) list. |
| 400 | {"error":"parameter \"x\": array parameter must not be empty"} |
An empty array — it would render as the invalid IN (). |
| 401 | {"error":"invalid token"} / {"error":"token expired"} |
A present-but-invalid or expired token was supplied and the request then failed: its resolved role is not in allowed_roles, or the pipe, read or write, reads a {{ jwt.<path> }} claim, which such a token cannot bind (Binding token claims) |
| 403 | {"error":"forbidden: claim \"x\" cannot be resolved from the token"} |
A pipe that writes reads a claim the caller’s token cannot bind — absent, null, an object, an empty array, an array with a non-scalar element, or a number with no canonical form — so the write is refused before anything is sent (Binding token claims) |
| 413 | {"error":"request body exceeded 1048576 bytes"} |
POST body over the 1 MiB cap |
| 400 / 403 / 500 / 502 / 503 | {"error":"clickhouse query: …","code":"clickhouse.…","retryable":…} |
ClickHouse failed the pipe’s query — for instance a parameter value it cannot use (400 clickhouse.rejected), or ClickHouse down (503 clickhouse.unavailable, Retry-After: 5); see ClickHouse errors on the query paths. A pipe that writes answers retryable: false with no Retry-After, its message led by clickhouse exec: |
| 503 | {"error":"token verifier not ready: the tenant's JWKS has not been fetched yet"} |
A token was supplied, with no valid operator key, while the tenant’s JWKS has not been fetched yet; refused before any policy runs, with a Retry-After: 30 header — see Authentication |
The three 400 parameter rows are decided after the claim check: a request to a pipe whose SQL reads a claim the token cannot bind gets the claim’s answer instead — 200 with [], 403 or 401 (Binding token claims).
GET /v1/stream — Server-Sent Events StreamOpens a persistent SSE connection for real-time event streaming. Supports historical gap-fill from NATS™ JetStream using DeliverByStartTime. A connection that carries a token, with no valid operator key, while the tenant’s JWKS has not been fetched yet is refused with 503 + Retry-After: 30 (see Authentication); a browser EventSource treats that as fatal rather than reconnecting, so reopen it after the delay (the SDKs’ streams re-dial on their own, after the Retry-After).
Query Parameters:
| Param | Type | Default | Description |
|---|---|---|---|
table |
string | (required) | Table name to subscribe to. Returns 400 only if missing/empty; other values aren’t rejected — the name is encoded into a NATS-safe subject token (wildcards * / > are percent-encoded), so a nonexistent or odd name simply matches no events. |
since |
string | — | RFC 3339 or RFC 3339 Nano timestamp. If provided, replays historical events from NATS before switching to live streaming. |
token |
string | — | JWT token (alternative to Authorization header, useful for EventSource). Stripped from URL after extraction. |
Headers:
| Header | Description |
|---|---|
Last-Event-ID |
RFC 3339 timestamp of the last received event. If present, overrides the since query parameter for automatic reconnection (standard EventSource behavior). |
Response: SSE stream (text/event-stream). Data events include an id: field set to the event’s received_timestamp. The stream opens with a : connected comment and emits a minimal : keepalive comment periodically (every 30 seconds by default), which keeps a quiet connection from being closed by a proxy; both are standard SSE comments that EventSource ignores (raw consumers should skip :-prefixed lines). When the server stops (see Stopping) it ends every open stream immediately rather than holding it for the drain; EventSource reconnects on its own and resumes from Last-Event-ID. A reload that stops serving the stream’s tenant — its folder removed or rejected, over a nested settings directory — ends that tenant’s open streams the same way, and the reconnect then gets its 404 (removed) or 503 (rejected): the SDKs stop on the 404 and retry the 503, resuming from Last-Event-ID once the folder is back, while a browser EventSource treats either as fatal. A browser going cross-origin reads either refusal only when it passes CORS: it is decorated from tenant 0’s list (multi-tenant deployments), so where tenant 0 is not served or its list does not admit the page’s origin, the TypeScript SDK in a browser sees a network error instead and keeps re-dialing.
Row values arrive positionally, and the column names are announced separately. Before the first row, and again whenever the column list changes, the stream sends an event: schema frame naming the columns of the rows that follow — in order, already reduced to what the caller’s role may read. That re-announcement is not guaranteed after a gap-fill across a column change; see the arity note below. Every data frame’s row array then has exactly one value per announced column, in that order. schema is a named SSE event, so a browser EventSource must addEventListener('schema', …) — it never reaches onmessage. A schema frame carries no id: line, so it never moves the client’s Last-Event-ID. In the example below the table has its own received_timestamp column, which collides by name with the frame’s top-level received_timestamp field — they are different values: the field is when WaveHouse received the event, the row slot is that column as published (null where the record omitted it, which ClickHouse replaces with the column’s default on insert).
event: schemadata: {"table_name":"clicks","columns":["page","button","score","received_timestamp"]}
id: 2026-03-24T12:00:00.123Zdata: {"table_name":"clicks","received_timestamp":"2026-03-24T12:00:00.123Z","row":["/home","signup",42.5,"2026-03-24T11:59:58.512Z"]}
id: 2026-03-24T12:00:01.456Zdata: {"table_name":"clicks","received_timestamp":"2026-03-24T12:00:01.456Z","row":["/pricing","cta",7,null]}A raw consumer must keep the most recent announced column list and zip each row against it; a value the record did not carry arrives as null in its slot rather than being omitted, so positions never shift. Check arity before zipping: drop a row whose length disagrees with the last announced list rather than zipping it, because the announcement is not guaranteed in one case — a connection that gap-fills across a column change may receive live rows with no fresh announcement until the columns next change or it reconnects (#543). An arity check covers an added or removed column; a same-length change (a RENAME COLUMN, or a drop paired with an add) it cannot see, and reconnecting is what resynchronizes. Separately, a replay spanning a server upgrade across the v2 ingest envelope silently omits the pre-upgrade events — see Upgrading across the v2 ingest envelope. Both SDKs do this for you and hand back rows by column name (SDK Streaming). The announcement is per connection, so a client that joins mid-stream is told the columns before it is sent a row, and a reconnect is told again.
Each SSE connection is bound to a single ?table=; to consume multiple tables, open one connection per table.
Values of top-level DateTime/DateTime64 columns inside row arrive in the canonical RFC 3339 UTC form (ingest rewrites them before publishing — see timestamp canonicalization), so a live event and a /v1/query read of the same row agree on the instant in zone-explicit form — a zone-less spelling no longer parses as local time in a browser (#372). The two renderings are byte-identical regardless of the declared time zone or a Nullable wrapper — a column declared with a non-UTC zone also streams as Z, and /v1/query normalizes it (nullable or not) to UTC before rendering. Canonicalization is fail-open at ingest, so a value outside the accepted input forms streams in whatever spelling the producer sent — and for exactly those events the byte-identity above does not hold: a spelling ClickHouse accepts anyway is stored and still queries back canonical, while one it too rejects lands in the DLQ and never becomes queryable at all.
Note: When access control policies are active, streamed events are filtered per the caller’s role: tables without select permission are skipped, denied columns are removed from each event, and the role’s row-level filter is evaluated per subscriber against the caller’s JWT claims — supplied by the connection’s token (the Authorization header, or the ?token= fallback above), with replayed gap-fill events filtered the same way. For a filter constant the query path’s SQL also accepts (the enforcement caution gives per-type guidance), a connection is never delivered a row the query path would hide for that role — every comparison the stream can’t prove fails closed and withholds the row instead. Numeric comparisons run in the column’s storage domain — both operands narrowed the way ClickHouse narrows the stored value and the bound constant — so columns that narrow on insert (Float32/Float64 width, a Decimal’s scale) agree with the query path too; the residual payload-vs-stored case is an event whose insert later fails into the DLQ, which the caution documents. The connection’s claims are captured once, when the stream is established — a policy change applies from the next event, replayed or live (a gap-fill re-reads the policy per event too), but an expired token or changed claims take effect only when the client reconnects.
CORS: /v1/stream honors the request’s tenant’s cors.allowed_origins allowlist (settings directory) like every endpoint — the preflight included, which a browser sends without X-Tenant-ID, so over a nested settings directory the fronting proxy has to set the header on the OPTIONS too. Note that a header-authenticated stream preflights before it connects — Authorization is not CORS-safelisted — where a bare EventSource never preflighted at all: its request is not a fetch(), so Fetch’s unsafe-request flag is never set and Last-Event-ID rides on the plain GET. Both headers are allow-listed, so an allowed origin connects and resumes cross-origin.
curl example:
# Subscribe to a specific tablecurl -N "http://localhost:8080/v1/stream?table=clicks"
# With gap-fillcurl -N "http://localhost:8080/v1/stream?table=clicks&since=2026-03-24T11:00:00Z"Every admin-gated surface lives under the /v1/ops/* prefix, behind a single RequireAdmin gate: schema discovery, DLQ stats, and the pipe and settings-reload endpoints below, plus the raw-SQL passthrough POST /v1/ops/query documented with the query endpoints above. They require the policy admin_role ("admin" by default, exact case-sensitive match) — or the non-JWT operator key, which reaches the same surface without a token; other callers get 401 (present-but-invalid token) / 403, and the quickstart’s trial public role cannot call any of them. Over a nested settings directory these routes reach every tenant, so the operator key alone opens them and an admin-role token gets 403. There is no separate service role. The JWT middleware always runs — a tokenless request (or a valid token without a role claim) resolves to the default_role (not the admin role unless default_role is deliberately set to it — a loudly-warned dev-only setting) and is denied 403, while a present-but-invalid token keeps its stashed verification error and is denied 401.
No admin endpoint in this section accepts a request body — they are reads and triggers; the settings directory’s files are the only write path. The raw-SQL POST /v1/ops/query carries the 16 MiB bulk-payload cap documented with the query endpoints above.
GET /v1/ops/schema — List All Table SchemasReturns all discovered ClickHouse table schemas of one tenant. All three schema routes take an optional ?tenant=<id> naming the tenant whose schema is read or refreshed; without it they address tenant 0, which is the whole settings directory unless it is nested. The query string is parsed strictly, with the pipe reads’ answers: 400 for a query that does not parse or an empty, repeated or malformed id, 404 for an unknown tenant, 503 for one whose settings folder was rejected. A tenant whose first discovery has not succeeded yet answers 503 {"error":"schema not loaded yet"} with Retry-After: 5 rather than an empty list, which would read as “no tables”.
Response:
[ { "name": "clicks", "columns": [ {"name": "page", "type": "String", "is_nullable": false, "has_default": false, "position": 1}, {"name": "button", "type": "String", "is_nullable": false, "has_default": false, "position": 2}, {"name": "score", "type": "Float64", "is_nullable": false, "has_default": false, "position": 3}, {"name": "received_timestamp", "type": "DateTime64(3, 'UTC')", "is_nullable": false, "has_default": true, "default_kind": "DEFAULT", "default_expression": "now64(3, 'UTC')", "position": 4} ] }]GET /v1/ops/schema?table={table} — Get Table SchemaReturns the schema for a specific table.
Response:
{ "name": "clicks", "columns": [ {"name": "page", "type": "String", "is_nullable": false, "has_default": false, "position": 1}, {"name": "button", "type": "String", "is_nullable": false, "has_default": false, "position": 2} ]}Per-column fields: name, type and is_nullable describe the column; position is its 1-based ordinal in the table’s declaration order (always present, and the order columns itself is in); has_default says whether it declares any default at all, while default_kind (DEFAULT, MATERIALIZED, ALIAS, EPHEMERAL) and default_expression say which and what — both omitted when the column declares none. A MATERIALIZED or ALIAS column is computed and not insertable, so it never appears in an ingest envelope or an SSE schema frame, though it is still reported here and can still be selected by name. An EPHEMERAL column is the reverse: insertable — it exists to be written — but never stored and never selectable at all, so it can appear in a stream’s column list while no query can return it. The table’s CREATE TABLE statement is captured on the same refresh but is deliberately not exposed here — for a table backed by an external engine it renders that engine’s wiring — endpoint, bucket/host, database, username, access key id. (ClickHouse masks the password as [HIDDEN] from ~23.9; the topology is what is withheld here.)
Error responses:
| Status | Body | Cause |
|---|---|---|
| 401 | {"error":"invalid token"} / {"error":"token expired"} |
A present-but-invalid/expired token was supplied and denied (the gate surfaces the token reason) |
| 403 | {"error":"forbidden"} |
Caller’s role is not the policy admin_role ("admin" by default) |
| 400 | {"error":"invalid ?tenant: …"} / {"error":"invalid query string: …"} |
The query string does not parse (?tenant=acme;x=1, a bad % escape), or tenant is empty, repeated, or not a tenant id — parsed as strictly as on the pipe reads |
| 404 | {"error":"unknown tenant: <id>"} |
No such tenant |
| 503 | {"error":"tenant settings are invalid"} |
The tenant’s settings folder was rejected |
| 404 | {"error":"table not found"} |
Table not in the tenant’s discovered schema |
| 503 | {"error":"schema not loaded yet"} |
The tenant’s first schema discovery has not succeeded yet (its ClickHouse unreachable, or no pool for it); Retry-After: 5 |
| 503 | {"error":"token verifier not ready: the tenant's JWKS has not been fetched yet"} |
A token was supplied, with no valid operator key, while tenant 0’s JWKS has not been fetched yet (the ops tree verifies as tenant 0); refused before any policy runs, with a Retry-After: 30 header — see Authentication |
POST /v1/ops/schema/refresh — Refresh SchemasTriggers an immediate re-discovery of the ?tenant=’s ClickHouse table schemas (tenant 0’s without it), then returns the refreshed schema list (same array shape as GET /v1/ops/schema). Admin-only, like the rest of this section.
Error responses:
| Status | Body | Cause |
|---|---|---|
| 401 / 403 | as above | Not the admin role |
| 400 / 404 / 503 | as on GET /v1/ops/schema |
The ?tenant= could not be resolved |
| 503 | {"error":"no ClickHouse connection is open for this tenant"} |
The tenant is on no ClickHouse pool — no pool could be opened for it, such as one the connection ceiling refused — so nothing can be discovered; Retry-After: 30, a settings reload retries the pool |
| 503 | {"error":"refresh failed: clickhouse unavailable"} |
ClickHouse could not be reached (connection refused, a timeout, overload); Retry-After: 5 |
| 500 | {"error":"refresh failed"} |
ClickHouse discovery query failed any other way |
| 503 | {"error":"token verifier not ready: the tenant's JWKS has not been fetched yet"} |
A token was supplied, with no valid operator key, while tenant 0’s JWKS has not been fetched yet (the ops tree verifies as tenant 0); refused before any policy runs, with a Retry-After: 30 header — see Authentication |
Response:
[ { "name": "clicks", "columns": [ {"name": "page", "type": "String", "is_nullable": false, "has_default": false, "position": 1} ] }]GET /v1/ops/dlq/stats — DLQ StatisticsReturns per-table message counts in one tenant’s Dead Letter Queue: the tenant an optional ?tenant=<id> names, the default tenant 0 without it, which is the whole settings directory unless it is nested. The tenant is looked up in the message queue, not the settings, so a tenant whose folder was rejected or removed is read like one being served, since its queue is kept (nothing deletes it). The query string is parsed strictly, as on the other admin reads. Admin-only, like the rest of this section. Whether a poison row lands here is the settings directory’s dlq.enabled switch (global or per table); a tenant’s dead-letter stream is opened when the tenant is first served, and this endpoint always exists. Until a row has been parked, the endpoint returns 200 with {"tables":{},"total":0}. Under mq.backend: nats every tenant’s rows are counted on one shared dead-letter stream, so any tenant id reads 200, with zeros when it has never parked a row, and the 404 below does not occur.
Error responses:
| Status | Body | Cause |
|---|---|---|
| 401 | {"error":"invalid token"} / {"error":"token expired"} |
A present-but-invalid/expired token was supplied and denied (the gate surfaces the token reason) |
| 400 | {"error":"invalid query string: …"} / {"error":"invalid ?tenant: …"} |
The query string does not parse (?tenant=acme;x=1, a bad % escape), or tenant is empty, repeated, or not a tenant id |
| 403 | {"error":"forbidden"} |
Caller’s role is not the policy admin_role ("admin" by default) |
| 404 | {"error":"no dead-letter queue for tenant: <id>"} |
Embedded queue only. The tenant has no dead-letter queue: it has never been served on this data directory, its queue could not be opened (see Message Queue), or the id names no tenant |
| 500 | {"error":"stream info failed"} |
NATS JetStream stream-info lookup failed |
| 503 | {"error":"token verifier not ready: the tenant's JWKS has not been fetched yet"} |
A token was supplied, with no valid operator key, while tenant 0’s JWKS has not been fetched yet (the ops tree verifies as tenant 0); refused before any policy runs, with a Retry-After: 30 header — see Authentication |
Query Parameters:
| Param | Type | Default | Description |
|---|---|---|---|
tenant |
string | 0 |
The tenant whose dead-letter queue is read. |
table |
string | — | Filter tables to one table name (e.g., ?table=clicks lists only the clicks count); total stays the tenant’s whole parked count, whatever the filter. |
Response:
{ "tables": { "clicks": 3, "page_views": 1 }, "total": 4}The policy has no endpoints: it is the settings directory’s policies.json, read, edited, and validated where it lives. Check a draft with wavehouse validate on the edited directory — it enforces everything adoption enforces, including the cross-file role references against roles.json — then let the watcher adopt it or trigger POST /v1/ops/settings/reload, whose findings report exactly why a rejected directory was refused. The document anatomy (default_role, admin_role, tables) is covered in Access Control.
GET /v1/ops/pipes — List Named PipesReturns every adopted named query pipe — the settings directory’s pipes.json. Pipes have no write endpoints: edit the file and reload.
Both pipe reads take an optional ?tenant=<id> naming the tenant whose pipes are read; without it they read the default tenant 0, which is the whole settings directory unless it is nested. The query string is parsed strictly, so that a request is never answered for a tenant it did not name:
| Status | When |
|---|---|
400 |
The query string does not parse (?tenant=acme;x=1, a bad % escape), or tenant is empty, repeated, or not a tenant id |
404 |
No such tenant |
503 |
The tenant’s settings folder was rejected |
503 |
A token was supplied, with no valid operator key, while tenant 0’s JWKS has not been fetched yet (the ops tree verifies as tenant 0), with a Retry-After: 30 header — see Authentication |
GET /v1/ops/pipes/{name} — Get Named PipeReturns a specific named pipe definition:
{ "name": "top_pages", "sql": "SELECT page, count() as views FROM clicks WHERE received_timestamp >= {{start_date}} GROUP BY page LIMIT {{limit}}", "parameters": [ {"name": "start_date", "type": "string", "required": true}, {"name": "limit", "type": "number", "required": false, "default": 100} ], "description": "Top pages by view count", "allowed_roles": ["viewer"]}allowed_roles restricts execution: the caller’s role (a tokenless or roleless request is first resolved to the policy default_role) must appear in the list. The admin role (admin_role) always passes. Matching is exact — there is no "*" wildcard — and empty-string entries are ignored. An empty or omitted list authorizes nobody but the admin role, and a request whose role is absent or unlisted is denied (fails closed). A {{ jwt.<path> }} reference in sql binds a claim of the caller’s verified token (Binding token claims).
POST /v1/ops/settings/reload — Reload Settings DirectoryRe-validates the settings directory — roles.json, policies.json, pipes.json, and config.json — and adopts it as one snapshot when no finding is an error — the same serialized reload path the file watcher and SIGHUP use. This is how a policy or pipe edit is applied on demand.
{ "adopted": true, "findings": [ { "severity": "warning", "file": "policies.json", "message": "empty document — no policy; every request will be denied (fail closed)" } ]}200 when adopted (warnings allowed); 422 when validation rejected the directory — the previous settings stay in effect, and findings says why.
An optional ?tenant=<id> reloads that tenant’s folder of a nested settings directory and nothing else; it is parsed as strictly as on the pipe reads (400), and an unknown tenant is a 404. A token sent with no valid operator key while tenant 0’s JWKS has not been fetched yet (the ops tree verifies as tenant 0) is refused with 503 + Retry-After: 30. Over a nested directory a rejected folder is not kept on its previous settings, and a 422 for the whole directory can mean adopted in part — see that section.
The message format used on NATS JetStream between ingest and the batch consumer:
{ "table_name": "clicks", "scope": "", "received_timestamp": "2026-03-24T12:00:00.123456789Z", "format": "JSONCompactEachRow", "columns": ["page", "button", "score", "received_timestamp"], "row": ["/home", "signup", 42.5, null]}| Field | Type | Description |
|---|---|---|
table_name |
string | Target ClickHouse table (from URL). |
scope |
string | Reserved; currently always empty. |
received_timestamp |
string | RFC 3339 nano timestamp when WaveHouse received the event. |
format |
string | Row format. Always JSONCompactEachRow today; stated on the wire so a reader can tell an envelope it understands from one it doesn’t. |
columns |
string[] | The table’s insertable column names, in declaration order — what each position in row means. A MATERIALIZED or ALIAS column is computed by ClickHouse and cannot be named in an INSERT, so it never appears here. |
row |
array | One JSONCompactEachRow line: one value per entry in columns, in that order. A column the request body omitted is null here; for a non-nullable column the insert turns that back into the column’s default (input_format_null_as_default), but a Nullable(T) DEFAULT … column stores NULL — only an absent key ever took the default, and a positional row has one slot per column and no way to express absence. Parseable DateTime/DateTime64 values are rewritten to canonical RFC 3339 UTC (see timestamp canonicalization); other values as originally sent. |
columns and row are only meaningful together: a reader that cannot pair them — a length mismatch, an undecodable row, a columns list naming one column twice — has no way to map a value to a column. Both readers also refuse an envelope whose format they do not recognize. Either way the SSE fan-out withholds such an envelope rather than guess, and the batch consumer parks it on the DLQ with X-DLQ-* headers — acking and dropping it only where the DLQ is switched off for that table, since it can never insert on retry. Both outcomes increment wavehouse_ingest_poison_total, separated by its disposition label (parked / dropped).
The same positional row, in a narrower body: a data frame carries table_name, received_timestamp and row, and neither scope nor format — those are envelope fields and do not cross to the client. The column list travels separately, in its own event: schema frame sent before the first row and again whenever the list drifts — though not guaranteed to re-announce after a gap-fill across a change (#543) — rather than repeated on every event — see GET /v1/stream for the frame sequence. The announced list is the caller’s projected columns (the role’s allow/deny rules applied), so both it and the row it describes can be narrower than the envelope’s — the row carries exactly one value per announced column, not per envelope column.
{ "table_name": "clicks", "received_timestamp": "2026-03-24T12:00:00.123456789Z", "row": ["/home", "signup", 42.5]}Three values, where the envelope above has four: this is the frame a role restricted to page, button and score receives, and its event: schema frame announces exactly those three.
When ClickHouse rejects a batch insert (a value it cannot parse, a type mismatch, a table or column it does not have), the worker re-inserts the batch row by row: rows that succeed are acked, and only the rows ClickHouse rejects again are published to the tenant’s own DLQ NATS stream (DLQ_{tenant}) under subjects dlq.{tenant}.{table} (the tenant the row was ingested under; 0 for a settings directory that holds the four files). This prevents infinite retry loops — those messages are ACKed from the main stream and moved to the DLQ for inspection. A ClickHouse that cannot take the insert — down, unreachable, timing out, overloaded, read-only, or refusing WaveHouse’s credentials — never sends a row here: the batch stays in the tenant’s ingest queue and is retried with backoff until it inserts (see Ingest Pipeline). A batch whose tenant has no ClickHouse connection — one no longer served, or one no pool could be opened for (such as by the connection ceiling) — skips the row-by-row retry, which no row of it could pass, and is parked whole; only a served tenant whose DLQ is off for the table leaves it for redelivery, since a tenant no longer served has no switch to read. A second class lands here too: an envelope the worker cannot read at all — malformed JSON, an unknown or absent format, or columns and row that do not pair — is parked without ever reaching a table batch. Two different body shapes land here, and a consumer must not assume one decoder. A row that failed its INSERT is parked as the EventMessage envelope above. An envelope the worker could not read is parked as its original bytes, verbatim — parkOnDLQ republishes what arrived — so it is whatever the producer sent: malformed JSON, an envelope of an unknown format, or a v2 envelope whose columns and row do not pair. Being undecodable as an EventMessage is precisely why it was parked, so decode defensively and fall back on the X-DLQ-Error header, which names the reason. For the first shape the body is the published EventMessage envelope ({"table_name":…,"scope":"","received_timestamp":…,"format":…,"columns":[…],"row":[…]} — the failed row is the row array, read against columns, its DateTime/DateTime64 values as published: canonicalized where WaveHouse could parse them, otherwise the producer’s original spelling — see timestamp canonicalization); the failure reason, table, and time travel in the X-DLQ-Table / X-DLQ-Error / X-DLQ-Timestamp message headers.
Under mq.backend: nats the parked rows of every tenant go to one shared dead-letter stream instead, under <prefix>.dlq.{tenant}.{table}; the bodies and headers are the same.
Use GET /v1/ops/dlq/stats to monitor DLQ depth, per tenant (?tenant=).
Needed whenever a caller must present a role — e.g. to reach an admin endpoint (role == admin_role) or any role beyond the policy default_role. The token must be signed with the tenant’s auth.jwt_secret (or a key its jwks_url serves), both settings-directory keys, and must carry the role in its role claim (auth.role_claim, default role) — a token without the claim resolves to the policy default_role.
"my-secret" below stands for your settings directory’s auth.jwt_secret. The seed wavehouse bootstrap writes (what make dev loads) and the compose quickstart’s deployments/compose/settings/config.json both leave it empty, so no token validates until you set one — a settings key, so it reloads live — and sign with that value (see Development — Validating tokens).
# Using jwt-cli (https://github.com/mike-engel/jwt-cli):jwt encode --secret "my-secret" '{"role": "admin", "exp": 9999999999}'
# Export for use with curl:export TOKEN=$(jwt encode --secret "my-secret" '{"role": "admin", "exp": 9999999999}')curl -X POST "http://localhost:8080/v1/ingest?table=clicks" \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d '{"page": "/home", "button": "signup", "score": 42.5}'