Skip to content

Incidents API ​

Incidents are automatically created when alert rules fire. They track the lifecycle of an alert event from detection through resolution. Incidents are managed through the dashboard API (not the client API).

INFO

These endpoints are dashboard APIs, authenticated via JWT session (not API tokens). They are used by the Cognipeer Console UI.

List Incidents ​

GET /api/alerts/incidents

Query Parameters ​

ParameterTypeRequiredDescription
ruleIdstringNoFilter by alert rule ID
statusstringNoFilter by status: open, acknowledged, investigating, resolved, closed
severitystringNoFilter by severity: critical, warning, info
limitnumberNoMax results (default: 50)
skipnumberNoPagination offset (default: 0)

Response ​

json
{
  "incidents": [
    {
      "_id": "inc_abc123",
      "ruleId": "rule_xyz",
      "ruleName": "High Error Rate",
      "metric": "error_rate",
      "threshold": 5,
      "actualValue": 12.3,
      "severity": "critical",
      "status": "open",
      "firedAt": "2026-03-01T10:00:00.000Z",
      "alertEventId": "evt_def456",
      "projectId": "proj_123",
      "tenantId": "tenant_1",
      "notes": [],
      "createdAt": "2026-03-01T10:00:00.000Z",
      "updatedAt": "2026-03-01T10:00:00.000Z"
    }
  ],
  "openCount": 3
}

Get Incident ​

GET /api/alerts/incidents/:incidentId

Response ​

json
{
  "incident": {
    "_id": "inc_abc123",
    "ruleId": "rule_xyz",
    "ruleName": "High Error Rate",
    "metric": "error_rate",
    "threshold": 5,
    "actualValue": 12.3,
    "severity": "critical",
    "status": "acknowledged",
    "firedAt": "2026-03-01T10:00:00.000Z",
    "alertEventId": "evt_def456",
    "projectId": "proj_123",
    "tenantId": "tenant_1",
    "acknowledgedAt": "2026-03-01T10:15:00.000Z",
    "notes": [
      {
        "userId": "user_1",
        "userName": "Admin User",
        "content": "Investigating upstream provider issues",
        "createdAt": "2026-03-01T10:30:00.000Z"
      }
    ],
    "createdAt": "2026-03-01T10:00:00.000Z",
    "updatedAt": "2026-03-01T10:15:00.000Z"
  }
}

Update Incident Status ​

PATCH /api/alerts/incidents/:incidentId

Request ​

json
{
  "status": "acknowledged"
}

Valid Statuses ​

StatusDescription
openInitial state when incident is created
acknowledgedOperator has seen the incident
investigatingActive investigation in progress
resolvedRoot cause addressed
closedIncident fully closed

Status Workflow ​

open → acknowledged → investigating → resolved → closed
  │                                      │          │
  ├──────────── resolved ────────────────┤          │
  ├──────────── closed ──────────────────┼──────────┤
  └──────────── reopen (open) ◄──────────┴──────────┘

In addition to the linear path, an incident may go directly from open to resolved or closed, and a resolved or closed incident may be reopened back to open if the issue recurs.

There is no statusHistory array. Transitions are tracked via the timestamp fields acknowledgedAt, resolvedAt, closedAt, and the resolvedBy actor, which are set as the incident moves through its lifecycle.

Add Note ​

POST /api/alerts/incidents/:incidentId/notes

Request ​

json
{
  "content": "Identified root cause: upstream provider rate limiting"
}

Parameters ​

FieldTypeRequiredDescription
contentstringYesNote text (non-empty)

Response ​

Returns the updated incident with the new note appended.

Severity Levels ​

Severity is automatically calculated when an incident is created based on the metric type and how far the actual value exceeds the threshold:

SeverityDescription
criticalActual value significantly exceeds threshold
warningThreshold breached but within moderate range
infoMinor threshold violation

Errors ​

StatusDescription
400Missing or invalid status value
401Not authenticated
404Incident not found
500Internal server error

Studio · Pulse · Console · Agent SDK and more — the Cognipeer documentation hub