---
title: Créer une pièce jointe post-mortem
description: Créer une pièce jointe de post-mortem pour un incident.
breadcrumbs: Documentation > API > Créer une pièce jointe post-mortem
---

> For the complete documentation index, see [llms.txt](https://dnd37xeb23o8n.cloudfront.net/jen.gilbert/astro-base/llms.txt).

# Créer une pièce jointe post-mortem

## v2 (latest)

{% alert level="warning" %}
**Note**: This endpoint is in public beta and it's subject to change.
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help.md).
{% /alert %}

| Datadog site      | API endpoint                                                                              |
| ----------------- | ----------------------------------------------------------------------------------------- |
| app.datadoghq.com | POST https://api.datadoghq.com/api/v2/incidents/{incident_id}/attachments/postmortems     |
| us3.datadoghq.com | POST https://api.us3.datadoghq.com/api/v2/incidents/{incident_id}/attachments/postmortems |
| us5.datadoghq.com | POST https://api.us5.datadoghq.com/api/v2/incidents/{incident_id}/attachments/postmortems |
| app.datadoghq.eu  | POST https://api.datadoghq.eu/api/v2/incidents/{incident_id}/attachments/postmortems      |
| ap1.datadoghq.com | POST https://api.ap1.datadoghq.com/api/v2/incidents/{incident_id}/attachments/postmortems |
| ap2.datadoghq.com | POST https://api.ap2.datadoghq.com/api/v2/incidents/{incident_id}/attachments/postmortems |
| uk1.datadoghq.com | POST https://api.uk1.datadoghq.com/api/v2/incidents/{incident_id}/attachments/postmortems |
| app.ddog-gov.com  | POST https://api.ddog-gov.com/api/v2/incidents/{incident_id}/attachments/postmortems      |
| us2.ddog-gov.com  | POST https://api.us2.ddog-gov.com/api/v2/incidents/{incident_id}/attachments/postmortems  |

### Overview

Créer une pièce jointe de post-mortem pour un incident.

L'endpoint accepte le format Markdown pour les notebooks créés dans Confluence ou Google Docs.
Les post-mortems créés à partir de notebooks doivent être formatés à l'aide de cellules de notebook frontend,
en plus du format Markdown.

### Arguments

#### Path Parameters

| Field                    | Type   | Description            |
| ------------------------ | ------ | ---------------------- |
| incident_id [*required*] | string | The ID of the incident |

### Request

#### Body Data (required)

{% tabs %}
{% tab label="Model" %}
| Parent field | Field                   | Type     | Description                                                                                                          |
| ------------ | ----------------------- | -------- | -------------------------------------------------------------------------------------------------------------------- |
|              | data [*required*]       | object   |                                                                                                                      |
| data         | attributes [*required*] | object   | Postmortem attachment attributes                                                                                     |
| attributes   | cells                   | [object] | The cells of the postmortem                                                                                          |
| cells        | attributes              | object   | Attributes of a postmortem cell                                                                                      |
| attributes   | definition              | object   | Definition of a postmortem cell                                                                                      |
| definition   | content                 | string   | The content of the cell in markdown format                                                                           |
| cells        | id                      | string   | The unique identifier of the cell                                                                                    |
| cells        | type                    | enum     | The postmortem cell resource type. Allowed enum values: `markdown`.                                                  |
| attributes   | content                 | string   | The content of the postmortem                                                                                        |
| attributes   | postmortem_template_id  | string   | The ID of the postmortem template                                                                                    |
| attributes   | title                   | string   | The title of the postmortem                                                                                          |
| data         | type [*required*]       | enum     | The incident attachment resource type. Allowed enum values: `incident_attachments`. Default: `incident_attachments`. |
{% /tab %}

{% tab label="Example" %}
```json
{
  "data": {
    "attributes": {
      "cells": [
        {
          "attributes": {
            "definition": {
              "content": "## Incident Summary\nThis incident was caused by..."
            }
          },
          "id": "cell-1",
          "type": "markdown"
        }
      ],
      "content": "# Incident Report - IR-123\n[...]",
      "postmortem_template_id": "93645509-874e-45c4-adfa-623bfeaead89-123",
      "title": "Postmortem-IR-123"
    },
    "type": "incident_attachments"
  }
}
```
{% /tab %}
{% /tabs %}

### Response

{% tabs %}
{% tab label="201" %}
Created

{% tabs %}
{% tab label="Model" %}
An attachment response containing the attachment data and related objects.

| Parent field          | Field                      | Type      | Description                                                                                                          |
| --------------------- | -------------------------- | --------- | -------------------------------------------------------------------------------------------------------------------- |
|                       | data                       | object    | Attachment data from a response.                                                                                     |
| data                  | attributes [*required*]    | object    | The attachment's attributes.                                                                                         |
| attributes            | attachment                 | object    | The attachment object.                                                                                               |
| attachment            | documentUrl                | string    | The URL of the attachment.                                                                                           |
| attachment            | title                      | string    | The title of the attachment.                                                                                         |
| attributes            | attachment_type            | enum      | The type of the attachment. Allowed enum values: `postmortem`, `link`.                                               |
| attributes            | modified                   | date-time | Timestamp when the attachment was last modified.                                                                     |
| data                  | id [*required*]            | string    | The unique identifier of the attachment.                                                                             |
| data                  | relationships [*required*] | object    | The attachment's resource relationships.                                                                             |
| relationships         | incident                   | object    | Relationship to incident.                                                                                            |
| incident              | data [*required*]          | object    | Relationship to incident object.                                                                                     |
| data                  | id [*required*]            | string    | A unique identifier that represents the incident.                                                                    |
| data                  | type [*required*]          | enum      | Incident resource type. Allowed enum values: `incidents`. Default: `incidents`.                                      |
| relationships         | last_modified_by_user      | object    | Relationship to user.                                                                                                |
| last_modified_by_user | data [*required*]          | object    | Relationship to user object.                                                                                         |
| data                  | id [*required*]            | string    | A unique identifier that represents the user.                                                                        |
| data                  | type [*required*]          | enum      | Users resource type. Allowed enum values: `users`. Default: `users`.                                                 |
| data                  | type [*required*]          | enum      | The incident attachment resource type. Allowed enum values: `incident_attachments`. Default: `incident_attachments`. |
|                       | included                   | [<oneOf>] | A list of related objects included in the response.                                                                  |
| included              | <type=users>               | object    | User object returned by the API.                                                                                     |
| <type=users>          | attributes                 | object    | Attributes of user object returned by the API.                                                                       |
| attributes            | email                      | string    | Email of the user.                                                                                                   |
| attributes            | handle                     | string    | Handle of the user.                                                                                                  |
| attributes            | icon                       | string    | URL of the user's icon.                                                                                              |
| attributes            | name                       | string    | Name of the user.                                                                                                    |
| attributes            | uuid                       | string    | UUID of the user.                                                                                                    |
| <type=users>          | id                         | string    | ID of the user.                                                                                                      |
| <type=users>          | type                       | enum      | Users resource type. Allowed enum values: `users`. Default: `users`.                                                 |
{% /tab %}

{% tab label="Example" %}
```json
{
  "data": {
    "attributes": {
      "attachment": {
        "documentUrl": "https://app.datadoghq.com/notebook/123/Postmortem-IR-123",
        "title": "Postmortem IR-123"
      },
      "attachment_type": "postmortem",
      "modified": "2025-01-01T01:01:01.000000001Z"
    },
    "id": "00000000-abcd-0002-0000-000000000000",
    "relationships": {
      "incident": {
        "data": {
          "id": "00000000-0000-0000-1234-000000000000",
          "type": "incidents"
        }
      },
      "last_modified_by_user": {
        "data": {
          "id": "00000000-0000-0000-2345-000000000000",
          "type": "users"
        }
      }
    },
    "type": "incident_attachments"
  },
  "included": [
    {
      "attributes": {
        "email": "string",
        "handle": "string",
        "icon": "string",
        "name": "string",
        "uuid": "string"
      },
      "id": "string",
      "type": "users"
    }
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="400" %}
Bad Request

{% tabs %}
{% tab label="Model" %}
API error response.

| Parent field | Field               | Type     | Description                                                                     |
| ------------ | ------------------- | -------- | ------------------------------------------------------------------------------- |
|              | errors [*required*] | [object] | A list of errors.                                                               |
| errors       | detail              | string   | A human-readable explanation specific to this occurrence of the error.          |
| errors       | meta                | object   | Non-standard meta-information about the error                                   |
| errors       | source              | object   | References to the source of the error.                                          |
| source       | header              | string   | A string indicating the name of a single request header which caused the error. |
| source       | parameter           | string   | A string indicating which URI query parameter caused the error.                 |
| source       | pointer             | string   | A JSON pointer to the value in the request document that caused the error.      |
| errors       | status              | string   | Status code of the response.                                                    |
| errors       | title               | string   | Short human-readable summary of the error.                                      |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    {
      "detail": "Missing required attribute in body",
      "meta": {},
      "source": {
        "header": "Authorization",
        "parameter": "limit",
        "pointer": "/data/attributes/title"
      },
      "status": "400",
      "title": "Bad Request"
    }
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="429" %}
Too many requests

{% tabs %}
{% tab label="Model" %}
API error response.

| Field               | Type     | Description       |
| ------------------- | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    "Bad Request"
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}
{% /tabs %}

### Code Example

{% tabs %}
{% tab label="Curl" %}
```bash
# Path parameters
export incident_id="00000000-0000-0000-0000-000000000000"

# Set your Datadog site and credentials
export DD_SITE="datadoghq.com" # Or us3.datadoghq.com, us5.datadoghq.com, datadoghq.eu, ap1.datadoghq.com, ap2.datadoghq.com, uk1.datadoghq.com, ddog-gov.com, us2.ddog-gov.com
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/incidents/${incident_id}/attachments/postmortems" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "cells": [
        {
          "id": "cell-1",
          "type": "markdown"
        }
      ],
      "content": "# Incident Report - IR-123\n[...]",
      "postmortem_template_id": "93645509-874e-45c4-adfa-623bfeaead89-123",
      "title": "Postmortem-IR-123"
    },
    "type": "incident_attachments"
  }
}
EOF
```
{% /tab %}

{% tab label="Go" %}
```go
// Create postmortem attachment returns "Created" response

package main

import (
	"context"
	"encoding/json"
	"fmt"
	"os"

	"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
	"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
)

func main() {
	body := datadogV2.PostmortemAttachmentRequest{
		Data: datadogV2.PostmortemAttachmentRequestData{
			Attributes: datadogV2.PostmortemAttachmentRequestAttributes{
				Cells: []datadogV2.PostmortemCell{
					{
						Attributes: &datadogV2.PostmortemCellAttributes{
							Definition: &datadogV2.PostmortemCellDefinition{
								Content: datadog.PtrString(`## Incident Summary
This incident was caused by...`),
							},
						},
						Id:   datadog.PtrString("cell-1"),
						Type: datadogV2.POSTMORTEMCELLTYPE_MARKDOWN.Ptr(),
					},
				},
				Content: datadog.PtrString(`# Incident Report - IR-123
[...]`),
				PostmortemTemplateId: datadog.PtrString("93645509-874e-45c4-adfa-623bfeaead89-123"),
				Title:                datadog.PtrString("Postmortem-IR-123"),
			},
			Type: datadogV2.INCIDENTATTACHMENTTYPE_INCIDENT_ATTACHMENTS,
		},
	}
	ctx := datadog.NewDefaultContext(context.Background())
	ctx = context.WithValue(ctx, datadog.ContextAccessToken, os.Getenv("DD_BEARER_TOKEN"))
	configuration := datadog.NewConfiguration()
	configuration.SetUnstableOperationEnabled("v2.CreateIncidentPostmortemAttachment", true)
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewIncidentsApi(apiClient)
	resp, r, err := api.CreateIncidentPostmortemAttachment(ctx, "00000000-0000-0000-0000-000000000000", body)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `IncidentsApi.CreateIncidentPostmortemAttachment`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `IncidentsApi.CreateIncidentPostmortemAttachment`:\n%s\n", responseContent)
}
```

#### Instructions

First [install the library and its dependencies](https://dnd37xeb23o8n.cloudfront.net/api/latest.md?code-lang=go) and then save the example to `main.go` and run following commands:

```bash
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"
```
{% /tab %}

{% tab label="Java" %}
```java
// Create postmortem attachment returns "Created" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.IncidentsApi;
import com.datadog.api.client.v2.model.Attachment;
import com.datadog.api.client.v2.model.IncidentAttachmentType;
import com.datadog.api.client.v2.model.PostmortemAttachmentRequest;
import com.datadog.api.client.v2.model.PostmortemAttachmentRequestAttributes;
import com.datadog.api.client.v2.model.PostmortemAttachmentRequestData;
import com.datadog.api.client.v2.model.PostmortemCell;
import com.datadog.api.client.v2.model.PostmortemCellAttributes;
import com.datadog.api.client.v2.model.PostmortemCellDefinition;
import com.datadog.api.client.v2.model.PostmortemCellType;
import java.util.Collections;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN"));
    defaultClient.setUnstableOperationEnabled("v2.createIncidentPostmortemAttachment", true);
    IncidentsApi apiInstance = new IncidentsApi(defaultClient);

    PostmortemAttachmentRequest body =
        new PostmortemAttachmentRequest()
            .data(
                new PostmortemAttachmentRequestData()
                    .attributes(
                        new PostmortemAttachmentRequestAttributes()
                            .cells(
                                Collections.singletonList(
                                    new PostmortemCell()
                                        .attributes(
                                            new PostmortemCellAttributes()
                                                .definition(
                                                    new PostmortemCellDefinition()
                                                        .content(
                                                            """
## Incident Summary
This incident was caused by...
""")))
                                        .id("cell-1")
                                        .type(PostmortemCellType.MARKDOWN)))
                            .content("""
# Incident Report - IR-123
[...]
""")
                            .postmortemTemplateId("93645509-874e-45c4-adfa-623bfeaead89-123")
                            .title("Postmortem-IR-123"))
                    .type(IncidentAttachmentType.INCIDENT_ATTACHMENTS));

    try {
      Attachment result =
          apiInstance.createIncidentPostmortemAttachment(
              "00000000-0000-0000-0000-000000000000", body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling IncidentsApi#createIncidentPostmortemAttachment");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}
```

#### Instructions

First [install the library and its dependencies](https://dnd37xeb23o8n.cloudfront.net/api/latest.md?code-lang=java) and then save the example to `Example.java` and run following commands:

```bash
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"
```
{% /tab %}

{% tab label="Python" %}
```python
"""
Create postmortem attachment returns "Created" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.incidents_api import IncidentsApi
from datadog_api_client.v2.model.incident_attachment_type import IncidentAttachmentType
from datadog_api_client.v2.model.postmortem_attachment_request import PostmortemAttachmentRequest
from datadog_api_client.v2.model.postmortem_attachment_request_attributes import PostmortemAttachmentRequestAttributes
from datadog_api_client.v2.model.postmortem_attachment_request_data import PostmortemAttachmentRequestData
from datadog_api_client.v2.model.postmortem_cell import PostmortemCell
from datadog_api_client.v2.model.postmortem_cell_attributes import PostmortemCellAttributes
from datadog_api_client.v2.model.postmortem_cell_definition import PostmortemCellDefinition
from datadog_api_client.v2.model.postmortem_cell_type import PostmortemCellType

body = PostmortemAttachmentRequest(
    data=PostmortemAttachmentRequestData(
        attributes=PostmortemAttachmentRequestAttributes(
            cells=[
                PostmortemCell(
                    attributes=PostmortemCellAttributes(
                        definition=PostmortemCellDefinition(
                            content="## Incident Summary\nThis incident was caused by...",
                        ),
                    ),
                    id="cell-1",
                    type=PostmortemCellType.MARKDOWN,
                ),
            ],
            content="# Incident Report - IR-123\n[...]",
            postmortem_template_id="93645509-874e-45c4-adfa-623bfeaead89-123",
            title="Postmortem-IR-123",
        ),
        type=IncidentAttachmentType.INCIDENT_ATTACHMENTS,
    ),
)

configuration = Configuration()
configuration.access_token = environ["DD_BEARER_TOKEN"]
configuration.unstable_operations["create_incident_postmortem_attachment"] = True
with ApiClient(configuration) as api_client:
    api_instance = IncidentsApi(api_client)
    response = api_instance.create_incident_postmortem_attachment(
        incident_id="00000000-0000-0000-0000-000000000000", body=body
    )

    print(response)
```

#### Instructions

First [install the library and its dependencies](https://dnd37xeb23o8n.cloudfront.net/api/latest.md?code-lang=python) and then save the example to `example.py` and run following commands:

```bash
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"
```
{% /tab %}

{% tab label="Ruby" %}
```ruby
# Create postmortem attachment returns "Created" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
  config.access_token = ENV["DD_BEARER_TOKEN"]
  config.unstable_operations["v2.create_incident_postmortem_attachment".to_sym] = true
end
api_instance = DatadogAPIClient::V2::IncidentsAPI.new

body = DatadogAPIClient::V2::PostmortemAttachmentRequest.new({
  data: DatadogAPIClient::V2::PostmortemAttachmentRequestData.new({
    attributes: DatadogAPIClient::V2::PostmortemAttachmentRequestAttributes.new({
      cells: [
        DatadogAPIClient::V2::PostmortemCell.new({
          attributes: DatadogAPIClient::V2::PostmortemCellAttributes.new({
            definition: DatadogAPIClient::V2::PostmortemCellDefinition.new({
              content: '## Incident Summary\nThis incident was caused by...',
            }),
          }),
          id: "cell-1",
          type: DatadogAPIClient::V2::PostmortemCellType::MARKDOWN,
        }),
      ],
      content: '# Incident Report - IR-123\n[...]',
      postmortem_template_id: "93645509-874e-45c4-adfa-623bfeaead89-123",
      title: "Postmortem-IR-123",
    }),
    type: DatadogAPIClient::V2::IncidentAttachmentType::INCIDENT_ATTACHMENTS,
  }),
})
p api_instance.create_incident_postmortem_attachment("00000000-0000-0000-0000-000000000000", body)
```

#### Instructions

First [install the library and its dependencies](https://dnd37xeb23o8n.cloudfront.net/api/latest.md?code-lang=ruby) and then save the example to `example.rb` and run following commands:

```bash
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"
```
{% /tab %}

{% tab label="Rust" %}
```rust
// Create postmortem attachment returns "Created" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_incidents::IncidentsAPI;
use datadog_api_client::datadogV2::model::IncidentAttachmentType;
use datadog_api_client::datadogV2::model::PostmortemAttachmentRequest;
use datadog_api_client::datadogV2::model::PostmortemAttachmentRequestAttributes;
use datadog_api_client::datadogV2::model::PostmortemAttachmentRequestData;
use datadog_api_client::datadogV2::model::PostmortemCell;
use datadog_api_client::datadogV2::model::PostmortemCellAttributes;
use datadog_api_client::datadogV2::model::PostmortemCellDefinition;
use datadog_api_client::datadogV2::model::PostmortemCellType;

#[tokio::main]
async fn main() {
    let body = PostmortemAttachmentRequest::new(PostmortemAttachmentRequestData::new(
        PostmortemAttachmentRequestAttributes::new()
            .cells(vec![PostmortemCell::new()
                .attributes(
                    PostmortemCellAttributes::new().definition(
                        PostmortemCellDefinition::new().content(
                            r#"## Incident Summary
This incident was caused by..."#
                                .to_string(),
                        ),
                    ),
                )
                .id("cell-1".to_string())
                .type_(PostmortemCellType::MARKDOWN)])
            .content(
                r#"# Incident Report - IR-123
[...]"#
                    .to_string(),
            )
            .postmortem_template_id("93645509-874e-45c4-adfa-623bfeaead89-123".to_string())
            .title("Postmortem-IR-123".to_string()),
        IncidentAttachmentType::INCIDENT_ATTACHMENTS,
    ));
    let mut configuration = datadog::Configuration::new();
    configuration.set_unstable_operation_enabled("v2.create_incident_postmortem_attachment", true);
    let api = IncidentsAPI::with_config(configuration);
    let resp = api
        .create_incident_postmortem_attachment(
            "00000000-0000-0000-0000-000000000000".to_string(),
            body,
        )
        .await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}
```

#### Instructions

First [install the library and its dependencies](https://dnd37xeb23o8n.cloudfront.net/api/latest.md?code-lang=rust) and then save the example to `src/main.rs` and run following commands:

```bash
DD_SITE="datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo run
```
{% /tab %}

{% tab label="TypeScript" %}
```typescript
/**
 * Create postmortem attachment returns "Created" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration({
  authMethods: {
    AuthZ: {
      accessToken: process.env.DD_BEARER_TOKEN as string,
    },
  },
});
configuration.unstableOperations["v2.createIncidentPostmortemAttachment"] =
  true;
const apiInstance = new v2.IncidentsApi(configuration);

const params: v2.IncidentsApiCreateIncidentPostmortemAttachmentRequest = {
  body: {
    data: {
      attributes: {
        cells: [
          {
            attributes: {
              definition: {
                content: "## Incident Summary\nThis incident was caused by...",
              },
            },
            id: "cell-1",
            type: "markdown",
          },
        ],
        content: "# Incident Report - IR-123\n[...]",
        postmortemTemplateId: "93645509-874e-45c4-adfa-623bfeaead89-123",
        title: "Postmortem-IR-123",
      },
      type: "incident_attachments",
    },
  },
  incidentId: "00000000-0000-0000-0000-000000000000",
};

apiInstance
  .createIncidentPostmortemAttachment(params)
  .then((data: v2.Attachment) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));
```

#### Instructions

First [install the library and its dependencies](https://dnd37xeb23o8n.cloudfront.net/api/latest.md?code-lang=typescript) and then save the example to `example.ts` and run following commands:

```bash
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"
```
{% /tab %}
{% /tabs %}
