Alert rules API
Workspace-scoped CRUD for alert rules. Webhook deliveries are queued with retry; email deliveries dispatch inline.All endpoints are mounted under
/api/workspaces/:workspaceId/alert-rules. Use a workspace-scoped API key (agents:read or agents:write scope, matched to the role each route requires) or an authenticated session cookie.
See the Alert rules guide for event patterns, channel shapes, and how delivery retry works.
List rules
viewer.
Response 200:
Create a rule
admin.
Body:
Response 200: the serialized rule (same shape as the list endpoint entries).
Errors:
400— validation failure (empty channels, malformed URL, unsupported channel type, too many email recipients).403— caller lacks theadminrole on this workspace.
Update a rule
admin.
Body fields are all optional; supply only the ones you want to change. Same validation rules as create.
Delete a rule
admin.
Response 200: { "success": true }.
Send a test event
admin.
Fires a synthetic event matching the rule’s pattern through the same delivery pipeline. Webhooks are queued with retry; emails are sent inline. Use this to verify channel configuration without waiting for a real event.
Response 200: { "success": true }. Delivery results land asynchronously on the rule’s lastFiredAt and lastError.
