API ReferenceFlag Evaluation APIFlag Events

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

Event Types

flag-updated Event

Sent when a single flag is created, updated, or deleted.

event: flag-updated
data: {"flagKey":"my-feature","timestamp":"2024-01-21T10:30:45.123Z"}
id: 1705844445123
FieldTypeDescription
flagKeystringThe key of the flag that changed.
timestampstringISO 8601 timestamp of when the change occurred.
idstringEvent ID in epoch milliseconds. Use for client-side ordering and deduplication.

config-updated Event

Sent when configuration changed that may affect multiple flags. Clients should re-evaluate all flags.

event: config-updated
data: {"reason":"segment-modified","timestamp":"2024-01-21T10:30:45.123Z"}
id: 1705844445123
FieldTypeDescription
reasonstringWhy the configuration update occurred.
timestampstringISO 8601 timestamp of when the change occurred.
idstringEvent ID in epoch milliseconds. Use for client-side ordering and deduplication.

Possible reason values:

heartbeat Event

Sent every 15 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

GET
/api/v1/flags/events

Header Parameters

X-API-Key?string

Environment API key for authentication. Required for establishing the SSE connection.

X-Flipswitch-SDK?string
X-Flipswitch-Runtime?string
X-Flipswitch-OS?string
X-Flipswitch-Features?string
X-Forwarded-For?string

Client IP address (set by reverse proxy)

Response Body

text/plain

text/plain

curl -X GET "https://loading/api/v1/flags/events"
Empty
"string"
"string"