Service Incident Templates API (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 for service 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.

Field

Mandatory

Description

Limit

serviceId

true

Id of the service on which incident rule will be created.

130 characters

incidentTemplate

true

Incident Template to be added. For more information about incident template, click here.

Sample Requests

curl -X POST 'https://api.opsgenie.com/v1/services/929fa6a4-ef29-4bda-8172-135335a9e8f2/incident-templates'
    -H 'Authorization: GenieKey eb24alp-faa2-4ba2-a551q-1alpf565c889'
    -H 'Content-Type: application/json'
    -d
'{
	"incidentTemplate": {
		"name": "Incident Template Name-3",
	    "incidentProperties": {
	        "message": "Incident Message",
	        "description": "Incident Description",
	        "tags": ["Tag 1", "Tag 2"],
	        "priority": "P2",
	        "stakeholderProperties": {
	            "enable": true,
	            "message": "Stakeholder Message",
	            "description": "Stakeholder Description"
	        }
	    }
	}
}'

Response:

{
  "data": {
    "id": "413dc40c-c7fc-4d67-8105-dde732c30ad3"
  },
  "requestId": "c93ff1c2-e19f-11e7-a9ed-99cc1aa8489f"
}

Update Incident Template

Update incident template request is used to update existing incident template for service 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.

Field

Mandatory

Description

Limit

serviceId

true

Id of the service on which incident template will be updated.

130 characters

incidentTemplateId

true

Id of incident template.

130 characters

incidentTemplate

true

Incident Template to be added. For more information about incident template, click here.

Sample Requests

curl -X PATCH 'https://api.opsgenie.com/v1/services/929fa6a4-ef29-4bda-8172-135335a9e8f2/incident-templates/6980c9d1-45ad-4458-9a72-127b87ef881d'
    -H 'Authorization: GenieKey eb24alp-faa2-4ba2-a551q-1alpf565c889'
    -H 'Content-Type: application/json'
    -d
'{
    "name": "Incident Template Name - Updated",
    "incidentProperties": {
        "message": "Incident Message",
        "description": "Incident Description",
        "tags": ["Tag 1", "Tag 2"],
        "priority": "P2",
        "stakeholderProperties": {
            "enable": true,
            "message": "Stakeholder Message",
            "description": "Stakeholder Description"
        }
    }
}'

Response:

{
  "result": "Updated",
  "data": {
    "id": "6980c9d1-45ad-4458-9a72-127b87ef881d"
  },
  "requestId": "c93ff1c2-e19f-11e7-a9ed-99cc1aa8489f"
}

Delete Incident Template

Delete incident template request is used to update existing incident template for service 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.

Field

Mandatory

Description

Limit

serviceId

true

Id of the service on which incident template will be updated.

130 characters

incidentTemplateId

true

Incident Template to be deleted.

130 characters

Sample Requests

curl -X DELETE 'https://api.opsgenie.com/v1/services/929fa6a4-ef29-4bda-8172-135335a9e8f2/incident-templates/128fa6a4-ef29-4bda-8172-135335a9e8f2'
    -H 'Authorization: GenieKey eb24alp-faa2-4ba2-a551q-1alpf565c889'
    -H 'Content-Type: application/json'

Response:

{
  "result": "Deleted",
  "requestId": "c93ff1c2-e19f-11e7-a9ed-99cc1aa8489f"
}

Get Incident Templates

Get incident templates request is used to retrieve a given service's incident templates

Field

Mandatory

Description

Limit

serviceId

true

Id of the service from which incident templates will be retrieved.

130 characters

Request

curl -X GET 'https://api.opsgenie.com/v1/services/12/incident-templates'
    -H 'Authorization: GenieKey eb24alp-faa2-4ba2-a551q-1alpf565c889'
    -H 'Content-Type: application/json'

Response

{
  "data": [
    {
      "id": "104315ea-efa7-49d4-b135-75f4910669b9",
      "name": "Incident Template Name - Updated",
      "incidentProperties": {
        "message": "Incident Message",
        "tags": [
          "Tag 1",
          "Tag 2"
        ],
        "description": "Incident Description",
        "details": {},
        "priority": "P2",
        "stakeholderProperties": {
          "enable": true,
          "message": "Stakeholder Message",
          "description": "Stakeholder Description"
        }
      }
    }
  ],
  "requestId": "c93ff1c2-e19f-11e7-a9ed-99cc1aa8489f"
}

Incident Template Fields

Field

Mandatory

Description

name

true

Name for given incident template.

incidentProperties

true

For more information about conditions object click here.

Incident Properties Fields

Field

Mandatory

Description

Limit

message

true

Message of the related incident template.

130 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

description

false

Description field of the incident template.

10000 characters

priority

true

Priority level of the incident. Possible values are P1, P2, P3, P4 and P5.

stakeholderProperties

true

For more information about conditions object click here.

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