Feature Flags
Toggle features on and off without redeploying. Supports boolean, string, number, and JSON flags with targeting rules and environment scoping.
Create a Flag
POST /projects/{project_id}/flags
{
"key": "dark_mode",
"name": "Dark Mode",
"description": "Enable dark mode for users",
"flag_type": "boolean",
"value": true,
"environment": "production",
"targeting_rules": [
{ "attribute": "country", "operator": "in", "values": ["IN", "US"] }
]
}Flag Types
| Type | Example Value |
|---|---|
| boolean | true / false |
| string | "variant-a" |
| number | 42 |
| json | {"max_items": 10, "theme": "dark"} |
List Flags
GET /projects/{project_id}/flags?environment=production
{
"flags": [
{
"key": "dark_mode",
"name": "Dark Mode",
"flag_type": "boolean",
"value": true,
"is_enabled": true,
"environment": "production"
}
],
"total": 1
}Evaluate a Flag (Client SDK)
POST /projects/{project_id}/flags/{flag_key}/evaluate
// Evaluate with user context for targeting
{
"context": { "country": "IN", "plan": "pro" }
}
// Response
{ "key": "dark_mode", "value": true, "matched_rule": 0 }Toggle Flag
POST /projects/{project_id}/flags/dark_mode/toggle
All Endpoints
| Method | Path | Description |
|---|---|---|
| POST | /flags | Create flag |
| GET | /flags | List flags |
| GET | /flags/{key} | Get flag |
| PATCH | /flags/{key} | Update flag |
| DELETE | /flags/{key} | Delete flag |
| POST | /flags/{key}/toggle | Toggle on/off |
| POST | /flags/{key}/evaluate | Evaluate with context |