Escalation API

API Requests

Create an API Integration and obtain your apiKey to make requests listed below. Please make sure that the integration is not restricted to access configurations.

Create Escalation Request

Create escalation request is used to create escalations in OpsGenie. It takes the following parameters:

Mandatory Parameters

Parameter Limit
apiKey API key is used for authenticating API requests
name Name of escalation 100 chars
rules Escalation rule list 512 chars

Optional Parameters

Parameter Limit
team Name of the team that the escalation will be assigned to. If left empty, the escalation will be global and not belong to any team.
description The description of escalation.

Mandatory Parameters Of Escalation Rule

Parameter Limit
delay Time delay of escalation rule in minutes 1440
notify Username of user or name of group which will be notified

Optional Parameters Of Escalation Rule

Parameter
notifyType Recipient calculation logic for schedules. Possible values are 'default' (on call users), 'next' (next users in rotation) and 'previous' (previous users on rotation). If not given default is used.
notifyCondition The condition for notifying the recipient of escalation rule that is based on the alert state. Possible values are if-not-acked and if-not-closed. If not given, if-not-acked is used.
Sample Request
curl -XPOST 'https://api.opsgenie.com/v1/json/escalation' -d '
{
     "apiKey": "eb243592-faa2-4ba2-a551q-1afdf565c889",
     "name" : "network_escalation",
     "rules" : [
         {"delay":1, "notify":"john.smith@opsgenie.com"},
         {"delay":2, "notify":"operations_schedule", "notifyType":"default", "notifyCondition":"if-not-closed"},
         {"delay":5, "notify":"DevOps_Schedule", "notifyType":"next", "notifyCondition":"if-not-acked"}
     ]
}'
Response:
{
     "id" : "ac463592-dbd2-4ca3-a651d-48fhf5j5c871",
     "status" : "successful",
     "code" : 200
}

Update Escalation Request

Update escalation request is used to update escalations in OpsGenie. It takes the following parameters:

Mandatory Parameters

Parameter
apiKey API key is used for authenticating API requests
id Id of escalation to be updated

Optional Parameters

Parameter Limit
name Name of escalation 512 chars
rules Escalation rule list 512 chars
team Name of the team that the escalation will be assigned to.
description The description of escalation.

Escalation rule limits are the same as create request.

Sample Request
curl -XPOST 'https://api.opsgenie.com/v1/json/escalation' -d '
{
     "apiKey": "eb243592-faa2-4ba2-a551q-1afdf565c889",
     "id" : "ac463592-dbd2-4ca3-a651d-48fhf5j5c871",
     "name" : "network_escalation_updated"
}'
curl -XPOST 'https://api.opsgenie.com/v1/json/escalation' -d '
{
     "apiKey": "eb243592-faa2-4ba2-a551q-1afdf565c889",
     "id" : "ac463592-dbd2-4ca3-a651d-48fhf5j5c871",
     "rules" : [
            {"delay":1, "notify":"john.smith@opsgenie.com"},
            {"delay":2, "notify":"operations_schedule", "notifyType":"default", "notifyCondition":"if-not-closed"},
            {"delay":5, "notify":"DevOps_Schedule", "notifyType":"next", "notifyCondition":"if-not-acked"}
     ]
}'
Response:
{
     "status" : "successful",
     "code" : 200
}

Delete Escalation Request

Delete escalation request is used to delete escalations in OpsGenie. It takes the following parameters:

Mandatory Parameters

Parameter
apiKey API key is used for authenticating API requests
id Id of escalation to be deleted
name Name of escalation to be deleted
One of id or name parameters should be specified with delete escalation request
Sample Request
curl -XDELETE 'https://api.opsgenie.com/v1/json/escalation?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&name=network_escalation'
curl -XDELETE 'https://api.opsgenie.com/v1/json/escalation?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&id=ac463592-dbd2-4ca3-a651d-48fhf5j5c871'
Response:
{
     "status" : "successful",
     "code" : 200
}

Get Escalation Request

This is a read request. Therefore, even if the integration of the API key is configured as read-only, the request will be accepted.

Get escalation request is used to search and retrieve escalations in OpsGenie. It takes the following parameters:

Mandatory Parameters

Parameter
apiKey API key is used for authenticating API requests
id Id of escalation to be retrieved
name Name of escalation to be retrieved
One of id or name parameters should be specified with get escalation request.
Sample Request For Escalation Retrieve
curl -XGET 'https://api.opsgenie.com/v1/json/escalation?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&name=network_escalation'
curl -XGET 'https://api.opsgenie.com/v1/json/escalation?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&id=ac463592-dbd2-4ca3-a651d-48fhf5j5c871'
Response:
{
    "id" : "ac463592-dbd2-4ca3-a651d-48fhf5j5c871",
    "name" : "network_escalation",
    "team" : "operations",
    "rules" : [
        {
            "delay":1,
            "notify":"john.smith@opsgenie.com",
            "type":"user",
            "notifyCondition":"if-not-acked"
        },
        {
            "delay":2,
            "notify":"database",
            "type":"group",
            "notifyCondition":"if-not-acked"
        },
        {
            "delay":3,
            "notify":"operations_schedule",
            "type":"team",
            "notifyType":"next",
            "notifyCondition":"if-not-closed"
        }
    ]
}

List Escalations Request

This is a read request. Therefore, even if the integration of the API key is configured as read-only, the request will be accepted.

List escalations request is used to list escalations in OpsGenie. It takes the following parameters:

Mandatory Parameters

Parameter
apiKey API key is used for authenticating API requests
Sample Request
curl -XGET 'https://api.opsgenie.com/v1/json/escalation?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889'
Response:
{
    "escalations":[
        {
            "id" : "ac463592-dbd2-4ca3-a651d-48fhf5j5c871",
            "name" : "escalation1",
            "team" : "operations",
            "rules" : [
                {
                    "delay":1,
                    "notify":"john.smith@opsgenie.com",
                    "type":"user",
                    "notifyCondition":"if-not-acked"
                },
                {
                    "delay":2,
                    "notify":"database",
                    "type":"group",
                    "notifyCondition":"if-not-acked"
                },
                {
                    "delay":3,
                    "notify":"operations_schedule",
                    "type":"schedule",
                    "notifyType":"next",
                    "notifyCondition":"if-not-closed"}
            ]
        },
        {
            "id" : "fg463552-dvf2-4ca3-a4315-48fhf5j67875",
            "name" : "escalation2",
            "team" : "",
            "rules" : [
                {
                    "delay":1,
                    "notify":"eric.boston@opsgenie.com",
                    "type":"user",
                    "notifyCondition":"if-not-closed"}
            ]
        }
    ]
}