Choose an endpoint
Author a single rule
For one rule, iterate without touching live balances:- Validate the condition (and optionally draft actions) with
POST /v1/rules/validate. - Simulate the draft with
POST /v1/rules/simulate. - Save the rule, then simulate the saved rule with
POST /v1/rules/{rule_id}/simulate, passingparticipant_idto run against live participant state.
event.* field checks. A simulation result also shows the bucket each asset action would use, so you can check that a settlement with a future matures_in or matures_at lands in DEFERRED.
Test a full configuration
A rule configuration simulation tests a program’s rules together against sample or past events. It checks rule-set order,stop_after_match within each set, interactions between rules, and tier qualification after each event. It leaves live rules, balances, budgets, and participant state unchanged. You can retrieve the results afterward.
Send it to POST /v1/programs/{program_id}/rule-configuration/simulations. Leave out rule_configuration to simulate your live configuration. To simulate a draft, add the same draft you send to analysis and preview as rule_configuration. Both return the same per-event detail.
Use scenario mode for sample events, or replay mode for past events with their original timestamps. Both let you check which rules match, when budgets stop a payout, and which rules stop_after_match skips.
Set options.compare_live to run your live configuration and a draft against the same inputs. Include the draft in rule_configuration. Use trace or full detail to see ordered condition and action outcomes.
See Managing rule configuration for analysis, simulations, and the preview/apply path. See Rule sets for execution order and set-local stopping.
Scenario events
A scenario simulation sends sample events through your rules, in the order you list them. This example sends an authorization and then its settlement for one participant. It assumes the live configuration has two rules: the authorizationCREDIT from Card authorizations and settlements on auth events, and the settlement CREDIT from Add a waiting period on settlement events.
rule_configuration to the request, using the same body you send to preview. The program comes from the path, so the body has no program_id.
If you set neither
external_id nor participant_id, each event goes to a random participant. scenario.participant_count sets how many participants the simulation has in total. Scrip adds sample participants when initial_state lists fewer.
Scenario events have no timestamp of their own. Every event in a scenario simulation gets the same time, which Scrip picks for that simulation. It is not the current time, and it can be years away from today. Sending the same request again uses the same time, so time-based results repeat. To test an active window or a condition on now, replay real events, which keep their timestamps. You can also simulate one rule with an event_timestamp.
The request returns 202 with the simulation’s id and its status:
GET /v1/programs/{program_id}/rule-configuration/simulations/{simulation_id} until status is completed, failed, or timeout.
At trace or full detail, result.events has one item per event, in order. Each item has event_index, event_type, source, participant_id, the rule_trace of the rules that ran, and totals. At "detail_level": "full", the default, it also has posting_diffs with one row for every balance change the event made, and state_diffs for state changes.
With the two rules above on an UNLIMITED asset, the settlement’s rows show 42 moving into DEFERRED, the 50 pending leaving HELD, and the unused 8 going back to system issuance. Other fields are left out here:
"detail_level": "full", an event can also have a lot_diffs list. The list appears only when the event creates, consumes, or changes the status of a lot. A SIMPLE asset has no lots, so its actions add no rows. Each row shows one change to a lot. These fields show which action caused it and what the lot looked like afterward:
A row shows the lot as its action left it, even when a later action in the same event changes the lot again.
Test an automation
An automation sends its savedevent_type and event_data unchanged. Check what the rules will do, then check that the automation delivers the event:
- What the rules will do. Send the automation’s
event_typeandevent_dataas a scenario event in a rule configuration simulation. The simulation shows which rules match and how balances would change, without changing live balances or state. - A real end-to-end run. Create a one-time copy of the automation: same
event_typeandevent_data, aONE_TIMEtrigger withtrigger_atomitted so it fires immediately, and aparticipant_filterpinned to a test participant (for exampleparticipant.external_id == "user_456"). The copy delivers one real event to that participant and moves toCOMPLETED. Verify it like any processed event: fetch the event, readrule_evaluations, and check the balance.
Verify a processed event
An event’s record shows its status and the rule evaluations Scrip recorded for it, so start debugging there:statusshows the lifecycle:PENDING→PROCESSING→COMPLETEDorFAILED. Failed events carry a machine-readableerror_code. Right after a202, theGETcan return404 event_not_foundwhile Scrip records the event. Wait for theevent.completedwebhook event or poll a bounded number of times; see Wait for the result.rule_evaluationsis the execution trace: which rules matched, credited, or were skipped, in the order they ran. An empty trace on aCOMPLETEDevent means no condition matched.GET /v1/events/{event_id}/impactshows the ledger effect: every balance change the event caused, with system accounts as counterparties.
Test webhooks
Webhook handling is part of your integration:- Replay real deliveries with the resend endpoint instead of manufacturing traffic. It re-dispatches a past delivery through the normal path with a fresh signature.
- Send a test delivery with
POST /v1/webhook-endpoints/{webhook_endpoint_id}/test. Send a body such as{"event_type": "balance.credited"}. Scrip returns202and sends one signed sample marked"test": true. See Send a test delivery. - Verify signatures against the documented scheme, not by skipping verification in test environments. See Webhooks: Verify a delivery.
- Watch endpoint health with the delivery listing and the endpoint’s
circuit_broken_untilandrate_limited_untilfields to catch failures your handler swallows.
Writing rules
Validation and simulation payloads for a single rule.
Managing rule configuration
Preview and apply a multi-rule change.
Webhooks
Verify signatures and replay deliveries.