Alerting Notification Channels API
Use the Alerting Notification Channels API to create, update, delete, and retrieve notification channels.
The identifier (id) of a notification channel is an auto-incrementing numeric value and is only unique per workspace. The unique identifier (uid) of a notification channel can be used to uniquely identify a folder between multiple workspaces. It’s automatically generated if you don't provide one when you create a notification channel. The uid allows having consistent URLs for accessing notification channels and when synchronizing notification channels between multiple Amazon Managed Grafana workspaces.
To use a Grafana API with your Amazon Managed Grafana workspace, you must have a valid Grafana API key. You include
this key in the Authorization
field in the API request. For information about how
to create a Grafana API key, see Using Grafana HTTP APIs.
Get all notification channels
Returns all notification channels that the authenticated user has permission to view.
GET /api/alert-notifications
Example request
GET /api/alert-notifications HTTP/1.1 Accept: application/json Content-Type: application/json Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
Example response
HTTP/1.1 200 Content-Type: application/json [ { "id": 1, "uid": "team-a-email-notifier", "name": "Team A", "type": "email", "isDefault": false, "sendReminder": false, "disableResolveMessage": false, "settings": { "addresses": "dev@grafana.com" }, "created": "2018-04-23T14:44:09+02:00", "updated": "2018-08-20T15:47:49+02:00" } ]
Get all notification channels (lookup)
Returns all notification channels, but with less detailed information. Accessible by any authenticated user and is mainly used to provide alert notification channels in the Grafana workspace console UI when configuring alert rules.
GET /api/alert-notifications/lookup
Example request
GET /api/alert-notifications/lookup HTTP/1.1 Accept: application/json Content-Type: application/json Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
Example response
HTTP/1.1 200 Content-Type: application/json [ { "id": 1, "uid": "000000001", "name": "Test", "type": "email", "isDefault": false }, { "id": 2, "uid": "000000002", "name": "Slack", "type": "slack", "isDefault": false } ]
Get all notification channels by UID
GET /api/alert-notifications/uid/:uid
Example request
GET /api/alert-notifications/uid/team-a-email-notifier HTTP/1.1 Accept: application/json Content-Type: application/json Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
Example response
HTTP/1.1 200 Content-Type: application/json { "id": 1, "uid": "team-a-email-notifier", "name": "Team A", "type": "email", "isDefault": false, "sendReminder": false, "disableResolveMessage": false, "settings": { "addresses": "dev@grafana.com" }, "created": "2018-04-23T14:44:09+02:00", "updated": "2018-08-20T15:47:49+02:00" }
Get all notification channels by Id
GET /api/alert-notifications/:id
Example request
GET /api/alert-notifications/1 HTTP/1.1 Accept: application/json Content-Type: application/json Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
Example response
HTTP/1.1 200 Content-Type: application/json { "id": 1, "uid": "team-a-email-notifier", "name": "Team A", "type": "email", "isDefault": false, "sendReminder": false, "disableResolveMessage": false, "settings": { "addresses": "dev@grafana.com" }, "created": "2018-04-23T14:44:09+02:00", "updated": "2018-08-20T15:47:49+02:00" }
Create notification channel
To see what notification channels are supported by Amazon Managed Grafana, see List of supported notifiers.
POST /api/alert-notifications
Example request
POST /api/alert-notifications HTTP/1.1 Accept: application/json Content-Type: application/json Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk { "uid": "new-alert-notification", // optional "name": "new alert notification", //Required "type": "email", //Required "isDefault": false, "sendReminder": false, "settings": { "addresses": "dev@grafana.com" } }
Example response
HTTP/1.1 200 Content-Type: application/json { "id": 1, "uid": "new-alert-notification", "name": "new alert notification", "type": "email", "isDefault": false, "sendReminder": false, "settings": { "addresses": "dev@grafana.com" }, "created": "2018-04-23T14:44:09+02:00", "updated": "2018-08-20T15:47:49+02:00" }
Update notification channel by UID
PUT /api/alert-notifications/uid/:uid
Example request
PUT /api/alert-notifications/uid/cIBgcSjkk HTTP/1.1 Accept: application/json Content-Type: application/json Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk { "uid": "new-alert-notification", // optional "name": "new alert notification", //Required "type": "email", //Required "isDefault": false, "sendReminder": true, "frequency": "15m", "settings": { "addresses": "dev@grafana.com" } }
Example response
HTTP/1.1 200 Content-Type: application/json { "id": 1, "uid": "new-alert-notification", "name": "new alert notification", "type": "email", "isDefault": false, "sendReminder": true, "frequency": "15m", "settings": { "addresses": "dev@grafana.com" }, "created": "2017-01-01 12:34", "updated": "2017-01-01 12:34" }
Update notification channel by Id
PUT /api/alert-notifications/:id
Example request
PUT /api/alert-notifications/1 HTTP/1.1 Accept: application/json Content-Type: application/json Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk { "id": 1, "uid": "new-alert-notification", // optional "name": "new alert notification", //Required "type": "email", //Required "isDefault": false, "sendReminder": true, "frequency": "15m", "settings": { "addresses": "dev@grafana.com" } }
Example response
HTTP/1.1 200 Content-Type: application/json { "id": 1, "uid": "new-alert-notification", "name": "new alert notification", "type": "email", "isDefault": false, "sendReminder": true, "frequency": "15m", "settings": { "addresses": "dev@grafana.com" }, "created": "2017-01-01 12:34", "updated": "2017-01-01 12:34" }
Delete notification channel by UID
DELETE /api/alert-notifications/uid/:uid
Example request
DELETE /api/alert-notifications/uid/team-a-email-notifier HTTP/1.1 Accept: application/json Content-Type: application/json Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
Example response
HTTP/1.1 200 Content-Type: application/json { "message": "Notification deleted" }
Delete notification channel by Id
DELETE /api/alert-notifications/:id
Example request
DELETE /api/alert-notifications/1 HTTP/1.1 Accept: application/json Content-Type: application/json Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
Example response
HTTP/1.1 200 Content-Type: application/json { "message": "Notification deleted" }
Test notification channel
Sends a test notification message for the given notification channel type and settings.
POST /api/alert-notifications/test
Example request
POST /api/alert-notifications/test HTTP/1.1 Accept: application/json Content-Type: application/json Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk { "type": "email", "settings": { "addresses": "dev@grafana.com" } }
Example response
HTTP/1.1 200 Content-Type: application/json { "message": "Test notification sent" }