Skip to main content
PUT
Replace a rule
The body is the whole rule, not a patch. Both name and expression are required, and the stored rule becomes exactly what you send. The identifier does not change, so every recipe already scoring over this rule picks up the new condition on its next evaluation. There is no versioning at the rule level.

Editing a rule a recipe depends on

The new expression is compiled against the latest catalog, on its own - not against the recipes that score over it. An edit that starts reading attr.cart_total is accepted here even if no recipe declares that key. At evaluation time such a rule can’t compile in that recipe’s environment. It reports unavailable and contributes nothing, and the recipe reports partial_evidence. Re-saving the recipe is what checks the pair, and it is the fastest way to confirm an edit landed cleanly. Aiming a replace at a managed rule’s identifier answers 403 - managed_rule_read_only.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

rule_id
string
required

The rule identifier.

Example:

"rul_01jc0t6fwwfgfsq1md24mhyztj"

Body

application/json
name
string
required

A label for the rule. It is returned in evaluation results, so make it say what the rule looks for.

Maximum string length: 128
Example:

"free_plan_signup"

expression
string
required

The condition, written in CEL. It must evaluate to a boolean, and it is compiled before it is stored: an expression that does not compile is refused.

It may reference the signals Prelude resolves for an evaluation, a recipe's request attributes as attr.<key>, and a recipe's configured values as param.<key>. A rule that references either namespace is bound to the recipes declaring those names, and can only be used by them. See Rules, recipes and flows; the signal vocabulary is not published yet, so contact us for the names available to your rules.

Example:

"attr.plan_tier == \"free\""

Response

OK

id
string
required

The rule identifier. Reference it in a recipe's rules to score over it.

Example:

"rul_01jc0t6fwwfgfsq1md24mhyztj"

name
string
required
Example:

"free_plan_signup"

expression
string
required
Example:

"attr.plan_tier == \"free\""

type
enum<string>
required

Always CUSTOM. A rule you author is your own; Prelude's are a separate, read-only listing.

Available options:
CUSTOM