Every run, and every new result, to whoever may see it
A call through any front door is recorded as it completes: one history row and one event, in the same batch. A separate events server reads every instance's events from the shared store and streams each one, over plain HTTP, only to the keys allowed to see it. With live queries (experimental), a change to the data makes the same server run each subscribed query again as its viewer, and send the result only if it changed.
result north · 413 open changeresult north · 412 open subscribe
What arrivesone frame per run: the record, never a row's values
id: 4182 source rest query orders_by_customer v1 status success rows 3812 ms key partner-acme
Stablecompatibility promiseExpmay change in a minor releaseOr GET /events on the main server: no extra process, up to 4 streams, its own process only, no resume.
Runs happenApps, partners, AI agents and exportsEvery run through a front door is recorded, with source set to rest, mcp or export.
↓
The governed coreIdentity → policy → execution → recordEach run is recorded as it completes: one history row and one event, in the same batch, on every instance.
↓
Shared storeThe event logKept 24 h by default. PostgreSQL wakes the events server at once; SQLite and the ClickHouse run store (experimental) are polled every second.
↓
Events server Stablequeryapigate eventsThousands of streams per process. A key sees its own runs, the admin key sees all, and filters only narrow.
↓
Who watchesOps screens, partner portals, failure boardsEach gets frames with who, which query, status, rows and timing, never a row's values.
Live queries ExpA change, then the result againA write through QueryAPIGate, or a change Debezium Server reads from the database's log, signals the tables that changed - never rows.
↓
Events serverRe-run as each viewerEach subscribed query that reads those tables runs again with the viewer's grants, row filter and masking, at most once a second, and is sent only if its result changed.
↓
Who watchesA regional dashboard on GET /live/Its own region's result, and nobody else's rows.
whoscreen · key in headerdoorGET /live/<query>re-run as the viewer ✓grants · masking ✓sent only if changed ✓datayour writes · Debezium
whobrowser · key in headerdoorGET /eventsper-key feed ✓every instance, one stream ✓filter by query · kind ✓datarun history · shared store
For screens that stay current
A screen that updates when the data changes, each viewer seeing only their rows
A dashboard, an order screen or a stock level should change when the data does - not when the next poll comes round. Subscribe to the saved query the screen already calls. QueryAPIGate sends its current result, then the new one each time the tables behind it change, whether the change came through QueryAPIGate or straight into the database through Debezium. Each result is run as the viewer: a regional manager's screen shows their region, and nobody else's rows ever reach it.
The shape of the call
GET /live/example_kpi_active_rentals → event: result with reason: subscribe, then reason: change after each changeGET /events?query=... → who ran what, as it happens
What you stop building
✓A polling loop.
✓A websocket service.
✓A cache you have to invalidate by hand: the same signals expire cached GET /q/ answers that read the changed tables.
✓A second permission check on the push path: a key that may not run the query gets the same 403 as GET /q/, before any stream opens.
ExperimentalLive queries are new in 0.51 and off unless QUERYAPIGATE_LIVE_QUERIES=1; their route, events and settings may change in a minor release. Run events are stable.
The other half: who ran what
✓Server-sent events over plain HTTP: a fetch stream in the browser with the key in a header, no WebSocket infrastructure.
✓Per-key feeds, so a partner can watch their own calls and nobody else's.
✓Across several instances, queryapigate events reads every instance's runs from the shared store, woken by a PostgreSQL notification.
✓Stable since 0.34, under the compatibility promise. Filter by query, connection, kind or status.
The example APIs ship with a generated database and one scoped key per scenario, so you can try each of these in a few minutes without connecting anything of your own.