Rules API
The Rules API lets you manage automation rules programmatically. You can create rules from YAML definitions, toggle their execution mode between disabled, shadow, and live, and manage webhook delivery and HMAC signing.
All endpoints are under /api/rules and require authentication.
Rules are defined using YAML. See the Rules YAML reference for the full schema.
CRUD Operations
/api/rulesAuth requiredCreate a new rule from a YAML definition.
// Request body
{ "yaml": "name: My Rule\ntrigger: push\n..." }/api/rulesAuth requiredList all rules. Supports pagination.
GET /api/rules?page=1&pageSize=20/api/rules/:idAuth requiredGet a single rule by ID.
/api/rules/:idAuth requiredUpdate an existing rule with new YAML.
// Request body
{ "yaml": "name: Updated Rule\ntrigger: pull_request\n..." }/api/rules/:idAuth requiredDelete a rule. Requires owner or admin role.
Only workspace owners and admins can delete rules. Members will receive a 403 response.
Rule State Management
/api/rules/:id/toggleAuth requiredToggle a rule between enabled and disabled.
/api/rules/:id/stateAuth requiredChange the rule execution mode.
// Request body
{ "mode": "disabled" | "shadow" | "live" }Testing
/api/rules/:id/testAuth requiredExecute the rule in test mode without side effects.
/api/rules/:id/test-webhookAuth requiredSend a test webhook delivery to verify your endpoint.
Shadow Mode
Shadow mode lets you observe how a rule would behave without actually executing actions. Use confidence stats and shadow logs to validate before promoting to live.
/api/rules/:id/confidenceAuth requiredGet confidence statistics from shadow mode executions.
/api/rules/:id/shadow-logAuth requiredGet shadow execution logs. Supports pagination.
GET /api/rules/:id/shadow-log?page=1&pageSize=50Webhook Deliveries
/api/rules/:id/deliveriesAuth requiredList webhook deliveries for this rule.
GET /api/rules/:id/deliveries?limit=25&offset=0/api/rules/:id/deliveries/lastAuth requiredGet the timestamp of the last successful delivery.
Webhook Security
/api/rules/:id/rotate-secretAuth requiredRotate the webhook signing secret. Requires owner or admin role.
/api/rules/:id/hmacAuth requiredEnable or disable HMAC signature verification. Requires owner or admin role.
// Request body
{ "enabled": true }Rotating a webhook secret invalidates the previous secret immediately. Update your receiving endpoint before rotating.