2022-06-09 10:08:07 +01:00
|
|
|
---
|
|
|
|
|
title: Grafana OnCall HTTP API reference
|
2024-02-08 15:59:28 -07:00
|
|
|
menuTitle: API reference
|
|
|
|
|
description: Reference material for Grafana OnCall API.
|
2024-08-15 15:29:56 -04:00
|
|
|
weight: 0
|
2024-02-08 15:59:28 -07:00
|
|
|
keywords:
|
|
|
|
|
- OnCall
|
|
|
|
|
- API
|
|
|
|
|
- HTTP
|
|
|
|
|
- API key
|
|
|
|
|
canonical: https://grafana.com/docs/oncall/latest/oncall-api-reference/
|
|
|
|
|
aliases:
|
|
|
|
|
- /docs/grafana-cloud/alerting-and-irm/oncall/oncall-api-reference/
|
2022-06-09 10:08:07 +01:00
|
|
|
---
|
2022-06-03 08:09:47 -06:00
|
|
|
|
|
|
|
|
# HTTP API Reference
|
|
|
|
|
|
|
|
|
|
Use the following guidelines for the Grafana OnCall API.
|
|
|
|
|
|
|
|
|
|
<!--Welcome to the Grafana OnCall API reference!
|
|
|
|
|
|
|
|
|
|
| Simplified API Structure |
|
|
|
|
|
| ----------- |
|
|
|
|
|
|  | -->
|
|
|
|
|
|
|
|
|
|
## Authentication
|
|
|
|
|
|
|
|
|
|
To authorize, use the **Authorization** header:
|
|
|
|
|
|
|
|
|
|
```shell
|
|
|
|
|
# With shell, you can just pass the correct header with each request
|
2024-12-11 08:54:00 -03:00
|
|
|
curl "api_endpoint_here" --header "Authorization: <api_key_here>"
|
2022-06-03 08:09:47 -06:00
|
|
|
```
|
|
|
|
|
|
2022-06-14 13:28:22 +04:00
|
|
|
Grafana OnCall uses API keys to allow access to the API. You can request a new OnCall API key in OnCall -> Settings page.
|
2022-06-03 08:09:47 -06:00
|
|
|
|
2022-12-01 14:26:54 +01:00
|
|
|
An API key is specific to a user and a Grafana stack. If you want to switch to a different stack configuration,
|
|
|
|
|
request a different API key.
|
2022-06-03 08:09:47 -06:00
|
|
|
|
2024-06-14 12:31:36 -04:00
|
|
|
The endpoint refers to the OnCall Application endpoint and can be found on the OnCall -> Settings page as well.
|
|
|
|
|
|
2024-12-11 08:54:00 -03:00
|
|
|
### Authentication using Service Account tokens
|
|
|
|
|
|
|
|
|
|
It is also possible to use a [service account token](https://grafana.com/docs/grafana/latest/administration/service-accounts/#service-account-tokens)
|
|
|
|
|
to authenticate instead of an OnCall access token. In this case you will also need to provide a
|
|
|
|
|
header (`X-Grafana-URL`) pointing to your Grafana stack:
|
|
|
|
|
|
|
|
|
|
```shell
|
|
|
|
|
# With shell, you can just pass the correct header with each request
|
|
|
|
|
curl "api_endpoint_here" --header "Authorization: <service account token>" --header "X-Grafana-URL: <your stack URL>"
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Service accounts allow you to set explicit permissions for tokens as well as expire and/or disable them if needed.
|
|
|
|
|
|
2022-06-03 08:09:47 -06:00
|
|
|
## Pagination
|
|
|
|
|
|
2022-06-09 10:08:07 +01:00
|
|
|
List endpoints such as List Integrations or List Alert Groups return multiple objects.
|
2022-06-03 08:09:47 -06:00
|
|
|
|
2022-06-09 10:08:07 +01:00
|
|
|
The OnCall API returns them in pages. Note that the page size may vary.
|
2022-06-03 08:09:47 -06:00
|
|
|
|
2022-06-09 10:08:07 +01:00
|
|
|
| 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. |
|
2022-06-03 08:09:47 -06:00
|
|
|
|
|
|
|
|
## Rate Limits
|
|
|
|
|
|
2022-12-01 14:26:54 +01:00
|
|
|
Grafana OnCall provides rate limits to ensure alert group notifications will be delivered to your Slack workspace even
|
|
|
|
|
when some integrations produce a large number of alerts.
|
2022-06-03 08:09:47 -06:00
|
|
|
|
|
|
|
|
### Monitoring integrations Rate Limits
|
|
|
|
|
|
2022-06-09 10:08:07 +01:00
|
|
|
Rate limited response HTTP status: 429
|
2022-06-03 08:09:47 -06:00
|
|
|
|
|
|
|
|
| Scope | Amount | Time Frame |
|
2022-06-09 10:08:07 +01:00
|
|
|
| ---------------------------- | :----: | :--------: |
|
|
|
|
|
| Alerts from each integration | 300 | 5 minutes |
|
2023-06-08 21:47:13 +08:00
|
|
|
| Alerts from the whole organization | 500 | 5 minutes |
|
2022-06-03 08:09:47 -06:00
|
|
|
|
|
|
|
|
## API rate limits
|
2022-06-09 10:08:07 +01:00
|
|
|
|
2022-06-03 08:09:47 -06:00
|
|
|
You can reduce or increase rate limits depending on platform status.
|
|
|
|
|
|
|
|
|
|
| Scope | Amount | Time Frame |
|
2022-06-09 10:08:07 +01:00
|
|
|
| ------------------------ | :----: | :--------: |
|
|
|
|
|
| API requests per API key | 300 | 5 minutes |
|