Skip to content

Feature flags API

Feature flags are on/off (or multivariate) toggles you flip per environment with no deploy. All endpoints on this page require the secret management key vsk_live_….

Base URL: https://statskit.ai/api/v1

GET /flags

Terminal window
curl https://statskit.ai/api/v1/flags \
-H "Authorization: Bearer vsk_live_..."

POST /flags

FieldTypeNotes
keystringStable key referenced from code, lowercase letters, digits, _, -, . only
namestringHuman-readable name
descriptionstringOptional
typeboolean | string | number | jsonDefault boolean
variationsarrayRequired for non-boolean: [{ idx, value, name }] (2+)
temporarybooleanMark as a cleanup-later flag (default true)
bucketBystringAttribute used for bucketing (default key)
tagsstring[]Optional

The flag is created disabled in every environment. Enable it per-environment with the environment endpoints below.

Terminal window
curl -X POST https://statskit.ai/api/v1/flags \
-H "Authorization: Bearer vsk_live_..." \
-H "Content-Type: application/json" \
-d '{ "key": "new_dashboard", "name": "New dashboard", "type": "boolean" }'

A multivariate flag supplies its own variations:

{
"key": "cta_copy",
"name": "CTA copy",
"type": "string",
"variations": [
{ "idx": 0, "value": "Sign up", "name": "Control" },
{ "idx": 1, "value": "Get started", "name": "B" }
]
}

GET /flags/:key

Terminal window
curl https://statskit.ai/api/v1/flags/new_dashboard \
-H "Authorization: Bearer vsk_live_..."

PATCH /flags/:key

Update name, description, tags, temporary, not per-environment behavior.

Terminal window
curl -X PATCH https://statskit.ai/api/v1/flags/new_dashboard \
-H "Authorization: Bearer vsk_live_..." \
-H "Content-Type: application/json" \
-d '{ "description": "Ships the redesigned dashboard", "tags": ["ui"] }'

POST /flags/:key/archive   POST /flags/:key/restore

Terminal window
curl -X POST https://statskit.ai/api/v1/flags/new_dashboard/archive \
-H "Authorization: Bearer vsk_live_..."

GET /flags/:key/audit: change history.

GET /flags/:key/code-refs: where the flag key is referenced in code.

GET /flags/:key/metrics: flag-attached metric results.

Terminal window
curl https://statskit.ai/api/v1/flags/new_dashboard/audit \
-H "Authorization: Bearer vsk_live_..."

Each flag has independent behavior per environment (e.g. production, staging).

GET /flags/:key/environments/:env

Terminal window
curl https://statskit.ai/api/v1/flags/new_dashboard/environments/production \
-H "Authorization: Bearer vsk_live_..."

PUT /flags/:key/environments/:env

Set whether the flag is enabled, the off variation, and the fallthrough (a fixed variation, or a percentage rollout).

Terminal window
curl -X PUT https://statskit.ai/api/v1/flags/new_dashboard/environments/production \
-H "Authorization: Bearer vsk_live_..." \
-H "Content-Type: application/json" \
-d '{
"enabled": true,
"offVariation": 0,
"fallthrough": { "rollout": [ { "idx": 0, "weight": 90 }, { "idx": 1, "weight": 10 } ] }
}'

A single-variation fallthrough:

{ "enabled": true, "offVariation": 0, "fallthrough": { "variation": 1 } }

POST /flags/:key/environments/:env/toggle

The everyday on/off (and kill switch). Republishes compiled config to the edge immediately.

Terminal window
curl -X POST https://statskit.ai/api/v1/flags/new_dashboard/environments/production/toggle \
-H "Authorization: Bearer vsk_live_..." \
-H "Content-Type: application/json" \
-d '{ "enabled": true }'

GET /flags/:key/environments/:env/rules

Terminal window
curl https://statskit.ai/api/v1/flags/new_dashboard/environments/production/rules \
-H "Authorization: Bearer vsk_live_..."

PUT /flags/:key/environments/:env/rules

Clause-based targeting. Each rule matches a context by attribute clauses and serves a variation (or a rollout) before the fallthrough applies.

Terminal window
curl -X PUT https://statskit.ai/api/v1/flags/new_dashboard/environments/production/rules \
-H "Authorization: Bearer vsk_live_..." \
-H "Content-Type: application/json" \
-d '{
"rules": [
{
"clauses": [ { "attribute": "plan", "op": "in", "values": ["pro", "enterprise"] } ],
"variation": 1
}
]
}'