Skip to main content
POST
Create Rule

Overview

Creates a new rule for automated risk detection, compliance monitoring, and fraud prevention. Every create runs a synchronous AI review (included; not debited from your AI token wallet) before the rule is persisted. New rules are always stored as in_progress with enabled: false so you can review suggestions and activate manually.
Request fields status and enabled on create are ignored β€” the API coerces status: in_progress and enabled: false. Expect several seconds of latency while the review completes. Bundle or template flows that create many rules run one review per rule.

Endpoint

Authentication

Requires a valid API key in the Authorization header:

Request Body

string
required
Descriptive name for the rule
string
required
Detailed description of what the rule detects
string
required
Category of the rule: kyc, kyb, aml, fraud, compliance, custom
array
required
Array of entity types this rule applies to: ["person"], ["company"], ["transaction"], ["person", "company"]
object
required
Condition logic structure (see Condition Structure below)
array
required
Array of actions to execute when conditions match (see Actions below)
boolean
Ignored on create β€” rules are always stored with enabled: false.
number
default:"50"
Rule priority (1-100). Higher values = higher priority
number
Risk score to assign when rule matches (0-100). Used in score-based risk matrices
string
Ignored on create β€” rules are always stored as in_progress (configuration).
string
default:"async"
Evaluation mode: sync (immediate) or async (background processing)
string
UUID of the risk matrix to associate this rule with
array
Array of ISO country codes to restrict rule execution: ["BR", "AR", "US"]
object
Additional scope configuration including temporal windows and triggers
array
Array of tags for organizing rules: ["high-risk", "pep", "sanctions"]
object
Optional origin metadata persisted on the rule. If omitted, the API defaults to sourceType: api (API key) or user (session). Fields: sourceType (user | agent | import_json | template | bundle | api), conversationId, messageId, platformAgentCategory, triggeredByUserId.

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 - Equals
  • neq - Not equals
  • gt - Greater than
  • gte - Greater than or equal
  • lt - Less than
  • lte - Less than or equal

String Operators

  • contains - Contains substring
  • notContains - Does not contain substring
  • startsWith - Starts with
  • endsWith - Ends with
  • regex - Matches regular expression

Array Operators

  • in - Value is in array
  • notIn - Value is not in array
  • hasAny - Has any of the values
  • hasAll - Has all of the values

List Operators

  • inList - Value exists in a data list
  • notInList - Value does not exist in a data list

Existence Operators

  • exists - Field exists
  • notExists - Field does not exist
  • isEmpty - Field is empty/null
  • isNotEmpty - Field is not empty/null

Boolean Operators

  • isTrue - Boolean field is true
  • isFalse - Boolean field is false

Array Field Syntax

For fields within arrays, use the $ symbol:
This evaluates if ANY item in the sanctions array has type equal to "terrorism".

Filters

You can pre-filter array items before evaluation:
This evaluates if ANY active legal proceeding has an amount greater than 100,000.

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

string
UUID of the created rule
string
Rule name
string
Rule description
string
Your organization ID
string
Current rule status
boolean
Whether rule is enabled
number
Rule version number
string
ISO timestamp of creation
string
User ID who created the rule
object
Origin metadata (sourceType, optional agent chat ids).
object
Synchronous AI review summary: verified, reason, functionalityDescription, suggestions, issues.

Response Example

Error Responses

400 Bad Request - Invalid Condition

400 Bad Request - Missing Required Fields

401 Unauthorized

Best Practices

  1. Start with Shadow Mode: Use status: "shadow" to test rules without affecting production
  2. Use Descriptive Names: Make rule names clear and searchable
  3. Set Appropriate Priorities: Higher priority rules execute first (1-100 scale)
  4. Tag Your Rules: Use tags for organization and filtering
  5. Country-Specific Rules: Use scope.countries for geo-specific compliance
  6. Test Thoroughly: Test rules with sample data before enabling
  7. Monitor Performance: Use sync mode for critical real-time rules, async for batch processing
  8. Score Strategically: Align scores with your risk matrix thresholds

See Also