Create a Grafana integration

Create a Grafana integration. The response includes the webhook_url to paste into Grafana. Alerts sent to that URL create incidents, and we notify you through the channels you choose.

POST https://incidents.betterstack.com/api/v3/grafana-integrations
team_id string

Team to use, such as t123. Get the ID via List teams. Required when you can access more than one team.

Authorization string required

Bearer $TOKEN

Content-Type string

application/json

name string or null

Integration name.

escalation_policy_id string or null

ID of the escalation policy for alerts, or null to alert the current on-call person directly.

paused boolean default: false

Whether the integration is paused. A paused integration opens no incidents.

call boolean default: false

Whether to call the on-call person. Ignored while an escalation policy is set.

sms boolean default: false

Whether to send an SMS to the on-call person. Ignored while an escalation policy is set.

email boolean default: true

Whether to send an e-mail to the on-call person. Ignored while an escalation policy is set.

push boolean default: false

Whether to send a push notification to the on-call person. Ignored while an escalation policy is set.

critical_alert boolean default: false

Whether to send a critical push notification that ignores the mute switch and Do Not Disturb mode. Ignored while an escalation policy is set.

team_wait integer or null

Seconds to wait before escalating to the whole team. 0 alerts the whole team right away, and null never escalates to the team. Ignored while an escalation policy is set.

201

Returns the newly created Grafana integration.

201 Created
{
  "data": {
    "id": "123456789",
    "type": "grafana_integration",
    "attributes": {
      "name": "Grafana alerts",
      "escalation_policy_id": null,
      "webhook_url": "https://incidents.betterstack.com/api/v1/grafana/webhook/token-placeholder",
      "paused": false,
      "call": false,
      "sms": true,
      "email": true,
      "push": false,
      "critical_alert": false,
      "team_wait": 180,
      "team_id": "t123",
      "team_name": "Production"
    }
  }
}
401

The API token is missing or invalid.

401 Unauthorized
{
  "errors": "Invalid Team API token. How to find your Team API token: https://betterstack.com/docs/uptime/api/getting-started-with-uptime-api/#get-an-incidents-api-token"
}
403

The token is read-only, your role doesn't include Manage on Monitors, heartbeats, integrations, or the token can't be used for this API. The plan doesn't include Grafana integrations.

403 Forbidden
{
  "errors": "This API token is read-only and cannot be used for write operations."
}
422

Validation failed, the request has an unknown field, or you set an escalation policy or a call, sms, push or critical_alert channel your plan doesn't include. The attributes the plan doesn't include are listed in unauthorized_attributes. Nothing is saved.

422 Unprocessable Content
{
  "errors": "Please upgrade your account before using these attributes",
  "unauthorized_attributes": [
    "escalation_policy_id",
    "call",
    "sms"
  ]
}
id string

The ID of the Grafana integration.

type string

Always grafana_integration.

name string or null

Integration name.

escalation_policy_id string or null

ID of the escalation policy for alerts, or null to alert the current on-call person directly.

webhook_url string

The URL to paste into Grafana. Alerts Grafana sends to it open incidents.

paused boolean

Whether the integration is paused. A paused integration opens no incidents.

call boolean

Whether to call the on-call person. Ignored while an escalation policy is set.

sms boolean

Whether to send an SMS to the on-call person. Ignored while an escalation policy is set.

email boolean

Whether to send an e-mail to the on-call person. Ignored while an escalation policy is set.

push boolean

Whether to send a push notification to the on-call person. Ignored while an escalation policy is set.

critical_alert boolean

Whether to send a critical push notification that ignores the mute switch and Do Not Disturb mode. Ignored while an escalation policy is set.

team_wait integer or null

Seconds to wait before escalating to the whole team. 0 alerts the whole team right away, and null never escalates to the team. Ignored while an escalation policy is set.

team_id string

Team that owns this integration, such as t123.

team_name string

Name of the team that owns this integration.

Example cURL

Create a Grafana integration
curl --request POST \
  --url https://incidents.betterstack.com/api/v3/grafana-integrations \
  --header "Authorization: Bearer $TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
  "name": "Grafana alerts",
  "sms": true,
  "team_wait": 180
}'