rule_configuration_version, and increases the number by one on every change.
Writing rules covers creating and updating one rule at a time. Use this page when more than one writer can change the same program, or when one change touches several rules or sets. The dashboard and the Scrip MCP server follow the same flow.
Choose an endpoint
Create and patch on a single rule or set do not check
rule_configuration_version, so two writers can overwrite each other. They still return the new version when the write changes the configuration.
Read the current configuration
ACTIVE and SUSPENDED rule in each set. Archived rules are omitted.
rule_configuration_version from this response on move, reorder, preview, and rollback requests. If another writer changes the program first, those requests return 409 rule_configuration_version_conflict. Read the configuration again and rebuild the request from the new snapshot.
See Get the complete rule configuration.
Move or reorder
To place one rule or set, send aposition of first, last, before, or after. before and after need reference_id. See Rule sets for execution order.
Move one set:
ACTIVE and SUSPENDED rules in one set the same way. Include every non-archived rule in that set exactly once. An empty rule_ids list is valid for an empty set:
Check a draft
Single-rule validation and simulation evaluate one rule. They do not run the rest of the program, so they cannot prove cross-set order,stop_after_match, or conditions that depend on an earlier rule’s writes. Analyze the draft and run a test before you apply a change that spans several rules.
Send {} to analyze the live configuration:
proposed_configuration in the same shape as preview. Each finding includes severity, confidence, runtime_semantics, and remediation.
See Analyze a rule configuration.
Then send the same draft as rule_configuration to POST /v1/test-runs. The test run evaluates in a transaction that rolls back. It does not change live rules, balances, budgets, or stored state.
Testing covers scenario vs replay, compare_live, and traces. The multi-set example shows a layout where set-local stops and the event-start snapshot matter.
Preview and apply
Use preview and apply when one change updates several rule sets, rules, positions, statuses, actions, or budgets. The preview body is the configuration you want, in execution order:
Preview runs the same CEL, action, target, asset, and budget checks as a single-rule write. It does not change the live configuration or increment the version.
The response includes:
Read the plan, diff, and warnings. Then apply exactly what preview stored:
rule_configuration_version by one. A preview can be applied once. If it expires, was already applied, or no longer matches current dependencies, create a new preview.
See Preview a rule-configuration change set and Apply a rule-configuration change set.
History
Each change that takes effect creates one revision. A revision stores the configuration at that version and the diff from the previous one. List revisions, newest first:pagination.next_cursor for the next page.
Get one revision:
revision and returns a caveats entry.
Compare two tracked revisions:
to_version, or pass to_version=current, to compare a tracked revision with the live configuration.
Roll back
Rollback builds a normal preview that restores a past configuration. History is left in place; the restore is a new revision.preview_token and request_hash as any other preview.
Rule sets created after the target revision remain, with no rules, because rule sets cannot be deleted. The preview warns about each of those sets. Rules created after the target are archived. Existing rule and rule-set IDs stay the same.
The new revision records source_revision, so you can see which historical configuration was restored and who applied it.
See Preview a rule-configuration rollback.