Alerts API

Configure alert rules and manage alert events and notifications.

Alert Rules

Alert rules define conditions that trigger notifications. When a log entry matches a rule's conditions, an alert event is created and notifications are sent via configured channels.

Create Alert Rule

POST
/api/v1/alert-rules

Create a new alert rule

Bash
curl -X POST "https://apperioserver.onrender.com/api/v1/alert-rules" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "High Error Rate Alert",
    "projectId": "proj_abc123",
    "enabled": true,
    "conditions": {
      "level": "error",
      "threshold": 10,
      "timeWindow": "5m",
      "operator": "greaterThan"
    },
    "channels": {
      "email": true,
      "slack": true,
      "webhook": false
    },
    "cooldownMinutes": 15
  }'
JSON
// Response(201 Created)
{
  "status": "success",
  "data": {
    "id": "rule_xyz789",
    "name": "High Error Rate Alert",
    "projectId": "proj_abc123",
    "enabled": true,
    "conditions": {
      "level": "error",
      "threshold": 10,
      "timeWindow": "5m",
      "operator": "greaterThan"
    },
    "channels": {
      "email": true,
      "slack": true,
      "webhook": false
    },
    "cooldownMinutes": 15,
    "lastTriggered": null,
    "createdAt": "2026-03-07T10:30:00Z"
  }
}

List Alert Rules

GET
/api/v1/alert-rules/:projectId

Get all alert rules for a project

Bash
curl "https://apperioserver.onrender.com/api/v1/alert-rules/proj_abc123" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"

Update Alert Rule

PUT
/api/v1/alert-rules/:id

Update an existing alert rule

Bash
curl -X PUT "https://apperioserver.onrender.com/api/v1/alert-rules/RULE_ID" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "enabled": false,
    "cooldownMinutes": 30
  }'

Delete Alert Rule

DELETE
/api/v1/alert-rules/:id

Delete an alert rule

Alert Events

Alert events are created when log data matches a rule's conditions. Each event records when the alert fired, what triggered it, and its current status.

GET
/api/v1/alerts/:projectId

Get alert events for a project

JSON
// Response
{
  "status": "success",
  "data": [
    {
      "id": "alert_001",
      "ruleId": "rule_xyz789",
      "ruleName": "High Error Rate Alert",
      "projectId": "proj_abc123",
      "status": "active",
      "triggeredAt": "2026-03-07T10:35:00Z",
      "triggerData": {
        "errorCount": 15,
        "timeWindow": "5m",
        "threshold": 10
      },
      "acknowledgedAt": null,
      "resolvedAt": null
    }
  ]
}
GET
/api/v1/alerts/stats

Get alert statistics across all projects

Manage Alert Events

Acknowledge Alert

POST
/api/v1/alerts/:alertId/acknowledge

Acknowledge an active alert

Update Alert Status

PATCH
/api/v1/alerts/:alertId/status

Update alert status (active, acknowledged, resolved)

JSON
// Request body
{
  "status": "resolved"
}

Bulk Update

PATCH
/api/v1/alerts/bulk-update

Update multiple alerts at once

JSON
// Request body
{
  "alertIds": ["alert_001", "alert_002", "alert_003"],
  "status": "resolved"
}

Auto-Resolve

POST
/api/v1/alerts/auto-resolve

Auto-resolve alerts older than a specified time

Notification Channels

Alert rules can notify through multiple channels:

ChannelConfigurationDetails
EmailAutomatic (uses account email)Sends email to project owner and admins
SlackWebhook URL in project settingsPosts to configured Slack channel
WebhookCustom URL in project settingsSends POST request with alert payload

Configure notification channels via the project integration settings:

PUT
/api/v1/projects/:projectId/integration-settings

Update Slack/webhook integration URLs

JSON
// Request body
{
  "slackWebhookUrl": "https://hooks.slack.com/services/T.../B.../...",
  "webhookUrl": "https://your-app.com/api/apperio-webhook"
}

Tip

Use the cooldownMinutes setting to prevent notification flooding. After an alert fires, the same rule will not trigger again until the cooldown period expires.