Skip to main content
POST
Execute Rule

Overview

Executes a specific rule against an entity to test rule logic, validate conditions, and preview results before deploying to production. Useful for testing rules in shadow mode or debugging rule behavior.

Endpoint

Authentication

Requires a valid API key in the Authorization header:

Path Parameters

string
required
UUID of the rule to execute

Request Body

string
required
UUID of the entity to evaluate against the rule
boolean
default:"false"
If true, executes in test mode without creating alerts or modifying entities
boolean
default:"false"
If true, includes detailed debug information about condition evaluation

Response

boolean
Whether the rule conditions matched
number
Risk score assigned by the rule (if matched)
number
Execution time in milliseconds
object
Detailed evaluation results for each condition
array
Actions that would be executed (or were executed if not in test mode)
object
Debug information (if includeDebug=true)

Example Requests

Execute Rule in Test Mode

Execute Rule in Production Mode

Response Examples

Successful Match with Debug Info

No Match

Production Mode - Actions Executed

Error Responses

404 Not Found - Rule

404 Not Found - Entity

400 Bad Request - Type Mismatch

400 Bad Request - Disabled Rule

Use Cases

Testing New Rules

Debugging Rule Behavior

Batch Testing

Best Practices

  1. Always Test First: Use testMode: true before running rules in production
  2. Enable Debug for Development: Use includeDebug: true to understand rule behavior
  3. Test Edge Cases: Test with entities that should and shouldn’t match
  4. Monitor Execution Time: Optimize rules that take longer than 200ms
  5. Validate Actions: Review action details before enabling production mode
  6. Use Shadow Mode: Deploy rules with status: "shadow" to log matches without executing actions

Performance Notes

  • Average execution time: 50-150ms
  • Sync rules block the request, async rules return immediately
  • Complex nested conditions may increase execution time
  • Array field evaluations with filters add ~10-30ms per array

See Also