Upload media
To send an image, a PDF or any other file, upload it first. You get back a med_ id, and that id
is what you send — not the bytes. Upload once, send it to a thousand people.
Upload
The file is stored and registered with WhatsApp in the same call, so the id works immediately — there is nothing to wait for and no second step.
What comes back
| Field | What it is |
|---|---|
id | The med_ id. This is what you send with. |
filename | The name you uploaded it under. |
mimeType | The type we normalised to, which may differ from the one you declared. |
sizeBytes | Size of the stored file. |
Size limits
WhatsApp caps each kind of file, and we check before storing anything, so an oversized file is refused at upload rather than at send.
| Kind | Cap |
|---|---|
| Image | 5 MB |
| Video, audio | 16 MB |
| Document | 100 MB |
| Sticker | 500 KB |
Keep the id. Uploading the same file again gives you a second copy and a second id.
A test key uploads for real — see Test keys and the sandbox.
Then send it
Pass the id as mediaId — see Send a message.