Skip to content

Document Messages

Document message using type: "document" with object document. Like images, documents can be sent via Public URL (link) or media ID (id).

{
"messaging_product": "whatsapp",
"to": "6281234567890",
"type": "document",
"document": {
"link": "https://example.com/invoice-12345.pdf",
"caption": "Invoice #12345",
"filename": "invoice-12345.pdf"
}
}
{
"messaging_product": "whatsapp",
"to": "6281234567890",
"type": "document",
"document": {
"id": "f7a816e2-8397-11f0-8e34-010203040506",
"caption": "Invoice #12345",
"filename": "invoice-12345.pdf"
}
}
FieldTypeRequiredDescription
linkstringYes*Public URL to the document file.
idstring (UUID)Yes*Media ID from a previous upload.
captionstringNoDocument description displayed below the file name.
filenamestringNoFile name displayed to the recipient. If not included, the name is taken from the URL.

* Use one of: link or id.

FormatExtensionMax Size
PDF.pdf100 MB
DOCX.docx100 MB
XLSX.xlsx100 MB
PPTX.pptx100 MB
Plain Text.txt100 MB
Terminal window
curl -X POST https://messaging.cpaas.id/v1/YOUR_PHONE_NUMBER_ID/messages \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"messaging_product": "whatsapp",
"to": "6281234567890",
"type": "document",
"document": {
"link": "https://example.com/invoice-12345.pdf",
"caption": "Invoice bulan Juni 2026",
"filename": "invoice-juni-2026.pdf"
}
}'
{
"messaging_product": "whatsapp",
"messages": [
{
"id": "msg_f7a816e2-8397-11f0-8e34-010203040506"
}
]
}
  1. message.status.sent — Document was successfully sent to the WhatsApp network
  2. message.status.delivered — Document reached the recipient’s device
  3. message.status.read — Document was opened by the recipient

If it fails, you receive message.status.failed.

See the page Webhook for details on the payload format of each event.