|
| 1 | +--- |
| 2 | +canonical: https://grafana.com/docs/oncall/latest/oncall-api-reference/escalation/ |
| 3 | +title: Escalation HTTP API |
| 4 | +weight: 1200 |
| 5 | +refs: |
| 6 | + users: |
| 7 | + - pattern: /docs/oncall/ |
| 8 | + destination: /docs/oncall/<ONCALL_VERSION>/oncall-api-reference/users |
| 9 | + - pattern: /docs/grafana-cloud/ |
| 10 | + destination: /docs/grafana-cloud/alerting-and-irm/oncall/oncall-api-reference/users |
| 11 | + teams: |
| 12 | + - pattern: /docs/oncall/ |
| 13 | + destination: /docs/oncall/<ONCALL_VERSION>/oncall-api-reference/teams |
| 14 | + - pattern: /docs/grafana-cloud/ |
| 15 | + destination: /docs/grafana-cloud/alerting-and-irm/oncall/oncall-api-reference/teams |
| 16 | + manual-paging: |
| 17 | + - pattern: /docs/oncall/ |
| 18 | + destination: /docs/oncall/<ONCALL_VERSION>/configure/integrations/references/manual |
| 19 | + - pattern: /docs/grafana-cloud/ |
| 20 | + destination: /docs/grafana-cloud/configure/integrations/references/manual |
| 21 | +--- |
| 22 | + |
| 23 | +# Escalation HTTP API |
| 24 | + |
| 25 | +See [Manual paging integration](ref:manual-paging) for more background on how escalating to a team or user(s) works. |
| 26 | + |
| 27 | +## Escalate to a set of users |
| 28 | + |
| 29 | +For more details about how to fetch a user's Grafana OnCall ID, refer to the [Users](ref:users) public API documentation. |
| 30 | + |
| 31 | +```shell |
| 32 | +curl "{{API_URL}}/api/v1/escalation/" \ |
| 33 | + --request POST \ |
| 34 | + --header "Authorization: meowmeowmeow" \ |
| 35 | + --header "Content-Type: application/json" \ |
| 36 | + --data '{ |
| 37 | + "title": "We are seeing a network outage in the datacenter", |
| 38 | + "message": "I need help investigating, can you join the investigation?", |
| 39 | + "source_url": "https://github.com/myorg/myrepo/issues/123", |
| 40 | + "users": [ |
| 41 | + { |
| 42 | + "id": "U281SN24AVVJX", |
| 43 | + "important": false |
| 44 | + }, |
| 45 | + { |
| 46 | + "id": "U5AKCVNDEDUE7", |
| 47 | + "important": true |
| 48 | + } |
| 49 | + ] |
| 50 | + }' |
| 51 | +``` |
| 52 | + |
| 53 | +The above command returns JSON structured in the following way: |
| 54 | + |
| 55 | +```json |
| 56 | +{ |
| 57 | + "id": "IZHCC4GTNPZ93", |
| 58 | + "integration_id": "CC3GZYZNIIEH5", |
| 59 | + "route_id": "RDN8LITALJXCJ", |
| 60 | + "alerts_count": 1, |
| 61 | + "state": "firing", |
| 62 | + "created_at": "2024-08-15T18:05:36.801215Z", |
| 63 | + "resolved_at": null, |
| 64 | + "resolved_by": null, |
| 65 | + "acknowledged_at": null, |
| 66 | + "acknowledged_by": null, |
| 67 | + "title": "We're seeing a network outage in the datacenter", |
| 68 | + "permalinks": { |
| 69 | + "slack": null, |
| 70 | + "slack_app": null, |
| 71 | + "telegram": null, |
| 72 | + "web": "http://<my_grafana_url>/a/grafana-oncall-app/alert-groups/I5LAZ2MXGPUAH" |
| 73 | + }, |
| 74 | + "silenced_at": null |
| 75 | +} |
| 76 | +``` |
| 77 | + |
| 78 | +## Escalate to a team |
| 79 | + |
| 80 | +For more details about how to fetch a team's Grafana OnCall ID, refer to the [Teams](ref:teams) public API documentation. |
| 81 | + |
| 82 | +```shell |
| 83 | +curl "{{API_URL}}/api/v1/escalation/" \ |
| 84 | + --request POST \ |
| 85 | + --header "Authorization: meowmeowmeow" \ |
| 86 | + --header "Content-Type: application/json" \ |
| 87 | + --data '{ |
| 88 | + "title": "We are seeing a network outage in the datacenter", |
| 89 | + "message": "I need help investigating, can you join the investigation?", |
| 90 | + "source_url": "https://github.com/myorg/myrepo/issues/123", |
| 91 | + "team": "TI73TDU19W48J" |
| 92 | + }' |
| 93 | +``` |
| 94 | + |
| 95 | +The above command returns JSON structured in the following way: |
| 96 | + |
| 97 | +```json |
| 98 | +{ |
| 99 | + "id": "IZHCC4GTNPZ93", |
| 100 | + "integration_id": "CC3GZYZNIIEH5", |
| 101 | + "route_id": "RDN8LITALJXCJ", |
| 102 | + "alerts_count": 1, |
| 103 | + "state": "firing", |
| 104 | + "created_at": "2024-08-15T18:05:36.801215Z", |
| 105 | + "resolved_at": null, |
| 106 | + "resolved_by": null, |
| 107 | + "acknowledged_at": null, |
| 108 | + "acknowledged_by": null, |
| 109 | + "title": "We're seeing a network outage in the datacenter", |
| 110 | + "permalinks": { |
| 111 | + "slack": null, |
| 112 | + "slack_app": null, |
| 113 | + "telegram": null, |
| 114 | + "web": "http://<my_grafana_url>/a/grafana-oncall-app/alert-groups/I5LAZ2MXGPUAH" |
| 115 | + }, |
| 116 | + "silenced_at": null |
| 117 | +} |
| 118 | +``` |
| 119 | + |
| 120 | +## Escalate to a set of user(s) for an existing Alert Group |
| 121 | + |
| 122 | +The following shows how you can escalate to a set of user(s) for an existing Alert Group. |
| 123 | + |
| 124 | +```shell |
| 125 | +curl "{{API_URL}}/api/v1/escalation/" \ |
| 126 | + --request POST \ |
| 127 | + --header "Authorization: meowmeowmeow" \ |
| 128 | + --header "Content-Type: application/json" \ |
| 129 | + --data '{ |
| 130 | + "alert_group_id": "IZMRNNY8RFS94", |
| 131 | + "users": [ |
| 132 | + { |
| 133 | + "id": "U281SN24AVVJX", |
| 134 | + "important": false |
| 135 | + }, |
| 136 | + { |
| 137 | + "id": "U5AKCVNDEDUE7", |
| 138 | + "important": true |
| 139 | + } |
| 140 | + ] |
| 141 | + }' |
| 142 | +``` |
| 143 | + |
| 144 | +The above command returns JSON structured in the following way: |
| 145 | + |
| 146 | +```json |
| 147 | +{ |
| 148 | + "id": "IZHCC4GTNPZ93", |
| 149 | + "integration_id": "CC3GZYZNIIEH5", |
| 150 | + "route_id": "RDN8LITALJXCJ", |
| 151 | + "alerts_count": 1, |
| 152 | + "state": "firing", |
| 153 | + "created_at": "2024-08-15T18:05:36.801215Z", |
| 154 | + "resolved_at": null, |
| 155 | + "resolved_by": null, |
| 156 | + "acknowledged_at": null, |
| 157 | + "acknowledged_by": null, |
| 158 | + "title": "We're seeing a network outage in the datacenter", |
| 159 | + "permalinks": { |
| 160 | + "slack": null, |
| 161 | + "slack_app": null, |
| 162 | + "telegram": null, |
| 163 | + "web": "http://<my_grafana_url>/a/grafana-oncall-app/alert-groups/I5LAZ2MXGPUAH" |
| 164 | + }, |
| 165 | + "silenced_at": null |
| 166 | +} |
| 167 | +``` |
| 168 | + |
| 169 | +| Parameter | Unique | Required | Description | |
| 170 | +| -------------------- | :----: | :--------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
| 171 | +| `title` | No | No | Name of the Alert Group that will be created | |
| 172 | +| `message` | No | No | Content of the Alert Group that will be created | |
| 173 | +| `source_url` | No | No | Value that will be added in the Alert's payload as `oncall.permalink`. This can be useful to have the source URL/button autopopulated with a URL of interest. | |
| 174 | +| `team` | No | Yes (see [Things to Note](#things-to-note)) | Grafana OnCall team ID. If specified, will use the "Direct Paging" Integration associated with this Grafana OnCall team, to create the Alert Group. | |
| 175 | +| `users` | No | Yes (see [Things to Note](#things-to-note)) | List of user(s) to escalate to. See above request example for object schema. `id` represents the Grafana OnCall user's ID. `important` is a boolean representing whether to escalate the Alert Group using this user's default or important personal notification policy. | |
| 176 | +| `alert_group_id` | No | No | If specified, will escalate the specified users for this Alert Group. | |
| 177 | + |
| 178 | +## Things to note |
| 179 | + |
| 180 | +- `team` and `users` are mutually exclusive in the request payload. If you would like to escalate to a team AND user(s), |
| 181 | +first escalate to a team, then using the Alert Group ID returned in the response payload, add the required users to the |
| 182 | +existing Alert Group |
| 183 | +- `alert_group_id` is mutually exclusive with `title`, `message`, and `source_url`. Practically speaking this means that |
| 184 | +if you are trying to escalate to a set of users on an existing Alert Group, you cannot update the `title`, `message`, or |
| 185 | +`source_url` of that Alert Group |
| 186 | +- If escalating to a set of users for an existing Alert Group, the Alert Group cannot be in a resolved state |
| 187 | + |
| 188 | +**HTTP request** |
| 189 | + |
| 190 | +`POST {{API_URL}}/api/v1/escalation/` |
0 commit comments