Media
Upload images, video, audio and documents for WhatsApp messages, and download the files your customers send you.
Media files are images, videos, audio, documents and stickers. You work with them in two directions.
Sending a file
There are two ways to attach a file to a message:
- By link. Put a public HTTPS URL in
link. WhatsApp downloads the file when it sends the message, so the URL must work without a login. This is the simplest option. - By upload. Upload the file first, then send its
id. This is better when you send the same file many times, or when it isn't public. Uploaded files are kept for 30 days.
Supported files
| Type | Formats | Max size |
|---|---|---|
| Image | JPEG, PNG | 5 MB |
| Video | MP4, 3GPP (H.264 video, AAC audio) | 16 MB |
| Audio | AAC, AMR, MP3, M4A, OGG (Opus) | 16 MB |
| Document | PDF, Word, Excel, PowerPoint, plain text | 100 MB |
| Sticker | WebP, 512×512 | 100 KB (500 KB animated) |
Receiving a file
When a customer sends a file, your webhook receives an incoming message with a media id, not the file itself. To get the file, do one of these:
- One step: call Download media with the ID. The response is the file.
- Two steps: call Retrieve a media URL, then fetch that
urlwith yourapikeyheader. The URL expires after 5 minutes, so fetch it straight away.
Download received files promptly and store them yourself. WhatsApp deletes them after a while.
- Upload mediaUpload an image, video, audio file or document to WhatsApp and get a media ID you can send for 30 days.
- Retrieve a media URLGet a temporary download link, type, size and checksum for a WhatsApp media file you uploaded or a customer sent.
- Delete mediaDelete a media file you uploaded to WhatsApp so its media ID can no longer be used.
- Download mediaDownload a WhatsApp media file, such as a photo a customer sent, in one step using its media ID.
- Download media from its URLDownload a WhatsApp media file from the temporary URL returned by Retrieve a media URL.