Incident Templates API
Incident Template is now global level incident configuration, previously it was under Services. Therefore Service Incident Templates API is deprecated.
If using the EU instance of Opsgenie, the URL needs to be https://api.eu.opsgenie.com for requests to be successful.
Create Incident Template
Create incident template request is used to add new incident template and it is a write request. If the integration of the API key configured as read-only, the request will not be accepted. For more information, you can refer to API Access Management.
HTTP Method | URL |
---|---|
POST | https://api.opsgenie.com/v1/incident-templates |
Field | Mandatory | Description | Limit |
---|---|---|---|
name | true | Name of the incident template. | |
message | true | Message of the related incident template. | 130 characters |
description | false | Description field of the incident template. | 10000 characters |
tags | false | Tags of the incident template. | 20 x 50 characters |
details | false | Map of key-value pairs to use as custom properties of the incident template. | 8000 characters |
priority | true | Priority level of the incident. Possible values are P1, P2, P3, P4 and P5. | |
impactedServices | false | Impacted services of incident template. | Maximum: 20 services |
stakeholderProperties | true | For more information about conditions object click here. |
Sample Requests
curl -X POST 'https://api.opsgenie.com/v1/incident-templates'
-H 'Authorization: GenieKey eb24alp-faa2-4ba2-a551q-1alpf565c889'
-H 'Content-Type: application/json'
-d
'{
"name": "Incident Template Name-4",
"message": "Incident Message",
"description": "Incident Description",
"tags": ["Tag 1", "Tag 2", "tag3"],
"details": {
"key1" : "value1"
},
"priority": "P2",
"stakeholderProperties": {
"enable": true,
"message": "Stakeholder Message",
"description": "Stakeholder Description"
},
"impactedServices": [
"df635094-efd3-48e4-b73a-b8bdfbf1178f",
"f1b6d050-f043-444c-ac5d-31fb47880400"]
}'
Response:
{
"result": "Created",
"data": {
"id": "ea9d0c5c-bd6a-4ab0-ab56-33b0d63e87ab"
},
"took": 0.078,
"requestId": "f4792fca-6598-4acd-b03d-7f2e4614061b"
}
Update Incident Template
Update incident template request is used to update existing incident template and it is a write request. If the integration of the API key configured as read-only, the request will not be accepted. For more information, you can refer to API Access Management.
HTTP Method | URL |
---|---|
PUT | https://api.opsgenie.com/v1/incident-templates/:incidentTemplateId |
Field | Mandatory | Description | Limit |
---|---|---|---|
incidentTemplateId | true | Id of incident template. | 130 characters |
name | true | Name of the incident template. | |
message | true | Message of the related incident template. | 130 characters |
description | false | Description field of the incident template. | 10000 characters |
tags | false | Tags of the incident template. | 20 x 50 characters |
details | false | Map of key-value pairs to use as custom properties of the incident template. | 8000 characters |
priority | true | Priority level of the incident. Possible values are P1, P2, P3, P4 and P5. | |
impactedServices | false | Impacted services of incident template. | Maximum: 20 services |
stakeholderProperties | true | For more information about conditions object click here. |
Sample Requests
curl -X PATCH 'https://api.opsgenie.com/v1/incident-templates/929fa6a4-ef29-4bda-8172-135335a9e8f2'
-H 'Authorization: GenieKey eb24alp-faa2-4ba2-a551q-1alpf565c889'
-H 'Content-Type: application/json'
-d
'{
"name": "sss - updated",
"message": "message - updated",
"stakeholderProperties": {
"enable": true,
"message": "Stakeholder Message - updated",
"description": "Stakeholder Description - updated"
},
"priority" : "P1",
"impactedServices": ["f1b6d050-f043-444c-ac5d-31fb47880400"]
}'
Response:
{
"result": "Updated",
"data": {
"id": "89653a2e-a0c3-44d0-a75c-e34011b69866"
},
"took": 0.019,
"requestId": "2d38d1e4-d0ec-4b39-9105-880052254dc5"
}
Delete Incident Template
Delete incident template request is used to update existing incident template and it is a write request. If the integration of the API key configured as read-only, the request will not be accepted. For more information, you can refer to API Access Management.
HTTP Method | URL |
---|---|
DELETE | https://api.opsgenie.com/v1/incident-templates/:incidentTemplateId |
Sample Requests
curl -X DELETE 'https://api.opsgenie.com/v1/incident-templates/929fa6a4-ef29-4bda-8172-135335a9e8f2'
-H 'Authorization: GenieKey eb24alp-faa2-4ba2-a551q-1alpf565c889'
-H 'Content-Type: application/json'
Response:
{
"result": "Deleted",
"took": 0.055,
"requestId": "ed859688-0a9e-4850-9662-7b01720fc1f3"
}
Get Incident Templates
Get incident templates request is used to retrieve incident templates of account.
HTTP Method | URL |
---|---|
GET | https://api.opsgenie.com/v1/incident-templates |
Request
curl -X GET 'https://api.opsgenie.com/v1/incident-templates'
-H 'Authorization: GenieKey eb24alp-faa2-4ba2-a551q-1alpf565c889'
-H 'Content-Type: application/json'
Response
{
"data": {
"incidentTemplates": [
{
"name": "incident template without impacted services",
"id": "259dac4c-d502-436b-b5d2-71512a07536d",
"message": "inci test",
"tags": [],
"description": "inci test summary",
"details": {},
"priority": "P2",
"stakeholderProperties": {
"enable": true,
"message": "",
"description": ""
},
"impactedServices": []
},
{
"name": "incident template with impacted services",
"id": "d0c99911-4554-4e36-b964-497c9a6f3f95",
"message": "inci test",
"tags": [],
"description": "inci test summary",
"details": {},
"priority": "P2",
"stakeholderProperties": {
"enable": true,
"message": "Status page entry title",
"description": "Status page entry details"
},
"impactedServices": [
"df635094-efd3-48e4-b73a-b8bdfbf1178f",
"f1b6d050-f043-444c-ac5d-31fb47880400"
]
}
]
},
"took": 0.067,
"requestId": "ccf4402d-4b64-420d-8db5-48bc1f02e726"
}
Stakeholder Properties Fields
Field | Mandatory | Description | Limit |
---|---|---|---|
enable | false | Option to enable stakeholder notifications.Default value is true. | |
message | true | Message that is to be passed to audience that is generally used to provide a content information about the alert. | |
description | false | Description that is generally used to provide a detailed information about the alert. | 15000 characters |
Updated over 4 years ago