Create and update Grafana unified alerting rules via the HTTP API

domain: grafana.com · 5 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Ensure Grafana is running with unified alerting enabled (default in recent versions); confirm at /api/v1/provisioning/alert-rules returns a valid response
  2. POST to '/api/v1/provisioning/alert-rules' with a JSON body containing 'title', 'ruleGroup', 'folderUID', 'condition' (the refId of the alert condition query), 'data' (array of query objects), and 'noDataState'/'execErrState' handling
  3. Each query object in 'data' needs 'refId', 'datasourceUid', 'model' (raw datasource query), and optionally 'relativeTimeRange'
  4. To update an existing rule, PUT to '/api/v1/provisioning/alert-rules/{uid}' with the full updated rule body including the existing UID
  5. Configure notification policies via '/api/v1/provisioning/policies' to route alerts to contact points created at '/api/v1/provisioning/contact-points'

Known gotchas

Related routes

Manage Grafana mute timings via the Alerting Provisioning HTTP API
grafana.com · 5 steps · unrated
Provision a Grafana dashboard programmatically using the HTTP API
grafana.com · 5 steps · unrated
Provision Grafana datasources and alert contact points as code using Grafana provisioning YAML files
grafana.com · 5 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans