OnCall API Reference
Use the following guidelines for the OnCall API in Grafana IRM.
Authentication
You can authenticate with the OnCall API in Grafana IRM using one of two methods:
- Grafana Cloud service account tokens (recommended)
- OnCall API keys (legacy)
Grafana Cloud service account tokens are the preferred method for most use cases. They allow you to assign granular permissions, rotate tokens, and manage access centrally. However, some endpoints require user-specific context and must be accessed using a legacy OnCall API key.
To locate your OnCall API endpoint, navigate to IRM > Settings > Admin & API in Grafana Cloud. For more details, see the IRM settings documentation.
Note
Certain OnCall API endpoints require user context and cannot be accessed with service account tokens. For these endpoints, use a legacy OnCall API key. These exceptions are noted in the relevant endpoint documentation.
Authenticate using a service account token (recommended)
Service account tokens provide secure, flexible access management. To authenticate:
- Add the
Authorization
header with your service account token. - Add the
X-Grafana-URL
header specifying your Grafana Cloud stack.
curl "https://your-oncall-endpoint/api/..." \
--header "Authorization: <service account token>" \
--header "X-Grafana-URL: https://your-stack.grafana.net"
Refer to the Service account tokens documentation for more information.
Authenticate using a legacy OnCall API key
Legacy OnCall API keys are user-specific and may be required for endpoints that record user actions.
curl "https://your-oncall-endpoint/api/..." \
--header "Authorization: <oncall-api-key>"
Note
OnCall API tokens are only visible to the user who created them. Other users cannot view or manage tokens they did not create.
Pagination
List endpoints such as List Integrations or List Alert Groups return multiple objects.
The OnCall API returns them in pages. Note that the page size may vary.
Parameter | Meaning |
---|---|
count | The total number of items. It can be 0 if a request does not return any data. |
next | A link to the next page. It can be null if the next page does not contain any data. |
previous | A link to the previous page. It can be null if the previous page does not contain any data. |
results | The data list. Can be [] if a request does not return any data. |
To control the size of the page and which page to access use the page
and perpage
query parameters. For example:
curl "{{API_URL}}/api/v1/alert_groups/?page=5&perpage=10" \
--request GET \
--header "Authorization: meowmeowmeow" \
--header "Content-Type: application/json" \
--header "X-Grafana-URL: https://your-stack.grafana.net"
Rate Limits
Rate limits ensure alert group notifications are delivered to your Slack workspace even when some integrations produce a large number of alerts.
Monitoring integrations Rate Limits
Rate limited response HTTP status: 429
Scope | Amount | Time Frame |
---|---|---|
Alerts from each integration | 300 | 5 minutes |
Alerts from the whole organization | 500 | 5 minutes |
API rate limits
You can reduce or increase rate limits depending on platform status.
Scope | Amount | Time Frame |
---|---|---|
API requests per API key | 300 | 5 minutes |