Messages
Send Media
Send an image, video, audio (voice/regular) or document by URL or base64
POST
Send Media
Auth:
Document (PDF) with
Sends a PDF as a document.
Error envelope:
TokenAccount or TokenInstance • Rate-limit: Global (100/min) • Idempotent: no
Description
Sends a media file (image, video, document or audio) from a public URL or a base64 string. The source can be provided in mediaUrl (which accepts either the URL or the base64 of the media) or in the mediaBase64 field, send one or the other, never both. Supports message as a caption, replyTo (quote by ID), replyPrivate, mention / mentionAll (group chats only), delay (in seconds) to simulate real typing and, for audio, isVoice (PTT), duration and waveform. The server downloads the file (when a URL) or decodes the base64, detects the mimeType when omitted and uploads it to the WhatsApp servers before sending.
Examples
Image by URL
Sends an image (mediaType: "image") downloaded from a public URL, with message used as the caption that appears below the photo in the chat.
Image via base64
Instead of a URL, send the media content as base64. You can put the base64 inmediaUrl itself (with or without the data:image/jpeg;base64, data URI prefix) or in the dedicated mediaBase64 field. Since there is no URL to infer the name/type, providing mimeType (and fileName, for documents) is recommended.
Voice audio (PTT)
WhenmediaType: "audio" and isVoice is omitted, the server defaults to true (voice/PTT message). To send as a “regular” audio (a music track, for example), pass isVoice: false.
Document (PDF) with fileName
Sends a PDF as a document. fileName (Contract-2026.pdf) sets the name displayed in the attachment card and message appears as accompanying text. Without fileName, WhatsApp shows a generic name.
Video with caption and delay
Sends an MP4 video with the caption “Check out this video!” anddelay: 3, the server sends the “typing…” indicator for 3 seconds before firing the video, simulating real typing.
Image in group with reply and mention
Sends an image in a group (@g.us), quoting a previous message via replyTo and mentioning a member via the mention array. @5511888888888 in the caption becomes clickable and triggers a notification for the tagged user.
Success response
ThemessageType echoes the mediaType you sent (image, video, document or audio). The metadata resolved by the upload appears in mediaUrl (URL re-issued for mmg.whatsapp.net), mediaMimeType and mediaSize. For PTT audio, the server also returns mediaDuration when it can compute it.
200 OK
For
mediaType: "document", fileName appears in the card. For mediaType: "audio" with isVoice: true, the message is delivered as PTT (waveform + microphone icon). For “regular” audio (a music track), use isVoice: false.Path parameters
Instance name (e.g.,
$Instance_Name).Headers
TokenAccount or TokenInstance.application/jsonRequest body
Destination: phone (
5511999999999) or JID (@s.whatsapp.net, @lid, @g.us, @newsletter).One of:
image, video, document, audio. Determines how WhatsApp renders the message.Media source: a public URL of the file or the base64 of the media (with a
data:<mime>;base64,... data URI or raw base64). When it is a URL, it must be publicly accessible (no authentication) and the server downloads it. You must provide mediaUrl or mediaBase64 (never both).Base64 of the media (alternative to
mediaUrl), with a data:<mime>;base64,... data URI or raw base64. Cannot be used together with mediaUrl, send one or the other. Since there is no URL, providing mimeType (and fileName for documents) is recommended.Media caption. For
mediaType: "document", it appears as accompanying text. Optional for all types.File MIME type (e.g.,
image/jpeg, application/pdf). When omitted, the server detects it automatically from the download.File name displayed in the card. Recommended for
mediaType: "document", without it, WhatsApp shows a generic name.Applies only to
mediaType: "audio". When true, the message is delivered as PTT (voice message, with a waveform). When false, it is delivered as regular audio (a music track). When the field is omitted on audio, the server assumes true.Audio duration in seconds. Applies only to
mediaType: "audio". Optional, when omitted, the server tries to detect it automatically.Pre-computed audio waveform (PTT). Optional, when omitted, the server automatically generates a default waveform. Applies only to
mediaType: "audio" with isVoice: true.Time in seconds to wait before sending. During the interval, the server sends the “typing…” indicator to the recipient and fires “paused” before the actual send.
ID of the message to be quoted (reply). The original message must belong to the same instance and have been saved in the database. Possible errors:
reply_message_not_found, reply_message_instance_mismatch.When
true and replyTo points to a message originating from a group, the reply is redirected to the original author’s private chat (keeping the quote). Ignored if the original message is not from a group.List of numbers (or JIDs) to mention. Group chats only (
@g.us). To appear as a clickable link, include @5511... in message (caption). Without that, they become hidden mentions (notify only).When
true, mentions every group member (except the instance itself). Equivalent to @everyone. Group chats only.Origin identifier for traceability (e.g.,
crm, bot-suporte, n8n). Saved on the message record in the database and propagated to webhooks. When omitted, defaults to "api".Notes
delayis in seconds, not milliseconds. A value of3= 3 seconds of “typing”.- For
mediaType: "audio",isVoicedefaults totrueautomatically when the field is omitted. To send as a music track, you must explicitly sendisVoice: false. - The media can come via URL or base64. Use
mediaUrl(which accepts a URL or base64) ormediaBase64, sending both returns400 use either mediaUrl or mediaBase64, not both; sending neither returns400 mediaUrl or mediaBase64 is required. - When
mediaUrlis a URL, it must be publicly accessible. URLs with authentication, sessions or bot protection commonly fail withmedia_download_failed. - For base64 sends, providing
mimeTypeis recommended (there is no URL to infer the type). The base64 accepts a data URI (data:<mime>;base64,...) or raw base64. - When
mimeTypeis not provided, the server detects it from the first bytes of the download (net/http+ sniff). In rare cases (atypical extensions), providing it manually avoids issues. - For BR numbers (starting with
55), the service automatically tries variations with and without the 9th digit. mentionandmentionAllare exclusive to groups. If sent to a DM/channel, the response is400 Mentions are only supported in group chats.- The
durationfield (audio) is informational,whatsmeowstill computes its own value from the file. Useful when the server cannot infer it. - The
waveformfield is optional and advisory: if omitted, the server generates a standard waveform for PTT.
Errors
| HTTP | Internal status | Message |
|---|---|---|
| 400 | , | Instance name is required |
| 400 | , | Invalid request body: <detail> |
| 400 | , | Number is required |
| 400 | , | MediaType is required |
| 400 | , | mediaUrl or mediaBase64 is required |
| 400 | , | use either mediaUrl or mediaBase64, not both |
| 400 | , | MediaType must be one of: image, video, document, audio |
| 400 | invalid_number | Invalid phone number format: <detail> |
| 400 | mentions_not_supported | Mentions are only supported in group chats |
| 400 | media_download_failed | Failed to download media: <reason> |
| 400 | media_input_invalid | Failed to resolve media: <reason> |
| 400 | media_validation_failed | Invalid media file: <reason> |
| 400 | unsupported_media_type | Unsupported media type: <mime> |
| 500 | media_upload_failed | Failed to upload media to WhatsApp servers |
| 500 | send_failed | Failed to send message: <reason> |
| 404 | , | Instance not found |
| 503 | disconnected | Instance is not connected to WhatsApp |