Skip to main content

Alerts API

Query and manage active alerts.

List Alerts

GET /api/v1/alerts

Parameters

ParameterTypeDescription
statusstringFilter by status: firing, acknowledged, resolved
severitystringFilter by severity: info, warning, critical
rule_idstringFilter by rule
sourcestringFilter by source: flux, pulse, reflex, recall
limitintegerMax results (default: 50)

Request

curl "https://signal.brainzlab.ai/api/v1/alerts?\
status=firing&\
severity=critical" \
  -H "Authorization: Bearer $API_KEY"

Response

{
  "data": [
    {
      "id": "alert_abc123",
      "rule_id": "rule_xyz",
      "rule_name": "High Error Rate",
      "status": "firing",
      "severity": "critical",
      "source": "reflex",
      "current_value": 150,
      "threshold": 100,
      "fired_at": "2024-01-15T10:30:00Z",
      "incident_id": "inc_123"
    }
  ],
  "meta": {
    "total": 3,
    "firing": 2,
    "acknowledged": 1
  }
}

Get Alert

GET /api/v1/alerts/:id

Response

{
  "data": {
    "id": "alert_abc123",
    "rule_id": "rule_xyz",
    "rule_name": "High Error Rate",
    "status": "firing",
    "severity": "critical",
    "source": "reflex",
    "source_name": "error_count",
    "current_value": 150,
    "threshold": 100,
    "operator": "gt",
    "window": "5m",
    "fired_at": "2024-01-15T10:30:00Z",
    "incident_id": "inc_123",
    "tags": {
      "service": "api",
      "environment": "production"
    },
    "history": [
      { "timestamp": "2024-01-15T10:25:00Z", "value": 80 },
      { "timestamp": "2024-01-15T10:30:00Z", "value": 150 }
    ]
  }
}

Acknowledge Alert

POST /api/v1/alerts/:id/acknowledge

Request

curl -X POST "https://signal.brainzlab.ai/api/v1/alerts/alert_abc123/acknowledge" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "note": "Investigating the issue"
  }'

Response

{
  "data": {
    "id": "alert_abc123",
    "status": "acknowledged",
    "acknowledged_at": "2024-01-15T10:35:00Z",
    "acknowledged_by": "user_xyz"
  }
}

Resolve Alert

POST /api/v1/alerts/:id/resolve

Request

curl -X POST "https://signal.brainzlab.ai/api/v1/alerts/alert_abc123/resolve" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "note": "Deployed fix"
  }'

Snooze Alert

Temporarily mute an alert:
POST /api/v1/alerts/:id/snooze

Request

curl -X POST "https://signal.brainzlab.ai/api/v1/alerts/alert_abc123/snooze" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "duration": "1h",
    "reason": "Known issue, fix deploying"
  }'

Errors

CodeDescription
alert_not_foundAlert does not exist
already_acknowledgedAlert is already acknowledged
already_resolvedAlert is already resolved