Evaluate all flags
Evaluate all feature flags for the given context.
ETag Caching
This endpoint supports ETag-based caching to reduce bandwidth and improve performance for polling clients.
How it works
- First request: Call without
If-None-Matchheader. Response includes anETagheader. - Subsequent requests: Include the
If-None-Matchheader with the previousETagvalue. - If flags unchanged: Server returns
304 Not Modifiedwith no body. - If flags changed: Server returns
200 OKwith new flag values and a newETag.
Example flow
# First request
POST /ofrep/v1/evaluate/flags
X-API-Key: your-api-key
Response: 200 OK
ETag: "abc123"
{ "flags": [...] }
# Subsequent request with ETag
POST /ofrep/v1/evaluate/flags
X-API-Key: your-api-key
If-None-Match: "abc123"
Response: 304 Not Modified (no body)
When to use
Use ETag caching when polling for flag updates. For real-time updates, consider using the SSE endpoint at /api/v1/flags/events instead.
Header Parameters
API key for authentication
ETag from a previous response. If the flag configuration hasn't changed, the server returns 304 Not Modified.
Request Body
application/json
Evaluation request with context
Response Body
application/json
application/json
application/json
curl -X POST "https://loading/ofrep/v1/evaluate/flags" \ -H "X-API-Key: string" \ -H "Content-Type: application/json" \ -d '{ "context": { "targetingKey": "string" } }'{
"flags": [
{
"result": {
"key": "string",
"errorCode": "string",
"errorDetails": "string"
}
}
],
"metadata": {
"property1": null,
"property2": null
}
}{
"errorCode": "string",
"errorDetails": "string"
}{
"errorCode": "string",
"errorDetails": "string"
}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 ```
Evaluate single flag
Evaluate a single feature flag for the given context