Evaluation

Evaluation

Client-authenticated flag evaluation and SDK bootstrap endpoints

Overview

The Evaluation resource provides the public endpoints used to resolve feature flags for an environment. It supports evaluating every flag for an evaluation context, fetching the flag definitions and segments required for SDK local evaluation, and evaluating one flag by key.

These routes use a project-scoped API key for the evaluation request. The project is derived from the authenticated key rather than supplied in the URL, so an evaluation request is limited to that key's project. Server keys may also call the evaluation routes.

Note:

Use GET /v1/config when an application will evaluate flags locally after bootstrap. Use POST /v1/evaluate or GET /v1/flags/{flagKey}/eval when the API should resolve values for the supplied context.

Schema

The following fields make up the evaluation request and response shapes. Nested fields are shown with their parent field so the same table covers all three endpoints.

FieldTypeRequiredDescription
environmentstringYesEnvironment key used for evaluation or configuration bootstrap.
contextobjectYes for POST /v1/evaluateEvaluation context containing a subject key and optional attributes.
context.keystringYesStable subject identifier, such as a user ID.
context.attributesrecord of attribute valuesNoAdditional subject attributes used by targeting conditions.
flagKeystringYes in an evaluation resultFlag key associated with an evaluation result. The request supplies this value as the path parameter for single-flag evaluation.
valueJSON valueYes in an evaluation resultResolved flag value.
variationKeystringYes in an evaluation resultNamed variation selected for the flag.
reasonobjectYes in an evaluation resultResolution metadata.
reason.kindOFF, FALLTHROUGH, RULE_MATCH, or ERRORYesEvaluation outcome category.
reason.ruleIdstringNoIdentifier of the targeting rule when one is associated with the result.
reason.ruleIndexintegerNoPosition of the targeting rule when one is associated with the result.
reason.errorstringNoError detail when the evaluation result has an error reason.
flagsrecord keyed by flag key, with evaluation results as valuesYes in POST /v1/evaluate responseResolved values for every flag in the requested environment.
flagsarray of flag definitionsYes in GET /v1/config responseDefinitions the SDK can evaluate locally. Each definition contains key, type, enabled, variations, defaultVariationKey, offVariationKey, and rules.
flags[].keystringYesFlag identifier.
flags[].typeboolean, string, number, or jsonYesType of the flag's variations.
flags[].enabledbooleanYesWhether the flag is enabled in the returned definition.
flags[].variationsarray of variation objectsYesNamed values available for the flag.
flags[].defaultVariationKeystringYesDefault variation key for the environment.
flags[].offVariationKeystringYesVariation key used when the flag is off.
flags[].rulesarray of targeting rule objectsYesTargeting rules defined for the environment.
segmentsarray of segment objectsYes in GET /v1/config responseReusable segment definitions available to local evaluation.
segments[].keystringYesSegment identifier.
segments[].conditionsarray of condition objectsYesConditions that define the segment.
keystringYes for GET /v1/flags/{flagKey}/evalSubject key used when evaluating one flag.

Endpoints

MethodPathDescription
POST/v1/evaluateEvaluate every flag in an environment for the supplied evaluation context.
GET/v1/configReturn every flag definition and segment for an environment so an SDK can bootstrap local evaluation.
GET/v1/flags/{flagKey}/evalEvaluate one flag by key for a subject in an environment.