Skip to content

Rules Engine API

API endpoints for managing AML detection rules, including CRUD operations and rule status toggling.

Base URL: /admin/aml/rules

Endpoints Summary

MethodEndpointDescription
GET/admin/aml/rulesList all rules
GET/admin/aml/rules/:ruleIdGet single rule
POST/admin/aml/rulesCreate rule
PUT/admin/aml/rules/:ruleIdUpdate rule
PUT/admin/aml/rules/:ruleId/toggleEnable/disable rule

List Rules

GET /admin/aml/rules

Query Parameters:

ParameterTypeDescription
enabledbooleanFilter by enabled status
ruleTypestringFilter by rule category

Returns: Array of rule objects


Get Single Rule

GET /admin/aml/rules/:ruleId

Returns: Full rule object with all configuration details


Create Rule

POST /admin/aml/rules

Request Body:

FieldTypeRequiredDescription
ruleIdstringYesUnique rule identifier (e.g., AML-TH-002)
namestringYesHuman-readable name
descriptionstringNoWhat this rule detects
categorystringNoRule category
conditionsobjectYesRule parameters and thresholds (JSON)
actionsobjectNoActions when triggered
severitystringNoLOW, MEDIUM, HIGH, CRITICAL
isActivebooleanNoEnable on creation (default: false)
prioritynumberNoEvaluation priority

Update Rule

PUT /admin/aml/rules/:ruleId

Updatable Fields: name, category, severity, description, conditions, actions, isActive, priority


Toggle Rule Status

PUT /admin/aml/rules/:ruleId/toggle

Enables or disables a rule. Returns updated rule with new status.


Rule Types (15 Categories)

TypeCountDescription
threshold3Transaction amount thresholds
structuring2Transaction splitting to avoid thresholds
velocity2Transaction frequency spikes
behavioral4User behavior inconsistencies
pep_related3Politically Exposed Person monitoring
network_analysis3Fund flow graph analysis
high_risk_transaction5ML typology patterns
pattern_detection4Automated pattern matching
account_lifecycle3New/dormant account monitoring
digital_wallet3Wallet-specific (NFC, top-up)
mobile_money2Mobile money monitoring
vendor_specific3Vendor transaction patterns
cft_related2Counter-terrorism financing
regional_risk2Geographic risk (Eswatini)
regulatory_reporting1Mandatory FIU reporting
business_sector1Industry-specific risk

Full Reference

See the AML Rules Catalog for all 43 rules with their parameters and current thresholds.


Conditions JSON Schema

The conditions field is a JSON object containing the rule's ruleType and type-specific parameters.

Threshold

json
{
  "ruleType": "threshold",
  "thresholdAmount": 4500,
  "description": "Enhanced scrutiny for large transactions"
}

Structuring

json
{
  "ruleType": "structuring",
  "thresholdAmount": 3000,
  "thresholdCount": 5,
  "timeWindowHours": 24,
  "description": "Classic structuring to avoid CTR reporting"
}

Velocity

json
{
  "ruleType": "velocity",
  "percentageChange": 300,
  "timeWindowHours": 24,
  "description": "Sudden increase in transaction activity"
}

Behavioral

json
{
  "ruleType": "behavioral",
  "thresholdAmount": 2000,
  "occupations": ["student", "unemployed", "retired", "homemaker"],
  "description": "Transactions inconsistent with stated income"
}
json
{
  "ruleType": "pep_related",
  "thresholdAmount": 2500,
  "description": "Enhanced monitoring for PEPs"
}

Network Analysis

json
{
  "ruleType": "network_analysis",
  "minSenders": 5,
  "minTotalAmount": 10000,
  "timeWindowHours": 24,
  "description": "Fund consolidation pattern"
}

Pattern Detection

json
{
  "ruleType": "pattern_detection",
  "minAmount": 3000,
  "timeWindowMinutes": 60,
  "similarityPercentage": 70,
  "description": "Deposit-withdrawal cycle"
}

Account Lifecycle

json
{
  "ruleType": "account_lifecycle",
  "inactiveDays": 30,
  "thresholdAmount": 5000,
  "description": "Dormant account reactivation"
}

Digital Wallet

json
{
  "ruleType": "digital_wallet",
  "minAmount": 3000,
  "timeWindowMinutes": 30,
  "topupPercentageTransferred": 80,
  "description": "Top-up-to-transfer pass-through"
}

Regional Risk

json
{
  "ruleType": "regional_risk",
  "regions": ["Hhohho", "Lubombo", "Matsapha"],
  "description": "Border regions with cross-border crime risk"
}

Regulatory Reporting

json
{
  "ruleType": "regulatory_reporting",
  "reportingThreshold": 50000,
  "description": "Mandatory FIU reporting (MLTFP Act Section 13)"
}

Severity Levels

LevelDescriptionTypical Response
LOWMinor anomalyLog only
MEDIUMModerate concernCreate alert
HIGHSignificant riskBlock + alert
CRITICALImmediate threatBlock + escalate

Error Responses

StatusErrorDescription
404Rule not foundInvalid rule ID
400Invalid priority valueInvalid configuration

Internal use only - Keshless Payment Platform