fluxgatedocs
Dashboard ↗GitHub

Stream rollups

GET/v1/stream
Bearer API keyQuery serviceAPI 1.0.0

Streams current rollup totals in committed revision order; multiple updates between polls may coalesce. Each event includes its metric kind. A new stream starts from now: it is for watching what happens next, and replaying history on connect would flood a client that only wanted the live edge.

Resuming. Every frame that changes the client's position carries an id: each rollup event, a reset event, and an id-only frame sent immediately after the retry preamble. Reconnect with the most recent one as Last-Event-ID and the stream continues with the next change after it -- nothing skipped, nothing repeated. A row that changed again while the client was away is delivered once, with its current totals. Ids are opaque, tenant-bound and at most 512 characters; treat them as positions, not as data.

Resets. When a position cannot be honoured the first event is reset, with data {"reason": ..., "revision": ...}, and the stream continues live from the latest revision. The client should refetch the range it displays through GET /v1/query. Reasons: stale_cursor (further behind than the server's resume horizon), future_cursor (ahead of every commit, as after a database restore), foreign_cursor (issued for another tenant), and lagging (a connected stream that fell too far behind to catch up). A stream that is behind reads its backlog back to back rather than one page per poll.

Server-sent events rather than WebSocket: the traffic is one-directional, every HTTP client already speaks it, it survives proxies that mangle upgrades, and reconnection is part of the protocol rather than of every client.

The stream advertises a retry interval and sends : keep-alive comments while idle, so intermediaries do not reap a connection they believe is dead. Connections are bounded server-side; a client should reconnect, which the protocol does automatically.

Per-instance tenant quotas default to eight concurrent streams. Tenant quota exhaustion returns 429; instance capacity exhaustion returns 503. Both include Retry-After.

The cursor advances on committed revision, not event time, so a late arrival updating a window that closed minutes ago still appears.

Payloads. A rollup event's data is a StreamRollup and a reset event's is a StreamReset (see the schemas below).

Events contain replacement totals, not additive deltas. Default connections last at most 30 minutes, poll every 2 seconds, send heartbeats every 20 seconds and honour a resume spanning up to 10,000 tenant commits. The retry preamble is twice the poll interval. Histogram buckets/percentiles are not streamed.

Base URL

These addresses are for local development. Replace them with your own deployed service URLs.

http://localhost:8082 Local query API; replace with the deployed query URL.

Request example

Replace credential and batch-key placeholders before running. JavaScript examples use Node.js 24; Python examples use the standard library. Browser clients need a same-origin proxy or suitable CORS configuration. See safe retries for production retry handling.

bash
curl --no-buffer --request GET 'http://localhost:8082/v1/stream?metric=http.requests' \
  --header 'Authorization: Bearer <YOUR_API_KEY>'

Authentication

An API key in the form fxg_<key id>_<secret>, sent as Authorization: Bearer fxg_....

The server stores only a SHA-256 digest of the secret. Every authentication failure returns an identical 401 regardless of cause, so a probing client cannot use the response to tell a valid key ID from an invalid one.

Credentials select the tenant. See tenant provisioning and key rotation.

Parameters

metricquery · stringoptional

Restricts the tail to one metric. Omit to tail everything.

Last-Event-IDheader · stringoptional

The id of the last frame received on an earlier connection. The stream resumes immediately after it, or begins with a reset event when it cannot. Browsers' EventSource sends it automatically on reconnect; other clients should send it themselves. A value this server could not have issued is rejected with 400.

Max length 512

Responses

Expand a response to inspect its headers and complete schema.

200An event stream.

An event stream.

text/event-stream

A new stream

text
retry: 4000

id: eyJ2IjoxLCJ0IjoiODVhYjU0N2JlYWQ2NmE4YSIsInIiOjQxfQ

event: rollup
id: eyJ2IjoxLCJ0IjoiODVhYjU0N2JlYWQ2NmE4YSIsInIiOjQyLCJrIjoiaGlzdG9ncmFtIiwibSI6ImxpdmUuZGVtbyIsImwiOiJlM2IwYzQ0Mjk4ZmMxYzE0OWFmYmY0Yzg5OTZmYjkyNCIsInciOjE3ODg0ODU3OTAwMDAwMDB9
data: {"kind":"histogram","metric":"live.demo","labels":{},"window_start":"2026-09-04T01:36:30Z","window_end":"2026-09-04T01:36:40Z","count":3,"sum":600,"min":100,"max":300,"last":300}

: keep-alive

A resume that could not be honoured

text
retry: 4000

event: reset
id: eyJ2IjoxLCJ0IjoiODVhYjU0N2JlYWQ2NmE4YSIsInIiOjEyMDQ0fQ
data: {"reason":"stale_cursor","revision":12044}
400Last-Event-ID is not a position this stream issued. Reconnect without it.

Last-Event-ID is not a position this stream issued. Reconnect without it.

Response headers

X-Request-Idstring

Correlation ID, echoed on every response. Quote it when reporting a problem.

application/problem+json

Problem ↗
typestringrequired
Format uri
titlestringrequired
statusintegerrequired
detailstringoptional

Human-readable explanation. Do not branch on this.

codestringrequired

Stable machine-readable identifier. Branch on this.

"bad_request" "validation_failed" "unauthorized" "forbidden" "not_found" "method_not_allowed" "conflict" "payload_too_large" "unsupported_media_type" "rate_limited" "timeout" "service_unavailable" "internal_error"
request_idstringoptional
errorsFieldError[]optional
Array items · FieldErrorFieldError ↗
Object properties
fieldstringrequired

Dotted path to the offending value, including the batch index.

messagestringrequired

What the submitter must change.

401Missing or invalid credentials.

Missing or invalid credentials.

Response headers

WWW-Authenticatestring

The Bearer challenge.

application/problem+json

Problem ↗
typestringrequired
Format uri
titlestringrequired
statusintegerrequired
detailstringoptional

Human-readable explanation. Do not branch on this.

codestringrequired

Stable machine-readable identifier. Branch on this.

"bad_request" "validation_failed" "unauthorized" "forbidden" "not_found" "method_not_allowed" "conflict" "payload_too_large" "unsupported_media_type" "rate_limited" "timeout" "service_unavailable" "internal_error"
request_idstringoptional
errorsFieldError[]optional
Array items · FieldErrorFieldError ↗
Object properties
fieldstringrequired

Dotted path to the offending value, including the batch index.

messagestringrequired

What the submitter must change.

422An RFC 9457 problem document.

An RFC 9457 problem document.

Response headers

X-Request-Idstring

Correlation ID, echoed on every response. Quote it when reporting a problem.

application/problem+json

Problem ↗
typestringrequired
Format uri
titlestringrequired
statusintegerrequired
detailstringoptional

Human-readable explanation. Do not branch on this.

codestringrequired

Stable machine-readable identifier. Branch on this.

"bad_request" "validation_failed" "unauthorized" "forbidden" "not_found" "method_not_allowed" "conflict" "payload_too_large" "unsupported_media_type" "rate_limited" "timeout" "service_unavailable" "internal_error"
request_idstringoptional
errorsFieldError[]optional
Array items · FieldErrorFieldError ↗
Object properties
fieldstringrequired

Dotted path to the offending value, including the batch index.

messagestringrequired

What the submitter must change.

429This tenant has reached its concurrent-stream quota; respect Retry-After.

This tenant has reached its concurrent-stream quota; respect Retry-After.

Response headers

Retry-Afterinteger

Seconds to wait before retrying. Absent when retrying cannot help because the batch exceeds the burst allowance.

application/problem+json

Problem ↗
typestringrequired
Format uri
titlestringrequired
statusintegerrequired
detailstringoptional

Human-readable explanation. Do not branch on this.

codestringrequired

Stable machine-readable identifier. Branch on this.

"bad_request" "validation_failed" "unauthorized" "forbidden" "not_found" "method_not_allowed" "conflict" "payload_too_large" "unsupported_media_type" "rate_limited" "timeout" "service_unavailable" "internal_error"
request_idstringoptional
errorsFieldError[]optional
Array items · FieldErrorFieldError ↗
Object properties
fieldstringrequired

Dotted path to the offending value, including the batch index.

messagestringrequired

What the submitter must change.

500Failure before the stream starts; after headers, failures may appear as a disconnect or logged failed poll.

Failure before the stream starts; after headers, failures may appear as a disconnect or logged failed poll.

Response headers

X-Request-Idstring

Correlation ID, echoed on every response. Quote it when reporting a problem.

application/problem+json

Problem ↗
typestringrequired
Format uri
titlestringrequired
statusintegerrequired
detailstringoptional

Human-readable explanation. Do not branch on this.

codestringrequired

Stable machine-readable identifier. Branch on this.

"bad_request" "validation_failed" "unauthorized" "forbidden" "not_found" "method_not_allowed" "conflict" "payload_too_large" "unsupported_media_type" "rate_limited" "timeout" "service_unavailable" "internal_error"
request_idstringoptional
errorsFieldError[]optional
Array items · FieldErrorFieldError ↗
Object properties
fieldstringrequired

Dotted path to the offending value, including the batch index.

messagestringrequired

What the submitter must change.

503Capacity exhausted; respect Retry-After before retrying.

Capacity exhausted; respect Retry-After before retrying.

Response headers

X-Request-Idstring

Correlation ID, echoed on every response. Quote it when reporting a problem.

application/problem+json

Problem ↗
typestringrequired
Format uri
titlestringrequired
statusintegerrequired
detailstringoptional

Human-readable explanation. Do not branch on this.

codestringrequired

Stable machine-readable identifier. Branch on this.

"bad_request" "validation_failed" "unauthorized" "forbidden" "not_found" "method_not_allowed" "conflict" "payload_too_large" "unsupported_media_type" "rate_limited" "timeout" "service_unavailable" "internal_error"
request_idstringoptional
errorsFieldError[]optional
Array items · FieldErrorFieldError ↗
Object properties
fieldstringrequired

Dotted path to the offending value, including the batch index.

messagestringrequired

What the submitter must change.

504Initial database operation exceeded its deadline before stream headers.

Initial database operation exceeded its deadline before stream headers.

Response headers

X-Request-Idstring

Correlation ID, echoed on every response. Quote it when reporting a problem.

application/problem+json

Problem ↗
typestringrequired
Format uri
titlestringrequired
statusintegerrequired
detailstringoptional

Human-readable explanation. Do not branch on this.

codestringrequired

Stable machine-readable identifier. Branch on this.

"bad_request" "validation_failed" "unauthorized" "forbidden" "not_found" "method_not_allowed" "conflict" "payload_too_large" "unsupported_media_type" "rate_limited" "timeout" "service_unavailable" "internal_error"
request_idstringoptional
errorsFieldError[]optional
Array items · FieldErrorFieldError ↗
Object properties
fieldstringrequired

Dotted path to the offending value, including the batch index.

messagestringrequired

What the submitter must change.

Something to improve? Edit this page View source

Search the complete documentation.