Sending
Send a file
POST
/v1/messagesSending a file takes two steps: upload the bytes once, then send them by id. The same upload can go to as many recipients as you like.
1. Upload
bash
curl -X POST "https://api.api-supp.com/v1/media?filename=menu.pdf" \
-H "Authorization: Bearer wat_YOUR_TOKEN" \
-H "Content-Type: application/pdf" \
--data-binary @menu.pdfThe response contains a media_id (mu_…). Details, limits and clean-up are on Media uploads.
2. Send
POST https://api.api-supp.com/v1/messages
| Field | Type | Notes |
|---|---|---|
recipient | string | Required. Phone digits or a full JID |
media_id | string | Required. From the upload |
message | string | Optional caption (ignored for audio) |
json
{ "recipient": "14155550132", "media_id": "mu_xyz...", "message": "This week's menu" }The file extension decides how it arrives:
| Extension | Sent as |
|---|---|
.jpg .png .gif | Image |
.mp4 .mov | Video |
.ogg | Voice note |
| Other audio | Audio |
| Anything else | Document, with its original filename |
Response
json
{
"ok": true,
"recipient": "14155550132@s.whatsapp.net",
"wa_message_id": "3EB0CB97F37F91F563B060",
"media": { "kind": "image", "mimetype": "image/jpeg", "size": 12345, "filename": "x.jpg", "media_id": "mu_..." }
}Errors
404unknownmedia_id502WhatsApp rejected the message503the number isn't connected right now
Documents open by type, not by name. The recipient's phone picks the app from the file's type, which comes from its extension. Common types are covered (PDF, Office files, CSV, TXT, JSON, ZIP and more). An unusual extension may arrive as a file the phone can't open; in that case send a link to the file instead.