---
title: Get an AI-generated incident postmortem
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: Docs > API Reference > Incidents
---

> For the complete documentation index, see [llms.txt](https://docs.datadoghq.com/llms.txt).

# Get an AI-generated incident postmortem{% #get-an-ai-generated-incident-postmortem %}
Copy pageCopied
{% tab title="v2" %}
**Note**: This endpoint is in preview and is subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).
| Datadog site      | API endpoint                                                                    |
| ----------------- | ------------------------------------------------------------------------------- |
| ap1.datadoghq.com | POST https://api.ap1.datadoghq.com/api/v2/incidents/{incident_id}/ai/postmortem |
| ap2.datadoghq.com | POST https://api.ap2.datadoghq.com/api/v2/incidents/{incident_id}/ai/postmortem |
| app.datadoghq.eu  | POST https://api.datadoghq.eu/api/v2/incidents/{incident_id}/ai/postmortem      |
| app.ddog-gov.com  | POST https://api.ddog-gov.com/api/v2/incidents/{incident_id}/ai/postmortem      |
| us2.ddog-gov.com  | POST https://api.us2.ddog-gov.com/api/v2/incidents/{incident_id}/ai/postmortem  |
| uk1.datadoghq.com | POST https://api.uk1.datadoghq.com/api/v2/incidents/{incident_id}/ai/postmortem |
| app.datadoghq.com | POST https://api.datadoghq.com/api/v2/incidents/{incident_id}/ai/postmortem     |
| us3.datadoghq.com | POST https://api.us3.datadoghq.com/api/v2/incidents/{incident_id}/ai/postmortem |
| us5.datadoghq.com | POST https://api.us5.datadoghq.com/api/v2/incidents/{incident_id}/ai/postmortem |

### Overview

Generate an AI postmortem for an incident. This endpoint requires the `incident_write` permission.

OAuth apps require the `incident_write` authorization [scope](https://docs.datadoghq.com/api/latest/scopes.md#incidents) to access this endpoint.



### Arguments

#### Path Parameters

| Name                          | Type   | Description               |
| ----------------------------- | ------ | ------------------------- |
| incident_id [*required*] | string | The UUID of the incident. |

### Response

{% tab title="200" %}
OK
{% tab title="Model" %}
Response with an AI-generated incident postmortem.

| Parent field | Field                        | Type   | Description                                                                                      |
| ------------ | ---------------------------- | ------ | ------------------------------------------------------------------------------------------------ |
|              | data [*required*]       | object | AI postmortem data in a response.                                                                |
| data         | attributes [*required*] | object | Attributes of an AI-generated incident postmortem.                                               |
| attributes   | action_items                 | string | Action items to prevent recurrence.                                                              |
| attributes   | customer_impact              | string | The impact of the incident on customers.                                                         |
| attributes   | executive_summary            | string | An executive summary of the incident.                                                            |
| attributes   | key_timeline                 | string | Key timeline events during the incident.                                                         |
| attributes   | lessons_learned              | string | Lessons learned from the incident.                                                               |
| attributes   | system_overview              | string | An overview of the affected systems.                                                             |
| data         | id [*required*]         | uuid   | The incident identifier.                                                                         |
| data         | type [*required*]       | enum   | AI postmortem response resource type. Allowed enum values: `get_incident_ai_postmortem_response` |

{% /tab %}

{% tab title="Example" %}

```json
{
  "data": {
    "attributes": {
      "action_items": "1. Improve failover testing. 2. Add more monitoring alerts.",
      "customer_impact": "5% of users experienced timeouts for 30 minutes.",
      "executive_summary": "A database failover caused a 30-minute service outage affecting 5% of users.",
      "key_timeline": "10:00 - Alert fired. 10:05 - On-call engineer paged. 10:30 - Issue resolved.",
      "lessons_learned": "We need to test the failover process under realistic load conditions.",
      "system_overview": "The primary database cluster experienced a failover event."
    },
    "id": "00000000-0000-0000-0000-000000000000",
    "type": "get_incident_ai_postmortem_response"
  }
}
```

{% /tab %}

{% /tab %}

{% tab title="400" %}
Bad Request
{% tab title="Model" %}
API error response.

| Field                    | Type     | Description       |
| ------------------------ | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |

{% /tab %}

{% tab title="Example" %}

```json
{
  "errors": [
    "Bad Request"
  ]
}
```

{% /tab %}

{% /tab %}

{% tab title="401" %}
Unauthorized
{% tab title="Model" %}
API error response.

| Field                    | Type     | Description       |
| ------------------------ | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |

{% /tab %}

{% tab title="Example" %}

```json
{
  "errors": [
    "Bad Request"
  ]
}
```

{% /tab %}

{% /tab %}

{% tab title="403" %}
Forbidden
{% tab title="Model" %}
API error response.

| Field                    | Type     | Description       |
| ------------------------ | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |

{% /tab %}

{% tab title="Example" %}

```json
{
  "errors": [
    "Bad Request"
  ]
}
```

{% /tab %}

{% /tab %}

{% tab title="404" %}
Not Found
{% tab title="Model" %}
API error response.

| Field                    | Type     | Description       |
| ------------------------ | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |

{% /tab %}

{% tab title="Example" %}

```json
{
  "errors": [
    "Bad Request"
  ]
}
```

{% /tab %}

{% /tab %}

{% tab title="429" %}
Too many requests
{% tab title="Model" %}
API error response.

| Field                    | Type     | Description       |
| ------------------------ | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |

{% /tab %}

{% tab title="Example" %}

```json
{
  "errors": [
    "Bad Request"
  ]
}
```

{% /tab %}

{% /tab %}

### Code Example

##### 
                  \# Path parameters export incident_id="CHANGE_ME" \# Curl command curl -X POST "https://api.datadoghq.com/api/v2/incidents/${incident_id}/ai/postmortem" \
-H "Accept: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_APP_KEY}" 
                
{% /tab %}
