POST /api/v1/projects/{project_id}/rules
Requires rules.write permission. Rules are evaluated in priority order (lowest number first) during flag evaluation.
Rule types:
boolean— Always matches. Returnsreturn_valueunconditionally.attribute— Matches when a context attribute satisfies the operator condition.percentage— Deterministic rollout based on a hash of thebucket_bycontext field.
attribute rules): eq, neq, in, not_in, contains, starts_with, ends_with
value_json encoding: Use a JSON string (e.g. "\"TR\"") for eq/neq/contains/starts_with/ends_with; use a JSON array of strings (e.g. "[\"TR\",\"DE\"]") for in/not_in.
Path parameters
UUID of the project.
Request body
UUID of the flag this rule belongs to.
Evaluation order. Lower numbers are evaluated first.
One of
boolean, attribute, or percentage.Value returned when this rule matches.
Context key to evaluate. Required for
attribute rules.Comparison operator for
attribute rules. One of eq, neq, in, not_in, contains, starts_with, ends_with.JSON-encoded target value. String for scalar operators; array of strings for
in/not_in.Percentage of traffic to include (0–100). Required for
percentage rules.Context field used to deterministically assign users to buckets.
Whether this rule participates in evaluation immediately.
Response
The newly created rule.
Errors
| Status | When |
|---|---|
400 | Request body is invalid or missing required fields |
403 | Caller lacks rules.write permission |
404 | Flag not found |