Using
Opens a Server-Sent Events stream that delivers real-time change events (`set` / `delete`) for keys matching the optional prefix. The connection stays open until the client disconnects; a keep-alive ping is sent automatically.
applies to v0.5.1const url = 'https://example.com/store-api/kv/example/watch';const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url https://example.com/store-api/kv/example/watch \ --header 'Authorization: Bearer <token>'A Last-Event-ID (header or ?last_event_id=) resumes gaplessly from an in-memory
replay ring when possible; otherwise the server emits event: reset before continuing live. A
client that ignores id:/reset behaves exactly as before this was added.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Domain name
Query Parameters
Section titled “Query Parameters”Key prefix filter
Resume id from a previous id: (or event: reset) — for callers that cannot set headers. Ignored when the Last-Event-ID header is present.
Header Parameters
Section titled “Header Parameters”Resume id from a previous id: (or event: reset); set automatically by a native EventSource’s auto-reconnect. Takes precedence over ?last_event_id=.
Responses
Section titled “Responses”SSE stream of key change events. Every event carries an id:. Event types: set / delete (data: the key) and reset (data: {"reason": ...}, emitted whenever gapless resume cannot be guaranteed — the client should re-read the domain, then keep applying events normally).
Domain is being deleted