01 · How it works, in 5 steps
How does a document message work?
- 1
Produce a phone-friendly file
Export a PDF that reads well on a small screen and keep it well under 100 MB. Avoid password protection unless the customer already knows the password.
- 2
Upload it
POST the file to
/{PHONE_NUMBER_ID}/mediaas multipart form data withmessaging_product=whatsappand its MIME type. The response is a mediaid, valid for 30 days. - 3
Name it for the customer
Set
filenameto something meaningful with the extension, such asGST-Invoice-ACS-20871.pdf, and write acaptionthat says what the file is and what to do with it. - 4
Pick the right vehicle
Inside the window, send
type: "document". Outside it, send an approved template whose header is a document, passing the mediaidorlinkas the header parameter. - 5
Confirm and keep records
Track the delivered and read statuses for the wamid, and keep the original in your own storage — the media ID expires, and the customer may ask for the file again.
02Try it
Hands-on: use the controls to work through it yourself.
Send an invoice, then a copy on request
Today
- Nagpur AC Service: GST-Invoice-ACS-20871.pdfDocumentHi Meera, here is your invoice for today's AC service. Keep it for warranty claims.Reply here if anything looks wrong10:30Read
- Customer: Thanks! Can you also send last year's invoice? I need it for the warranty.10:31
- Nagpur AC Service: GST-Invoice-ACS-11402.pdfDocumentHere it is: the service visit from 12 May 2025.10:32Read
- Customer: Got both, thank you!10:33
Message 4 of 4
CustomerText
Free-form text. A business can send it only within 24 hours of the customer’s last message.
Message 4 of 4: Customer, Text. Free-form text. A business can send it only within 24 hours of the customer’s last message.
03What is a document message?
A document message is the WhatsApp message type (type: "document") for sending a file the customer can open, save or forward: an invoice, an e-ticket, a bank statement, a policy schedule, a menu. The customer sees a file card with an icon for the file type, the filename and an optional caption underneath, and taps it to open the file in their phone's viewer.
On the Cloud API the document object takes either an id — a media ID from uploading the file with POST /{PHONE_NUMBER_ID}/media, which Meta recommends for performance — or a link to the file on a public HTTPS server, plus an optional caption and an optional filename. The filename should include the extension, because the WhatsApp client picks the icon from it. Officially supported types are PDF, Word (DOC, DOCX), Excel (XLS, XLSX), PowerPoint (PPT, PPTX) and plain text, each up to 100 MB; other types may go through but are not guaranteed to display correctly.
It is one member of the media message family, alongside images, video, audio and stickers, with its formats listed under media file limits. Like every free-form message it can be sent only inside an open customer service window. Outside the window, a document travels as the header of an approved template — typically a utility template such as an invoice or ticket confirmation — and is billed by that template's category.
Key takeaways
- A document message delivers a file — usually a PDF — as a card the customer can open, save or forward, with a filename and an optional caption.
- Officially supported types are PDF, DOC/DOCX, XLS/XLSX, PPT/PPTX and TXT, each up to 100 MB.
- Send by uploaded media
id(Meta's recommendation) or by publiclink, and setfilenamewith its extension so the right icon shows. - As a free-form message it needs an open window; outside it, attach the file as the document header of an approved template.
- Uploaded media IDs expire after 30 days, so upload close to sending and keep your own copy of every file.
04 · In code
A document message in code
# 1. Upload the file (the media id is valid for 30 days)curl -X POST "https://graph.facebook.com/v26.0/{PHONE_NUMBER_ID}/media" \-H "Authorization: Bearer {ACCESS_TOKEN}" \-F "messaging_product=whatsapp" \-F "type=application/pdf" \-F "file=@GST-Invoice-ACS-20871.pdf;type=application/pdf"# → { "id": "1037543291543636" }# 2. Send it inside an open customer service windowcurl -X POST "https://graph.facebook.com/v26.0/{PHONE_NUMBER_ID}/messages" \-H "Authorization: Bearer {ACCESS_TOKEN}" \-H "Content-Type: application/json" \-d '{"messaging_product": "whatsapp","recipient_type": "individual","to": "919812345678","type": "document","document": {"id": "1037543291543636","filename": "GST-Invoice-ACS-20871.pdf","caption": "Your invoice for the AC service on 14 October. Keep it for warranty claims."}}'
05 · Mistakes to avoid
Common mistakes with a document message
Leaving out the filename
Without it the customer may see a generic name, and without the extension the wrong icon. Always send
filename, ending in.pdfor the right extension.Linking to private storage
A
linkmust be publicly reachable when Meta fetches it. Signed URLs that expire in seconds or need cookies fail, so upload the file and send byidinstead.Reusing an old media ID
IDs from uploads expire after 30 days, and IDs received in webhooks after 7. Re-upload from your own archive rather than caching media IDs for months.
A free-form document after the window closed
A plain document message fails once 24 hours have passed since the customer's last message. Use a template with a document header, approved in advance.
Files phones cannot open
ZIP archives, unusual formats or 80 MB scans may not open on low-end phones. Stick to supported types and compress large PDFs.
06 · Key facts
A document message: key facts and limits
- Message type
- document
- Supported types
- PDF, DOC(X), XLS(X), PPT(X), TXT
- Maximum size
- 100 MB
- Source
- Uploaded media id (recommended) or public link
- Uploaded media ID
- Expires after 30 days
- Filename
- Optional; its extension sets the icon
- Caption
- Optional, with a length limit
- Outside the window
- Document header on an approved template
07Example: Invoices that stop getting lost in Nagpur
A Nagpur AC-servicing company used to email invoices that customers rarely opened, then spent time re-sending them for warranty claims. It moved to WhatsApp: after each visit, an approved utility template with a document header delivers GST-Invoice-ACS-20871.pdf with the line "Your invoice for today's service. Keep it for warranty claims." When a customer later asks in chat for last year's invoice, the agent — inside the window her question opened — sends it as a plain document message, fetched from the company's archive and uploaded again because the original media ID expired months ago.
08 · Why it matters
Why does a document message matter?
Many of the messages customers value most are documents: the tax invoice they need for reimbursement, the boarding pass at the gate, the lab report for their doctor. Delivering them on WhatsApp instead of email puts them where customers already look and keeps them findable in the chat's media tab. Getting the details right — a descriptive filename, the right template category, files that open on any phone — decides whether the document is used or turns into a support call.
09 · Pro tips
Best practices for a document message
- Put the reference number in the filename; customers search their media tab by it.
- Make the caption the instruction: "Show this at the gate" or "Keep for warranty claims".
- Send invoices and tickets with a utility template's document header; that is the category transactional files belong to.
- Check large files with a media size optimiser before sending them to customers on slow networks.