pydo.insights.list_alert_rules()

Generated on 16 Oct 2026 from pydo version v0.44.0

Usage

client.insights.list_alert_rules(
    page=1,
    per_page=20,
    resource_urn=None,
)
Returns JSON Raises HttpResponseError

Description

To list alert rules for your account, send a GET request to /v2/insights/alert-rules. Results are paginated with page and per_page (default 20, maximum 200). Optionally filter by resource_urn.

Parameters

page integer optional

Which 'page' of paginated results to return.

Min: 1

Default: 1

per_page integer optional

Number of items returned per page

Min: 1

Max: 200

Default: 20

resource_urn string optional

Optional filter. When set, only resources associated with this resource URN
are returned.

Pagination

This method returns paginated results. The response includes a links.pages object with URLs for navigating between pages. To retrieve the next page, parse the next URL and pass the page parameter:

from urllib.parse import urlparse, parse_qs

resp = client.insights.list_alert_rules()
pages = resp.get("links", {}).get("pages", {})

while "next" in pages:
    parsed = urlparse(pages["next"])
    page = int(parse_qs(parsed.query)["page"][0])
    resp = client.insights.list_alert_rules(page=page)
    pages = resp.get("links", {}).get("pages", {})

Response Example

Show Response Example
{
  "alert_rules": [
    {
      "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "spec": {
        "name": "High CPU",
        "query": {
          "metric": "do.droplets.cpu_utilization",
          "resource_urns": [
            "do:droplet:12345"
          ]
        },
        "condition": {
          "window": "EVALUATION_WINDOW_5M"
        },
        "thresholds": {
          "warning": 80,
          "critical": 95,
          "operator": "THRESHOLD_OPERATOR_GREATER_THAN"
        },
        "notification_channels": [
          {
            "notification_channel_id": "550e8400-e29b-41d4-a716-446655440000",
            "notify_on": [
              "SEVERITY_CRITICAL"
            ]
          }
        ],
        "re_alert_duration": "RE_ALERT_DURATION_4H"
      },
      "status": "ALERT_RULE_STATUS_PAUSED",
      "created_at": "2026-09-03T10:00:00Z",
      "updated_at": "2026-09-03T10:30:00Z"
    }
  ],
  "links": {
    "pages": {
      "first": "https://api.digitalocean.com/v2/insights/alert-rules?page=1",
      "last": "https://api.digitalocean.com/v2/insights/alert-rules?page=1"
    }
  },
  "meta": {
    "total": 1
  }
}

More Information

See /v2/insights/alert-rules in the API reference for additional detail on responses, headers, parameters, and more.

We can't find any results for your search.

Try using different keywords or simplifying your search terms.