Execute Rule
API Reference
Execute Rule
Execute a rule against a specific entity for testing and validation β in the gu1 rules engine for compliance and risk detection, with examples for execute use.
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
- Always Test First: Use
testMode: truebefore running rules in production - Enable Debug for Development: Use
includeDebug: trueto understand rule behavior - Test Edge Cases: Test with entities that should and shouldnβt match
- Monitor Execution Time: Optimize rules that take longer than 200ms
- Validate Actions: Review action details before enabling production mode
- 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
- Create Rule - Create new rules
- Condition Fields Reference - Available condition fields
- List Rules - Query rules
- Update Rule - Modify existing rules