OpenFeature Remote Evaluation Protocol (OFREP) v1 compliance — endpoints, request/response format, and interoperability
OFREP Protocol
Flaggr implements the OpenFeature Remote Evaluation Protocol (OFREP) v1, enabling interoperability with any OFREP-compatible client or provider.
What is OFREP?
OFREP is the standard protocol defined by the OpenFeature project for remote flag evaluation. It provides a vendor-neutral API that any feature flag provider can implement, and any OpenFeature SDK can consume.
OFREP means you can switch between flag providers without changing your application code. Any OFREP-compatible SDK works with Flaggr.
Endpoints
Single Flag Evaluation
/api/ofrep/v1/evaluate/flags/{key}Bearer token (optional)Evaluate a single flag by key.
Headers:
| Header | Required | Description |
|---|---|---|
X-Service-Id | Yes | Service identifier (or serviceId query param) |
X-Environment | No | development, staging, production (default: development) |
Authorization | No | Bearer token for authenticated evaluation |
Request:
{
"context": {
"targetingKey": "user-123",
"email": "alice@example.com",
"plan": "enterprise"
}
}Response (200):
{
"key": "checkout-v2",
"value": true,
"reason": "TARGETING_MATCH",
"variant": "enabled",
"metadata": {
"evaluatedAt": "2025-07-20T10:30:00Z"
}
}Multi-Language Examples
curl -s -X POST https://flaggr.dev/api/ofrep/v1/evaluate/flags/checkout-v2 \
-H "Authorization: Bearer flg_abc123xxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-H "X-Service-Id: web-app" \
-H "X-Environment: production" \
-d '{
"context": {
"targetingKey": "user-123",
"email": "alice@example.com",
"plan": "enterprise"
}
}' | jqBulk Evaluation
/api/ofrep/v1/evaluate/flagsBearer token (optional)Evaluate multiple flags in a single request.
Request:
{
"context": {
"targetingKey": "user-123",
"plan": "enterprise"
},
"flags": ["checkout-v2", "dark-mode", "new-pricing"]
}Omit flags to evaluate all flags for the service.
Response (200):
{
"flags": [
{
"key": "checkout-v2",
"value": true,
"reason": "TARGETING_MATCH",
"variant": "enabled"
},
{
"key": "dark-mode",
"value": false,
"reason": "DEFAULT"
},
{
"key": "new-pricing",
"value": "tier-b",
"reason": "VARIANT",
"variant": "tier-b"
}
]
}Multi-Language Examples
curl -s -X POST https://flaggr.dev/api/ofrep/v1/evaluate/flags \
-H "Authorization: Bearer flg_abc123xxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-H "X-Service-Id: web-app" \
-d '{
"context": {
"targetingKey": "user-123",
"plan": "enterprise"
},
"flags": ["checkout-v2", "dark-mode", "new-pricing"]
}' | jq '.flags[] | "\(.key): \(.value) (\(.reason))"'Server Metadata
/api/ofrep/v1/metadataReturns server capabilities and version information.
Response:
{
"name": "flaggr",
"version": "1.0.0",
"capabilities": {
"cacheInvalidation": true,
"flagChangeEvents": true,
"contextTransform": true
}
}OFREP Reasons
| Reason | Description |
|---|---|
STATIC | Statically configured value |
DEFAULT | Default value returned |
TARGETING_MATCH | Targeting rule matched |
SPLIT | Variant percentage split |
CACHED | Cached evaluation result |
DISABLED | Flag is disabled |
ERROR | Evaluation error |
UNKNOWN | Unknown reason |
Error Responses
OFREP defines standard error codes:
{
"key": "nonexistent-flag",
"errorCode": "FLAG_NOT_FOUND",
"errorDetails": "Flag 'nonexistent-flag' not found in service 'web-app'",
"reason": "ERROR"
}| Error Code | HTTP Status | Description |
|---|---|---|
PROVIDER_NOT_READY | 503 | Service initializing |
FLAG_NOT_FOUND | 404 | Flag key doesn't exist |
PARSE_ERROR | 400 | Invalid request format |
TYPE_MISMATCH | 400 | Value type doesn't match |
INVALID_CONTEXT | 400 | Context validation failed |
GENERAL | 500 | Unexpected error |
Using with OpenFeature SDKs
Any OpenFeature OFREP provider works with Flaggr.
import { OpenFeature } from "@openfeature/server-sdk";
import { OFREPProvider } from "@openfeature/ofrep-provider";
const provider = new OFREPProvider({
baseUrl: "https://flaggr.dev/api/ofrep/v1",
headers: {
"X-Service-Id": "web-app",
"Authorization": "Bearer flg_abc123xxxxxxxxxxxx",
},
});
OpenFeature.setProvider(provider);
const client = OpenFeature.getClient();
const isEnabled = await client.getBooleanValue("checkout-v2", false, {
targetingKey: "user-123",
});
console.log(`checkout-v2 enabled: ${isEnabled}`);Related
- Protocols — Protocol comparison (REST, Connect, gRPC, OFREP, SSE)
- REST API Reference — Native Flaggr evaluation endpoints
- Provider Architecture — Flaggr provider implementations