Alert rule API

Alert rule API

Define sustained conditions, missing-data behavior, and notification ownership.

Alert rules evaluate infrastructure conditions for a resolved resource set. Rules, firing alert instances, and notification attempts have separate identities.

POST/organizations/{organization_id}/projects/{project_id}/alert-rules
Scope
alerts:write
Auth
Bearer API key

Creates an alert rule for a selected resource set.

Send name, selection, condition, and an optional route. A condition identifies a metric threshold, named health condition, or no-data check.

To detect fewer than 3 healthy replicas for a volume, send this rule:

JSON
{
  "name": "Missing volume replica",
  "selection": { "resource_ids": ["vol_database"] },
  "condition": {
    "type": "metric",
    "metric": "volume.replica.healthy_count",
    "comparison": "less_than",
    "value": 3,
    "aggregation": "min"
  },
  "pending_seconds": 300,
  "missing_data": "unknown",
  "severity": "warning",
  "route_id": "route_platform"
}

The example requires a metric available from the selected source. Unknown metrics or incompatible units return 422 invalid_condition. pending_seconds defaults to 300 and accepts non-negative integer seconds. Missing-data behavior defaults to unknown and can explicitly be firing; zero substitution is unsupported.

Returns 201 with rule ID and revision. It does not create a firing alert because a past chart contains a threshold crossing.

Read and edit

GET/organizations/{organization_id}/projects/{project_id}/alert-rules/{rule_id}
Scope
alerts:read
Auth
Bearer API key

Returns requested configuration, enabled state, last evaluation, and ETag. Requires alerts:read.

PATCH/organizations/{organization_id}/projects/{project_id}/alert-rules/{rule_id}
Scope
alerts:write
Auth
Bearer API key

Updates an alert rule using its current revision.

Requires If-Match; supplied selection and condition objects replace their whole value. Invalid revisions leave the rule unchanged.

Disabling a rule stops new evaluations. Historical alert instances remain available under retention. It does not repair the resource's health condition.

Alert instances

GET/organizations/{organization_id}/projects/{project_id}/alerts
Scope
alerts:read
Auth
Bearer API key

Lists alert instances matching the selected filters.

Filters by rule, resource, state, and severity. States include pending, firing, unknown, and resolved. Each instance contains first observation, last evaluation, acknowledgement, and linked delivery attempts.

POST/organizations/{organization_id}/projects/{project_id}/alerts/{alert_id}/acknowledge
Scope
alerts:write
Auth
Bearer API key

Acknowledges an alert instance and records response ownership.

Accepts a required reason and optional owner team. It requires alert ownership permission and returns the updated instance. Acknowledgement does not force resolution or alter the measured value.

Notification failures

GET/organizations/{organization_id}/projects/{project_id}/alerts/{alert_id}/deliveries
Scope
alerts:read
Auth
Bearer API key

Returns destination status and retry state. A firing instance can have no successful delivery. A failed webhook endpoint must be repaired separately from the threshold condition.

DELETE/organizations/{organization_id}/projects/{project_id}/alert-rules/{rule_id}
Scope
alerts:write
Auth
Bearer API key

Deletes an alert rule while retaining historical instances.

Deletion of a rule requires its ETag and retains historical instances. Use alerts and routing for maintenance suppression and Metrics query API to inspect the underlying observations.