Dashboard
Evaluation (OFREP)

Evaluate a flag

POST
/ofrep/v1/evaluate/flags/{key}

Evaluates one flag for the evaluation context in the request body. Returns the value, the variant, and the reason it was served.

Accepts an evaluation key, a management key, or a public token.

Returns 404 with FLAG_NOT_FOUND if the flag does not exist in the credential's environment. Returns 400 if evaluation fails, such as TARGETING_KEY_MISSING when a percentage rollout needs a targetingKey. A request body that is not valid JSON returns 400 with PARSE_ERROR, and a JSON body that is not a valid evaluation request returns 400 with INVALID_CONTEXT.

Authorization

bearer
headerAuthorizationBearer <token>

Send a credential in the Authorization header: Authorization: Bearer <token>. Each credential belongs to one environment of one workspace, so the API never takes a workspace or environment in the URL.

  • Management key (ffk_…, secret): manages flags, segments, environments, and API keys, and reads the audit log and analytics. It can also do everything an evaluation key can.
  • Evaluation key (ffk_…, secret): for server SDKs. It evaluates flags, reads flag definitions for local evaluation, and sends telemetry.
  • Public token (ffp_…, not secret): for browser and mobile apps. It evaluates flags through OFREP and sends telemetry. It cannot read flag definitions.

Keep secret keys on your server. A 401 response means the credential is missing or not valid. A 403 response means the credential is valid but its role cannot perform the operation.

Path Parameters

key*string

The flag key, such as new-checkout.

Request Body

application/json
  1. body

The evaluation context to evaluate flags for. An empty body evaluates with an empty context.

context?

Attributes of the subject you evaluate flags for. targetingKey identifies the subject, such as a user ID, and percentage rollouts use it by default. Add any other attributes your targeting rules test, such as email or plan.

Response Body

OK

application/json
  1. response

A successful flag evaluation.

key*string

The flag key.

value*unknown

The evaluated value. Its type matches the flag type.

reason*string

Why the value was served. STATIC: no rule matched, so the default variant was served. TARGETING_MATCH: a rule served a fixed variant. SPLIT: a percentage rollout chose the variant. DISABLED: the flag is off, so the off variant was served. ERROR: evaluation failed.

Value in"STATIC""DEFAULT""TARGETING_MATCH""SPLIT""CACHED""DISABLED""UNKNOWN""STALE""ERROR"
variant?string

The name of the served variant.

metadata?

Free-form key-value data for the flag. Values must be strings, numbers, or booleans. Evaluation responses return it as flag metadata.

Example Request
curl -X POST 'https://api.toggld.io/ofrep/v1/evaluate/flags/string' \  -H 'Content-Type: application/json' \  -d '{  "context": {    "targetingKey": "user-123",    "plan": "beta"  }}'
Example Response
{  "key": "new-checkout",  "value": true,  "reason": "TARGETING_MATCH",  "variant": "on",  "metadata": {    "team": "growth"  }}