Alert API (Deprecated)
Create an API Integration and obtain your apiKey to make requests listed below.
Create Alert Request
Create alert request is used to create alerts in OpsGenie. It takes the following parameters:
Mandatory Parameters
Parameter | Limit | |
---|---|---|
apiKey | API key is used for authenticating API requests | |
message | Alert text limited to 130 characters | 130 chars |
Optional Parameters
Parameter | Limit | |
---|---|---|
teams | List of team names which will be responsible for the alert. Team escalation policies are run to calculate which users will receive notifications. Teams which are exceeding the limit are ignored. | 50 teams |
alias | Used for Alert De-Duplication. A user defined identifier for the alert and there can be only one alert with open status with the same alias. Provides ability to assign a known id and later use this id to perform additional actions such as log, close, attach for the same alert. | 512 chars |
description | This field can be used to provide a detailed description of the alert, anything that may not have fit in the Message field. | 15000 chars |
recipients | Optional user, group, schedule or escalation names to calculate which users will receive the notifications of the alert. Recipients which are exceeding the limit are ignored. | 50 recipients |
actions | A comma separated list of actions that can be executed. Custom actions can be defined to enable users to execute actions for each alert. If Webhook Integration exists, webhook URL will be called when action is executed. Also if Marid Integration exists, actions will be posted to Marid. Actions will be posted to all existing bi-directional integrations too. Actions which are exceeding the number limit are ignored. Action names which are longer than length limit are shortened. | 10 actions, 50 chars each |
source | Field to specify source of alert. By default, it will be assigned to IP address of incoming request | 512 chars |
tags | A comma separated list of labels attached to the alert. You can overwrite Quiet Hours setting for urgent alerts by adding OverwriteQuietHours tag. Tags which are exceeding the number limit are ignored. Tag names which are longer than length limit are shortened. | 20 tags, 50 chars each |
details | Set of user defined properties. This will be specified as a nested JSON map such as: "details" : {"prop1":"prop1Value", "prop2":"prop2Value"} | 8000 chars |
entity | The entity the alert is related to. | 512 chars |
user | Default owner of the execution. If user is not specified, the system becomes owner of the execution. | 100 chars |
note | Additional alert note |
Sample Request:
curl -XPOST 'https://api.opsgenie.com/v1/json/alert' -d '
{
"apiKey": "eb243592-faa2-4ba2-a551q-1afdf565c889",
"message" : "WebServer3 is down",
"teams" : ["operations", "developers"]
}'
Response:
{
"message" : "alert created",
"alertId" : "d85b4c10-ca86-45f3-94a0-0685de932a86",
"status" : "successful",
"code" : 200
}
Sample Response When Alias is Given and Count Increased:
{
"message" : "alert updated",
"alertId" : "b962fe76-bdb8-4d33-ba0b-91e9c602a8fb",
"status" : "successful",
"code" : 201
}
Close Alert Request
Close alert request is used to close open alerts in OpsGenie. It takes the following parameters:
Mandatory Parameters
Parameter | |
---|---|
apiKey | API key is used for authenticating API requests. |
id | ID of the alert that will be closed. |
alias | Alias of the alert that will be closed. |
tinyId | short ID assigned to the alert. All requests supports tinyId but using this field is not recommended because it rolls. |
One of id, alias or tinyId parameters should be specified with close alert request. Alias option can only be used for open alerts
Optional Parameters
Parameter | |
---|---|
user | Default owner of the execution. If user is not specified, the system becomes owner of the execution. |
note | Additional alert note. |
source | User defined field to specify source of close action. |
Sample Request
curl -XPOST 'https://api.opsgenie.com/v1/json/alert/close' -d '
{
"apiKey": "eb243592-faa2-4ba2-a551q-1afdf565c889",
"id": "ac463592-dbd2-4ca3-a651d-48fhf5j5c871"
}'
Response
{
"status" : "successful",
"code" : 200
}
Delete Alert Request
Delete alert request is used to delete closed alerts in OpsGenie. It takes the following parameters:
Mandatory Parameters
apiKey | API key is used for authenticating API requests |
id | ID of the alert that will be deleted. |
alias | Alias of the alert will be deleted. |
tinyId | short ID assigned to the alert. All requests supports tinyId but using this field is not recommended because it rolls. |
One of id, alias or tinyId parameters should be specified with delete alert request. Alias option can only be used for open alerts
Optional Parameters
Parameter | |
---|---|
user | Default owner of the execution. If user is not specified, the system becomes owner of the execution. |
source | User defined field to specify source of delete action. |
Sample Request
curl -XDELETE 'https://api.opsgenie.com/v1/json/alert?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&id=ac463592-dbd2-4ca3-a651d-48fhf5j5c871'
Response:
{
"status" : "successful",
"code" : 200
}
Get Alert Request
Get alert request is used to search and retrieve alerts in OpsGenie. It takes the following parameters:
Mandatory Parameters
Parameter | |
---|---|
apiKey | API key is used for authenticating API requests. |
id | ID of the alert to be retrieved. |
alias | Alias of the alert to be retrieved. Using alias will only retrieve an open alert with that alias if it exists. |
tinyId | short ID assigned to the alert. All requests supports tinyId but using this field is not recommended because it rolls. |
One of id, alias or tinyId parameters should be specified with get alert request. Alias option can only be used for open alerts
Sample request to retrieve a single alert
curl -XGET 'https://api.opsgenie.com/v1/json/alert?apiKey=e3343592-faa2-4ba2-a551q-1afdf565c889&alias=host_down'
curl -XGET 'https://api.opsgenie.com/v1/json/alert?apiKey=e3343592-faa2-4ba2-a551q-1afdf565c889&id=ac463592-dbd2-4ca3-a651d-48fhf5j5c871'
curl -XGET 'https://api.opsgenie.com/v1/json/alert?apiKey=e3343592-faa2-4ba2-a551q-1afdf565c889&tinyId=324'
Response:
Timestamps are Unix Epoch as:
- updatedAt: in nanoseconds
- createdAt: in nanoseconds
- ackTime : in milliseconds
- closeTime : in milliseconds
{
"tags": [ ],
"count": 1,
"status": "closed",
"teams":["operations", "developers"]
"recipients": [
"[email protected]"
],
"tinyId": "324",
"alias": "host_down",
"entity": ""
"id": "ac463592-dbd2-4ca3-a333d-48fhf5j5c871",
"updatedAt": 1349698149317,
"message": "WebServer3 is down",
"details": {
"ip": "192.168.1.87"
},
"source": "[email protected]",
"description": "WebServer3 is down due to failure in WAN-1 connection.",
"createdAt": 1349698149317,
"isSeen":true,
"acknowledged":true,
"snoozed":false,
"owner":"[email protected]",
"actions": [ ],
"systemData": {
"integrationType": "API",
"integrationId": "95225ed3-03fb-4cdd-a035-44052d6f4496",
"integrationName": "API",
"ackTime":18171,
"acknowledgedBy":"[email protected]",
"closeTime":24737,
"closedBy":"[email protected]"
}
}
List Alert Request
Alert list & count api is async, changes to alerts are available to list requests at most within 2 seconds.
Async behaviour does not create pagination problems. Alert create, ack, close, get actions are real time.
List alerts request is used to list alerts in OpsGenie. It takes the following parameters:
Mandatory Parameters
Parameter | |
---|---|
apiKey | API key is used for authenticating API requests |
Optional Parameters
Parameter | |
---|---|
createdAfter | Unix timestamp value which is converted to nano second. Request will return all alerts which are created after specified time. |
createdBefore | Unix timestamp value which is converted to nano second. Request will return all alerts which are created after specified time. |
updatedAfter | Unix timestamp value which is converted to nano second. Request will return all alerts which are created after specified time. |
updatedBefore | Unix timestamp value which is converted to nano second. Request will return all alerts which are created after specified time. |
limit | Page size. Default is 20. Max value for this parameter is 100. |
status | Used to query alerts with specified status. May take one of open, acked, unacked, seen, notseen, closed. |
sortBy | createdAt, updatedAt, default is createdAt |
order | asc/desc, default: desc |
tags | A comma separated list of labels attached to the alert such as "tag1, tag2" |
tagsOperator | tags are combined with tagsOperator like "tag1 and tag2" when filtered. Accepted values: and/or, default: and. |
teams | A comma separated list of teams that an alert belongs to such as "ops_team, business_team". One or more teams' alerts can be filtered via this parameter. If multiple teams are specified, alerts that belong to all given teams are filtered. The list can consist of team ids and team names. |
Sample requests to retrieve list of alerts
retrieve the last 20 alerts (20 is the default for limit, 100 is the max for limit)
curl -XGET 'https://api.opsgenie.com/v1/json/alert?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889'
retrieve the last 10 open alerts
curl -XGET 'https://api.opsgenie.com/v1/json/alert?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&status=open&limit=10'
retrieve alerts created after this time
curl -XGET 'https://api.opsgenie.com/v1/json/alert?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&createdAfter=1351634560000000&limit=20'
retrive alerts with paging
This request retrieves oldest 5 alert by ascending order. By using the createdAt value of the 5th alert, we will make the second request.
curl -XGET 'https://api.opsgenie.com/v1/json/alert?apiKey=39d50168-24b3-4355-b285-b91060823dee&order=asc&limit=5'
Let's say "createdAt" value of the 5th alert we retrieved above is "1405953557284001300". To get 6th to 10th alerts, we should add this value to our request to retrieve 5 alerts created after that alert.
curl -XGET 'https://api.opsgenie.com/v1/json/alert?apiKey=39d50168-24b3-4355-b285-b91060823dee&order=asc&limit=5&createdAfter=1405953557284001300'
To continue polling, you can use the second request by changing createdAfter value according to the alerts you retrieved.
retrieve critical alerts that have not been acknowledged
curl -XGET 'https://api.opsgenie.com/v1/json/alert?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&status=unacked&tags=critical'
Response:
Timestamps are Unix Epoch as nanoseconds
{
"alerts":[
{
"id" : "ac463592-dbd2-4ca3-a651d-48fhf5j5c871",
"count" : 1
"alias" : "host_down",
"message" : "Host 192.168.1.1 is down",
"status" : "open",
"isSeen" : false,
"acknowledged" : false,
"snoozed" : false,
"createdAt" : "1351634560000000",
"updatedAt" : "1351634560000000",
"tinyId" : "111",
"tags" : ["critical"],
"owner" : "[email protected]",
"teams": ["ops_team", "business_team"]
},
{
"id" : "cf463592-emt2-4ca3-a651d-56hhf5j5c132",
"count" : 1
"alias" : "app_down",
"message" : "Web server Web_Server1 is down",
"status" : "closed",
"isSeen" : true,
"acknowledged" : false,
"snoozed" : false,
"createdAt" : "1351634560000000",
"updatedAt" : "1351634560000000",
"tinyId" : "66",
"tags" : ["critical"],
"owner" : "",
"teams": ["ops_team"]
}
]
}
Count Alerts Request
Count alerts request is used to counts alerts in OpsGenie. It takes the following parameters:
Mandatory Parameters
Parameter | |
---|---|
apiKey | API key is used for authenticating API requests. |
Optional Parameters
createdAfter | Unix timestamp value which is converted to nano second. Request will return all alerts which are created after specified time. |
createdBefore | Unix timestamp value which is converted to nano second. Request will return all alerts which are created after specified time. |
updatedAfter | Unix timestamp value which is converted to nano second. Request will return all alerts which are created after specified time. |
updatedBefore | Unix timestamp value which is converted to nano second. Request will return all alerts which are created after specified time. |
limit | For performance reasons, the desired result is to limit that count. Max: 100000, default: 100000 |
status | Used to query alerts with specified status. May take one of open, acked, unacked, seen, notseen, closed |
tags | A comma separated list of labels attached to the alert such as "tag1, tag2" |
tagsOperator | tags are combined with tagsOperator like "tag1 and tag2" when filtered. Accepted values: and/or, default: and. |
Sample requests to retrieve count of alerts
Count all of the alerts
curl -XGET 'https://api.opsgenie.com/v1/json/alert/count?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889'
Count the open alerts
curl -XGET 'https://api.opsgenie.com/v1/json/alert/count?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&status=open'
Count the open alerts
curl -XGET 'https://api.opsgenie.com/v1/json/alert/count?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&status=open'
Count alerts created after a specific time
curl -XGET 'https://api.opsgenie.com/v1/json/alert/count?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&createdAfter=1351634560000000'
Count critical alerts that have not been acknowledged
curl -XGET 'https://api.opsgenie.com/v1/json/alert/count?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&status=unacked&tags=critical'
Response:
{
"count" : 2
}
List Alert Notes Request
List alert notes request is used to retrieve alert notes in OpsGenie. It takes the following parameters:
Mandatory Parameters
Parameter | |
---|---|
apiKey | API key is used for authenticating API requests |
id | ID of the alert to be retrieved |
alias | Alias of alert to be retrieved |
tinyId | short ID assigned to the alert. All requests supports tinyId but using this field is not recommended because it rolls. |
One of id, alias or tinyId parameters should be specified with list alert notes request. Alias option can only be used for open alerts.
Optional Parameters
limit | Page size. Default is 100. |
order | asc/desc, default: desc |
lastKey | Key which will be used in pagination |
Sample request to retrieve a single alert
curl -XGET 'https://api.opsgenie.com/v1/json/alert/note?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&alias=host_down'
curl -XGET 'https://api.opsgenie.com/v1/json/alert/note?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&id=ac463592-dbd2-4ca3-a651d-48fhf5j5c871'
Response:
Timestamps are Unix Epoch as nanoseconds
{
"lastKey": "13099992234_1309999223432245566",
"notes": [
{
"note": "comment message",
"owner":"[email protected]",
"createdAt":13099992234
}
]
}
List Alert Logs Request
List alert logs request is used to retrieve alert logs in OpsGenie. It takes the following parameters:
Mandatory Parameters
Parameter | |
---|---|
apiKey | API key is used for authenticating API requests |
id | ID of the alert to be retrieved |
alias | Alias of alert to be retrieved |
tinyId | short ID assigned to the alert. All requests supports tinyId but using this field is not recommended because it rolls. |
One of id, alias or tinyId parameters should be specified with list alert logs request. Alias option can only be used for open alerts.
Optional Parameters
Parameter | |
---|---|
limit | Page size. Default is 100 |
order | asc/desc, default: desc |
lastKey | Key which will be used in pagination. |
Sample request to retrieve alert logs.
curl -XGET 'https://api.opsgenie.com/v1/json/alert/log?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&alias=host_down'
curl -XGET 'https://api.opsgenie.com/v1/json/alert/log?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&id=ac463592-dbd2-4ca3-a651d-48fhf5j5c871'
Response
Timestamps are Unix Epoch as nanoseconds
{
"lastKey": "13099992234_1309999223432245566",
"logs": [
{
"log": "log message",
"logType":"comment",
"owner":"[email protected]",
"createdAt":13099992234
}
]
}
List Alert Recipients Request
List alert recipients request is used to retrieve alert recipients in OpsGenie. It takes the following parameters:
Mandatory Parameters
Parameter | |
---|---|
apiKey | API key is used for authenticating API requests |
id | ID of the alert to be retrieved |
alias | Alias of alert to be retrieved |
tinyId | short ID assigned to the alert. All requests supports tinyId but using this field is not recommended because it rolls. |
One of id, alias or tinyId parameters should be specified with list alert recipients request. Alias option can only be used for open alerts.
Sample request to retrieve a single alert
curl -XGET 'https://api.opsgenie.com/v1/json/alert/recipient?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&alias=host_down'
curl -XGET 'https://api.opsgenie.com/v1/json/alert/recipient?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&id=ac463592-dbd2-4ca3-a651d-48fhf5j5c871'
Response:
{
"users": [
{"username": "[email protected]", "state":"pending", "method":"sms", "stateChangedAt":13999878445}
],
"groups": {
"group1":[
{"username": "[email protected]", "state":"sent", "method":"email", "stateChangedAt":13997878445}
]
}
}
Acknowledge Request
Acknowledge request is used to acknowledge alerts in OpsGenie. It takes the following parameters:
Mandatory Parameters
Parameter | |
---|---|
apiKey | API key is used for authenticating API requests |
id | ID of the alert that will be acknowledged. |
alias | Alias of the alert that will be acknowledged. |
tinyI | short ID assigned to the alert. All requests supports tinyId but using this field is not recommended because it rolls. |
One of id, alias or tinyId parameters should be specified with acknowledge alert request.
Optional Parameters
Parameter | |
---|---|
user | Default owner of the execution. If user is not specified, the system becomes owner of the execution. |
note | Additional alert note |
source | User defined field to specify source of acknowledge action. |
Sample Request
curl -XPOST 'https://api.opsgenie.com/v1/json/alert/acknowledge' -d '
{
"apiKey": "eb243592-faa2-4ba2-a551q-1afdf565c889",
"id": "ac463592-dbd2-4ca3-a651d-48fhf5j5c871"
}'
Response
{
"status" : "successful",
"code" : 200
}
UnAcknowledge Request
UnAcknowledge request is used to revert back the alert state to un-acknowledged. It takes the following parameters:
Mandatory Parameters
Parameter | |
---|---|
apiKey | API key is used for authenticating API requests |
id | ID of the alert that will be un-acknowledged. |
alias | Alias of the alert that will be un-acknowledged. |
tinyId | Short ID assigned to the alert. All requests supports tinyId but using this field is not recommended because it rolls. |
One of id, alias or tinyId parameters should be specified with un-acknowledge alert request.
Optional Parameter
Parameter | |
---|---|
user | Default owner of the execution. If user is not specified, the system becomes owner of the execution. |
note | Additional alert note. |
source | User defined field to specify source of unacknowledge action. |
Sample Request
curl -XPOST 'https://api.opsgenie.com/v1/json/alert/unacknowledge' -d '
{
"apiKey": "eb243592-faa2-4ba2-a551q-1afdf565c889",
"id": "ac463592-dbd2-4ca3-a651d-48fhf5j5c871"
}'
Response:
{
"took" : 245,
"code" : 200,
"status" : "successful"
}
Snooze Request
Snooze request is used to snooze alerts in OpsGenie. It takes the following parameters:
Mandatory Parameters
Parameter | |
---|---|
apiKey | API key is used for authenticating API requests. |
id | ID of the alert that will be snoozed. |
alias | Alias of the alert that will be snoozed. |
tinyId | short ID assigned to the alert. All requests supports tinyId but using this field is not recommended because it rolls. |
endDate | The date and time snooze will end. |
One of id, alias or tinyId parameters should be specified with snooze alert request. Alias option can only be used for open alerts.
Optional Parameters
Parameter | |
---|---|
user | Default owner of the execution. If user is not specified, the system becomes owner of the execution. |
note | Additional alert note. |
source | User defined field to specify source of snooze action. |
timezone | Timezone of endDate parameter. Please look at Supported Timezone IDs for available timezones. Defaults to Root Timezone, explained in Time Constraints and Timezones document. |
Sample Request
curl -XPOST 'https://api.opsgenie.com/v1/json/alert/snooze' -d '
{
"apiKey": "eb243592-faa2-4ba2-a551q-1afdf565c889",
"id": "ac463592-dbd2-4ca3-a651d-48fhf5j5c871",
"endDate": "2016-01-28 08:00"
}'
Response:
{
"status" : "successful",
"code" : 200
}
Renotify Request
Renotify request is used to renotify recipients about specified alert in OpsGenie. It takes the following parameters:
Mandatory Parameters
Parameter | |
---|---|
apiKey | API key is used for authenticating API requests. |
id | ID of the alert that will be acknowledged. |
alias | Alias of the alert that will be acknowledged. |
tinyId | short ID assigned to the alert. All requests supports tinyId but using this field is not recommended because it rolls. |
One of id, alias or tinyId parameters should be specified with renotify alert request. Alias option can only be used for open alerts.
Optional Parameters
recipients | The user names of individual users or groups. If not specified alert recipients will be renotified. |
user | Default owner of the execution. If user is not specified, owner of the alert will be the system. |
note | Additional alert note |
source | User defined field to specify source of renotify action. |
Sample Request
curl -XPOST 'https://api.opsgenie.com/v1/json/alert/renotify' -d '
{
"apiKey": "eb243592-faa2-4ba2-a551q-1afdf565c889",
"id": "ac463592-dbd2-4ca3-a651d-48fhf5j5c871",
"recipients": "[email protected], group1"
}'
Response
{
"status" : "successful",
"code" : 200
}
Take Ownership Request
Take ownership request is used to take the ownership of the alerts in OpsGenie. It takes the following parameters:
Mandatory Parameters
Parameter | |
---|---|
apiKey | API key is used for authenticating API requests |
id | ID of the alert whose ownership will be taken. |
alias | Alias of the alert whose ownership will be taken. |
tinyId | short ID assigned to the alert. All requests supports tinyId but using this field is not recommended because it rolls. |
One of id, alias or tinyId parameters should be specified with take ownership request. Alias option can only be used for open alerts.
Optional Parameters
Parameter | |
---|---|
user | Default owner of the execution. If user is not specified, the system becomes owner of the execution. |
note | Additional alert note |
source | User defined field to specify source of takeownership action. |
Sample Request
curl -XPOST 'https://api.opsgenie.com/v1/json/alert/takeOwnership' -d '
{
"apiKey": "eb243592-faa2-4ba2-a551q-1afdf565c889",
"id": "ac463592-dbd2-4ca3-a651d-48fhf5j5c871"
}'
Response
{
"status" : "successful",
"code" : 200
}
Assign Request
Assign request is used to assign the ownership of the alerts in OpsGenie. It takes the following parameters:
Mandatory Parameters
Parameter | |
---|---|
apiKey | API key is used for authenticating API requests |
id | ID of the alert that will be assigned. |
alias | Alias of the alert that will be assigned. |
tinyId | short ID assigned to the alert. All requests supports tinyId but using this field is not recommended because it rolls. |
owner | The user who will be the owner of the alert after the execution. |
One of id, alias or tinyId parameters should be specified with assign alert request. Alias option can only be used for open alerts.
Optional Parameters
Parameter | |
---|---|
user | Default owner of the execution. If user is not specified, the system becomes owner of the execution. |
note | Additional alert note |
source | User defined field to specify source of assign action. |
Sample Request
curl -XPOST 'https://api.opsgenie.com/v1/json/alert/assign' -d '
{
"apiKey": "eb243592-faa2-4ba2-a551q-1afdf565c889",
"id": "ac463592-dbd2-4ca3-a651d-48fhf5j5c871",
"owner":"[email protected]"
}'
Response
{
"status" : "successful",
"code" : 200
}
Add Team Request
Add team request is used to add new teams to alerts in OpsGenie. It takes the following parameters:
Mandatory Parameters
Parameter | |
---|---|
apiKey | API key is used for authenticating API requests |
id | ID of the alert that the new recipient will be added. |
alias | Alias of the alert that the new recipient will be added. |
tinyId | short ID assigned to the alert. All requests support tinyId but using this field is not recommended because it rolls. |
team | The new team that will be added. |
One of id, alias or tinyId parameters should be specified with add team request. Alias option can only be used for open alerts.
Optional Parameters
Parameter | |
---|---|
user | Default owner of the execution. If the user is not specified, the system becomes the owner of the execution. |
note | Additional alert note |
source | User defined the field to specify the source of add team action. |
Sample Request
curl -XPOST 'https://api.opsgenie.com/v1/json/alert/team' -d '
{
"apiKey": "eb243592-faa2-4ba2-a551q-1afdf565c889",
"id": "ac463592-dbd2-4ca3-a651d-48fhf5j5c871",
"team":"operations"
}'
Response
{
"status" : "successful",
"code" : 200
}
Add Recipient Request
Add recipient request is used to add new recipients(user or group) to alerts in OpsGenie. It takes the following parameters:
Mandatory Parameters
Parameter | |
---|---|
apiKey | API key is used for authenticating API requests |
id | ID of the alert that the new recipient will be added. |
alias | Alias of the alert that the new recipient will be added. |
tinyId | short ID assigned to the alert. All requests support tinyId but using this field is not recommended because it rolls. |
recipient | The new recipient that will be added. |
One of id, alias or tinyId parameters should be specified with add recipient request. Alias option can only be used for open alerts
Optional Parameters
Parameter | |
---|---|
user | Default owner of the execution. If user is not specified, the system becomes owner of the execution. |
note | Additional alert note |
source | User defined field to specify source of add recipient action. |
Sample Request
curl -XPOST 'https://api.opsgenie.com/v1/json/alert/recipient' -d '
{
"apiKey": "eb243592-faa2-4ba2-a551q-1afdf565c889",
"id": "ac463592-dbd2-4ca3-a651d-48fhf5j5c871",
"recipient":"[email protected]"
}'
Response
{
"status" : "successful",
"code" : 200
}
Add Note Request
Add note request is used to add notes to alerts in OpsGenie. It takes the following parameters:
Mandatory Parameters
Parameter | |
---|---|
apiKey | API key is used for authenticating API requests |
id | ID of the alert that note will be added. |
alias | Alias of the alert that note will be added. |
tinyId | short ID assigned to the alert. All requests supports tinyId but using this field is not recommended because it rolls. |
note | Note text. Limit is 25000 characters |
One of id, alias or tinyId parameters should be specified with add note request. Alias option can only be used for open alerts
Optional Parameters
Parameter | |
---|---|
user | Default owner of the execution. If user is not specified, the system becomes owner of the execution. |
source | User defined field to specify source of add note action. |
Sample Request
curl -XPOST 'https://api.opsgenie.com/v1/json/alert/note' -d '
{
"apiKey": "eb243592-faa2-4ba2-a551q-1afdf565c889",
"id": "ac463592-dbd2-4ca3-a651d-48fhf5j5c871",
"note": "custom note"
}'
Response
{
"status" : "successful",
"code" : 200
}
Add Tags Request
Add tags request is used to add tags to alerts in OpsGenie. It takes the following parameters:
Mandatory Parameters
Parameter | |
---|---|
apiKey | API key is used for authenticating API requests |
id | ID of the alert that tags will be added. |
alias | Alias of the alert that tags will be added. |
tinyId | short ID assigned to the alert. All requests support tinyId but using this field is not recommended because it rolls. |
tags | Comma separated list of tags that will be added. |
One of id or alias parameters should be specified with add tags request. Alias option can only be used for open alerts
Optional Parameters
user | Default owner of the execution. If user is not specified, the system becomes owner of the execution. |
source | User defined field to specify source of add tags action. |
note | Additional alert note |
Sample Request
curl -XPOST 'https://api.opsgenie.com/v1/json/alert/tags' -d '
{
"apiKey": "eb243592-faa2-4ba2-a551q-1afdf565c889",
"id": "ac463592-dbd2-4ca3-a651d-48fhf5j5c871",
"tags": "emergency, delay"
}'
Response
{
"status" : "successful",
"code" : 200
}
Remove Tags
Remove tags request is used to remove tags from alerts in OpsGenie. It takes the following parameters:
Mandatory Parameters
Parameter | |
---|---|
apiKey | API key is used for authenticating API requests |
id | ID of the alert that tags will be removed from. |
alias | Alias of the alert that tags will be removed from. |
tinyId | short ID assigned to the alert. All requests supports tinyId but using this field is not recommended because it rolls. |
tags | Comma separated list of tags that will be removed from. |
One of id, alias or tinyId parameters should be specified with remove tags request. Alias option can only be used for open alerts
Optional Parameters
Parameter | |
---|---|
user | Default owner of the execution. If user is not specified, the system becomes owner of the execution. |
source | User defined field to specify source of remove tags action. |
note | Additional alert note |
Sample Request
curl -XDELETE 'https://api.opsgenie.com/v1/json/alert/tags?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&id=ac463592-dbd2-4ca3-a651d-48fhf5j5c871&tags=emergency,delay'
Response
{
"status" : "successful",
"code" : 200
}
Add Details Request
Add details request is used to add properties to alert details in OpsGenie. If you send an existing alert property's key, it overwrites the existing one. It takes the following parameters:
Mandatory Parameters
Parameter | |
---|---|
apiKey | API key is used for authenticating API requests |
id | ID of the alert that details will be added. |
alias | Alias of the alert that details will be added. |
tinyId | short id assigned to the alert. All requests support tinyId but using this field is not recommended because it rolls. |
details | Set of properties to be added to alert details. This will be specified as a nested JSON map such as: "details" : {"prop1":"prop1Value", "prop2":"prop2Value"}. |
One of id, alias or tinyId parameters should be specified with add details request. Alias option can only be used for open alerts
Optional Parameters
Parameter | |
---|---|
user | Default owner of the execution. If user is not specified, the system becomes owner of the execution. |
source | User defined field to specify source of add details action. |
note | Additional alert note |
Sample Request
curl -XPOST 'https://api.opsgenie.com/v1/json/alert/details' -d '
{
"apiKey": "eb243592-faa2-4ba2-a551q-1afdf565c889",
"id": "ac463592-dbd2-4ca3-a651d-48fhf5j5c871",
"details": {"prop1" : "val1", "prop2" : "val2"}
}'
Response
{
"status" : "successful",
"code" : 200
}
Remove Details Request
Remove details request is used to remove properties from alert details in OpsGenie. It takes the following parameters:
Mandatory Parameters
Parameter | |
---|---|
apiKey | API key is used for authenticating API requests |
id | ID of the alert that details properties will be removed from. |
alias | Alias of the alert that details properties will be removed from. |
tinyId | short ID assigned to the alert. All requests support tinyId but using this field is not recommended because it rolls. |
keys | Comma separated list of keys of alert details properties. |
One of id, alias or tinyId parameters should be specified with remove details request. Alias option can only be used for open alerts
Optional Parameters
Parameter | |
---|---|
user | Default owner of the execution. If user is not specified, the system becomes owner of the execution. |
source | User defined field to specify source of remove details action. |
note | Additional alert note |
Sample Request
curl -XDELETE 'https://api.opsgenie.com/v1/json/alert/details?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&id=ac463592-dbd2-4ca3-a651d-48fhf5j5c871&keys=prop1,prop2'
Response
{
"status" : "successful",
"code" : 200
}
Execute Action Request
Execute action request is used to execute predefined actions on alerts in OpsGenie. It takes the following parameters:
Mandatory Parameters
Parameter | |
---|---|
apiKey | API key is used for authenticating API requests |
id | ID of the alert that action will be executed for. |
alias | Alias of the alert that action will be executed for. |
tinyId | short ID assigned to the alert. All requests supports tinyId but using this field is not recommended because it rolls. |
action | Action to execute |
One of id, alias or tinyId parameters should be specified with execute action request. Alias option can only be used for open alerts
Optional Parameters
Parameter | |
---|---|
user | Default owner of the execution. If user is not specified, the system becomes owner of the execution. |
source | User defined field to specify source of action execution. |
note | Additional alert note |
Sample Request
curl -XPOST 'https://api.opsgenie.com/v1/json/alert/executeAction' -d '
{
"apiKey": "eb243592-faa2-4ba2-a551q-1afdf565c889",
"id": "ac463592-dbd2-4ca3-a651d-48fhf5j5c871",
"action": "acknowledge"
}'
Response
curl -XPOST 'https://api.opsgenie.com/v1/json/alert/executeAction' -d '
{
"apiKey": "eb243592-faa2-4ba2-a551q-1afdf565c889",
"id": "ac463592-dbd2-4ca3-a651d-48fhf5j5c871",
"action": "acknowledge"
}'
Attach File Request
Attach file request is used to attach files to alerts in OpsGenie. It should be sent as multipart HTTP request. It takes the following parameters:
Mandatory Parameters
Parameter | |
---|---|
apiKey | API key is used for authenticating API requests |
id | ID of the alert that attachment will be added. |
alias | Alias of the alert that attachment will be added. |
tinyId | short ID assigned to the alert. All requests support tinyId but using this field is not recommended because it rolls. |
attachment | Attachment file content |
One of id, alias or tinyId parameters should be specified with attach file request. Alias option can only be used for open alerts
Optional Parameters
Parameter | |
---|---|
user | Default owner of the execution. If user is not specified, the system becomes owner of the execution. |
source | User defined field to specify source of atatch action. |
indexFile | 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. |
note | Additional alert note |
Sample Request
curl -XPOST 'https://api.opsgenie.com/v1/json/alert/attach' -F apiKey="eb243592-faa2-4ba2-a551q-1afdf565c889" -F id="ac463592-dbd2-4ca3-a651d-48fhf5j5c871" -F attachment=@/opt/trial.txt
Response
{
"status" : "successful",
"code" : 200
}
Escalate to Next Request
Escalate to Next request is used to immediately process the next available rule in the specified escalation. It takes the following parameters:
For more details see Escalate to Next documentation page
Mandatory Parameters
Parameter | |
---|---|
apiKey | API key is used for authenticating API requests |
id | ID of the alert that details will be added. |
alias | Alias of the alert that details will be added. |
tinyId | short ID assigned to the alert. All requests support tinyId but using this field is not recommended because it rolls. |
escalationId | ID of the escalation that will be escalated to the next level. |
escalationName | Name of the escalation that will be escalated to the next level. |
One of id, alias or tinyId parameters should be specified with escalate to next request. Alias option can only be used for open alerts
One of escalationId or escalationName parameters should be specified with escalate to next request.
Optional Parameters
Parameter | |
---|---|
user | Default owner of the execution. If user is not specified, the system becomes owner of the execution. |
note | Additional alert note |
source | User defined field to specify source of unacknowledge action. |
Sample Request
curl -XPOST 'https://api.opsgenie.com/v1/json/alert/escalateToNext' -d '
{
"apiKey": "eb243592-faa2-4ba2-a551q-1afdf565c889",
"id": "ac463592-dbd2-4ca3-a651d-48fhf5j5c871",
"escalationId": "a915eb9c-60da-4be9-a98f-cfcd206b421d"
}'
Response
{
"status" : "successful",
"code" : 200
}
Updated almost 5 years ago