Skip to main content
Alert rules monitor platform metrics and trigger notifications when thresholds are breached. Each rule defines a metric, comparison operator, threshold, time window, and notification channels.

GET /api/v1/alerts

List all alert rules for the tenant.

Response

[
  {
    "id": "clx...",
    "name": "High Error Rate",
    "metric": "error_rate",
    "operator": "gt",
    "threshold": 5.0,
    "windowMinutes": 5,
    "channels": [
      { "type": "webhook", "target": "https://hooks.slack.com/..." }
    ],
    "cooldownMinutes": 60,
    "enabled": true,
    "tenantId": "my-tenant",
    "createdAt": "2026-03-18T12:00:00.000Z"
  }
]

POST /api/v1/alerts

Create a new alert rule. Editor or Admin.

Request Body

FieldTypeRequiredDescription
namestringYesAlert rule name
metricstringYesMetric to monitor (e.g., error_rate, latency_p99, decision_count)
operatorstringYesComparison operator: gt, lt, gte, lte, eq
thresholdnumberYesThreshold value to compare against
windowMinutesnumberNoTime window in minutes (default: 5)
channelsarrayYesNotification channels
channels[].typestringYesChannel type: webhook or email
channels[].targetstringYesWebhook URL or email address
cooldownMinutesnumberNoCooldown between re-alerts (default: 60)
enabledbooleanNoWhether the rule is active (default: true)

Example

curl -X POST https://playground.kaireonai.com/api/v1/alerts \
  -H "Content-Type: application/json" \
  -H "X-Tenant-Id: my-tenant" \
  -d '{
    "name": "High Latency Alert",
    "metric": "latency_p99",
    "operator": "gt",
    "threshold": 500,
    "windowMinutes": 10,
    "channels": [
      { "type": "webhook", "target": "https://hooks.slack.com/services/..." },
      { "type": "email", "target": "ops@example.com" }
    ],
    "cooldownMinutes": 30
  }'

Response (201)

Returns the created alert rule object.

GET /api/v1/alerts/

Get a single alert rule by ID.

PUT /api/v1/alerts/

Update an existing alert rule. All fields are optional — only provided fields are updated. Editor or Admin.

Request Body

Same fields as POST, all optional.

DELETE /api/v1/alerts/

Delete an alert rule. Editor or Admin.

Response

204 No Content on success.