Feature Flags

Replace the ordered targeting rules of a flag in one environment.

Changed on

Rules apply after the kill switch and before the environment value; the first rule whose conditions hold (and whose rollout includes the subject) decides the value. Send the environment row's updated_at as expected_updated_at so a concurrent edit is refused with 409 instead of being overwritten.

put/projects/{project_id}/flags/{key}/environments/{environment_id}/rules

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

keystring required

Flag key

environment_idinteger required

Environment ID

Request body

expected_updated_atstring nullable

The environment row's updated_at as last read, or absent when the flag had no row for this environment. A 409 means someone else changed the rules in between: reload and apply the change again.

Example request

{
  "rules": [
    {
      "conditions": [
        {
          "attribute": "plan"
        }
      ]
    }
  ]
}

Response

Rules replaced

enabledboolean required
environment_idinteger required
rules_validboolean required

false when the stored rules could not be decoded. The flag then serves its default with reason ERROR until they are replaced.

updated_atstring required

Send back as expected_updated_at when replacing the rules.

valueunknown

Example response

{
  "rules": [
    {
      "conditions": [
        {
          "attribute": "plan"
        }
      ]
    }
  ]
}

Changes