Search results for "{{ search.query }}"

No results found for "{{search.query}}". 
View All Results

Alert API

Create an API Integration and obtain your apiKey to make requests listed below.

Get Request Status

Alert creation, deletion and action requests are processed asynchronously to provide higher availability and scalability, therefore valid requests for those endpoints are responded with HTTP status 202 - Accepted. Get Request Status endpoint is used to track the status and alert details (if any) of the request whose identifier is given.

In-Line Parameters

Referred Name
Description

requestId

Universally unique identifier of the questioned request. Please note: that ID of the request was provided within response.

Sample Requests

curl -X GET 'https://api.opsgenie.com/v2/alerts/requests/513085b8-caf3-4f91-aa23-be5fdefc3570'
    -H 'Authorization: GenieKey eb243592-faa2-4ba2-a551q-1afdf565c889'

Sample Responses

{
    "data": {
        "success": true,
        "action": "Create",
        "processedAt": "2017-05-24T14:24:20.844Z",
        "integrationId": "c9cec2cb-e782-4ebb-bc1d-1b2fa703cf03",
        "isSuccess": true,
        "status": "Created alert",
        "alertId": "8743a1b2-11da-480e-8493-744660987bef",
        "alias": "8743a1b2-11da-480e-8493-744660987bef"
    },
    "took": 0.022,
    "requestId": "ec7e1d8e-1c75-442e-a271-731070a7fa4d"
}
{
    "data": {
        "success": false,
        "action": "Acknowledge",
        "processedAt": "2017-05-24T14:41:18.185Z",
        "integrationId": "c9cec2cb-e782-4ebb-bc1d-1b2fa703cf03",
        "isSuccess": false,
        "status": "Alert does not exist",
        "alertId": "",
        "alias": ""
    },
    "took": 0.019,
    "requestId": "dc194ce3-9daf-4a19-bca3-40be91218089"
}

Create Alert

HTTP Method
URL

JSON Body Fields

Field
Mandatory
Description
Limit

message

true

Message of the alert

130 characters

alias

false

Client-defined identifier of the alert, that is also the key element of Alert De-Duplication.

512 characters

description

false

Description field of the alert that is generally used to provide a detailed information about the alert.

15000 characters

teams

false

Teams that the alert will be routed to send notifications. If the API Key belongs to a team integration, this field will be overwritten with the owner team. Either id or name of each team should be provided.You can refer below for example values.

50 teams

visibleTo

false

Teams and users that the alert will become visible to without sending any notification.type field is mandatory for each item, where possible values are team and user. In addition to the type field, either id or name should be given for teams and either id or username should be given for users. Please note: that alert will be visible to the teams that are specified withinteams field by default, so there is no need to re-specify them within visibleTo field. You can refer below for example values.

50 teams or users in total

actions

false

Custom actions that will be available for the alert.

10 x 50 characters

tags

false

Tags of the alert.

20 x 50 characters

details

false

Map of key-value pairs to use as custom properties of the alert.

8000 characters in total

entity

false

Entity field of the alert that is generally used to specify which domain alert is related to.

512 characters

source

false

Source field of the alert. Default value is IP address of the incoming request.

100 characters.

priority

false

Priority level of the alert. Possible values are P1, P2, P3, P4 and P5. Default value is P3.

user

false

Display name of the request owner.

100 characters.

note

false

Additional note that will be added while creating the alert.

25000 characters.

teams field example:

{
    "teams":[
        {
            "id":"4513b7ea-3b91-438f-b7e4-e3e54af9147c"
        },
        {
            "name":"rocket_team"
        }
    ]
}

visibleTo field example:

{
    "visibleTo":[
        {
            "id":"4513b7ea-3b91-438f-b7e4-e3e54af9147c",
            "type":"team"
        },
        {
            "name":"rocket_team",
            "type":"team"
        },
        {
            "id":"bb4d9938-c3c2-455d-aaab-727aa701c0d8",
            "type":"user"
        },
        {
            "username":"trinity@opsgenie.com",
            "type":"user"
        }
    ]
}

Sample Request

curl -X POST https://api.opsgenie.com/v2/alerts
    -H "Content-Type: application/json"
    -H "Authorization: GenieKey eb243592-faa2-4ba2-a551q-1afdf565c889"
    -d
'{
    "message": "An example alert message",
    "alias": "Life is too short for no alias",
    "description":"Every alert needs a description",
    "teams":[{"id":"4513b7ea-3b91-438f-b7e4-e3e54af9147c"}, {"name":"rocket_team"}],
    "visibleTo":[
        {"id":"4513b7ea-3b91-438f-b7e4-e3e54af9147c","type":"team"},
        {"name":"rocket_team","type":"team"},
        {"id":"bb4d9938-c3c2-455d-aaab-727aa701c0d8","type":"user"},
        {"username":"trinity@opsgenie.com","type":"user"}
    ],
    "actions": ["Restart", "AnExampleAction"],
    "tags": ["OverwriteQuietHours","Critical"],
    "details":{"key1":"value1","key2":"value2"},
    "entity":"An example entity",
    "priority":"P1"
}'

Sample Response

Create alert requests are processed asynchronously, therefore valid requests are responded with HTTP status 202 - Accepted.

{
    "result": "Request will be processed",
    "took": 0.302,
    "requestId": "43a29c5c-3dbf-4fa4-9c26-f4f71023e120"
}

Delete Alert

In-Line Parameters

Referred Name
Description

identifier

Identifier of the alert

Query Parameters

Parameter
Mandatory
Description
Limit

identifierType

false

Type of the identifier that is provided as an in-line parameter. Possible values are id, tiny and alias. Default value is id.

false

Display name of the request owner.

100 characters.

source

false

Display name of the request source.

100 characters.

Sample Request

 curl -X DELETE 'https://api.opsgenie.com/v2/alerts/8418d193-2dab-4490-b331-8c02cdd196b7?identifierType=id'
    -H "Authorization: GenieKey eb243592-faa2-4ba2-a551q-1afdf565c889" 

Sample Response

Delete alert requests are processed asynchronously, therefore valid requests are responded with HTTP status 202 - Accepted.

{
    "result": "Request will be processed",
    "took": 0.204,
    "requestId": "43a29c5c-3dbf-4fa4-9c26-f4f71023e120"
}

Get Alert

In-Line Parameters

Referred Name
Description

identifier

Identifier of the alert

Query Parameters

Parameter
Mandatory
Description

identifierType

false

Type of the identifier that is provided as an in-line parameter. Possible values are id, tiny and alias. Default value is id.

Sample Requests

curl -X GET -H "Authorization: GenieKey eb243592-faa2-4ba2-a551q-1afdf565c889" 'https://api.opsgenie.com/v2/alerts/8418d193-2dab-4490-b331-8c02cdd196b7?identifierType=id'
curl -X GET -H "Authorization: GenieKey eb243592-faa2-4ba2-a551q-1afdf565c889" 'https://api.opsgenie.com/v2/alerts/1905?identifierType=tiny'
curl -X GET -H "Authorization: GenieKey eb243592-faa2-4ba2-a551q-1afdf565c889" 'https://api.opsgenie.com/v2/alerts/life%20is%20too%20short%20for%20no%20alias?identifierType=alias'

Sample Response

{
    "data": {
        "id": "70413a06-38d6-4c85-92b8-5ebc900d42e2",
        "tinyId": "1791",
        "alias": "event_573",
        "message": "Our servers are in danger",
        "status": "closed",
        "acknowledged": false,
        "isSeen": true,
        "tags": [
            "OverwriteQuietHours",
            "Critical"
        ],
        "snoozed": true,
        "snoozedUntil": "2017-04-03T20:32:35.143Z",
        "count": 79,
        "lastOccurredAt": "2017-04-03T20:05:50.894Z",
        "createdAt": "2017-03-21T20:32:52.353Z",
        "updatedAt": "2017-04-03T20:32:57.301Z",
        "source": "Isengard",
        "owner": "morpheus@opsgenie.com",
        "priority": "P5",
        "teams": [
            {
                "id": "8418d193-2dab-4490-b331-8c02cdd196b7"
            },
            {
                "id": "43a29c5c-3dbf-4fa4-9c26-f4f71023e120"
            }
        ],
        "integration": {
            "id": "4513b7ea-3b91-438f-b7e4-e3e54af9147c",
            "name": "Nebuchadnezzar",
            "type": "API"
        },
        "report": {
            "ackTime": 15702,
            "closeTime": 60503,
            "acknowledgedBy": "agent_smith@opsgenie.com",
            "closedBy": "neo@opsgenie.com"
        },
        "actions": ["Restart", "Ping"],
        "entity": "EC2",
        "description": "Example description",
        "details": {
            "serverName": "Zion",
            "region": "Oregon"
        }
    },
    "requestId": "9ae63dd7-ed00-4c81-86f0-c4ffd33142c9"
}

List Alerts

Query Parameters

Either query or searchIdentifier parameter should be provided to apply any filter. If both parameters are given, query parameter will be used. If none of the parameters are given, no filtering will be applied.

Field Name
Mandatory
Value Definition

query

false

Search query to apply while filtering the alerts. You can refer Alerts Search Query Help for further information about search queries.

searchIdentifier

false

Identifier of the saved search query to apply while filtering the alerts.

searchIdentifierType

false

Identifier type of the saved search query. Possible values are id and name. Default value is id. If searchIdentifier is not provided, this value is ignored.

offset

false

Start index of the result set (to apply pagination). Minimum value (and also default value) is 0.

limit

false

Maximum number of items to provide in the result. Must be a positive integer value. Default value is 20 and maximum value is 100.

sort

false

Name of the field that result set will be sorted by. Default value is createdAt. Possible values are specified below:

  • createdAt
  • updatedAt
  • tinyId
  • alias
  • message
  • status
  • acknowledged
  • isSeen
  • snoozed
  • snoozedUntil
  • count
  • lastOccurredAt
  • source
  • owner
  • integration.name
  • integration.type
  • report.ackTime
  • report.closeTime
  • report.acknowledgedBy
  • report.closedBy

order

false

Sorting order of the result set. Possible values are desc and asc. Default value is desc.

  • desc: Sort result set in descending order
  • asc: Sort result set in ascending order

Sample Requests

curl -XGET -H "Authorization: GenieKey eb243592-faa2-4ba2-a551q-1afdf565c889" 'https://api.opsgenie.com/v2/alerts?query=status%3Aopen&offset=7&limit=10&sort=createdAt&order=desc'
curl -XGET -H "Authorization: GenieKey eb243592-faa2-4ba2-a551q-1afdf565c889" 'https://api.opsgenie.com/v2/alerts?searchIdentifier=70413a06-38d6-4c85-92b8-5ebc900d42e2&searchIdentifierType=id&&limit=10&sort=createdAt&order=desc'
curl -XGET -H "Authorization: GenieKey eb243592-faa2-4ba2-a551q-1afdf565c889" 'https://api.opsgenie.com/v2/alerts?searchIdentifier=openAlerts&searchIdentifierType=name&limit=10&sort=createdAt&order=desc'

Sample Response

If pageField and sort parameters are different, URL of the next page will not be provided.

{
    "data": [
        {
            "id": "70413a06-38d6-4c85-92b8-5ebc900d42e2",
            "tinyId": "1791",
            "alias": "event_573",
            "message": "Our servers are in danger",
            "status": "closed",
            "acknowledged": false,
            "isSeen": true,
            "tags": [
                "OverwriteQuietHours",
                "Critical"
            ],
            "snoozed": true,
            "snoozedUntil": "2017-04-03T20:32:35.143Z",
            "count": 79,
            "lastOccurredAt": "2017-04-03T20:05:50.894Z",
            "createdAt": "2017-03-21T20:32:52.353Z",
            "updatedAt": "2017-04-03T20:32:57.301Z",
            "source": "Isengard",
            "owner": "morpheus@opsgenie.com",
            "priority": "P4",
            "teams": [
                {
                    "id": "8418d193-2dab-4490-b331-8c02cdd196b7"
                },
                {
                    "id": "43a29c5c-3dbf-4fa4-9c26-f4f71023e120"
                }
            ],
            "integration": {
                "id": "4513b7ea-3b91-438f-b7e4-e3e54af9147c",
                "name": "Nebuchadnezzar",
                "type": "API"
            },
            "report": {
                "ackTime": 15702,
                "closeTime": 60503,
                "acknowledgedBy": "agent_smith@opsgenie.com",
                "closedBy": "neo@opsgenie.com"
            }
        },
        {
            "id": "70413a06-38d6-4c85-92b8-5ebc900d42e2",
            "tinyId": "1791",
            "alias": "event_573",
            "message": "Life is too short for shitty software",
            "status": "open",
            "acknowledged": false,
            "isSeen": false,
            "tags": [
                "RandomTag"
            ],
            "snoozed": false,
            "count": 1,
            "lastOccurredAt": "2017-03-21T20:32:52.353Z",
            "createdAt": "2017-03-21T20:32:52.353Z",
            "updatedAt": "2017-04-03T20:32:57.301Z",
            "source": "Zion",
            "owner": "",
            "priority": "P5",
            "teams": [],
            "integration": {
                "id": "4513b7ea-3b91-b7e4-438f-e3e54af9147c",
                "name": "My_Lovely_Amazon",
                "type": "CloudWatch"
            }
        }

    ],
    "paging":{
        "next":"https://api.opsgenie.com/v2/alerts?query=status%3Aopen&offset=20&limit=10&sort=createdAt&order=desc",
        "first":"https://api.opsgenie.com/v2/alerts?query=status%3Aopen&offset=0&limit=10&sort=createdAt&order=desc",
        "last":"https://api.opsgenie.com/v2/alerts?query=status%3Aopen&offset=100&limit=10&sort=createdAt&order=desc"
    },
    "took": 0.605,
    "requestId": "9ae63dd7-ed00-4c81-86f0-c4ffd33142c9"
}

Acknowledge Alert

In-Line Parameters

Referred Name
Description

identifier

Identifier of the alert

Query Parameters

Parameter
Mandatory
Description

identifierType

false

Type of the identifier that is provided as an in-line parameter. Possible values are id, tiny and alias. Default value is id.

JSON Body Fields

Field
Mandatory
Description
limit

user

false

Display name of the request owner.

100 characters

source

false

Display name of the request source.

100 characters

note

false

Additional alert note to add.

25000 characters

Sample Requests

curl -X POST https://api.opsgenie.com/v2/alerts/8418d193-2dab-4490-b331-8c02cdd196b7/acknowledge?identifierType=id
    -H "Content-Type: application/json"
    -H "Authorization: GenieKey eb243592-faa2-4ba2-a551q-1afdf565c889"
    -d
'{
    "user":"Monitoring Script",
    "source":"AWS Lambda",
    "note":"Action executed via Alert API"
}'
curl -X POST https://api.opsgenie.com/v2/alerts/1905/acknowledge?identifierType=tiny
    -H "Content-Type: application/json"
    -H "Authorization: GenieKey eb243592-faa2-4ba2-a551q-1afdf565c889"
    -d
'{
    "user":"Monitoring Script",
    "source":"AWS Lambda",
    "note":"Action executed via Alert API"
}'
curl -X POST https://api.opsgenie.com/v2/alerts/life%20is%20too%20short%20for%20no%20alias/acknowledge?identifierType=alias
    -H "Content-Type: application/json"
    -H "Authorization: GenieKey eb243592-faa2-4ba2-a551q-1afdf565c889"
    -d
'{
    "user":"Monitoring Script",
    "source":"AWS Lambda",
    "note":"Action executed via Alert API"
}'

Sample Response

Acknowledge alert requests are processed asynchronously, therefore valid requests are responded with HTTP status 202 - Accepted.

{
    "result": "Request will be processed",
    "took": 0.302,
    "requestId": "43a29c5c-3dbf-4fa4-9c26-f4f71023e120"
}

Close Alert

In-Line Parameters

Referred Name
Description

identifier

Identifier of the alert

Query Parameters

Parameter
Mandatory
Description

identifierType

false

Type of the identifier that is provided as an in-line parameter. Possible values are id, tiny and alias. Default value is id.

JSON Body Fields

Field
Mandatory
Description
limit

user

false

Display name of the request owner.

100 characters

source

false

Display name of the request source.

100 characters

note

false

Additional alert note to add.

25000 characters

Sample Requests

 curl -X POST https://api.opsgenie.com/v2/alerts/8418d193-2dab-4490-b331-8c02cdd196b7/close?identifierType=id
    -H "Authorization: GenieKey eb243592-faa2-4ba2-a551q-1afdf565c889"
    -H "Content-Type: application/json"
    -d
'{
    "user":"Monitoring Script",
    "source":"AWS Lambda",
    "note":"Action executed via Alert API"
}'
 curl -X POST https://api.opsgenie.com/v2/alerts/1905/close?identifierType=tiny
    -H "Authorization: GenieKey eb243592-faa2-4ba2-a551q-1afdf565c889"
    -H "Content-Type: application/json"
    -d
'{
    "user":"Monitoring Script",
    "source":"AWS Lambda",
    "note":"Action executed via Alert API"
}'
 curl -X POST https://api.opsgenie.com/v2/alerts/life%20is%20too%20short%20for%20no%20alias/close?identifierType=alias
    -H "Authorization: GenieKey eb243592-faa2-4ba2-a551q-1afdf565c889"
    -H "Content-Type: application/json"
    -d
'{
    "user":"Monitoring Script",
    "source":"AWS Lambda",
    "note":"Action executed via Alert API"
}'

Sample Response

Close alert requests are processed asynchronously, therefore valid requests are responded with HTTP status 202 - Accepted.

{
    "result": "Request will be processed",
    "took": 0.107,
    "requestId": "43a29c5c-3dbf-4fa4-9c26-f4f71023e120"
}

Add Note to Alert

In-Line Parameters

Referred Name
Description

identifier

Identifier of the alert

Query Parameters

Parameter
Mandatory
Description

identifierType

false

Type of the identifier that is provided as an in-line parameter. Possible values are id, tiny and alias. Default value is id.

JSON Body Fields

Field
Mandatory
Description
limit

user

false

Display name of the request owner.

100 characters

source

false

Display name of the request source.

100 characters

note

true

Alert note to add

25000 characters

Sample Requests

curl -X POST https://api.opsgenie.com/v2/alerts/8418d193-2dab-4490-b331-8c02cdd196b7/notes?identifierType=id
    -H "Authorization: GenieKey eb243592-faa2-4ba2-a551q-1afdf565c889"
    -H "Content-Type: application/json"
    -d
'{
    "user":"Monitoring Script",
    "source":"AWS Lambda",
    "note":"Action executed via Alert API"
}'
curl -X POST https://api.opsgenie.com/v2/alerts/1905/notes?identifierType=tiny
    -H "Authorization: GenieKey eb243592-faa2-4ba2-a551q-1afdf565c889"
    -H "Content-Type: application/json"
    -d
'{
    "user":"Monitoring Script",
    "source":"AWS Lambda",
    "note":"Action executed via Alert API"
}'
curl -X POST https://api.opsgenie.com/v2/alerts/life%20is%20too%20short%20for%20no%20alias/notes?identifierType=alias
    -H "Authorization: GenieKey eb243592-faa2-4ba2-a551q-1afdf565c889"
    -H "Content-Type: application/json"
    -d
'{
    "user":"Monitoring Script",
    "source":"AWS Lambda",
    "note":"Action executed via Alert API"
}'

Sample Response

Add note requests are processed asynchronously, therefore valid requests are responded with HTTP status 202 - Accepted.

{
    "result": "Request will be processed",
    "took": 0.213,
    "requestId": "43a29c5c-3dbf-4fa4-9c26-f4f71023e120"
}

Execute Custom Action

In-Line Parameters

Referred Name
Description

identifier

Identifier of the alert

action

Name of the action to execute

Query Parameters

Parameter
Mandatory
Description

identifierType

false

Type of the identifier that is provided as an in-line parameter. Possible values are id, tiny and alias. Default value is id.

JSON Body Fields

Field
Mandatory
Description
limit

user

false

Display name of the request owner.

100 characters

source

false

Display name of the request source.

100 characters

note

false

Alert note to add

25000 characters

Sample Requests

curl -X POST https://api.opsgenie.com/v2/alerts/8418d193-2dab-4490-b331-8c02cdd196b7/actions/restart?identifierType=id
    -H "Authorization: GenieKey eb243592-faa2-4ba2-a551q-1afdf565c889"
    -H "Content-Type: application/json"
    -d
'{
    "user":"Monitoring Script",
    "source":"AWS Lambda",
    "note":"Action executed via Alert API"
}'
curl -X POST https://api.opsgenie.com/v2/alerts/1905/actions/restart?identifierType=tiny
    -H "Authorization: GenieKey eb243592-faa2-4ba2-a551q-1afdf565c889"
    -H "Content-Type: application/json"
    -d
'{
    "user":"Monitoring Script",
    "source":"AWS Lambda",
    "note":"Action executed via Alert API"
}'
curl -X POST https://api.opsgenie.com/v2/alerts/life%20is%20too%20short%20for%20no%20alias/actions/restart?identifierType=alias
    -H "Authorization: GenieKey eb243592-faa2-4ba2-a551q-1afdf565c889"
    -H "Content-Type: application/json"
    -d
'{
    "user":"Monitoring Script",
    "source":"AWS Lambda",
    "note":"Action executed via Alert API"
}'

Sample Response

Custom action requests are processed asynchronously, therefore valid requests are responded with HTTP status 202 - Accepted.

{
    "result": "Request will be processed",
    "took": 0.304,
    "requestId": "43a29c5c-3dbf-4fa4-9c26-f4f71023e120"
}

Unacknowledge Alert

In-Line Parameters

Referred Name
Description

identifier

Identifier of the alert

Query Parameters

Parameter
Mandatory
Description

identifierType

false

Type of the identifier that is provided as an in-line parameter. Possible values are id, tiny and alias. Default value is id.

JSON Body Fields

Field
Mandatory
Description
limit

user

false

Display name of the request owner.

100 characters

source

false

Display name of the request source.

100 characters

note

false

Additional alert note to add.

25000 characters

Sample Requests

curl -X POST https://api.opsgenie.com/v2/alerts/8418d193-2dab-4490-b331-8c02cdd196b7/unacknowledge?identifierType=id
    -H "Authorization: GenieKey eb243592-faa2-4ba2-a551q-1afdf565c889"
    -H "Content-Type: application/json"
    -d
'{
    "user":"Monitoring Script",
    "source":"AWS Lambda",
    "note":"Action executed via Alert API"
}'
curl -X POST https://api.opsgenie.com/v2/alerts/1905/unacknowledge?identifierType=tiny
    -H "Authorization: GenieKey eb243592-faa2-4ba2-a551q-1afdf565c889"
    -H "Content-Type: application/json"
    -d
'{
    "user":"Monitoring Script",
    "source":"AWS Lambda",
    "note":"Action executed via Alert API"
}'
curl -X POST https://api.opsgenie.com/v2/alerts/life%20is%20too%20short%20for%20no%20alias/unacknowledge?identifierType=alias
    -H "Authorization: GenieKey eb243592-faa2-4ba2-a551q-1afdf565c889"
    -H "Content-Type: application/json"
    -d
'{
    "user":"Monitoring Script",
    "source":"AWS Lambda",
    "note":"Action executed via Alert API"
}'

Sample Response

Unacknowledge alert requests are processed asynchronously, therefore valid requests are responded with HTTP status 202 - Accepted.

{
    "result": "Request will be processed",
    "took": 0.202,
    "requestId": "43a29c5c-3dbf-4fa4-9c26-f4f71023e120"
}

Snooze Alert

In-Line Parameters

Referred Name
Description

identifier

Identifier of the alert

Query Parameters

Parameter
Mandatory
Description

identifierType

false

Type of the identifier that is provided as an in-line parameter. Possible values are id, tiny and alias. Default value is id.

JSON Body Fields

Field
Mandatory
Description
limit

endTime

true

Date and time that snooze will lose effect. Provided value should be in ISO 8061 format.

user

false

Display name of the request owner.

100 characters

source

false

Display name of the request source.

100 characters

note

false

Additional alert note to add.

25000 characters

Sample Requests

curl -X POST https://api.opsgenie.com/v2/alerts/8418d193-2dab-4490-b331-8c02cdd196b7/snooze?identifierType=id
    -H "Authorization: GenieKey eb243592-faa2-4ba2-a551q-1afdf565c889"
    -H "Content-Type: application/json"
    -d
'{
    "endTime":"2017-04-03T20:05:50.894Z",
    "user":"Monitoring Script",
    "source":"AWS Lambda",
    "note":"Action executed via Alert API"
}'
curl -X POST https://api.opsgenie.com/v2/alerts/1905/snooze?identifierType=tiny
    -H "Authorization: GenieKey eb243592-faa2-4ba2-a551q-1afdf565c889"
    -H "Content-Type: application/json"
    -d
'{
    "endTime":"2017-04-03T20:05:50.894Z",
    "user":"Monitoring Script",
    "source":"AWS Lambda",
    "note":"Action executed via Alert API"
}'
curl -X POST https://api.opsgenie.com/v2/alerts/life%20is%20too%20short%20for%20no%20alias/snooze?identifierType=alias
    -H "Authorization: GenieKey eb243592-faa2-4ba2-a551q-1afdf565c889"
    -H "Content-Type: application/json"
    -d
'{
    "endTime":"2017-04-03T20:05:50.894Z",
    "user":"Monitoring Script"
    "source":"AWS Lambda",
    "note":"Action executed via Alert API"
}'

Sample Response

Snooze alert requests are processed asynchronously, therefore valid requests are responded with HTTP status 202 - Accepted.


{
    "result": "Request will be processed",
    "took": 0.109,
    "requestId": "43a29c5c-3dbf-4fa4-9c26-f4f71023e120"
}

Escalate Alert to Next

In-Line Parameters

Referred Name
Description

identifier

Identifier of the alert

Query Parameters

Parameter
Mandatory
Description

identifierType

false

Type of the identifier that is provided as an in-line parameter. Possible values are id, tiny and alias. Default value is id.

JSON Body Fields

Field
Mandatory
Description
limit

escalation

true

Escalation that the alert will be escalated. Either id or name of the escalation should be provided. You can refer below for example values.

user

false

Display name of the request owner.

100 characters

source

false

Display name of the request source.

100 characters

note

false

Additional alert note to add.

25000 characters

escalation field examples:

{
    "escalation": {
        "id":"4513b7ea-3b91-438f-b7e4-e3e54af9147c"
    }
}
{
    "escalation": {
        "name":"Operations_Escalation"
    }
}

Sample Requests

curl -X POST https://api.opsgenie.com/v2/alerts/8418d193-2dab-4490-b331-8c02cdd196b7/escalate?identifierType=id
    -H "Authorization: GenieKey eb243592-faa2-4ba2-a551q-1afdf565c889"
    -H "Content-Type: application/json"
    -d
'{
    "escalation":{"id":"4513b7ea-3b91-438f-b7e4-e3e54af9147c"},
    "user":"Monitoring Script",
    "source":"AWS Lambda",
    "note":"Action executed via Alert API"
}'
curl -X POST https://api.opsgenie.com/v2/alerts/1905/escalate?identifierType=tiny
    -H "Authorization: GenieKey eb243592-faa2-4ba2-a551q-1afdf565c889"
    -H "Content-Type: application/json"
    -d
'{
    "escalation":{"name":"Operations_Escalation"},
    "user":"Monitoring Script",
    "source":"AWS Lambda",
    "note":"Action executed via Alert API"
}'
curl -X POST https://api.opsgenie.com/v2/alerts/life%20is%20too%20short%20for%20no%20alias/escalate?identifierType=alias
    -H "Authorization: GenieKey eb243592-faa2-4ba2-a551q-1afdf565c889"
    -H "Content-Type: application/json"
    -d
'{
    "escalation":{"id":"4513b7ea-3b91-438f-b7e4-e3e54af9147c"},
    "user":"Monitoring Script",
    "source":"AWS Lambda",
    "note":"Action executed via Alert API"
}'

Sample Response

Escalate alert requests are processed asynchronously, therefore valid requests are responded with HTTP status 202 - Accepted.

{
    "result": "Request will be processed",
    "took": 0.456,
    "requestId": "43a29c5c-3dbf-4fa4-9c26-f4f71023e120"
}

Assign Alert

In-Line Parameters

Referred Name
Description

identifier

Identifier of the alert

Query Parameters

Parameter
Mandatory
Description

identifierType

false

Type of the identifier that is provided as an in-line parameter. Possible values are id, `tiny and alias. Default value is id**.

JSON Body Fields

Field
Mandatory
Description
limit

owner

true

User that the alert will be assigned to. Either id or username of the user should be provided. You can refer below for example values.

user

false

Display name of the request owner.

100 characters

source

false

Display name of the request source.

100 characters

note

false

Additional alert note to add.

25000 characters

owner field examples:

{
    "owner": {
        "id":"4513b7ea-3b91-438f-b7e4-e3e54af9147c"
    }
}
{
    "owner": {
        "username":"trinity@opsgenie.com"
    }
}

Sample Requests

 curl -X POST https://api.opsgenie.com/v2/alerts/8418d193-2dab-4490-b331-8c02cdd196b7/escalate?identifierType=id
    -H "Content-Type: application/json"
    -H "Authorization: GenieKey eb243592-faa2-4ba2-a551q-1afdf565c889"
    -d
'{
    "owner": { "id":"4513b7ea-3b91-438f-b7e4-e3e54af9147c" },
    "user":"Monitoring Script",
    "source":"AWS Lambda",
    "note":"Action executed via Alert API"
}'
curl -X POST https://api.opsgenie.com/v2/alerts/1905/escalate?identifierType=tiny
    -H "Content-Type: application/json"
    -H "Authorization: GenieKey eb243592-faa2-4ba2-a551q-1afdf565c889"
    -d
'{
    "owner":{ "username":"trinity@opsgenie.com"},
    "user":"Monitoring Script",
    "source":"AWS Lambda",
    "note":"Action executed via Alert API"
}'
curl -X POST https://api.opsgenie.com/v2/alerts/life%20is%20too%20short%20for%20no%20alias/escalate?identifierType=alias
    -H "Content-Type: application/json"
    -H "Authorization: GenieKey eb243592-faa2-4ba2-a551q-1afdf565c889"
    -d
'{
    "owner": { "id":"4513b7ea-3b91-438f-b7e4-e3e54af9147c" },
    "user":"Monitoring Script",
    "source":"AWS Lambda",
    "note":"Action executed via Alert API"
}'

Sample Response

Assign alert requests are processed asynchronously, therefore valid requests are responded with HTTP status 202 - Accepted.

{
    "result": "Request will be processed",
    "took": 0.202,
    "requestId": "43a29c5c-3dbf-4fa4-9c26-f4f71023e120"
}

Add Team to Alert

In-Line Parameters

Referred Name
Description

identifier

Identifier of the alert

Query Parameters

Parameter
Mandatory
Description

identifierType

false

Type of the identifier that is provided as an in-line parameter. Possible values are id, tiny and alias. Default value is id.

JSON Body Fields

Field
Mandatory
Description
limit

team

true

Team to route the alert. Either id or name of the team should be provided. You can refer below for example values.

user

false

Display name of the request owner.

100 characters

source

false

Display name of the request source.

100 characters

note

false

Additional alert note to add.

25000 characters

team field examples:

{
    "team": {
        "id":"4513b7ea-3b91-438f-b7e4-e3e54af9147c"
    }
}
{
    "team": {
        "name":"operations"
    }
}

Sample Requests

 curl -X POST https://api.opsgenie.com/v2/alerts/8418d193-2dab-4490-b331-8c02cdd196b7/teams?identifierType=id
    -H "Content-Type: application/json"
    -H "Authorization: GenieKey eb243592-faa2-4ba2-a551q-1afdf565c889"
    -d
'{
    "team": { "id": "4513b7ea-3b91-438f-b7e4-e3e54af9147c" },
    "user":"Monitoring Script",
    "source":"AWS Lambda",
    "note":"Action executed via Alert API"
}'
curl -X POST https://api.opsgenie.com/v2/alerts/1905/teams?identifierType=tiny
    -H "Content-Type: application/json"
    -H "Authorization: GenieKey eb243592-faa2-4ba2-a551q-1afdf565c889"
    -d
'{
    "team": { "name": "operations" },
    "user":"Monitoring Script",
    "source":"AWS Lambda",
    "note":"Action executed via Alert API"
}'
 curl -X POST https://api.opsgenie.com/v2/alerts/life%20is%20too%20short%20for%20no%20alias/teams?identifierType=alias
    -H "Content-Type: application/json"
    -H "Authorization: GenieKey eb243592-faa2-4ba2-a551q-1afdf565c889"
    -d
'{
    "team": { "id": "4513b7ea-3b91-438f-b7e4-e3e54af9147c" },
    "user":"Monitoring Script",
    "source":"AWS Lambda",
    "note":"Action executed via Alert API"
}'

Sample Response

Add team to alert requests are processed asynchronously, therefore valid requests are responded with HTTP status 202 - Accepted.

{
    "result": "Request will be processed",
    "took": 0.333,
    "requestId": "43a29c5c-3dbf-4fa4-9c26-f4f71023e120"
}

Add Tags to Alert

In-Line Parameters

Referred Name
Description

identifier

Identifier of the alert

Query Parameters

Parameter
Mandatory
Description

identifierType

false

Type of the identifier that is provided as an in-line parameter. Possible values are id, tiny and alias. Default value is id.

JSON Body Fields

tags

true

List of tags to add into alert. You can refer below for example values.

20 x 50 characters

user

false

Display name of the request owner.

100 characters

source

false

Display name of the request source.

100 characters

note

false

Additional alert note to add.

25000 characters

tags field examples:

{
    "tags": ["OverwriteQuietHours","Critical"]
}

Sample Requests

 curl -X POST https://api.opsgenie.com/v2/alerts/8418d193-2dab-4490-b331-8c02cdd196b7/tags?identifierType=id
    -H "Content-Type: application/json"
    -H "Authorization: GenieKey eb243592-faa2-4ba2-a551q-1afdf565c889"
    -d
'{
    "tags": ["OverwriteQuietHours","Critical"],
    "user":"Monitoring Script",
    "source":"AWS Lambda",
    "note":"Action executed via Alert API"
}'
 curl -X POST https://api.opsgenie.com/v2/alerts/1905/tags?identifierType=tiny
    -H "Content-Type: application/json"
    -H "Authorization: GenieKey eb243592-faa2-4ba2-a551q-1afdf565c889"
    -d
'{
    "tags": ["OverwriteQuietHours","Critical"],
    "user":"Monitoring Script",
    "source":"AWS Lambda",
    "note":"Action executed via Alert API"
}'
curl -X POST https://api.opsgenie.com/v2/alerts/life%20is%20too%20short%20for%20no%20alias/tags?identifierType=alias
    -H "Content-Type: application/json"
    -H "Authorization: GenieKey eb243592-faa2-4ba2-a551q-1afdf565c889"
    -d
'{
    "tags": ["OverwriteQuietHours","Critical"],
    "user":"Monitoring Script",
    "source":"AWS Lambda",
    "note":"Action executed via Alert API"
}'

Sample Response

Add tags to alert requests are processed asynchronously, therefore valid requests are responded with HTTP status 202 - Accepted.

{
    "result": "Request will be processed",
    "took": 0.206,
    "requestId": "43a29c5c-3dbf-4fa4-9c26-f4f71023e120"
}

Remove Tags from Alert

In-Line Parameters

Referred Name
Description

identifier

Identifier of the alert

Query Parameters

Parameter
Mandatory
Description
Limit

tags

true

Comma separated list of tags to remove from alert.

20 x 50 characters

identifierType

false

Type of the identifier that is provided as an in-line parameter. Possible values are id, tiny and alias. Default value is id.

user

false

Display name of the request owner.

100 characters

source

false

Display name of the request source.

100 characters

note

false

Additional alert note to add.

25000 characters

Sample Requests

curl -X DELETE -H "Authorization: GenieKey eb243592-faa2-4ba2-a551q-1afdf565c889" 'https://api.opsgenie.com/v2/alerts/8418d193-2dab-4490-b331-8c02cdd196b7/tags?identifierType=id&tags=OverwriteQuietHours,Critical'
curl -X DELETE -H "Authorization: GenieKey eb243592-faa2-4ba2-a551q-1afdf565c889" 'https://api.opsgenie.com/v2/alerts/1905/tags?identifierType=tiny&tags=OverwriteQuietHours,Critical'
curl -X DELETE -H "Authorization: GenieKey eb243592-faa2-4ba2-a551q-1afdf565c889" 'https://api.opsgenie.com/v2/alerts/life%20is%20too%20short%20for%20no%20alias/tags?identifierType=alias&tags=OverwriteQuietHours,Critical'

Sample Response

Remove tags from alert requests are processed asynchronously, therefore valid requests are responded with HTTP status 202 - Accepted.

{
    "result": "Request will be processed",
    "took": 0.195,
    "requestId": "43a29c5c-3dbf-4fa4-9c26-f4f71023e120"
}

Add Details (Custom Properties) to Alert

In-Line Parameters

Referred Name
Description

identifier

Identifier of the alert

Query Parameters

Parameter
Mandatory
Description

identifierType

false

Type of the identifier that is provided as an in-line parameter. Possible values are id, tiny and alias. Default value is id.

JSON Body Fields

Field
Mandatory
Description
limit

details

true

Key-value pairs to add as custom property into alert. You can refer below for example values.

20 x 50 characters

user

false

Display name of the request owner.

100 characters

source

false

Display name of the request source.

100 characters

note

false

Additional alert note to add.

25000 characters

details field examples:

{
    "details": {
        "serverName": "Zion",
        "region": "Oregon"
    }
}

Sample Requests

 curl -X POST https://api.opsgenie.com/v2/alerts/8418d193-2dab-4490-b331-8c02cdd196b7/details?identifierType=id
    -H "Content-Type: application/json"
    -H "Authorization: GenieKey eb243592-faa2-4ba2-a551q-1afdf565c889"
    -d
'{
    "details": {
        "serverName": "Zion",
        "region": "Oregon"
    },
    "user":"Monitoring Script",
    "source":"AWS Lambda",
    "note":"Action executed via Alert API"
}'
 curl -X POST  https://api.opsgenie.com/v2/alerts/1905/details?identifierType=tiny
    -H "Content-Type: application/json"
    -H "Authorization: GenieKey eb243592-faa2-4ba2-a551q-1afdf565c889"
    -d
'{
    "details": {
        "serverName": "Zion",
        "region": "Oregon"
    },
    "user":"Monitoring Script",
    "source":"AWS Lambda",
    "note":"Action executed via Alert API"
}'
 curl -X POST https://api.opsgenie.com/v2/alerts/life%20is%20too%20short%20for%20no%20alias/details?identifierType=alias
    -H "Content-Type: application/json"
    -H "Authorization: GenieKey eb243592-faa2-4ba2-a551q-1afdf565c889"
    -d
'{
    "details": {
        "serverName": "Zion",
        "region": "Oregon"
    },
    "user":"Monitoring Script",
    "source":"AWS Lambda",
    "note":"Action executed via Alert API"
}'

Sample Response

Add details to alert requests are processed asynchronously, therefore valid requests are responded with HTTP status 202 - Accepted.

{
    "result": "Request will be processed",
    "took": 0.303,
    "requestId": "43a29c5c-3dbf-4fa4-9c26-f4f71023e120"
}

Remove Details (Custom Properties) from Alert

In-Line Parameters

Referred Name
Description

identifier

Identifier of the alert

Query Parameters

Parameter
Mandatory
Description
Limit

keys

true

Comma separated list of keys to remove from the custom properties of the alert.

10 keys

identifierType

false

Type of the identifier that is provided as an in-line parameter. Possible values are id, tiny and alias. Default value is id.

user

false

Display name of the request owner.

100 characters

source

false

Display name of the request source.

100 characters

note

false

Additional alert note to add.

25000 characters

Sample Requests

curl -X DELETE -H "Authorization: GenieKey eb243592-faa2-4ba2-a551q-1afdf565c889" 'https://api.opsgenie.com/v2/alerts/8418d193-2dab-4490-b331-8c02cdd196b7/details?identifierType=id&keys=serverName,region'
curl -X DELETE -H "Authorization: GenieKey eb243592-faa2-4ba2-a551q-1afdf565c889" 'https://api.opsgenie.com/v2/alerts/1905/details?identifierType=tiny&keys=serverName,region'
curl -X DELETE -H "Authorization: GenieKey eb243592-faa2-4ba2-a551q-1afdf565c889" 'https://api.opsgenie.com/v2/alerts/life%20is%20too%20short%20for%20no%20alias/details?identifierType=alias&keys=serverName,region'

Sample Response

Remove tags from alert requests are processed asynchronously, therefore valid requests are responded with HTTP status 202 - Accepted.

{
    "result": "Request will be processed",
    "took": 0.202,
    "requestId": "43a29c5c-3dbf-4fa4-9c26-f4f71023e120"
}

List Alert Recipients

In-Line Parameters

Referred Name
Description

identifier

Identifier of the alert

Query Parameters

Field Name
Mandatory
Value Definition

identifierType

false

Type of the identifier that is provided as an in-line parameter. Possible values are id, tiny and alias. Default value is id.

Sample Requests

curl -X GET -H "Authorization: GenieKey eb243592-faa2-4ba2-a551q-1afdf565c889" 'https://api.opsgenie.com/v2/alerts/8418d193-2dab-4490-b331-8c02cdd196b7/recipients?identifierType=id'
curl -X GET -H "Authorization: GenieKey eb243592-faa2-4ba2-a551q-1afdf565c889" 'https://api.opsgenie.com/v2/alerts/1905/recipients?identifierType=tiny'
curl -X GET -H "Authorization: GenieKey eb243592-faa2-4ba2-a551q-1afdf565c889" 'https://api.opsgenie.com/v2/alerts/life%20is%20too%20short%20for%20no%20alias/recipients?identifierType=alias'

Sample Response

{
    "data": [
        {
            "user": {
                "id": "2503a523-8ba5-4158-a4bd-7850074b5cca",
                "username": "neo@opsgenie.com"
            },
            "state": "action",
            "method": "Acknowledge",
            "createdAt": "2017-04-12T12:27:28.52Z",
            "updatedAt": "2017-04-12T12:27:52.86Z"
        },
        {
            "user": {
                "id": "0966cfd8-fc9a-4f5c-a013-7d1f9318aef8",
                "username": "trinity@opsgenie.com"
            },
            "state": "notactive",
            "method": "",
            "createdAt": "2017-04-12T12:27:28.571Z",
            "updatedAt": "2017-04-12T12:27:28.589Z"
        }
    ],
    "took": 0.306,
    "requestId": "d90a7fb5-f5b6-4e1a-a1d1-0a37bded6a32"
}

List Alert Logs

In-Line Parameters

Referred Name
Description

identifier

Identifier of the alert

Query Parameters

Field Name
Mandatory
Value Definition

identifierType

false

Type of the identifier that is provided as an in-line parameter. Possible values are id, tiny and alias. Default value is id.

offset

false

Starting value of the offset property.

direction

false

Page direction to apply for the given offset. Possible values are next and prev. Default value is next.

  • next: Offset values of provided logs should be greater than the given offset
  • prev: Offset values of provided logs should be less than the given offset

limit

false

Maximum number of items to provide in the result. Must be a positive integer value. Default value is 20 and maximum value is 100.

order

false

Sorting order of the result set. Possible values are desc and asc. Default value is desc.

  • desc: Sort result set in descending order
  • asc: Sort result set in ascending order

Sample Requests

curl -X GET 'https://api.opsgenie.com/v2/alerts/8418d193-2dab-4490-b331-8c02cdd196b7/logs?identifierType=id&offset=1492000072838_1492000072838234593&direction=prev&limit=2&order=desc'
    -H "Authorization: GenieKey eb243592-faa2-4ba2-a551q-1afdf565c889" 
curl -X GET 'https://api.opsgenie.com/v2/alerts/1905/logs?identifierType=tiny&offset=1492000072838_1492000072838234593&direction=prev&limit=2&order=desc'
    -H "Authorization: GenieKey eb243592-faa2-4ba2-a551q-1afdf565c889"
curl -X GET 'https://api.opsgenie.com/v2/alerts/life%20is%20too%20short%20for%20no%20alias/logs?identifierType=alias&offset=1492000072838_1492000072838234593&direction=prev&limit=2&order=desc'
    -H "Authorization: GenieKey eb243592-faa2-4ba2-a551q-1afdf565c889"

Sample Response

{
    "data": [
    {
      "log": "Alert acknowledged via web",
      "type": "system",
      "owner": "neo@opsgenie.com",
      "createdAt": "2017-04-12T12:27:52.838Z",
      "offset": "1492000072838_1492000072838234593"
    },
    {
      "log": "Viewed on [web]",
      "type": "alertRecipient",
      "owner": "trinity@opsgenie.com",
      "createdAt": "2017-04-12T12:27:46.379Z",
      "offset": "1492000066378_1492000066379000127"
    }
    ],
    "requestId": "174abe1b-e2a8-48d6-a747-05f012760988",
    "took": 0.456,
    "paging": {
        "next": "https://api.opsgenie.com/v2/alerts/ee624ed0-3ee0-45be-9c9d-e7667eaf21e5/logs?identifierType=id&offset=1492000072838_1492000072838234593&direction=next&limit=2&order=desc",
        "first": "https://api.opsgenie.com/v2/alerts/ee624ed0-3ee0-45be-9c9d-e7667eaf21e5/logs?identifierType=id&limit=2&order=desc"
    }
}

List Alert Notes

In-Line Parameters

Referred Name
Description

identifier

Identifier of the alert

Query Parameters

Field Name
Mandatory
Value Definition

identifierType

false

Type of the identifier that is provided as an in-line parameter. Possible values are id, tiny and alias. Default value is id.

offset

false

Starting value of the offset property.

direction

false

Page direction to apply for the given offset. Possible values are next and prev. Default value is next.

  • next: Offset values of provided notes should be greater than the given offset
  • prev: Offset values of provided notes should be less than the given offset

limit

false

Maximum number of items to provide in the result. Must be a positive integer value. Default value is 20 and maximum value is 100.

order

false

Sorting order of the result set. Possible values are desc and asc. Default value is desc.

  • desc: Sort result set in descending order
  • asc: Sort result set in ascending order

Sample Requests

curl -X GET 'https://api.opsgenie.com/v2/alerts/8418d193-2dab-4490-b331-8c02cdd196b7/notes?identifierType=id&offset=1492004181874000155&direction=prev&limit=2&order=desc'
    -H "Authorization: GenieKey eb243592-faa2-4ba2-a551q-1afdf565c889"
curl -X GET 'https://api.opsgenie.com/v2/alerts/1905/notes?identifierType=tiny&offset=1492004181874000155&direction=prev&limit=2&order=desc'
    -H "Authorization: GenieKey eb243592-faa2-4ba2-a551q-1afdf565c889"
curl -X GET 'https://api.opsgenie.com/v2/alerts/life%20is%20too%20short%20for%20no%20alias/notes?identifierType=alias&offset=1492000072838234593&direction=prev&limit=2&order=desc'
    -H "Authorization: GenieKey eb243592-faa2-4ba2-a551q-1afdf565c889"

Sample Response

{
    "data": [
        {
            "note": "This is your last chance. After this, there is no turning back. You take the blue pill—the story ends, you wake up in your bed and believe whatever you want to believe. You take the red pill—you stay in Wonderland and I show you how deep the rabbit-hole goes.",
            "owner": "morpheus@opsgenie.com",
            "createdAt": "2017-04-12T13:36:21.874Z",
            "offset": "1492004181874000155"
        },
        {
            "note": "You see there is only one constant. One universal. It is the only real truth: Causality. Action, reaction. Cause and effect.",
            "owner": "merovingian@opsgenie.com",
            "createdAt": "2017-04-12T13:36:18.098Z",
            "offset": "1492004178098000065"
        }
    ],
    "requestId": "fbbd807d-6024-4572-8d51-bd4a047617d0",
    "took": 0.278,
    "paging": {
        "next": "https://api.opsgenie.com/v2/alerts/ee624ed0-3ee0-45be-9c9d-e7667eaf21e5/notes?identifierType=id&offset=1492004181874000155&direction=next&limit=2&order=desc",
        "first": "https://api.opsgenie.com/v2/alerts/ee624ed0-3ee0-45be-9c9d-e7667eaf21e5/notes?identifierType=id&limit=2&order=desc"
    }
}

Create a Saved Search

Field
Mandatory
Description

name

true

Unique name of the saved search. Maximum length is 100 characters.

query

true

Search query to be used while filtering the alerts. Maximum length is 1000 characters.

owner

true

User that will be assigned as owner of the saved search. Saved searches are always accessible to their owners.

description

false

Informational description of the saved search. Maximum length is 15000 characters.

teams

false

Teams that saved search is assigned to. If a saved-search is assigned to at least one team, saved-search will only be accessible to the owner and members of the assigned teams. A saved-search can be assigned to at most 20 teams.

Sample Requests

 curl -X POST https://api.opsgenie.com/v2/alerts/saved-searches
    -H "Authorization: GenieKey eb243592-faa2-4ba2-a551q-1afdf565c889"
    -H "Content-Type: application/json"
    -d
'{
    "name": "Closed but Unacked Alerts",
    "description": "Will be used to display the alerts that are closed before someone acknowledges.",
    "query": "status: Open and acknowledged: false",
    "teams":[
        {"id":"4513b7ea-3b91-438f-b7e4-e3e54af9147c"},
        {"name":"rocket_team"}
    ],
    "owner": {"username":"neo@opsgenie.com"}
}'

Sample Response

{
    "data": {
        "id": "d8b16789-3b71-48e4-9ff2-48a76a789137",
        "name": "Closed but Unacked Alerts"
    },
    "took": 0.302,
    "requestId": "613909cc-f6c5-42f7-8107-5ea17ba79451"
}

Update Saved Search (Partial) Expand

In-Line Parameters

Referred Name
Description

identifier

Identifier of the saved search

Query Parameters

Parameter
Mandatory
Description

identifierType

false

Type of the identifier that is provided as an in-line parameter. Possible values are id and name. Default value is id.

JSON Body Fields

Field
Mandatory
Description

name

false

Unique name of the saved search. Maximum length is 100 characters.

query

false

Search query to be used while filtering the alerts. Maximum length is 1000 characters.

owner

false

User that will be assigned as owner of the saved search. Saved searches are always accessible to their owners.

description

false

Informational description of the saved search. Maximum length is 15000 characters.

teams

false

Teams that saved search is assigned to. If a saved-search is assigned to at least one team, saved-search will only be accessible to the owner and members of the assigned teams. A saved-search can be assigned to at most 20 teams.

Sample Requests

 curl -X PATCH https://api.opsgenie.com/v2/alerts/saved-searches/d8b16789-3b71-48e4-9ff2-48a76a789137
    -H "Authorization: GenieKey eb243592-faa2-4ba2-a551q-1afdf565c889"
    -H "Content-Type: application/json"
    -d
'{
    "name": "Closed but Unacked Alerts",
    "description": "Will be used to display the alerts that are closed before someone acknowledges.",
    "query": "status: Open and acknowledged: false",
    "teams":[
        {"id":"4513b7ea-3b91-438f-b7e4-e3e54af9147c"},
        {"name":"rocket_team"}
    ],
    "owner":{"username":"neo@opsgenie.com"}}'

Sample Response

{
    "data": {
        "id": "d8b16789-3b71-48e4-9ff2-48a76a789137",
        "name": "Closed but Unacked Alerts"
    },
    "took": 0.404,
    "requestId": "613909cc-f6c5-42f7-8107-5ea17ba79451"
}

Get Saved Search

In-Line Parameters

Referred Name
Description

identifier

Identifier of the saved search

Query Parameters

Parameter
Mandatory
Description

identifierType

false

Type of the identifier that is provided as an in-line parameter. Possible values are id and name. Default value is id.

Sample Requests

curl -H "Authorization: GenieKey eb243592-faa2-4ba2-a551q-1afdf565c889" -X GET 'https://api.opsgenie.com/v2/alerts/saved-searches/8418d193-2dab-4490-b331-8c02cdd196b7?identifierType=id'
curl -H "Authorization: GenieKey eb243592-faa2-4ba2-a551q-1afdf565c889" -X GET 'https://api.opsgenie.com/v2/alerts/saved-searches/team_apollo_filter?identifierType=name'

Sample Response

{
    "data": {
        "id": "d8b16789-3b71-48e4-9ff2-48a76a789137",
        "name": "unacked alerts query",
        "createdAt": "2017-04-12T13:53:02.736Z",
        "updatedAt": "2017-04-12T13:53:02.736Z",
        "teams": [
            { "id": "b65f29fc-9e47-4532-9659-7dff16d4ec49" }
        ],
        "description": "Used to get alerts that are not acknowledged",
        "query": "status: open AND acknowledged: false"
    },
    "requestId": "613909cc-f6c5-42f7-8107-5ea17ba79451"
}

List Saved Searches

Sample Requests

curl -X GET 'https://api.opsgenie.com/v2/alerts/saved-searches'
    -H "Authorization: GenieKey eb243592-faa2-4ba2-a551q-1afdf565c889"

Sample Response

{
    "data": [
        {
            "id": "62dca743-bddc-4d17-99ab-6d8e0c066d1c",
            "name": "unacked alerts query"
        },
        {
            "id": "3155ddd1-8d6c-438e-9cdd-28b31edca301",
            "name": "team apollo alerts"
        },
        {
            "id": "d8b16789-3b71-48e4-9ff2-48a76a789137",
            "name": "Critical_Open_Alerts"
        }
    ],
    "requestId": "fbd4a99d-aa05-4549-870d-02fa3d6395e5"
}

Create Alert Attachment

In-Line Parameters

Referred Name
Description

alertIdentifier

Identifier of the alert

Query Parameters

Parameter
Mandatory
Description

alertIdentifierType

false

Type of the identifier that is provided as an in-line parameter. Possible values are id, tiny and alias. Default value is id.

file

true

The file that will be attached to the alert.

user

false

Default owner of the execution. If user is not specified, the system becomes owner of the execution.

indexFile

false

Name of html file which will be shown when attachment clicked on UI.

If it is not specified, following rules will be applied by order to determine index file name

  1. if it is not a zip file, it will be assigned to attachment file name
  2. If it is a zip file, it will be assigned to
    1. HTML file whose name equals attachment file name
    2. index.htm or index.html file
    3. the first HTML file found in the ZIP
    4. If no HTML file exists, it will be assigned to attachment zip file name and zip file will be downloaded from OpsGenie web site directly when clicked on attachment.

Sample Request

curl -X POST ‘https://api.opsgenie.com/v2/alerts/5/attachments?alertIdentifierType=tiny'   
  -H ‘authorization: GenieKey 123-H ‘content-type: multipart/form-data;’  
  -F file=@attachment.jpg
  -F user=user@opsgenie.com

Sample Response

{
  “result”:“Attachment [attachment.jpg] successfully added to alert [c8daa4c3951d-40ee-9711-bd332040c207].,
  ”data”:{
  	“id”:“1503330358392000143"
  },
  “took”:0.5,
  “requestId”:“1bccb6d4-723f-4e84-bb3d-677f2d9dbe4f”
}

Get Alert Attachment

In-Line Parameters

Referred Name
Description

alertIdentifier

Identifier of the alert

attachmentId

Identifier of the attachment

Query Parameters

Parameter
Mandatory
Description

alertIdentifierType

false

Type of the identifier that is provided as an in-line parameter. Possible values are id, tiny and alias. Default value is id.

Sample Request

curl -X GET 'https://api.opsgenie.com/v2/alerts/5/attachments/1503330178663000098?alertIdentifierType=tiny' 
  -H 'authorization: GenieKey 123'

Sample Response

{
    "data": {
        "name": "attachment.jpg",
        "url": "download link here"
    },
    "took": 0.558,
    "requestId": "e4274f85-684e-4d94-9fca-e29c72c8050b"
}

List Alert Attachments

In-Line Parameters

Referred Name
Description

alertIdentifier

Identifier of the alert

Query Parameters

Parameter
Mandatory
Description

alertIdentifierType

false

Type of the identifier that is provided as an in-line parameter. Possible values are id, tiny and alias. Default value is id.

Sample Request

curl -X GET 'https://api.opsgenie.com/v2/alerts/5/attachments?alertIdentifierType=tiny' 
  -H 'authorization: GenieKey 123'

Sample Response

{
    "data": [
        {
            "name": "attachment1.jpg",
            "id": 1503330178663000098
        },
        {
            "name": "attachment2.zip",
            "id": 1503330193202000133
        }
    ],
    "took": 0.055,
    "requestId": "07c4564b-5f02-4bf4-996c-493b751363e4"
}

Delete Alert Attachment

In-Line Parameters

Referred Name
Description

alertIdentifier

Identifier of the alert

attachmentId

Identifier of the attachment

Query Parameters

Referred Name
Mandatory
Description

alertIdentifierType

false

Type of the identifier that is provided as an in-line parameter. Possible values are id, tiny and alias. Default value is id.

user

false

Default owner of the execution. If user is not specified, the system becomes owner of the execution.

Sample Request

curl -X DELETE 'https://api.opsgenie.com/v2/alerts/5/attachments/1503330193202000133?alertIdentifierType=tiny&user=user@opsgenie.com' 
  -H 'authorization: GenieKey 123'

Sample Response

{
    "result": "Deleted",
    "took": 0.207,
    "requestId": "a5e14c49-9006-4d2b-9062-5560e639b03f"
}

Alert API