// wiki / api

API reference

Evaluate flags and manage flag definitions remotely with one Management Key format and explicit permissions.

Authentication and permissions

Send the key in x-management-key. Create and rotate keys on Management Keys. The plaintext is shown only after creation or rotation.

PermissionAllowsScope rules
CanEvaluatePOST /flags/{name}Application scope is required. Environment scope is optional.
CanReadList and retrieve flag definitions.Application scope filters accessible flags.
CanWriteCreate, update, configure, and delete flags.Includes read. Application and config-environment scopes are enforced.

A key is 64 lowercase hex characters, shown once at creation and once again on rotation and never retrievable afterwards. Only admins can create, rotate, disable, or delete keys. Authenticated keys are cached for 60 seconds, so disabling or rotating a key takes up to a minute to stop the old value from working — roll new keys out before rotating, not after.

A key may combine permissions. Missing or invalid keys return 401; valid keys without the required permission return 403.

Evaluation API

POST /flags/{name}

Requires CanEvaluate. The request stage is required. If the key has an environment scope, the stage must match it (case-insensitive) and the key's own spelling of that stage is what config lookup uses; otherwise the key can evaluate any environment in its scoped application. An org-wide key cannot evaluate at all — evaluation always requires an application scope. Add ?explain=true to include the decision reason.

FieldTypeRequiredPurpose
userIdstringyesStable user identifier for targeting and deterministic rollout.
stagestringyesEnvironment to evaluate.
clientIdstring | nullnoOptional client-specific configuration selector.
contextobjectnoFree-form values consumed by targeting rules.

Request

POST /flags/checkout-redesign?explain=true
x-management-key: $FF_MANAGEMENT_KEY
Content-Type: application/json

{
  "userId": "user-42",
  "stage": "production",
  "clientId": "checkout-api",
  "context": { "plan": "pro", "country": "DE" }
}

Response (200)

{
  "variant": true,
  "key": "on",
  "reason": {
    "code": "rule_matched",
    "message": "Matched rule 'pro-users'.",
    "ruleId": "pro-users"
  }
}

Without explain=true, the reason property is omitted. Some terminal outcomes add documented metadata alongside variant and key.

Evaluation reason codes

rule_matcheddefaultkillswitcharchivednot_yet_activeexpiredproject_or_env_mismatchdisabled_dependencyconfig_disabledconfig_missingrollout_excludedenrollment_closedno_variants

Public Management API

These are the supported service-integration endpoints under /api/flags. Every call authenticates with a Management Key in the x-management-key header; give the key CanRead to read flags and CanEvaluate to evaluate them.

MethodPathPermissionResult
GET/api/flagsCanReadLists visible flag definitions.
GET/api/flags/{name}CanReadReturns one flag definition.
POST/api/flagsCanWriteCreates a flag; returns 201.
PUT/api/flags/{name}CanWritePartially updates flag metadata.
POST/api/flags/{name}/configsCanWriteUpserts one stage configuration.
DELETE/api/flags/{name}CanWriteDeletes the flag and returns 204.

Archiving is performed with PUT /api/flags/{name} and { "isArchived": true }. There is no separate public archive endpoint.

Status codes

400Required data is missing or the body cannot be parsed.
401The Management Key is missing, unknown, or disabled.
402The organization requires an active subscription.
403The key lacks the required permission or violates its application/environment scope.
404The flag or requested evaluation target was not found.
409A flag with the requested name already exists, a new stage configuration targets an environment the flag doesn't use, or a new dependency's parent is missing one of the flag's environments.
429A rate limit was exceeded. Evaluation is partitioned by Management Key.
500An unexpected server error occurred.