Feature Flags

POST /projects/{project_id}/flags

Changed on

Request

  • Base URL
    /api (relative, and the document was published on a file host, not at the API’s origin)
  • Auth
    HTTP bearer

Path parameters

project_idinteger required

Project ID

Request body

client_visibleboolean

Whether the flag may be exposed on the unauthenticated same-origin evaluation endpoint. Defaults to false: flags are server-only unless explicitly opted in, because targeting rules can encode business logic.

default_valueunknown required
descriptionstring nullable
exposure_sample_ratenumber double

Share of subjects (0..=1) whose browser records a flag_exposure event when it reads the flag. Defaults to 0: exposure is opt-in.

keystring required

Stable key used in application code. Immutable after create.

value_type'bool' | 'string' | 'number' | 'json' required

Fixed at create: retyping would invalidate every stored value and every call site.

Example request

{
  "key": "checkout.v2",
  "variants": [
    {
      "key": "test"
    }
  ]
}

Response

Flag created

archived_atstring nullable
client_visibleboolean required
created_atstring required
default_valueunknown required
descriptionstring nullable
exposure_sample_ratenumber double required

Share of subjects whose browser records exposure events. 0 = off.

idinteger required
keystring required
last_evaluated_atstring nullable

When an app last actually evaluated this flag. None means never seen, which is a real answer rather than missing data.

updated_atstring required

Send back as expected_updated_at to make an update conditional.

value_typestring required

Changes

    • info

      added the new optional request property exposure_sample_rate

    • info

      added the new optional request property variants

    • info

      added the required property environments/items/rules to the response with the status

    4 more changes in this revision