How rules work

Rules are conditions attached to a flag. All enabled rules must pass for the flag to be active.

If the client does not pass context, no rule can match — enabled: false, value: null is returned.

Rules only activate when the eval request body contains the keys they reference. A missing key is treated as a non-match. Always handle null on the client: result.value ?? yourLocalDefault.

Evaluation flow

  1. 1 Client calls POST /eval/{flag_key} with an API key and context.
  2. 2 Rules are sorted by priority (highest first).
  3. 3 Every enabled rule is evaluated. If all rules pass, the flag is active and its value is returned.
  4. 4 If any rule fails, enabled: false and value: null are returned.
  5. 5 If the flag has no rules: if enabled, its value is returned; if disabled, returns enabled: false, value: null.

Comparators

ComparatorPasses whenExample
eqcontext value exactly equals rule valuecountry eq US
neqcontext value does not equal rule valueplan neq free
gt / gtenumeric greater than / greater-or-equalseats gt 0
lt / ltenumeric less than / less-or-equalage lte 17
incontext value is in a comma-separated listplan in pro,enterprise
not_incontext value is not in the listcountry not_in CN,RU
containscontext value contains the substringemail contains @acme.com
semver_gt / semver_gtesemantic version greater than / ≥app_version semver_gte 2.0.0
semver_lt / semver_ltesemantic version less than / ≤app_version semver_lt 3.0.0