Create Rule
API Reference
Create Rule
Create a new rule for risk detection and compliance monitoring β in the gu1 rules engine for compliance and risk detection, with examples for create use cases.
POST
Create Rule
Overview
Creates a new rule for automated risk detection, compliance monitoring, and fraud prevention. Rules can evaluate entities (persons, companies), transactions, relationships, and network patterns using flexible condition logic and automated actions.Endpoint
Authentication
Requires a valid API key in the Authorization header:Request Body
Descriptive name for the rule
Detailed description of what the rule detects
Category of the rule:
kyc, kyb, aml, fraud, compliance, customArray of entity types this rule applies to:
["person"], ["company"], ["transaction"], ["person", "company"]Condition logic structure (see Condition Structure below)
Whether the rule is enabled
Rule priority (1-100). Higher values = higher priority
Risk score to assign when rule matches (0-100). Used in score-based risk matrices
Rule status:
draft, in_progress, in_review, active, shadow, archived, inactiveEvaluation mode:
sync (immediate) or async (background processing)UUID of the risk matrix to associate this rule with
Array of ISO country codes to restrict rule execution:
["BR", "AR", "US"]Additional scope configuration including temporal windows and triggers
Array of tags for organizing rules:
["high-risk", "pep", "sanctions"]Condition Structure
Rules use a nested condition structure with logical operators:Condition Fields
- operator: Logical operator connecting conditions (
AND,OR,NOT,XOR) - conditions: Array of condition objects (can be nested for complex logic)
- id: Unique identifier for the condition
- type: Condition type (
simple,complex,array,object) - field: Field path to evaluate (e.g.,
taxId,entityData.company.revenue,enrichmentData.normalized.sanctions.$.type) - operator: Comparison operator (see Operators below)
- value: Value to compare against
- filters: Array of filters for array/object fields
- countryMetadata: Country-specific metadata for the condition
Operators
Comparison Operators
eq- Equalsneq- Not equalsgt- Greater thangte- Greater than or equallt- Less thanlte- Less than or equal
String Operators
contains- Contains substringnotContains- Does not contain substringstartsWith- Starts withendsWith- Ends withregex- Matches regular expression
Array Operators
in- Value is in arraynotIn- Value is not in arrayhasAny- Has any of the valueshasAll- Has all of the values
List Operators
inList- Value exists in a data listnotInList- Value does not exist in a data list
Existence Operators
exists- Field existsnotExists- Field does not existisEmpty- Field is empty/nullisNotEmpty- Field is not empty/null
Boolean Operators
isTrue- Boolean field is trueisFalse- Boolean field is false
Array Field Syntax
For fields within arrays, use the$ symbol:
sanctions array has type equal to "terrorism".
Filters
You can pre-filter array items before evaluation:Actions
Rules support multiple action types:Create Alert
Update Entity Status
Send Notification
Create Case
Example Requests
Simple KYC Rule - Check Tax ID
Complex Rule - Sanctions Check with Multiple Conditions
Transaction Monitoring Rule
Response
UUID of the created rule
Rule name
Rule description
Your organization ID
Current rule status
Whether rule is enabled
Rule version number
ISO timestamp of creation
User ID who created the rule
Response Example
Error Responses
400 Bad Request - Invalid Condition
400 Bad Request - Missing Required Fields
401 Unauthorized
Best Practices
- Start with Shadow Mode: Use
status: "shadow"to test rules without affecting production - Use Descriptive Names: Make rule names clear and searchable
- Set Appropriate Priorities: Higher priority rules execute first (1-100 scale)
- Tag Your Rules: Use tags for organization and filtering
- Country-Specific Rules: Use
scope.countriesfor geo-specific compliance - Test Thoroughly: Test rules with sample data before enabling
- Monitor Performance: Use sync mode for critical real-time rules, async for batch processing
- Score Strategically: Align scores with your risk matrix thresholds
See Also
- Condition Fields Reference - Complete list of available condition fields by entity type and country
- Execute Rule - Test rules against specific entities
- List Rules - Query and filter rules
- Update Rule - Modify existing rules