Skip to main content

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.

Vendor Neutral

OFREP means you can switch between flag providers without changing your application code. Any OFREP-compatible SDK works with Flaggr.

Endpoints

Single Flag Evaluation

POST/api/ofrep/v1/evaluate/flags/{key}Bearer token (optional)

Evaluate a single flag by key.

Headers:

HeaderRequiredDescription
X-Service-IdYesService identifier (or serviceId query param)
X-EnvironmentNodevelopment, staging, production (default: development)
AuthorizationNoBearer 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"
    }
  }' | jq

Bulk Evaluation

POST/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

GET/api/ofrep/v1/metadata

Returns server capabilities and version information.

Response:

{
  "name": "flaggr",
  "version": "1.0.0",
  "capabilities": {
    "cacheInvalidation": true,
    "flagChangeEvents": true,
    "contextTransform": true
  }
}

OFREP Reasons

ReasonDescription
STATICStatically configured value
DEFAULTDefault value returned
TARGETING_MATCHTargeting rule matched
SPLITVariant percentage split
CACHEDCached evaluation result
DISABLEDFlag is disabled
ERROREvaluation error
UNKNOWNUnknown 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 CodeHTTP StatusDescription
PROVIDER_NOT_READY503Service initializing
FLAG_NOT_FOUND404Flag key doesn't exist
PARSE_ERROR400Invalid request format
TYPE_MISMATCH400Value type doesn't match
INVALID_CONTEXT400Context validation failed
GENERAL500Unexpected 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}`);