Skip to content
Dashboard
Theme
Theme

Create a feature flag

POST /v1/feature_flags: Create a feature flag.

View Markdown

POST /v1/feature_flags

Feature Flags product. A boolean flag serves the variants true and false (omit variants); a multivariate flag lists 2-20 variants with any JSON value. Rules are tried in order (every condition must match) and serve a variant or a percentage rollout (weights in thousandths of a percent summing to 100000, bucketed by a stable hash of the flag key and user_id, organization_id or bucket_by); otherwise the fallthrough serves. A disabled flag serves off_variant. At most 500 flags per environment; a taken key answers resource_already_exists. Changes reach evaluation within the config snapshot’s refresh.

Scope
feature_flags:write
Auth
Secret key (sk_…)
Since
1.1
  • OhAuthCat-Version string

    Minor version; defaults to the environment’s pin.

  • Idempotency-Key string

    Honoured for 24 h; a replay returns the original response.

    min length 1 · max length 255

  • key string Required

  • name string Required

    min length 1 · max length 200

  • description string

    max length 2000

  • kind string Required

    one of boolean, multivariate

  • enabled boolean

    Defaults to false.

  • variants array of FeatureFlagVariant

    max items 20

  • off_variant string

    Defaults to false for a boolean flag and the first variant otherwise.

  • rules array of FeatureFlagRule

    max items 50

  • fallthrough FeatureFlagServe

    Exactly one of variant and rollout.

Errors share one shape; see the error code catalogue.

curl -X POST \
"https://api.ohauthcat.com/v1/feature_flags" \
-H "Authorization: Bearer $OHAUTHCAT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"key": "plan",
"name": "Acme Corp",
"kind": "boolean"
}'
Response 201
{
"object": "feature_flag",
"id": "flag_01J9Z3K5V7W8X9Y0Z1A2B3C4D5",
"key": "plan",
"name": "Acme Corp",
"description": "Primary SSO connection for Acme Corp.",
"kind": "boolean",
"enabled": true,
"variants": [
{
"key": "plan",
"value": {}
}
],
"off_variant": "example_off_variant",
"rules": [
{
"conditions": [
{
"attribute": "department",
"operator": "in",
"values": []
}
],
"serve": {
"variant": "default",
"rollout": [
{}
],
"bucket_by": "example_bucket_by"
}
}
],
"fallthrough": {
"variant": "default",
"rollout": [
{
"variant": "default",
"weight": 0
}
],
"bucket_by": "example_bucket_by"
},
"revision": 1,
"created_at": "2026-01-15T09:30:00Z",
"updated_at": "2026-01-15T09:30:00Z"
}