The WaMyDocs API
Send documents to your clients' WhatsApp straight from your own software, and see when each is delivered and read.
Each document you send through the API takes exactly the same steps as one emailed to WaMyDocs: the same checks, conversion and number scan, the same secure links, consent and opt-outs, and it counts on your plan the same way. It appears in your Sent log too.
1. Get a key
The business's owner or an admin makes one in the dashboard: Settings, API keys. It's shown once: copy it into your software's secret settings. Treat it like a password: anyone who has it can send documents as your business. A business can have up to 10 keys, and you can remove one at any time. A key stops working if the person who made it leaves the team.
2. Send a document
One file to one client per request. Send it as a form (multipart/form-data):
curl https://hooks.wamydocs.com/v1/documents \
-A "YourApp/1.0" \
-H "Authorization: Bearer wmd_your_key" \
-H "Idempotency-Key: invoice-1042" \
-F to=0821234567 \
-F type=invoice \
-F file=@INV-1042.pdf
or as JSON, with the file's content in base64:
POST https://hooks.wamydocs.com/v1/documents
Authorization: Bearer wmd_your_key
User-Agent: YourApp/1.0
Content-Type: application/json
{ "to": "0821234567", "type": "invoice",
"file": { "name": "INV-1042.pdf", "content": "JVBERi0xLjcK..." } }
| Field | What it is |
|---|---|
to | The client's WhatsApp number, written as for a number address: your own country's numbers the local way (0821234567), others with 00 and the country code (00447700900123). |
email | Instead of to: the client's email address, if WaMyDocs already knows their number. |
type | Optional: invoice, statement, quote, receipt, credit_note, proof_of_payment, itinerary, ticket, contract. Otherwise it's worked out from the file, as for an email. |
secure | Optional: true sends it by secure link, opened with a code we email to the client. |
file | The document: a PDF, a Word or Excel file, or a photo (made into a PDF), up to 20 MB. |
The answer, 202 Accepted:
{ "id": "6f1c…",
"documents": [ { "id": "9b2e…", "status": "queued", "type": "invoice",
"reference": "INV-1042", "to": "+27 82 … 4567", "via": "whatsapp",
"secure_link": false, "delivered_at": null, "read_at": null, "reason": null } ],
"problems": [] }
problems lists anything found in the file that stopped part of it going, in the same words as an emailed report.
3. See how it went
curl https://hooks.wamydocs.com/v1/documents/9b2e… -A "YourApp/1.0" -H "Authorization: Bearer wmd_your_key"
| status | Meaning |
|---|---|
queued, sending | On its way to WhatsApp. |
accepted | WhatsApp has it. |
delivered | On the client's phone (delivered_at). |
read | Opened (read_at), where the client hasn't switched off read receipts. |
awaiting_confirmation | A new number, waiting for the OK we emailed the key's maker ("check new numbers first" in Settings). |
awaiting_template | Waiting for Meta to approve the business's message template. |
held, failed | Not sent: reason says why (for example, not on WhatsApp, or replied STOP). |
Rules
- Name your software in a
User-Agentheader, such asYourApp/1.0, so we can tell your requests apart if you ask us for help. - Retries: send the same
Idempotency-Key(up to 100 letters, digits and. _ : -) and, for 24 hours, a retry answers with the first send instead of sending again. - Limits: 60 sends a minute per key. Over it, the answer is
429withRetry-After. - No report email is sent for API sends: the answers above take its place.
- Send only to clients who have agreed to get documents from you on WhatsApp.
Errors
Every error answers with { "error": { "code": "…", "message": "…" } }:
| HTTP | code | When |
|---|---|---|
| 400 | bad_request | A field is missing or wrong; the message says which. |
| 401 | unauthorized | No key, or a key that isn't valid or was removed. |
| 403 | forbidden | The key's maker is no longer on the team. |
| 404 | not_found | No such document in this business. |
| 409 | cannot_send | The business can't send now: no plan, WhatsApp not connected, on hold or closed. The message says which. |
| 409 | in_progress | A request with the same Idempotency-Key is still being handled. |
| 413 | too_large | The file is over 20 MB. |
| 415 | unsupported_media_type | Not a form or JSON. |
| 429 | rate_limited | Over 60 sends a minute. |
Webhooks
Instead of asking, your software can be told each time a document's status changes. In Settings, API keys, add your address (https): a signing secret is shown once. Then, for every change (accepted, delivered, read, held, failed, or waiting for an OK or a template), we send:
POST https://example.com/wamydocs
Content-Type: application/json
User-Agent: WaMyDocs-Webhooks/1.0
WaMyDocs-Event-Id: 3f9a…
WaMyDocs-Signature: t=1795480000,v1=5d1c…
{ "id": "3f9a…", "type": "document.status", "created_at": "2026-11-25T09:41:07.000Z",
"data": { "id": "9b2e…", "status": "delivered", "type": "invoice", "reference": "INV-1042",
"to": "+27 82 … 4567", "via": "whatsapp", "delivered_at": "2026-11-25T09:41:07.000Z", … } }
Check the signature before trusting an event: the HMAC-SHA256 of t, a full stop and the raw body, made with your signing secret, must equal v1. In Node.js:
const [t, v1] = header.split(",").map((part) => part.split("=")[1]);
const expected = crypto.createHmac("sha256", secret).update(`${t}.${rawBody}`).digest("hex");
const fresh = Math.abs(Date.now() / 1000 - Number(t)) < 300;
const valid = fresh && crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(v1));
- Answer with any 2xx within 10 seconds. Otherwise we try again after 1, 5 and 30 minutes, then 2, 6 and 12 hours, and a day, then stop (8 tries in all).
- Each try is signed afresh, and keeps the same
WaMyDocs-Event-Id: use it to ignore repeats. Events can arrive out of order:created_atsays when the change happened. - Send a test event in Settings posts a
pingevent to your address and shows the answer. - Events follow a document once it's sent; its first status is in the answer to your POST.
Questions, or something you need? Contact us.