Skip to main content
AntifraudAI’s machine-learning engine is powerful out of the box, but every business has unique risk tolerances and edge cases that a general model cannot anticipate. Custom rules let you encode your own business logic on top of ML scoring: explicitly block transactions from specific regions, bypass scoring for known-trusted users, or adjust scores when certain conditions are met. Rules are evaluated at screening time alongside the ML model and can override or modify the final decision.

Types of Rules


Creating a Rule in the Dashboard

1

Open the Rules editor

In the AntifraudAI dashboard, go to Settings → Rules and click New Rule.
2

Choose a rule type

Select one of the four rule types: block, allow, score_adjust, or flag. The form will update to show the relevant configuration fields for your chosen type.
3

Set the condition

Define when the rule should fire by specifying:
  • Field — the transaction attribute to evaluate (e.g. billing_address.country, amount, user_id)
  • Operator — the comparison to apply (see the condition reference below)
  • Value — the target value or list of values to match against
You can add multiple conditions to a single rule; all conditions must match for the rule to fire (logical AND).
4

Set the action

Configure what happens when the rule fires:
  • For block or allow: no additional configuration is needed.
  • For score_adjust: enter a positive integer to increase the score or a negative integer to decrease it.
  • For flag: enter the custom signal string to append (e.g. high_value_new_user).
5

Set the priority

Enter a priority integer. Rules are evaluated in ascending order — a rule with priority 1 runs before a rule with priority 100. Lower numbers win conflicts.
6

Save and activate

Click Save. The rule is immediately active in the environment you are currently viewing (sandbox or production). You can toggle a rule on or off at any time from the Rules list.

Rule Condition Reference


Example Rules

The following examples show rules in the JSON format accepted by the Rules API. You can create and manage the same rules through the dashboard UI described above.

1. Block transactions from high-risk countries

2. Allow transactions from VIP users

For large VIP lists, use an in condition with a generous list or combine multiple allow rules to keep your rules maintainable.

3. Boost score for large amounts


Rule Ordering

Rules run in ascending priority order — the lowest priority number fires first. An early allow rule (e.g. priority 5) will cause AntifraudAI to short-circuit and return decision=allow immediately, preventing any subsequent block rules (e.g. priority 10) from ever being evaluated for that transaction. Review your priority assignments carefully when mixing allow and block rules.
If two rules share the same priority number, their relative order is non-deterministic. Always assign unique priority values to rules that could conflict.
Test all new rules in the sandbox environment before enabling them in production. Use the sandbox trigger values to confirm your rule fires under the expected conditions and does not inadvertently suppress legitimate block decisions.