API Reference
Flipswitch REST APIs
Flag Evaluation API
The Flag Evaluation API follows the OpenFeature Remote Evaluation Protocol (OFREP). Use it directly or through any OpenFeature SDK.
Authentication
All requests require an API key via the X-API-Key header:
curl -H "X-API-Key: YOUR_API_KEY" https://api.flipswitch.io/ofrep/v1/...API keys are scoped to a specific environment. Each environment automatically gets a key when created. Find your key in the dashboard under Project > Environments > select your environment.
Slack
Get flag change notifications delivered to a Slack channel
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 15 seconds to keep the connection alive and detect stale connections ## 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 ``` | Field | Type | Description | |-------|------|-------------| | `flagKey` | string | The key of the flag that changed. | | `timestamp` | string | ISO 8601 timestamp of when the change occurred. | | `id` | string | Event 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 ``` | Field | Type | Description | |-------|------|-------------| | `reason` | string | Why the configuration update occurred. | | `timestamp` | string | ISO 8601 timestamp of when the change occurred. | | `id` | string | Event ID in epoch milliseconds. Use for client-side ordering and deduplication. | **Possible `reason` values:** - `segment-modified` - A segment rule was created, updated, or deleted - `api-key-rotated` - API key was regenerated ### `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) ```bash curl -N -H "X-API-Key: your-api-key" \ https://your-server/api/v1/flags/events ```