Guides
Media
Uploading files, sending by id or link, downloading received media and type and size limits.
Upload
Send multipart/form-data to Upload media:
curl --request POST \ --url https://whatsapp.mimicr.dev/v24.0/424361664134261/media \ --header 'Authorization: Bearer <token>' \ --form 'messaging_product=whatsapp' \ --form 'type=image/png' \ --form 'file=@nota.png;type=image/png'
{ "id": "132404823835057" }Use the id in the message:
{ "messaging_product": "whatsapp", "to": "5511987654321", "type": "image", "image": { "id": "132404823835057", "caption": "Comprovante" } }Types and limits
| Type | MIME | Max size |
|---|---|---|
image | image/jpeg, image/png | 5 MB |
sticker | image/webp | 500 KB |
audio | audio/aac, audio/amr, audio/mpeg, audio/mp4, audio/ogg | 16 MB |
video | video/3gpp, video/mp4 | 16 MB |
document | text/plain, application/pdf, Word, Excel and PowerPoint | 100 MB |
Anything else makes the upload answer 131053. When sending by id, an unknown or deleted id also answers 131053. By link, the URL must be http(s).
Download media
Received media arrives in the webhook with id, mime_type and sha256. Ask for the URL with Retrieve media URL:
curl --url https://whatsapp.mimicr.dev/v24.0/132404823835057 \ --header 'Authorization: Bearer <token>'
{
"messaging_product": "whatsapp",
"url": "https://whatsapp.mimicr.dev/api/media-download/132404823835057?ext=1793914487&hash=7d509b48b2b772142de8e1f14f848e70",
"mime_type": "image/png",
"sha256": "63ef318d96b5d0d0ceba6e04a4e622b1158335cdc67c49e27839132c6f655058",
"file_size": 68,
"id": "132404823835057"
}The URL is valid for 5 minutes. Download it with the same Authorization: Bearer <token> header, as with Meta:
curl --url '<url>' --header 'Authorization: Bearer <token>' --output file.png
Delete
Delete media answers {"success": true}. After that, GET and DELETE on the same id answer 100 with subcode 33.
Simulate media from the customer
curl --request POST \
--url https://api.mimicr.dev/v1/whatsapp/docs/contacts/5511987654321/reply \
--header 'Authorization: Bearer mk_...' \
--header 'Content-Type: application/json' \
--data '{ "type": "document", "data": "<base64>", "mime_type": "application/pdf", "filename": "comprovante.pdf", "caption": "Segue" }'Instead of data, pass the media_id of an upload. image, video, audio (with "voice": true for a voice message), document and sticker are accepted.