Reference
Responses and errors
Every answer is JSON with success. When it’s false, error says in plain words what went wrong and what to change.
Error format
400 Bad Request
{
"success": false,
"error": "templateParams: This template needs 3 values (for {{1}}, {{2}}, {{3}}), got 2.",
"expected": 3
}Some errors add details, such as expected (how many values or cards are needed) or problems (a list of every value that needs fixing).
Status codes
| Status | Meaning | What to do |
|---|---|---|
200 | WhatsApp accepted the message (or the dryRun passed). | Nothing. |
400 | A value is missing or wrong: number, values, file link, button, code… | Fix the request. The error says which field. |
401 | The API key is missing, wrong or revoked. | Check the key. See API keys. |
402 | The wallet is too low, or sending is paused for your account. | Add money to the wallet, or contact us. |
403 | The API isn’t part of your QMessage plan. | Contact us to turn it on. |
404 | No API campaign with that name in this project. | Check campaignName and that the key is from the right project. |
409 | Can’t send right now: the campaign is paused, the template is no longer approved, the number isn’t connected, or the contact opted out or is blocked. | Read the error. Retrying the same request won’t help until that changes. |
422 | WhatsApp refused the message. | Read error and hint. See below. |
429 | More than 20 requests a second with this key. | Wait a moment and retry. |
500 | Something went wrong on our side. | Retry after a short wait. |
502 | WhatsApp couldn’t be reached, or a file couldn’t be uploaded to it. | Retry after a short wait. |
Common errors
| Error says | Why |
|---|---|
| campaignName is required | The body has no campaignName. |
| No API campaign named “…” | The name doesn’t match an API campaign in the key’s project. |
| API campaign “…” is paused | Someone paused it in QMessage. Resume it to send. |
| destination: Not a valid WhatsApp number | The number is too short or long. Send it with the country code. |
| templateParams: This template needs N values | Send exactly as many values as the template has. |
| templateParams: Value N is empty | A value is blank. Fill it, or send paramsFallbackValue. |
| media: This template has an image header | Send media.url, or set a default file on the API campaign. |
| media.url: Use a public link that starts with https:// | The file link isn’t https, or isn’t a link. |
| buttonParams: Send the link ending for button N | The template has a website button whose link needs a value. |
| This contact opted out of marketing messages. | The customer stopped marketing messages. Utility templates still go. |
| Your wallet balance is too low | Add money to your QMessage wallet, then send again. |
When WhatsApp refuses a message
QMessage checks everything it can before sending. If WhatsApp still refuses the message, you get status 422 with WhatsApp’s reason, its error code and a hint:
422 Unprocessable Entity
{
"success": false,
"error": "Template name does not exist in the translation",
"code": 132001,
"hint": "This template does not exist (or not in this language).",
"messageId": "6f1c2a9e-0d3b-4c71-9a55-2b7d8e4f1c20"
}The failed message is kept in QMessage with this reason, so your team can see it too. Common codes:
| Code | Meaning |
|---|---|
131026 | Couldn’t deliver. The number may not be on WhatsApp, or the customer has an old app. |
131049 | WhatsApp held back this marketing message so the customer doesn’t get too many. Try later. |
131050 | The customer stopped marketing messages from your business on WhatsApp. |
132001 | The template doesn’t exist, or not in this language. |
132015 | The template is paused because of low quality. |
131056 | Too many messages to this customer in a short time. Wait and retry. |
130429 | Your number’s sending speed limit was reached. Retry shortly. |
131031 | The WhatsApp account is locked. Contact us. |
Retrying
- Retry
429,500and502after a short wait, waiting a little longer each time (for example 1, 5, then 30 seconds). - Don’t retry 400, 401, 403, 404 or 409 as they are. The same request will fail again until something changes.
- After a
200, don’t send the same request again: it would send a second message.
Note
A
200 means WhatsApp accepted the message. It can still fail later, for example if the phone can’t be reached for days. Those messages show as Failed in the API campaign’s results in QMessage.