# Document

Document messages are messages that display a document icon, linked to a document, that a WhatsApp user can tap to download.

![](https://3527970750-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M4sMxKjL6eJRvZn6jeG-887967055%2Fuploads%2FSWbnZm1K6CwqTLW2aKWV%2FDocument.png?alt=media\&token=e9410ec6-8a90-4f9b-954d-81b5a95e49fd)

### Document Message Request

<mark style="color:orange;">`POST`</mark> `https://waba-v2.360dialog.io/messages`

Use the messages endpoint to send a document message to a WhatsApp user.

**Headers**

| Name          | Value              |
| ------------- | ------------------ |
| Content-Type  | `application/json` |
| Authorization | `D360-API-KEY`     |

**Body Example**

```json
{
  "messaging_product": "whatsapp",
  "recipient_type": "individual",
  "to": "<WHATSAPP_USER_PHONE_NUMBER>",
  "type": "document",
  "document": {
    "id": "<MEDIA_ID>", <!-- Only if using uploaded media -->
    "link": "<MEDIA_URL>", <!-- Only if using hosted media (not recommended) -->
    "caption": "<MEDIA_CAPTION_TEXT>",
    "filename": "<MEDIA_FILENAME>",
    "caption": "<MEDIA_CAPTION_TEXT>"
  }
}
```

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
  "contacts": [
    {
      "input": "text",
      "wa_id": "text"
    }
  ],
  "messages": [
    {
      "id": "text",
      "message_status": "accepted"
    }
  ],
  "messaging_product": "text"
}
```

{% endtab %}

{% tab title="400" %}

```json
{
  "error": "Invalid request"
}
```

{% endtab %}
{% endtabs %}

### Supported document types

| Text                 | .txt  | text/plain                                                                | 100 MB |
| -------------------- | ----- | ------------------------------------------------------------------------- | ------ |
| Microsoft Excel      | .xls  | application/vnd.ms-excel                                                  | 100 MB |
| Microsoft Excel      | .xlsx | application/vnd.openxmlformats-officedocument.spreadsheetml.sheet         | 100 MB |
| Microsoft Word       | .doc  | application/msword                                                        | 100 MB |
| Microsoft Word       | .docx | application/vnd.openxmlformats-officedocument.wordprocessingml.document   | 100 MB |
| Microsoft PowerPoint | .ppt  | application/vnd.ms-powerpoint                                             | 100 MB |
| Microsoft PowerPoint | .pptx | application/vnd.openxmlformats-officedocument.presentationml.presentation | 100 MB |
| PDF                  | .pdf  | application/pdf                                                           | 100 MB |

Only the above listed document types are officially supported and guaranteed to display correctly in the WhatsApp client. Other file types may be sent via the API, but they are not supported and may not be handled as expected.
