Postmortem API

πŸ“˜

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

πŸ“˜

If using the EU instance of Opsgenie, the URL needs to be https://api.eu.opsgenie.com for requests to be successful.

πŸ“˜

Postmortems are available for Essentials (up to 5 per month), Standard (unlimited) and, Enterprise (unlimited).

Get Postmortem Request

Get postmortem request is used to get the details for a postmortem in Opsgenie. The API key should have Read access rights to perform this action. For more information, you can refer to API Access Management.

Sample Request

curl -X GET  'https://api.opsgenie.com/v2/postmortem/uy12brsfaa2-4ba2-a551q-1brsf565c542'
    --header 'Authorization: GenieKey eb296rsfaa2-47a2-a551q-1brsf565c889'

Response

{
  "data" : {
    "executiveSummary": {
        "version": 1,
        "type": "doc",
        "content": [... ]
    },
    "content": {
        "version": 1,
        "type": "doc",
        "content": [... ]
    },
    "postmortemId": "4e4b3a71-1fa4-47fb-9b27-23dcbde566a5",
    "title": "Incident - postmortem report",
    "severity": "P1",
    "status": "draft",
    "startTime": "2021-02-26T04:13:21.075Z",
    "endTime": "2021-02-26T04:13:27.757Z",
    "respondTime": "2021-02-26T04:13:27.947Z",
    "resolveTime": "2021-02-26T04:13:27.757Z",
    "createdAtTime": "2021-02-26T04:20:33.873Z",
    "rootIncident": {
        "metadataId": "2cdf7f15-e907-42d8-944c-6154b09d0c67",
        "id": "aff8a4f3-02fd-4146-b278-8e350e06202d",
        "priority": "P1",
        "tinyId": "3",
        "message": "Incident",
        "status": "closed",
        "creationTime": "2021-02-26T04:13:21.075Z",
        "tags": []
    },
    "owner": {
        "metadataId": "4a470fc3-2bda-45da-9eff-91723fe583ad",
        "id": "b75a117f-fe66-4321-bc69-1782e4b86c4d",
        "name": "John Doe"
    },
    "timeline": {
        "metadataId": "557db221-3cb1-4bdc-8256-16e5f6f40b8d",
        "id": "p_bc447472-2738-4eea-9fd5-351c8eebd7d2"
    },
    "jiraIssues": [],
    "relatedIncidents": [],
    "affectedServices": [],
    "iccSessions": [],
    "responderTeams": [],
    "responders": [],
    },
    "took": 0.202,
    "requestId": "507074c7-3515-4f68-a1ce-156fef84c4d7"
}

The keys executiveSummary and content are in Atlassian Document Format (ADF)

Create Postmortem Request

Create postmortem request is used to create a postmortem for an incident. The API key should have Write access right permissions. For more information, you can refer to API Access Management.

JSON Body Fields

FieldsMandatoryDescriptionDetails
incidentIdtrueThe id of the incident to create postmortem forString
actorUserIdtrueThe id of the user carrying out the creation of the postmortemString
ownerIdfalseThe id of the user who owns the postmortem. If ownerId is missing from the request the actorUserId will be assigned as the owner of the postmortemString

Sample Request

curl -X POST 'https://api.opsgenie.com/v2/postmortem'
    --header 'Authorization: GenieKey eb24alp-faa2-4ba2-a551q-1alpf565c889'
    --header 'Content-Type: application/json'
    --data
'{
    "incidentId" : "aff8a4f3-02fd-4146-b278-8e350e06202d",
    "actorUserId" : "b75a117f-fe66-4321-bc69-1782e4b86c4d",
    "ownerId" : "b75a117f-fe66-4321-bc69-1782e4b86c4d"
}'

Response

{
    "data": {
        "postmortemId": "c8e40431-c6cc-46e4-8a24-cf655e2e9c2b"
    },
    "took": 3.487,
    "requestId": "5804f9d9-4029-4fb5-96ea-b90bf8a39f5a"
}

Delete Postmortem Request

Delete postmortem request is used to delete postmortems in Opsgenie. The API key should have Delete access right permissions. For more information, you can refer to API Access Management.

JSON Body Fields

FieldsMandatoryDescriptionDefault
actorUserIdtrueUser ID of the user carrying out this actionNONE
deleteExportIncidentTimelinesfalseDelete the exported timeline to confluencefalse

Sample Request

curl -X DELETE  'https://api.opsgenie.com/v2/postmortem/4e4b3a71-1fa4-47fb-9b27-23dcbde566a5'
        -H "Content-Type: application/json"
    --header 'Authorization: GenieKey eb24brsfaa2-4ba2-a551q-1brsf565c889'
    --data
'{
    "actorUserId" : "b75a117f-fe66-4321-bc69-1782e4b86c4d",
    "deleteExportIncidentTimelines" : false
}'

Response

{
    "data": {
        "message": "Postmortem with id c9b6ad15-91fa-4e18-b7c2-221d686a67b5 deleted"
    },
    "took": 0.472,
    "requestId": "b221110f-e050-40fd-8575-414f49f6aeb2"
}

Update Postmortem Request

Update postmortem request is a write request. If the integration of the API key configured as read-only, the request will not be accepted. For more information, you can refer to API Access Management
Please note that postmortem that is already in published state cannot be updated. In order to update a published postmortem, the postmortem's status has to be changed to [draft or in-review] first.

JSON Body Fields

FieldsMandatoryDescription
actorUserIdtrueThe id of the user carrying out the updation of the postmortem
titletrueTitle of the postmortem
severitytrueSeverity of the postmortem. Allowed values [P1, P2, P3, P4, P5] with P1 being the highest severity and P5 being the lowest
statustrueStatus of the postmortem. Allowed values [draft, in-review, published]
ownerIdtrueThe id of the user whom the ownership of the postmortem should be changed to
jiraIssuestrueList of Jira software issue URLs
Detailed description at Update Postmortem Jira Issues Request
relatedIncidentIdstrueList of Incident IDs. For more information, you can refer Incident API
Detailed description at Update Postmortem Related Incidents Request
affectedServicestrueList of affected services. For more information, you can refer Service API
Detailed description at Update Postmortem Affected Services Request
responderTeamstrueList of Teams that will be added as responders to the postmortem. For more information, you can refer Team API
Detailed description at Update Postmortem Responder Teams Request
responderUserstrueList of Users that will be added as responders to the postmortem. For more information, you can refer User API and Custom User Role API
Detailed description at Update Postmortem Responder Users Request

Update Postmortem Status Request

Update postmortem status request is a write request. If the integration of the API key configured as read-only, the request will not be accepted. For more information, you can refer to API Access Management
Please note that postmortem that is already in published state cannot be updated. In order to update a published postmortem, the postmortem's status has to be changed to [draft or in-review] first.

JSON Body Fields

FieldMandatoryDescription
actorUserIdtrueThe id of the user carrying out the updation of the postmortem status
statustrueStatus of the postmortem. Allowed values [draft, in-review, published]

Update Postmortem Owner Request

Update postmortem owner request is a write request. If the integration of the API key configured as read-only, the request will not be accepted. For more information, you can refer to API Access Management
Please note that postmortem that is already in published state cannot be updated. In order to update a published postmortem, the postmortem's status has to be changed to [draft or in-review] first.

JSON Body Fields

FieldsMandatoryDescription
ownerIdtrueThe id of the user whom the ownership of the postmortem should be changed to

Update Postmortem Severity Request

Update postmortem severity request is a write request. If the integration of the API key configured as read-only, the request will not be accepted. For more information, you can refer to API Access Management
Please note that postmortem that is already in published state cannot be updated. In order to update a published postmortem, the postmortem's status has to be changed to [draft or in-review] first.

JSON Body Fields

FieldsMandatoryDescription
severitytrueSeverity of the postmortem. Allowed values [P1, P2, P3, P4, P5] with P1 being the highest severity and P5 being the lowest

Update Postmortem Title Request

Update postmortem title request is a write request. If the integration of the API key configured as read-only, the request will not be accepted. For more information, you can refer to API Access Management
Please note that postmortem that is already in published state cannot be updated. In order to update a published postmortem, the postmortem's status has to be changed to [draft or in-review] first.

JSON Body Fields

FieldsMandatoryDescription
titletrueTitle of the postmortem

Update Postmortem Jira Issues Request

Update postmortem jira issues request is a write request. If the integration of the API key configured as read-only, the request will not be accepted. For more information, you can refer to API Access Management
Please note that postmortem that is already in published state cannot be updated. In order to update a published postmortem, the postmortem's status has to be changed to [draft or in-review] first.

JSON Body Fields

FieldsMandatoryDescription
jiraIssuestrueList of Jira software issue URLs

jiraIssues field example

{
  jiraIssues: [
    "https://atlantis.atlassian.net/browse/TRIDENT-101",
    "https://atlantis.atlassian.net/browse/TRIDENT-102"
  ]
}

Update Postmortem Related Incidents Request

Update postmortem related incidents request is a write request. If the integration of the API key configured as read-only, the request will not be accepted. For more information, you can refer to API Access Management
Please note that postmortem that is already in published state cannot be updated. In order to update a published postmortem, the postmortem's status has to be changed to [draft or in-review] first.

JSON Body Fields

FieldsMandatoryDescription
relatedIncidentIdstrueList of Incident IDs. For more information, you can refer Incident API

relatedIncidentIds field example

{
  relatedIncidentIds: [
    "4513b7ea-3b91-438f-b7e4-e3e54af9147c",
    "bb4d9938-c3c2-455d-aaab-727aa701c0d8"
  ]
}

Update Postmortem Affected Services Request

Update postmortem affected services request is a write request. If the integration of the API key configured as read-only, the request will not be accepted. For more information, you can refer to API Access Management
Please note that postmortem that is already in published state cannot be updated. In order to update a published postmortem, the postmortem's status has to be changed to [draft or in-review] first.

JSON Body Fields

FieldsMandatoryDescription
affectedServicestrueList of affected services. For more information, you can refer Service API

relatedIncidentIds field example

{
  affectedServices: [
    {
      "name": "Service 1",
      "id": "fc1448b7-46b2-401d-9df8-c02675958e3b"
    },
    {
      "name": "Service 2",
      "id": "fe954a67-813e-4356-87dc-afed1eec6b66"
    }
  ]
}

Update Postmortem Responder Teams Request

Update postmortem responder teams request is a write request. If the integration of the API key configured as read-only, the request will not be accepted. For more information, you can refer to API Access Management
Please note that postmortem that is already in published state cannot be updated. In order to update a published postmortem, the postmortem's status has to be changed to [draft or in-review] first.

JSON Body Fields

FieldsMandatoryDescription
responderTeamstrueList of Teams that will be added as responders to the postmortem. For more information, you can refer Team API

responderTeams field example

{
  responderTeams: [
    {
      "name": "Team 1",
      "id": "fc1448b7-46b2-401d-9df8-c02675958e3b"
    },
    {
      "name": "Team 2",
      "id": "fe954a67-813e-4356-87dc-afed1eec6b66"
    }
  ]
}

Update Postmortem Responder Users Request

Update postmortem responder users request is a write request. If the integration of the API key configured as read-only, the request will not be accepted. For more information, you can refer to API Access Management
Please note that postmortem that is already in published state cannot be updated. In order to update a published postmortem, the postmortem's status has to be changed to [draft or in-review] first.

JSON Body Fields

FieldsMandatoryDescription
responderUserstrueList of Users that will be added as responders to the postmortem. For more information, you can refer User API and Custom User Role API

responderUsers field example

{
  responderUsers: [
    {
      "name": "User 1",
      "id": "fc1448b7-46b2-401d-9df8-c02675958e3b",
      "role": "Incident Commander"
    },
    {
      "name": "User 2",
      "id": "fe954a67-813e-4356-87dc-afed1eec6b66",
      "role": "Communication Officer"
    }
  ]
}

Update Postmortem Content

Update postmortem content request is a write request. If the integration of the API key configured as read-only, the request will not be accepted. For more information, you can refer to API Access Management
Please note that postmortem that is already in published state cannot be updated. In order to update a published postmortem, the postmortem's status has to be changed to [draft or in-review] first.

JSON Body Fields

FieldsMandatoryDescription
contenttrueJson serialized string in Atlassian Document Format (ADF)
typetrueContent type. Allowed values [adf]

Fields example

{
  type:"adf",
  content: "{\"version\":1,\"type\":\"doc\",\"content\":[{\"type\":\"heading\",\"attrs\":{\"level\":4},\"content\":[{\"type\":\"text\",\"text\":\"Leadup\"}]},{\"type\":\"paragraph\",\"content\":[{\"type\":\"text\",\"text\":\"Describe the circumstances that led to this incident\",\"marks\":[{\"type\":\"textColor\",\"attrs\":{\"color\":\"#7a869a\"}}]},{\"type\":\"hardBreak\"}]},{\"type\":\"heading\",\"attrs\":{\"level\":4},\"content\":[{\"type\":\"text\",\"text\":\"Fault\"}]},{\"type\":\"paragraph\",\"content\":[{\"type\":\"text\",\"text\":\"Describe what failed to work as expected\",\"marks\":[{\"type\":\"textColor\",\"attrs\":{\"color\":\"#7a869a\"}}]},{\"type\":\"hardBreak\"}]},{\"type\":\"heading\",\"attrs\":{\"level\":4},\"content\":[{\"type\":\"text\",\"text\":\"Detection\"}]},{\"type\":\"paragraph\",\"content\":[{\"type\":\"text\",\"text\":\"Describe how the incident was detected\",\"marks\":[{\"type\":\"textColor\",\"attrs\":{\"color\":\"#7a869a\"}}]},{\"type\":\"hardBreak\"}]},{\"type\":\"heading\",\"attrs\":{\"level\":4},\"content\":[{\"type\":\"text\",\"text\":\"Root causes\"}]},{\"type\":\"paragraph\",\"content\":[{\"type\":\"text\",\"text\":\"Run a 5-whys analysis to understand the true causes of the incident\",\"marks\":[{\"type\":\"textColor\",\"attrs\":{\"color\":\"#7a869a\"}}]}]}]}"
}

Update Postmortem Executive Summary

Update postmortem executive summary request is a write request. If the integration of the API key configured as read-only, the request will not be accepted. For more information, you can refer to API Access Management
Please note that postmortem that is already in published state cannot be updated. In order to update a published postmortem, the postmortem's status has to be changed to [draft or in-review] first.

JSON Body Fields

FieldsMandatoryDescription
executiveSummarytrueJson serialized string in Atlassian Document Format (ADF)
typetrueExecutive Summary content type. Allowed values [adf]

Fields example

{
  type: "adf",
  executiveSummary: "{\"version\":1,\"type\":\"doc\",\"content\":[{\"type\":\"paragraph\",\"content\":[{\"type\":\"text\",\"text\":\"Executive summary\",\"marks\":[{\"type\":\"strong\"}]}]}]}"
}