Flambe docs

Subscribe to live events

A [Server-Sent Events](https://developer.mozilla.org/docs/Web/API/Server-sent_events) stream of changes to the caller's data — most usefully, import progress and completion, which removes the need to poll `GET /api/imports/{id}`. The connection is authenticated with the usual `Authorization: Bearer` header. Note that the browser's built-in `EventSource` cannot set headers, so on the web you need a fetch-based SSE client. The server sends a comment line every few seconds as a keep-alive; ignore lines beginning with `:`.

GET
/api/events/stream

A Server-Sent Events stream of changes to the caller's data — most usefully, import progress and completion, which removes the need to poll GET /api/imports/{id}.

The connection is authenticated with the usual Authorization: Bearer header. Note that the browser's built-in EventSource cannot set headers, so on the web you need a fetch-based SSE client.

The server sends a comment line every few seconds as a keep-alive; ignore lines beginning with :.

Authorization

bearerAuth
AuthorizationBearer <token>

A Clerk session JWT. Obtain one with a Clerk frontend SDK (session.getToken()) or, for server-to-server use, with a Clerk machine token. The token's sub claim is the Flambe user id that scopes every request.

In: header

Response Body

text/event-stream

application/json

curl -X GET "https://example.com/api/events/stream"
": connected\n\nevent: import.updated\ndata: {\"id\":\"4d1f8c2e\",\"status\":\"processing\"}\n\nevent: import.completed\ndata: {\"id\":\"4d1f8c2e\",\"recipe_id\":\"9b8a7c6d\"}\n"