Change Streams (SSE)
Subscribe to real-time document changes via Server-Sent Events. Pro plan only.
info
Change streams are available on the Pro plan only. Free tier users will receive a 403 response.
Subscribe to Changes
GET
/v1/db/{ns}/{collection}/_streamOpens an SSE connection that emits events when documents change.
Path Parameters
| Name | Type | Description |
|---|---|---|
nsrequired | string | Namespace name (e.g. 'default') |
collectionrequired | string | Collection name (e.g. 'users') |
Query Parameters
| Name | Type | Description |
|---|---|---|
events | string | Comma-separated event types: created, updated, deleted. Default: all events. |
filter[field] | string | Only stream events for documents matching this filter. |
Headers
| Name | Type | Description |
|---|---|---|
Acceptrequired | string | Must be 'text/event-stream' |
Authorizationrequired | string | Bearer token (API key) |
Last-Event-ID | string | Resume from this event ID after reconnection |
curl -N https://api.jsondb.cloud/v1/db/default/users/_stream \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Accept: text/event-stream"Event Format
Each event follows the SSE standard format with an event type, unique ID, and JSON data payload.
event: document.created
id: evt_a1b2c3d4e5f6
data: {"event":"document.created","timestamp":"2026-02-24T14:30:00Z","collection":"users","namespace":"default","document":{"_id":"usr_a1b2c3d4","name":"Alice","email":"[email protected]","_version":1}}Resumability
When a connection drops, clients can reconnect with the Last-Event-ID header to replay missed events. Events are retained for up to 5 minutes.
curl -N https://api.jsondb.cloud/v1/db/default/users/_stream \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Accept: text/event-stream" \
-H "Last-Event-ID: evt_a1b2c3d4e5f6"info
The SDK handles reconnection and event replay automatically. You don't need to manage Last-Event-ID manually.
Limits
| Limit | Free | Pro |
|---|---|---|
| Change streams | Not available | Included |
| Concurrent connections per key | - | 10 |
| Event retention (for resume) | - | 5 minutes |
| Heartbeat interval | - | 30 seconds |