Subscribe to flag change events
Server-Sent Events (SSE) endpoint for real-time flag change notifications.
Overview
This endpoint establishes a long-lived SSE connection that streams flag change events in real-time. Use this to keep your application's flag values synchronized without polling.
Connection Behavior
- Long-lived connection: The connection remains open indefinitely until closed by the client
- Automatic filtering: Events are filtered to only include changes for the environment associated with your API key
- Heartbeat: A heartbeat event is sent every 30 seconds to keep the connection alive and detect stale connections
Event Types
flag-change Event
Sent when a flag is created, updated, deleted, or when a segment change affects flag evaluation.
event: flag-change
data: {"flagKey":"my-feature","timestamp":"2024-01-21T10:30:45.123Z"}
id: 1705844445123
| Field | Type | Description |
|---|---|---|
flagKey | string | null | The key of the changed flag. null when a segment change may affect multiple flags. |
timestamp | string | ISO 8601 timestamp of when the change occurred. |
id | string | Event ID in epoch milliseconds. Use for client-side ordering and deduplication. |
When flagKey is null: A segment was modified that may affect multiple flags. Clients should re-evaluate all flags.
heartbeat Event
Sent every 30 seconds to keep the connection alive.
event: heartbeat
data: {}
No action required from clients. This event helps detect stale connections and prevents proxy timeouts.
curl (Testing)
curl -N -H "X-API-Key: your-api-key" \
https://your-server/api/v1/flags/events
Header Parameters
X-API-KeystringEnvironment API key for authentication. Required for establishing the SSE connection.