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.

FieldMandatoryDescriptionLimit
nametrueName of the incident template.
messagetrueMessage of the related incident template.130 characters
descriptionfalseDescription field of the incident template.10000 characters
tagsfalseTags of the incident template.20 x 50 characters
detailsfalseMap of key-value pairs to use as custom properties of the incident template.8000 characters
prioritytruePriority level of the incident. Possible values are P1, P2, P3, P4 and P5.
impactedServicesfalseImpacted services of incident template.Maximum: 20 services
stakeholderPropertiestrueFor 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.

FieldMandatoryDescriptionLimit
incidentTemplateIdtrueId of incident template.130 characters
nametrueName of the incident template.
messagetrueMessage of the related incident template.130 characters
descriptionfalseDescription field of the incident template.10000 characters
tagsfalseTags of the incident template.20 x 50 characters
detailsfalseMap of key-value pairs to use as custom properties of the incident template.8000 characters
prioritytruePriority level of the incident. Possible values are P1, P2, P3, P4 and P5.
impactedServicesfalseImpacted services of incident template.Maximum: 20 services
stakeholderPropertiestrueFor 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.

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.

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

FieldMandatoryDescriptionLimit
enablefalseOption to enable stakeholder notifications.Default value is true.
messagetrueMessage that is to be passed to audience that is generally used to provide a content information about the alert.
descriptionfalseDescription that is generally used to provide a detailed information about the alert.15000 characters