REST (OFREP)
If there is no OpenFeature SDK for your stack, or you just want a raw HTTP call, evaluate directly against the OpenFeature Remote Evaluation Protocol (OFREP). This is the exact protocol the SDKs speak, so behavior is identical.
All requests go to the Flagon API host and authenticate with an SDK key:
Authorization: Bearer flagon_sdk_...
Content-Type: application/jsonExamples use https://api.flagon.io. Running Flagon locally, the API is at
http://localhost:3002.
Evaluate one flag
POST /ofrep/v1/evaluate/flags/{key}The body carries the evaluation context
under a context object:
curl -X POST "https://api.flagon.io/ofrep/v1/evaluate/flags/new-checkout" \
-H "Authorization: Bearer $FLAGON_SDK_KEY" \
-H "Content-Type: application/json" \
-d '{"context":{"targetingKey":"user-123","plan":"pro"}}'A successful response resolves the flag for that context:
{
"key": "new-checkout",
"value": true,
"reason": "TARGETING_MATCH",
"variant": "on",
"metadata": {}
}The value is typed by the flag: a boolean, string, number, or JSON object. See
reasons for what each reason means.
Evaluate every flag (bulk)
To fetch every flag configured in the key's environment in one round trip, omit the key:
POST /ofrep/v1/evaluate/flagscurl -X POST "https://api.flagon.io/ofrep/v1/evaluate/flags" \
-H "Authorization: Bearer $FLAGON_SDK_KEY" \
-H "Content-Type: application/json" \
-d '{"context":{"targetingKey":"user-123","plan":"pro"}}'The response is a flags array, each entry the same shape as a single
evaluation:
{
"flags": [
{ "key": "new-checkout", "value": true, "reason": "TARGETING_MATCH", "variant": "on", "metadata": {} },
{ "key": "theme", "value": "dark", "reason": "STATIC", "variant": "dark", "metadata": {} }
]
}Bulk is how SDKs hydrate all flags at once. Fetch on startup (and refresh periodically), then evaluate from the result in memory rather than making a call per flag.
Errors
| Status | errorCode | Meaning |
| --- | --- | --- |
| 401 | AUTHENTICATION_ERROR | Missing, malformed, or revoked SDK key. |
| 404 | FLAG_NOT_FOUND | No flag with that key is configured in this environment. |
| 429 | None | Too many requests; back off. A Retry-After header says for how long. |
Error responses carry an errorDetails string with a human-readable
explanation. On any error, an OpenFeature SDK falls back to the default value you
passed; if you call OFREP directly, handle these statuses and fall back the same
way, so a flag never takes down a request.
Notes on behavior
- The clock is the server's. Time-based targeting evaluates against Flagon's
clock (
$currentTime), so a client can't shift a scheduled rollout by sending its own time. - Archived flags still evaluate. Only deleting a flag stops it resolving, so old clients don't break mid-migration.
- Config is cached briefly. A configuration change is live within a few seconds, not necessarily the same millisecond.
Next
- Evaluate with OpenFeature: let an SDK handle this for you.
- Management API: create and configure flags programmatically.