Skip to main content

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

Required role: viewer. Response 200:

Create a rule

Required role: 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 the admin role on this workspace.

Update a rule

Required role: admin. Body fields are all optional; supply only the ones you want to change. Same validation rules as create.

Delete a rule

Required role: admin. Response 200: { "success": true }.

Send a test event

Required role: 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.