Rules
Simulate a rule
Dry-run a rule against sample event data. No ledger changes occur.
post/v1/rules/{rule_id}/simulate
Request
- Base URL: https://api.scrip.dev
- URL: https://api.scrip.dev/v1/rules/{rule_id}/simulate
- Auth: HTTP bearer
Path parameters
rule_idstring uuid required
The rule's id.
Request body
Example request
{
"diagnostics": true,
"event": {
"amount": 75,
"type": "purchase"
},
"event_id": "e5dc1b6a-7f3d-4e2a-8c1b-9a0f4d7e6c05",
"event_timestamp": "2027-01-15T10:30:00Z",
"participant_id": "f7a8b9c0-1d2e-4f3a-b4c5-d6e7f8a9b006",
"participant_state": {
"attributes": {
"region": "US"
},
"counters": {
"purchase_count": 9
},
"tags": [
"vip"
]
}
}Response
Simulation result
Example response
{
"evaluation": {
"matched": true,
"reason": "no such key: amount",
"results": [
{
"action": {
"amount": "${{ event.amount * 10 }}",
"asset_id": "a3bb189e-8bf9-4c8b-9be0-6b5d2f4e7a02",
"type": "CREDIT"
},
"result": {
"amount": "750",
"asset_symbol": "POINTS",
"description": "Credit 750 POINTS to participant",
"to_bucket": "AVAILABLE"
}
}
],
"status": "EVALUATED"
},
"rule": {
"condition": "event.type == 'purchase' && event.amount > 0",
"id": "c9f0f895-fb98-4b39-9f86-1e5a0d3e2b03",
"name": "Purchase Reward",
"order": 1
},
"warnings": [
{
"code": "unknown_state_key",
"key": "purchaseCnt",
"kind": "counter",
"message": "unknown counter \"purchaseCnt\" on participant: no rule in this program writes it; did you mean \"purchase_count\"?",
"scope": "participant",
"suggestion": "purchase_count"
}
]
}Changes
No recorded changes to this operation across all 1 revision of this API.