API Docs

Errors

Every error code the API returns and what to do about it.

Error shape

Failed requests use the normal response envelope with success: false. Decide what to do from status_code and error; show messageto a person if you like, but don't branch on its text.

Response
400 Bad Request
{
  "success": false,
  "status_code": 400,
  "status_text": "Bad Request",
  "message": "insufficient balance",
  "error": "creation_error"
}

Error codes

All error codes
StatuserrorWhen it happens
400validation_errorA field is missing, empty, too long or the wrong type. message names the field.
400creation_errorThe request was valid but couldn't be carried out: sender name not approved or not yours, not enough balance, WhatsApp template not approved, amount below the bundle price, name already taken.
400invalid_parameterA path parameter is malformed — usually an id that isn't a UUID.
400verification_errorThe OTP is wrong, expired or already used.
400idempotency_conflictThe same Idempotency-Key was reused for a different request body.
401missing_tokenNo API key was sent.
401invalid_tokenThe API key is wrong or was deleted.
401account_not_foundThe key's account no longer exists.
401account_disabledThe account is switched off.
401account_not_verifiedThe account hasn't been verified yet.
403forbiddenThe key may not access this resource (e.g. another customer's sender name).
404not_foundNo resource with that id belongs to you.
405method_not_allowedWrong HTTP method for this path.
429rate_limitedToo many requests in a short time. Wait for Retry-After seconds.
500server_errorAn unexpected problem on our side. It's logged and we're alerted.

Handling errors

  • 4xx (except 429): fix, don't retry. Sending the same request again will fail the same way.
  • 429 and 5xx: retry with backoff. Wait 1 s, 2 s, 4 s… up to a minute, and honour Retry-After.
  • Timeouts on sends: retry with the same Idempotency-Key so the message isn't sent twice.
  • Log the error code and your request id so support can find the request quickly.
Retry helper (JavaScript)
async function callNbm(url, options, attempt = 0) {
  const res = await fetch(url, options);
  const body = await res.json();
  if (body.success) return body.data;

  const retryable = res.status === 429 || res.status >= 500;
  if (retryable && attempt < 5) {
    const wait = Number(res.headers.get("Retry-After")) || 2 ** attempt;
    await new Promise((r) => setTimeout(r, wait * 1000));
    return callNbm(url, options, attempt + 1);
  }
  throw Object.assign(new Error(body.message), { code: body.error, status: res.status });
}