Skip to main content
This example publishes three rule sets in one change: base earning, summer promotions with a premium bonus and a standard fallback, and purchase tracking. Every set with a matching ACTIVE rule runs. Managing rule configuration covers the preview and apply steps it uses.

Final run order

A premium purchase receives base earning plus the premium promotional credit. The premium rule has a per-rule budget. Budget exhaustion skips that rule and lets evaluation continue to the fallback and later sets.

The draft

The program starts at rule_configuration_version 7 with one rule set, default, which holds Base purchase points. The draft keeps that set and renames it Base earning. It adds the two new sets with client_ref values. The order of rule_sets is the run order, and the order of each rules array is the order inside that set:
To place one set or rule at a time instead, send a position to the create or move endpoint. See Move or reorder.

Keep mutually exclusive rates inside one set

premium_bonus has stop_after_match: true, so a premium match skips only standard_bonus. Base earning and purchase tracking still run in their sets.

The tracking set reads the event-start count

The tracking set increments purchase_count, then checks whether the participant reached ten purchases. Both conditions read the event-start snapshot of the count. When the count starts at 8, the event ends at 9 and the tag does not apply. When it starts at 9, the tag applies and the event ends at 10. Moving the second rule to a later set would not make it see the same-event increment.

Test the snapshot dependency

Simulate the draft with one participant at 8 purchases and one at 9, and send each of them one purchase. Paste the complete draft from above (base_rule_configuration_version and rule_sets) into rule_configuration:
The request returns 202 with the simulation’s id. Fetch the result with GET /v1/programs/8f14e45f-ceea-4e70-9df8-2a7d1b3c9f01/rule-configuration/simulations/{simulation_id} until status is completed. The tag rule does not match for user_123 and matches for user_456. Only the tracking rules are shown here:

Check event field names

Before applying the draft, compare its event.type, event.amount, and event.segment references with the event_type and event_data fields your application sends. If the draft says event.segmnet, a simulation shows the rule never matching, while your events carry segment. Fix the field name before publishing. Follow Managing rule configuration to analyze, test, preview, apply, and verify the draft.

Suspend, archive, and roll back

A suspended rule stays in its set and keeps its position. To suspend or reactivate a rule, send the complete draft again with the rule’s existing id and its status set to SUSPENDED or ACTIVE. Leaving an existing rule out of a draft archives it when you apply. An archived rule stops running and drops out of the configuration. You cannot edit it, and a later draft cannot bring it back by its id. To restore an archived rule, roll back to a revision that still has it. The rollback restores that whole configuration, and the rule keeps its original id. Otherwise, create the rule again as a new rule. Rollback restores an earlier configuration as a new revision. Preview the revision you want to restore, review the proposed changes and warnings, then apply it. Past revisions stay unchanged. See Roll back.

Managing rule configuration

Preview, apply, and roll back.

Testing

Simulate a draft.