Rules
Turn risk scores into decisions that fit your business.
Rules run after scoring. Each rule has a condition and an action, and the first rule that matches decides the outcome.
Writing conditions
Conditions are expressions evaluated against the check context.
benefit.type == "free_trial" &&
benefit.previousClaims >= 1 &&
score >= 40| Variable | Type | Example |
|---|---|---|
score | number | 62 |
event | string | "trial_start" |
benefit.type | string | "credit" |
benefit.previousClaims | number | 2 |
signals | string[] | ["vpn", "alias"] |
Evaluation order
Rules run from the lowest priority to the highest. If nothing matches, the default score ranges from risk checks apply.
[
{ "name": "Allow staff", "when": "identity.email.endsWith(\"@abusezero.com\")", "action": "allow", "priority": 1 },
{ "name": "Block repeat trials", "when": "benefit.previousClaims >= 1", "action": "deny", "priority": 10 },
{ "name": "Review VPN users", "when": "\"vpn\" in signals", "action": "review", "priority": 20 }
]Order matters
A broad allow rule with a low priority will hide every rule after it. Keep allow rules narrow.
Deleting rules
Deleted rules can't be restored. Disable a rule with "enabled": false if you might need it again.
Testing a rule
Try a condition against a sample check before you save it.
// Sample check contextconst context = {score: 62,event: 'trial_start',benefit: { type: 'free_trial', previousClaims: 1 },signals: ['alias', 'vpn'],};Manage rules from the dashboard or with the Rules API.
How is this guide?
Edit on GitHub
Last updated on