Errors
How the OonoBox API reports failures.
Every error uses one envelope, with a matching HTTP status:
{
"error": {
"code": "VALIDATION_FAILED",
"message": "`to` must be a phone number in international format.",
"details": null
}
}code— a stable, machine-readable string. Branch on this, not the message.message— a human-readable explanation, safe to log.details— optional structured context (e.g. which fields failed), ornull.
Status codes
| HTTP | code | When you'll see it |
|---|---|---|
| 400 | VALIDATION_FAILED | Missing/invalid fields (bad phone, empty body, …). |
| 401 | NOT_AUTHENTICATED | Missing, invalid, revoked, or wrong-scope API key. |
| 404 | NOT_FOUND | The template (or other resource) doesn't exist in this workspace. |
| 422 | TEMPLATE_NOT_APPROVED | The template isn't approved yet. |
| 422 | WINDOW_CLOSED | Free-form text outside the 24-hour window — send a template instead. |
| 422 | META_ERROR | WhatsApp rejected the send; message forwards Meta's reason. |
| 429 | RATE_LIMITED | A rate limit was exceeded (e.g. OTP sends per recipient). |
Handling tips
- Treat any
2xxas success and read the JSON body for ids. - On
401, stop and check the key + its scopes — retrying won't help. - On
429, back off and retry later. WINDOW_CLOSEDis expected for proactive outreach — fall back to a template automatically.