Customer Rules (Risk Factors)
A customer rule โ also called a risk factor โ is a configurable scoring rule that evaluates your customers' data and contributes to their overall risk score. Each rule looks at one or more conditions about a customer (such as their account type, country, or custom fields) and adds a numeric score when those conditions are met.
Together, all active risk factors produce a cumulative risk score for each customer. That score is used to classify customers as low, medium, or high risk โ and it feeds directly into transaction monitoring decisions.
How it worksโ
Customer rules follow a three-level structure:
Rule (Risk Factor)
โโโ Group
โโโ Condition (field + operator + value)
Ruleโ
The top-level risk factor. A rule has a name, a status, and one or more groups. You can configure whether the rule:
- Takes only the highest-scoring group (
takeMaxScore) โ useful when groups are mutually exclusive risk categories - Allows multiple groups to score simultaneously โ useful when a customer can match several risk indicators at once
Groupโ
A group is a named scenario within a rule, with its own score. For example, a "High-risk countries" group might carry a score of 40, while a "Medium-risk countries" group carries 20.
A group can be scored in two ways:
| Scoring mode | How it works |
|---|---|
fixed | The group's score is applied as-is when the conditions are met |
classifier | The score is calculated dynamically using a trained classifier model |
Conditionโ
A condition is the actual check: a customer field, an operator, and a target value. All conditions within a group must be satisfied for the group to trigger.
Example: accountTypeId equals 2 (i.e., the customer is a company).
Manual rulesโ
Rules can also be set to manual mode. A manual rule has no automated conditions โ instead, your team assigns the score directly against a customer. This is useful for risk factors that cannot be derived from data alone, such as a compliance officer's assessment after an in-person review.
API referenceโ
List rulesโ
GET /api/v1/customer-rules
Query parametersโ
| Parameter | Type | Description |
|---|---|---|
search | string | Filter by rule name |
status | string | active or disabled |
skip | number | Pagination offset. Default: 0 |
take | number | Page size. Default: 20 |
Responseโ
{
"status": 200,
"message": "Customer rules fetched",
"data": {
"data": [
{
"id": 1,
"name": "High-risk country",
"status": "active",
"isManual": false,
"takeMaxScore": true,
"allowMultipleChoice": false,
"groups": [
{
"id": 10,
"name": "Tier 1 risk",
"score": 40,
"scoringMode": "fixed",
"_count": { "fieldOptions": 1 }
}
],
"_count": { "groups": 1 }
}
],
"total": 1
}
}
Get a ruleโ
GET /api/v1/customer-rules/:id
Returns the full rule including all groups and their conditions.
Responseโ
{
"status": 200,
"message": "Customer rule fetched",
"data": {
"id": 1,
"name": "High-risk country",
"status": "active",
"isManual": false,
"takeMaxScore": true,
"allowMultipleChoice": false,
"groups": [
{
"id": 10,
"name": "Tier 1 risk",
"score": 40,
"scoringMode": "fixed",
"fieldOptions": [
{
"id": 100,
"field": "country",
"operator": "in",
"value": "NG,GH,KE",
"functionKey": "field_check",
"classifier": null
}
]
}
]
}
}
Create a ruleโ
POST /api/v1/customer-rules
Request bodyโ
| Field | Type | Required | Description |
|---|---|---|---|
name | string | โ | Display name for the risk factor |
status | string | โ | active or disabled. Default: active |
isManual | boolean | โ | true for manual scoring rules. Default: false |
takeMaxScore | boolean | โ | Only apply the highest-scoring matching group. Default: false |
allowMultipleChoice | boolean | โ | Allow multiple groups to score simultaneously. Default: false |
groups | array | โ | Groups to create with the rule (see below) |
Group fieldsโ
| Field | Type | Required | Description |
|---|---|---|---|
name | string | โ | Group label |
score | number | โ | Score applied when this group matches |
scoringMode | string | โ | fixed or classifier. Default: fixed |
fieldOptions | array | โ | Conditions to evaluate (not allowed when isManual is true) |
Condition fieldsโ
| Field | Type | Required | Description |
|---|---|---|---|
functionKey | string | โ | The evaluation function to use |
field | string | โ | The customer field to evaluate |
operator | string | โ | Comparison operator (e.g. equals, in, greaterThan) |
value | string | โ | Value to compare against |
classifierId | number | โ | Classifier to use when scoringMode is classifier |
Exampleโ
{
"name": "High-risk country",
"takeMaxScore": true,
"groups": [
{
"name": "Tier 1 risk",
"score": 40,
"fieldOptions": [
{
"functionKey": "field_check",
"field": "country",
"operator": "in",
"value": "NG,GH,KE"
}
]
}
]
}
Update a ruleโ
PUT /api/v1/customer-rules/:id
Updates the rule's top-level fields. To modify groups or conditions, use the group and condition endpoints below.
| Field | Type | Description |
|---|---|---|
name | string | New display name |
status | string | active or disabled |
isManual | boolean | Toggle manual scoring |
takeMaxScore | boolean | |
allowMultipleChoice | boolean |
Delete a ruleโ
DELETE /api/v1/customer-rules/:id
Managing groupsโ
Add a groupโ
POST /api/v1/customer-rules/:id/groups
Body accepts the same fields as the groups array items in create.
Update a groupโ
PUT /api/v1/customer-rules/:id/groups/:groupId
| Field | Type | Description |
|---|---|---|
name | string | |
score | number | |
scoringMode | string | fixed or classifier |
Remove a groupโ
DELETE /api/v1/customer-rules/:id/groups/:groupId
Managing conditionsโ
Add a conditionโ
POST /api/v1/customer-rules/:id/groups/:groupId/options
Body accepts the same fields as condition items in create.
Update a conditionโ
PUT /api/v1/customer-rules/:id/groups/:groupId/options/:optionId
All fields are optional โ only the provided fields are updated.
Remove a conditionโ
DELETE /api/v1/customer-rules/:id/groups/:groupId/options/:optionId