Skip to main content

Flag State API

Flag states control per-environment behavior: enabled/disabled, targeting rules, rollout percentages, and A/B variants.

Get Flag State​

GET /v1/projects/{projectID}/flags/{flagKey}/environments/{envID}

Auth: JWT (All roles)

Response 200 OK​

{
"id": "uuid",
"enabled": true,
"default_value": true,
"rules": [
{
"id": "rule-1",
"priority": 1,
"description": "Beta users",
"conditions": [
{"attribute": "beta", "operator": "eq", "values": ["true"]}
],
"segment_keys": [],
"percentage": 10000,
"value": true,
"match_type": "all"
}
],
"percentage_rollout": 0,
"variants": [],
"scheduled_enable_at": null,
"scheduled_disable_at": null,
"updated_at": "2026-04-01T00:00:00Z"
}

If no state exists for the environment, a synthetic response is returned:

{
"enabled": false
}

Update Flag State​

PUT /v1/projects/{projectID}/flags/{flagKey}/environments/{envID}

Auth: JWT (Owner, Admin, Developer)

Request​

All fields are optional — only provided fields are updated.

{
"enabled": true,
"default_value": true,
"rules": [
{
"id": "rule-1",
"priority": 1,
"description": "Beta users in US",
"conditions": [
{"attribute": "country", "operator": "eq", "values": ["US"]},
{"attribute": "beta", "operator": "eq", "values": ["true"]}
],
"segment_keys": [],
"percentage": 10000,
"value": true,
"match_type": "all"
}
],
"percentage_rollout": 2500,
"variants": [
{"key": "control", "value": "original", "weight": 5000},
{"key": "treatment", "value": "new", "weight": 5000}
],
"scheduled_enable_at": "2026-04-15T09:00:00Z",
"scheduled_disable_at": "2026-04-15T18:00:00Z"
}

Fields​

FieldTypeDescription
enabledbooleanMaster toggle
default_valueanyEnvironment-level default value
rulesTargetingRule[]Targeting rules (see below)
percentage_rolloutintBasis points 0–10000 (0%–100%)
variantsVariant[]A/B experiment variants
scheduled_enable_atstringRFC3339 timestamp or "" to clear
scheduled_disable_atstringRFC3339 timestamp or "" to clear

Targeting Rule​

FieldTypeDescription
idstringRule identifier
priorityintEvaluation order (lower = first)
descriptionstringHuman-readable description
conditionsCondition[]Attribute conditions
segment_keysstring[]Segment references
percentageintBasis points for rule-level rollout
valueanyValue to return when matched
match_typestringall (AND) or any (OR)

Condition​

FieldTypeDescription
attributestringUser attribute name
operatorstringComparison operator (see operators)
valuesstring[]Values to compare against

Variant​

FieldTypeDescription
keystringVariant identifier
valueanyValue returned to users in this variant
weightintRelative weight in basis points (sum to 10000)

Response 200 OK​

Returns the updated flag state object.