Skip to content
GridRouterhome

Search

Search providers, capabilities and pages

Docs
API referenceLogs, drains and alerts

Create an alert rule

POST
/v1/alerts/rules

Alert when a metric crosses a threshold over a window: error_rate, p95_latency, spend, budget_used, vendor_failure_spike, vendor_key_failing, billing_mismatch, cache_hit_rate, delivery_backlog, security_event or new_ip. Scope it to the workspace, a key, a vendor or a capability; route it to every destination or to chosen ones.

Authorization

bearer
AuthorizationBearer <token>

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

curl -X POST "https://example.com/v1/alerts/rules" \  -H "Content-Type: application/json" \  -d '{    "name": "string",    "metric": "error_rate",    "threshold": 0,    "window_s": 60  }'
{  "object": "alert_rule",  "id": "string",  "name": "string",  "description": "",  "enabled": true,  "metric": "error_rate",  "threshold": 0,  "window_s": 60,  "min_events": 1,  "severity": "info",  "scope": {},  "kinds": [],  "cooldown_s": 900,  "destination_ids": [],  "all_destinations": true,  "toast": true,  "muted_until": null,  "is_default": true,  "evaluator": "live",  "state": {    "status": "ok",    "last_evaluated_at": "2019-08-24T14:15:22Z",    "last_value": 0,    "open_alert_id": "string",    "note": "string"  },  "created_at": "2019-08-24T14:15:22Z",  "updated_at": "2019-08-24T14:15:22Z"}