Skip to main content
POST
Send Media
Auth: TokenAccount or TokenInstanceRate-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 in mediaUrl 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)

When mediaType: "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!” and delay: 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

The messageType 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

string
required
Instance name (e.g., $Instance_Name).

Headers

string
required
TokenAccount or TokenInstance.
string
required
application/json

Request body

string
required
Destination: phone (5511999999999) or JID (@s.whatsapp.net, @lid, @g.us, @newsletter).
string
required
One of: image, video, document, audio. Determines how WhatsApp renders the message.
string
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).
string
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.
string
Media caption. For mediaType: "document", it appears as accompanying text. Optional for all types.
string
File MIME type (e.g., image/jpeg, application/pdf). When omitted, the server detects it automatically from the download.
string
File name displayed in the card. Recommended for mediaType: "document", without it, WhatsApp shows a generic name.
boolean
default:"true (for audio)"
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.
uint32
Audio duration in seconds. Applies only to mediaType: "audio". Optional, when omitted, the server tries to detect it automatically.
byte[]
Pre-computed audio waveform (PTT). Optional, when omitted, the server automatically generates a default waveform. Applies only to mediaType: "audio" with isVoice: true.
int
default:"0"
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.
string
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.
boolean
default:"false"
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.
string[]
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).
boolean
default:"false"
When true, mentions every group member (except the instance itself). Equivalent to @everyone. Group chats only.
string
default:"api"
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

  • delay is in seconds, not milliseconds. A value of 3 = 3 seconds of “typing”.
  • For mediaType: "audio", isVoice defaults to true automatically when the field is omitted. To send as a music track, you must explicitly send isVoice: false.
  • The media can come via URL or base64. Use mediaUrl (which accepts a URL or base64) or mediaBase64, sending both returns 400 use either mediaUrl or mediaBase64, not both; sending neither returns 400 mediaUrl or mediaBase64 is required.
  • When mediaUrl is a URL, it must be publicly accessible. URLs with authentication, sessions or bot protection commonly fail with media_download_failed.
  • For base64 sends, providing mimeType is recommended (there is no URL to infer the type). The base64 accepts a data URI (data:<mime>;base64,...) or raw base64.
  • When mimeType is 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.
  • mention and mentionAll are exclusive to groups. If sent to a DM/channel, the response is 400 Mentions are only supported in group chats.
  • The duration field (audio) is informational, whatsmeow still computes its own value from the file. Useful when the server cannot infer it.
  • The waveform field is optional and advisory: if omitted, the server generates a standard waveform for PTT.

Errors

Error envelope: