Messages
Send files
Sends one or more files to the conversation through the workspace’s active connection (QR-linked number or Cloud API), one message per file, in request order. Upload the files in the request as multipart/form-data, or send JSON with the file_id of a file you uploaded earlier or an https url to download it from. One file returns the stored message, in the same shape as Send a message; several files return {messages, failed}. Live listeners receive message.created and conversation.updated events.
- 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-datafilefilerequiredA file, as a form part with a file name. Repeat the part to send several files (the field names
filesandfiles[]work too). Its type is detected from its content together with the file name’s extension; the part’s ownContent-Typeis ignored. A name without an extension takes the type the content shows. To send JSON instead, see JSON bodies below.captionstringoptionalText shown under the photo, video or document; it becomes the message’s
content. Leading and trailing spaces are trimmed. With several files, it goes on the first file only.captions[]stringoptionalOne caption per file: repeat the part, in the same order as the files. An empty part means no caption for that file. The field name
captionsworks too.voice_notebooleanoptionaltruesends the file as a WhatsApp voice note (waveform and play button) instead of an audio file. In JSON, send"voice_note": truewithfile_idorurl. See Send a voice note.
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 file was sent and stored: the message, in the fields below.
message_typeisimagefor a photo anddocumentfor everything else (videos and audio included). A request with several files returns{messages, failed}instead (see several files); when none of them could be sent, the status is that of the first failure. - 400Bad request. Form:
file is required,file is empty,at most 10 files per request,send multipart/form-data with a file field,send caption or captions, not both,more captions than files,caption is too long (at most 1024 characters),audio files cannot have a caption. JSON:invalid JSON body,send one of file_id, file_ids, url or urls,file_ids is empty,urls is empty,file_name can only be used with url,file_names can only be used with urls,more file_names than urls,invalid file id, and the link errors listed under Which links are allowed?. Alsoinvalid conversation id,the upload was interrupted: send the file again(the upload broke off before its end), or the conversation cannot be used for sending (conversation belongs to an inactive channel,conversation has no whatsapp jid,invalid chat jid). - 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. A file is over the limit of its type (
file too large: images can be up to 5 MB,file too large: videos, audio and documents can be up to 16 MB), also while a link is downloaded; or the request body is too large (the request is too large,request too large: at most 60 MB per request (images up to 5 MB, videos, audio and documents up to 16 MB each)): over 60 MB for a form, over 64 KB for JSON. - 415Unsupported type. The file type cannot be sent, or the content is not what the extension says (
unsupported file type: the file is not a valid .png file). For a link, the type is read from the downloaded bytes. Cloud API numbers cannot send ZIP files. - 429Too many requests. The request’s files do not fit in what is left of the workspace’s 30 files a minute (each file counts). Nothing is sent (
too many attempts, please wait a minute and try again), and aRetry-Afterheader says when to retry. The API key rate limits apply as well. - 500Server error. The file could not be stored on our side. Nothing was sent; try again.
- 502Bad gateway. WhatsApp did not accept the file: the upload to its media servers or the send failed or timed out. Nothing was sent; try again in a moment.
What are the limits?
| Limit | Value |
|---|---|
| Files per request | 1 to 10 |
| Request body | 60 MB for a form, 64 KB for JSON |
| Photos (JPEG, PNG, WebP) | 5 MB each |
| Videos, audio and documents | 16 MB each |
| Caption | 1024 characters; none for audio |
| Files sent per workspace | 30 a minute (each file counts) |
| Downloads from links | 20 seconds in total per request, at most 3 redirects |
How do I send several files?
Repeat the file part, up to 10 times. The files are sent in the order of the request, one message per file, one at a time.
captiongoes on the first file only.- For a caption on each file, send one
captions[]part per file, in the same order. An empty part means no caption for that file.captionandcaptions[]cannot be used together.
curl -X POST "https://whatsappx.si/api/conversations/6a1f3c52-8e0b-4d7a-b1f2-93c4d5e6f708/attachments" \
-H "Authorization: Bearer $WHATSAPPX_API_KEY" \
-F "file=@invoice-1042.pdf" \
-F "file=@storefront.jpg" \
-F "captions[]=Your invoice for October" \
-F "captions[]=Our new storefront"What does a request with several files return?
A request with one file (one form file, file_id, url, or a one-item file_ids or urls) returns the message, or an error, as described above. A request with several files returns 201 with:
| Field | Type | Description |
|---|---|---|
messages | array of Message | The messages that were sent, in request order. Each is shaped like the single-file response. |
failed | array of object | The files that could not be sent: index (0-based position in the request), file_name and error. [] when every file was sent. |
One file that fails does not stop the others, so check failed even on a 201:
{
"messages": [
{
"id": "2b3c4d5e-6f70-4812-9a3b-4c5d6e7f8091",
"whatsapp_message_id": "3EB0C4D5E6F708192A3B",
"conversation_id": "6a1f3c52-8e0b-4d7a-b1f2-93c4d5e6f708",
"sender_jid": "15550100999@s.whatsapp.net",
"sender_name": "",
"content": "Your invoice for October",
"message_type": "document",
"media_url": "/api/media/8d0f6c2e-3b1a-4c55-9a7e-2f4b6d1e9c30/3EB0C4D5E6F708192A3B.pdf",
"mime_type": "application/pdf",
"file_name": "invoice-1042.pdf",
"file_size": 184320,
"timestamp": "2026-10-08T09:12:44Z",
"from_me": true,
"status": "sent",
"created_at": "2026-10-08T09:12:45Z",
"edited_at": null,
"deleted_at": null,
"sent_via_api_key_id": "8192a3b4-c5d6-4e7f-8091-a2b3c4d5e6f7",
"sent_via_api_key_name": "CRM sync"
},
{
"id": "5e6f7081-92a3-4b4c-8d5e-6f708192a3b4",
"whatsapp_message_id": "3EB0D5E6F708192A3B4C",
"conversation_id": "6a1f3c52-8e0b-4d7a-b1f2-93c4d5e6f708",
"sender_jid": "15550100999@s.whatsapp.net",
"sender_name": "",
"content": "",
"message_type": "image",
"media_url": "/api/media/8d0f6c2e-3b1a-4c55-9a7e-2f4b6d1e9c30/3EB0D5E6F708192A3B4C.jpg",
"mime_type": "image/jpeg",
"file_name": "storefront.jpg",
"file_size": 734512,
"timestamp": "2026-10-08T09:12:47Z",
"from_me": true,
"status": "sent",
"created_at": "2026-10-08T09:12:47Z",
"edited_at": null,
"deleted_at": null,
"sent_via_api_key_id": "8192a3b4-c5d6-4e7f-8091-a2b3c4d5e6f7",
"sent_via_api_key_name": "CRM sync"
}
],
"failed": [
{
"index": 2,
"file_name": "setup.exe",
"error": "unsupported file type (.exe): send a photo (JPG, PNG, WebP), a video (MP4, 3GP), audio (MP3, OGG/Opus, AAC, AMR, M4A) or a document (PDF, Word, Excel, PowerPoint, TXT, CSV, ZIP)"
}
]
}
When none of the files could be sent, the status is that of the first failure (for example 404, 409, 413, 415 or 502) and the body carries the same lists, with error set to the first failure:
{
"error": "unsupported file type (.exe): send a photo (JPG, PNG, WebP), a video (MP4, 3GP), audio (MP3, OGG/Opus, AAC, AMR, M4A) or a document (PDF, Word, Excel, PowerPoint, TXT, CSV, ZIP)",
"messages": [],
"failed": [
{
"index": 0,
"file_name": "setup.exe",
"error": "unsupported file type (.exe): send a photo (JPG, PNG, WebP), a video (MP4, 3GP), audio (MP3, OGG/Opus, AAC, AMR, M4A) or a document (PDF, Word, Excel, PowerPoint, TXT, CSV, ZIP)"
},
{
"index": 1,
"file_name": "update.exe",
"error": "unsupported file type (.exe): send a photo (JPG, PNG, WebP), a video (MP4, 3GP), audio (MP3, OGG/Opus, AAC, AMR, M4A) or a document (PDF, Word, Excel, PowerPoint, TXT, CSV, ZIP)"
}
]
}
Which JSON bodies are accepted?
Send Content-Type: application/json and exactly one of file_id, file_ids, url or urls (otherwise send one of file_id, file_ids, url or urls). The body can be at most 64 KB, and it can name at most 10 files.
| Field | Type | Description |
|---|---|---|
file_id | uuid | Send one uploaded file. |
file_ids | array of uuid | Send several uploaded files, in this order. Not empty (file_ids is empty). |
url | string | Download one file from this https link and send it. |
file_name | string | Only with url: the name to send the file under. |
urls | array of string | Download several files and send them, in this order. Not empty (urls is empty). |
file_names | array of string | Only with urls: the names, in the same order as urls. Not more than urls. |
caption | string | Caption, as in the form. |
captions | array of string | One caption per file, in order. Not more than files, and not together with caption. |
voice_note | boolean | true sends one audio file (file_id or url) as a voice note, without a caption. See Send a voice note. |
The four shapes:
{ "file_id": "<uuid>", "caption": "…" }
{ "file_ids": ["<uuid>", "<uuid>"], "captions": ["…", "…"] }
{ "url": "https://…", "file_name": "…", "caption": "…" }
{ "urls": ["https://…", "https://…"], "file_names": ["…", "…"], "caption": "…" }
caption, captions, file_name and file_names are optional.
How do I send a file I uploaded earlier?
Upload it with POST /api/v1/files, then send its id as file_id (or several as file_ids). An uploaded file can be sent any number of times, to several chats. The first send sets the file's sent_at and clears its expires_at, so it is kept until you delete it. An unknown, expired, deleted or other workspace's file answers 404 with file not found; an id that is not a UUID, 400 with invalid file id.
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 '{
"file_id": "4f1c2d3e-4a5b-4c7d-8e9f-0a1b2c3d4e5f",
"caption": "Your invoice for October"
}'How do I send a file from a link?
Send url (or several as urls). whatsappx.si downloads the file, checks it like an uploaded one, then sends it. Up to 4 downloads run at the same time; the files are still sent in request order.
The file is sent under the first name available: file_name (or file_names[i]), the file name in the response's Content-Disposition header, the last segment of the URL path, or file. That name is then cleaned and given an extension of the detected type.
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/files/price-list.pdf",
"file_name": "price-list-october.pdf",
"caption": "Our prices for October"
}'Which links are allowed?
To keep the download safe, a link must pass these checks. A link that fails one answers 400 with the error shown, unless noted otherwise.
- https only:
url must use https. Alsourl is required,invalid url,url must not contain a user name or passwordandurl is too long (at most 2048 characters). - Public addresses only: the host must resolve only to public IP addresses. Private ranges (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16), loopback, link-local (including the cloud metadata address 169.254.169.254), multicast, CGNAT (100.64.0.0/10), unspecified, reserved and documentation ranges, and on IPv6
::1, unique localfc00::/7, link-localfe80::/10and NAT64, 6to4 and Teredo addresses are refused:url host is not allowed: it resolves to a private or reserved address. A host that does not resolve:could not resolve the url host. - No DNS rebinding: the connection goes to the IP address that was checked.
- At most 3 redirects, each to an
httpslink that is checked again:too many redirects (at most 3),redirect to a non-https url is not allowed. - 20 seconds in total for all the downloads of one request:
download timed out (20 seconds). - A successful answer: any status outside 2xx fails, for example
download failed: the server answered 404. Other network errors also start withdownload failed:. - Size: the download stops at the limit of the file's type (5 MB for photos, 16 MB for everything else) and answers
413, as for an upload. - Type from the bytes: the type is detected from the downloaded content; the name's extension is only used to tell apart types whose bytes look alike, such as DOCX and ZIP. A file that is not a supported type answers
415.
What does the customer receive?
Photos arrive as photos, videos as videos, audio files as audio messages (not voice notes, unless you send voice_note=true; see Send a voice note) and everything else as a document under its file name. The file name is cleaned before it is sent: any folder path, control characters and the characters <>:"/\|?* are removed, and it always ends in an extension of the detected type (a photo named IMG_0001 is sent as IMG_0001.jpg).
How is the sent file stored?
Like a received one: the message's media_url (/api/media/<workspace>/<file>) serves the file you sent, with your API key; see Download a message's file. The original name is the message's file_name. Each message keeps its own copy, so deleting an uploaded file does not affect messages already sent with it.