Skip to content

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.

POST/api/conversations/{id}/attachments
  • Bearer API key
  • Scope: write or admin
  • or app session
  • Workspace: X-Tenant-ID (optional with a key)

Path parameters

  • iduuidrequired

    Conversation id.

    Example
    6a1f3c52-8e0b-4d7a-b1f2-93c4d5e6f708

Headers

  • Authorizationstringrequired

    Your API key as Bearer <key>. The word Bearer and the space are case-sensitive. Browser clients signed in to the app use the session cookie instead.

    Constraints
    Keys start with pk_live_ and are 47 characters long (56 for keys created before 10 October 2026).
    Example
    Bearer pk_live_…
  • X-Tenant-IDuuidoptional

    Workspace 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.

    Example
    8d0f6c2e-3b1a-4c55-9a7e-2f4b6d1e9c30

Body

multipart/form-data
  • filefilerequired

    A file, as a form part with a file name. Repeat the part to send several files (the field names files and files[] work too). Its type is detected from its content together with the file name’s extension; the part’s own Content-Type is ignored. A name without an extension takes the type the content shows. To send JSON instead, see JSON bodies below.

    Constraints
    1 to 10 files, at most 60 MB for the whole request. Photos: JPEG, PNG, WebP, up to 5 MB. Videos: MP4, 3GP, up to 16 MB. Audio: MP3, OGG (Opus), AAC, AMR, M4A, up to 16 MB. Documents: PDF, DOC, DOCX, XLS, XLSX, PPT, PPTX, TXT, CSV, ZIP, up to 16 MB.
    Example
    @invoice-1042.pdf
  • captionstringoptional

    Text 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.

    Constraints
    At most 1024 characters. Audio files cannot have a caption. Not together with captions[].
    Example
    Your invoice for October
  • captions[]stringoptional

    One 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 captions works too.

    Constraints
    Not more parts than files (more captions than files). Each at most 1024 characters; audio files cannot have a caption. Not together with caption.
  • voice_notebooleanoptional

    true sends the file as a WhatsApp voice note (waveform and play button) instead of an audio file. In JSON, send "voice_note": true with file_id or url. See Send a voice note.

    Constraints
    Exactly one audio file, up to 16 MB and 15 minutes; no caption.
    Default
    false
    Example
    true

Response

201 Createdapplication/json

  • iduuid

    Message id in whatsappx.si.

  • whatsapp_message_idstring

    Message id assigned by WhatsApp.

  • conversation_iduuid

    Conversation the message belongs to.

  • sender_jidstring

    WhatsApp id (JID) of the sender. For your own messages, the connected number.

  • sender_namestring

    Sender display name, when WhatsApp provides one (may be empty). AI Assistant for messages the AI assistant sent.

  • contentstring

    Message text. Images and documents carry their caption here. Types without downloadable media (for example location) use a placeholder such as [location message].

  • message_typestring

    text, image or document. Stickers arrive as image; video and audio (including voice notes) as document. Other Cloud API types (for example location) keep the name Meta sends and have no downloadable media.

  • media_urlstringmay be absent

    Path of the stored media file, for example /api/media/<workspace>/<file>. Prefix it with https://whatsappx.si and 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 absent

    MIME type of the media file.

  • file_namestringmay be absent

    Original file name of a document.

  • file_sizeintegermay be absent

    Media size in bytes.

  • timestamptimestamp

    When the message was sent on WhatsApp (RFC 3339).

  • from_meboolean

    true for messages sent from the connected number (by your team, the API or an automation).

  • statusenum

    received for incoming messages. Outgoing ones start as sent, then become delivered (two grey ticks: the contact’s phone got it) and read (blue ticks: they opened it; for a voice note, played it). Status only moves forward. Contacts who turned off read receipts never reach read; in a group the first member’s receipt counts.

  • delivered_attimestampnullable

    When an outgoing message was first delivered to the contact’s phone (RFC 3339). null for incoming messages and until delivered.

  • read_attimestampnullable

    When an outgoing message was first read (blue ticks). null for incoming messages, until read, and when the contact has read receipts turned off.

  • edited_attimestampnullable

    When the text was last edited: through the API or the app, or by its sender on WhatsApp. null if never edited.

  • deleted_attimestampnullable

    When the message was deleted for everyone. Its content and media fields are then empty. null if not deleted.

  • created_attimestamp

    When whatsappx.si stored the message (RFC 3339).

  • sent_by_user_iduuidmay be absent

    User 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 absent

    Name of that teammate. Left out with sent_by_user_id.

  • sent_via_api_key_iduuidmay be absent

    Id of the API key the message was sent with. Left out for messages not sent through the API.

  • sent_via_api_key_namestringmay be absent

    Name 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_type is image for a photo and document for 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?. Also invalid 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 read scope, which only allows GET requests (API key is read-only). A key in another workspace gets API key belongs to a different workspace; a key used from an IP address outside its allowed_ips gets this 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). With file_id or file_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 a Retry-After header 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?

LimitValue
Files per request1 to 10
Request body60 MB for a form, 64 KB for JSON
Photos (JPEG, PNG, WebP)5 MB each
Videos, audio and documents16 MB each
Caption1024 characters; none for audio
Files sent per workspace30 a minute (each file counts)
Downloads from links20 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.

  • caption goes 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. caption and captions[] 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:

FieldTypeDescription
messagesarray of MessageThe messages that were sent, in request order. Each is shaped like the single-file response.
failedarray of objectThe 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.

FieldTypeDescription
file_iduuidSend one uploaded file.
file_idsarray of uuidSend several uploaded files, in this order. Not empty (file_ids is empty).
urlstringDownload one file from this https link and send it.
file_namestringOnly with url: the name to send the file under.
urlsarray of stringDownload several files and send them, in this order. Not empty (urls is empty).
file_namesarray of stringOnly with urls: the names, in the same order as urls. Not more than urls.
captionstringCaption, as in the form.
captionsarray of stringOne caption per file, in order. Not more than files, and not together with caption.
voice_notebooleantrue 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"
}'

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"
}'

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. Also url is required, invalid url, url must not contain a user name or password and url 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 local fc00::/7, link-local fe80::/10 and 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 https link 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 with download 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.