# List alert rules (/docs/api/logs/alerts_rules_list)

Every alert rule with its metric, threshold, window, scope, severity, destinations, mute and live state (ok, firing, muted, no_data). New workspaces start with defaults (a vendor key failing, budgets at 80% and 100%, billing mismatches, error-rate and spend spikes, a key on a new IP, failing deliveries, security events).

`GET /v1/alerts/rules`

```json
{
  "operationId": "alerts_rules_list",
  "summary": "List alert rules",
  "description": "Every alert rule with its metric, threshold, window, scope, severity, destinations, mute and live state (ok, firing, muted, no_data). New workspaces start with defaults (a vendor key failing, budgets at 80% and 100%, billing mismatches, error-rate and spend spikes, a key on a new IP, failing deliveries, security events).",
  "tags": [
    "alerts"
  ],
  "security": [
    {
      "bearer": []
    }
  ],
  "responses": {
    "200": {
      "description": "OK",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "items": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "alert_rule"
                      ]
                    },
                    "id": {
                      "type": "string",
                      "pattern": "^alr_[a-z0-9]{8,32}$"
                    },
                    "name": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 80
                    },
                    "description": {
                      "type": "string",
                      "maxLength": 300,
                      "default": ""
                    },
                    "enabled": {
                      "type": "boolean",
                      "default": true
                    },
                    "metric": {
                      "type": "string",
                      "enum": [
                        "error_rate",
                        "p95_latency",
                        "spend",
                        "budget_used",
                        "vendor_failure_spike",
                        "vendor_key_failing",
                        "billing_mismatch",
                        "cache_hit_rate",
                        "delivery_backlog",
                        "security_event",
                        "new_ip"
                      ]
                    },
                    "threshold": {
                      "type": "number",
                      "minimum": 0,
                      "maximum": 10000000000000
                    },
                    "window_s": {
                      "type": "integer",
                      "minimum": 60,
                      "maximum": 604800
                    },
                    "min_events": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 1000000,
                      "default": 1
                    },
                    "severity": {
                      "type": "string",
                      "enum": [
                        "info",
                        "warning",
                        "critical"
                      ],
                      "default": "warning"
                    },
                    "scope": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "workspace",
                            "key",
                            "vendor",
                            "capability"
                          ],
                          "default": "workspace"
                        },
                        "value": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "pattern": "^[A-Za-z0-9_.:/-]{1,200}$",
                          "default": null
                        }
                      },
                      "default": {}
                    },
                    "kinds": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "invalid_key_burst",
                          "new_geo",
                          "admin_action",
                          "key_ip_denied",
                          "scope_denied_burst"
                        ]
                      },
                      "maxItems": 10,
                      "default": []
                    },
                    "cooldown_s": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 86400,
                      "default": 900
                    },
                    "destination_ids": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "pattern": "^dst_[a-z0-9]{8,32}$"
                      },
                      "maxItems": 20,
                      "default": []
                    },
                    "all_destinations": {
                      "type": "boolean",
                      "default": true
                    },
                    "toast": {
                      "type": "boolean",
                      "default": true
                    },
                    "muted_until": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time",
                      "default": null
                    },
                    "is_default": {
                      "type": "boolean"
                    },
                    "evaluator": {
                      "type": "string",
                      "enum": [
                        "live",
                        "scheduled",
                        "event"
                      ]
                    },
                    "state": {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string",
                          "enum": [
                            "ok",
                            "firing",
                            "muted",
                            "disabled",
                            "no_data"
                          ]
                        },
                        "last_evaluated_at": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time"
                        },
                        "last_value": {
                          "type": [
                            "number",
                            "null"
                          ]
                        },
                        "open_alert_id": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "pattern": "^alt_[a-z0-9]{8,40}$"
                        },
                        "note": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "maxLength": 200
                        }
                      },
                      "required": [
                        "status",
                        "last_evaluated_at",
                        "last_value",
                        "open_alert_id",
                        "note"
                      ]
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "updated_at": {
                      "type": "string",
                      "format": "date-time"
                    }
                  },
                  "required": [
                    "object",
                    "id",
                    "name",
                    "metric",
                    "threshold",
                    "window_s",
                    "is_default",
                    "evaluator",
                    "state",
                    "created_at",
                    "updated_at"
                  ]
                }
              }
            },
            "required": [
              "items"
            ]
          }
        }
      }
    },
    "default": {
      "description": "Error",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "error": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "enum": [
                      "invalid_request",
                      "unauthorized",
                      "insufficient_balance",
                      "max_cost_exceeded",
                      "scope_denied",
                      "budget_blocked",
                      "not_found",
                      "idempotency_mismatch",
                      "invalid_meta",
                      "rate_limited",
                      "upstream_error",
                      "response_buffer_limit",
                      "provider_capacity_unavailable",
                      "grid_saturated",
                      "upstream_timeout",
                      "conflict",
                      "internal_error",
                      "account_frozen",
                      "strict_filters",
                      "plan_limit_reached",
                      "validation_failed",
                      "deadline_exceeded",
                      "cancelled"
                    ]
                  },
                  "message": {
                    "type": "string"
                  },
                  "request_id": {
                    "type": "string"
                  },
                  "call_id": {
                    "type": "string"
                  },
                  "retry_after_ms": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "details": {
                    "type": "object",
                    "additionalProperties": {}
                  }
                },
                "required": [
                  "code",
                  "message"
                ]
              }
            },
            "required": [
              "error"
            ]
          }
        }
      }
    }
  }
}
```
