Skip to main content

Rule Simulation

Use the simulation endpoint to test a rule against sample data without creating real events or affecting balances. Simulation evaluates the rule’s CEL condition and returns what actions would fire, without executing them.
curl -X POST https://api.scrip.dev/v1/rules/{ruleId}/simulate \
  -H "Authorization: Bearer $SCRIP_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "event": {
      "type": "purchase",
      "amount": 50.00,
      "category": "dining"
    },
    "participant_state": {
      "tags": ["active"],
      "counters": {"monthly_spend": 250},
      "attributes": {"tier": "gold"}
    }
  }'
The response shows whether the condition matched, the evaluated action amounts, and any errors in the CEL expression. Use this to iterate on conditions and amount formulas before activating a rule.

Validation

For syntax-only checks, use the validation endpoint:
curl -X POST https://api.scrip.dev/v1/rules/validate \
  -H "Authorization: Bearer $SCRIP_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "condition": "event.type == '\''purchase'\'' && event.amount > 10.0"
  }'
This checks that the CEL expression compiles without evaluating it against any data.