Messages
Send a voice note
Sends exactly one audio file as a voice note (push-to-talk): the customer sees a waveform and a play button, not an audio file. This endpoint always sends a voice note. You can do the same with Send files (POST /api/conversations/:id/attachments) by adding the form field voice_note=true, or "voice_note": true in a JSON body with file_id or url. Upload the audio in the request as multipart/form-data (field file), or send JSON with the file_id of an uploaded file or an https url. Returns 201 with the stored message, as for one attachment.
- Bearer API key
- Scope:
writeor admin - or app session
- Workspace:
X-Tenant-ID(optional with a key)
Path parameters
iduuidrequiredConversation id.
Headers
AuthorizationstringrequiredYour API key as
Bearer <key>. The wordBearerand the space are case-sensitive. Browser clients signed in to the app use the session cookie instead.X-Tenant-IDuuidoptionalWorkspace id. Optional with an API key (a key always acts in its own workspace); if you send it, it must match the key’s workspace. Required with a session cookie. You can pass
?tenant=<id>instead.
Body
multipart/form-datafilefilerequiredThe audio file, as a form part with a file name. OGG/Opus is sent as it is; MP3, M4A/AAC, WAV, WebM/Opus (as recorded by browsers) and Ogg Vorbis are converted to mono 16 kHz Opus at 24 kbps. To send JSON instead, use
file_idorurl(see below).
Response
201 Createdapplication/json
iduuidMessage id in whatsappx.si.
whatsapp_message_idstringMessage id assigned by WhatsApp.
conversation_iduuidConversation the message belongs to.
sender_jidstringWhatsApp id (JID) of the sender. For your own messages, the connected number.
sender_namestringSender display name, when WhatsApp provides one (may be empty).
AI Assistantfor messages the AI assistant sent.contentstringMessage text. Images and documents carry their caption here. Types without downloadable media (for example location) use a placeholder such as
[location message].message_typestringtext,imageordocument. Stickers arrive asimage; video and audio (including voice notes) asdocument. Other Cloud API types (for examplelocation) keep the name Meta sends and have no downloadable media.media_urlstringmay be absentPath of the stored media file, for example
/api/media/<workspace>/<file>. Prefix it withhttps://whatsappx.siand send your API key to download it (see Download a message’s file). Present for QR-linked and Cloud API inbound files (up to 25 MiB) and for files you send.mime_typestringmay be absentMIME type of the media file.
file_namestringmay be absentOriginal file name of a document.
file_sizeintegermay be absentMedia size in bytes.
timestamptimestampWhen the message was sent on WhatsApp (RFC 3339).
from_mebooleantruefor messages sent from the connected number (by your team, the API or an automation).statusenumreceivedfor incoming messages. Outgoing ones start assent, then becomedelivered(two grey ticks: the contact’s phone got it) andread(blue ticks: they opened it; for a voice note, played it). Status only moves forward. Contacts who turned off read receipts never reachread; in a group the first member’s receipt counts.delivered_attimestampnullableWhen an outgoing message was first delivered to the contact’s phone (RFC 3339).
nullfor incoming messages and until delivered.read_attimestampnullableWhen an outgoing message was first read (blue ticks).
nullfor incoming messages, until read, and when the contact has read receipts turned off.edited_attimestampnullableWhen the text was last edited: through the API or the app, or by its sender on WhatsApp.
nullif never edited.deleted_attimestampnullableWhen the message was deleted for everyone. Its
contentand media fields are then empty.nullif not deleted.created_attimestampWhen whatsappx.si stored the message (RFC 3339).
sent_by_user_iduuidmay be absentUser id of the teammate who sent the message from the app (or whose scheduled message it was). Left out for incoming messages, messages sent from the phone or by an automation, and older messages.
sent_by_namestringmay be absentName of that teammate. Left out with
sent_by_user_id.sent_via_api_key_iduuidmay be absentId of the API key the message was sent with. Left out for messages not sent through the API.
sent_via_api_key_namestringmay be absentName of that API key. Left out with
sent_via_api_key_id.
Status codes
- 201Created. The voice note was sent and stored: the message, as for one attachment. It is stored with
message_typedocument,mime_typeaudio/oggandfile_namevoice-note.ogg; the inbox shows it as a voice note. - 400Bad request. More than one file, a caption, a file that is not audio, or audio longer than 15 minutes. Also the other
400errors of Send files. - 401Unauthorized. The API key is unknown, revoked or expired (
invalid or expired API key), the key was blocked because it may have been leaked (code: "api_key_blocked"), or there is no key and no signed-in session (unauthorized). - 402Payment required. Only when subscriptions are enforced and the workspace has no active subscription. The body includes
code: "payment_required". - 403Forbidden. The API key has the
readscope, which only allows GET requests (API key is read-only). A key in another workspace getsAPI key belongs to a different workspace; a key used from an IP address outside itsallowed_ipsgetsthis API key is not allowed from your IP address(code: "ip_not_allowed"). - 404Not found. The conversation does not exist in this workspace, belongs to the inactive connection, or (for agents signed in to the app) is not assigned to you (
conversation not found). Withfile_idorfile_ids: the uploaded file is unknown, expired, deleted or belongs to another workspace (file not found). - 409Conflict. The WhatsApp connection is not ready to send (
whatsapp is not connected). - 413Too large. The audio is over 16 MB (
file too large: videos, audio and documents can be up to 16 MB), also while a link is downloaded. - 415Unsupported type. The audio is not OGG/Opus and the server cannot convert it (
voice notes need OGG/Opus audio), or the type cannot be sent, as for Send files. - 429Too many requests. The workspace already sent 30 files in the last minute (
too many attempts, please wait a minute and try again); aRetry-Afterheader says when to retry. The API key rate limits apply as well. - 500Server error. WhatsApp or Meta rejected the file, or it could not be stored. The
errorcarries the reason.
Which endpoint should I use?
Both send the same voice note and return the same message:
POST /api/conversations/:id/attachmentswith the form fieldvoice_note=true, or JSON"voice_note": truetogether withfile_idorurl.POST /api/conversations/:id/voice-noteswith a multipartfile, or JSONfile_idorurl. It is always a voice note, sovoice_noteis not needed.
Which audio formats work?
WhatsApp voice notes are OGG with the Opus codec.
| You send | What happens |
|---|---|
| OGG/Opus | Sent as it is. |
| MP3, M4A/AAC, WAV, WebM/Opus (from browsers), Ogg Vorbis | Converted to mono 16 kHz Opus at 24 kbps. |
WAV and WebM are accepted only as a voice note sent with multipart/form-data. Files uploaded with POST /api/v1/files and links accept the usual audio types: MP3, OGG/Opus, AAC, AMR, M4A. When the server cannot convert audio that is not OGG, the answer is 415 with voice notes need OGG/Opus audio.
What are the limits?
| Limit | Value |
|---|---|
| Files per request | Exactly 1 audio file |
| Size | 16 MB |
| Length | 15 minutes (longer answers 400) |
| Caption | None |
An MP3, converted
The MP3 is converted to OGG/Opus and arrives as a voice note. With the alias, voice_note is not needed:
curl -X POST "https://whatsappx.si/api/conversations/6a1f3c52-8e0b-4d7a-b1f2-93c4d5e6f708/attachments" \
-H "Authorization: Bearer $WHATSAPPX_API_KEY" \
-F "file=@greeting.mp3" \
-F "voice_note=true"From a link or an uploaded file
Send JSON with url (or file_id) and "voice_note": true. The link rules are those of Send files.
curl -X POST "https://whatsappx.si/api/conversations/6a1f3c52-8e0b-4d7a-b1f2-93c4d5e6f708/attachments" \
-H "Authorization: Bearer $WHATSAPPX_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/note.mp3",
"voice_note": true
}'What does the customer receive?
A real voice note (push-to-talk), with a waveform and a play button, not an audio file.
- Numbers linked by QR code: sent as a voice note with its duration and waveform.
- Cloud API (Meta) numbers: sent as an
audiomessage of OGG/Opus, which WhatsApp shows as a voice message.
How is it stored?
Like any sent file: the message has message_type document, mime_type audio/ogg and file_name voice-note.ogg, and its media_url serves the audio with your API key (see Download a message's file). The inbox shows it as a voice note.