Errors

A failed request has an HTTP status that says what kind of failure it is, and a code that says exactly which. Branch on the code; show or log the message.

Format

{
  "success": false,
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "to: Recipient phone is required",
    "details": [
      {
        "field": "to",
        "message": "Recipient phone is required"
      }
    ]
  }
}

message is written to be read by a person and may change wording over time, so do not match on it. details appears only on some errors.

Codes

StatusCodeMeaningRetry?
400BAD_REQUESTThe request was understood but cannot be done: the template is not approved, a button value is missing, WhatsApp refused the message. The message says which.No. Fix the request.
400HEADER_MEDIA_REQUIREDThe template has an image, video or document header and the send had no headerMediaUrl.No. Add the link.
400NO_OPEN_CONVERSATIONA reply was sent outside the 24-hour window.No. Send a template instead.
400MEDIA_TOO_LARGEThe file is over 16 MB.No.
400MEDIA_FETCH_FAILEDDownloading the file link failed, for example it answered 404.Only after fixing the link.
400MEDIA_URL_REJECTEDThe file link points somewhere we will not fetch from, such as a private address.No.
401API_KEY_MISSINGNo key was sent.No.
401API_KEY_INVALIDThe key is wrong or revoked.No.
401API_KEY_EXPIREDThe key passed its expiry date.No. Create a new key.
403API_KEY_IP_NOT_ALLOWEDThe call came from an address the key does not allow. The message names the address.No. Add the address to a new key, or call from an allowed one.
401WORKSPACE_SUSPENDEDThe workspace is suspended.No.
402WALLET_INSUFFICIENTThe workspace pays through the Wamafy wallet and the balance cannot cover the message. Nothing was sent or charged.Not on a timer. Resume once the wallet is topped up.
403API_SCOPE_MISSINGThe key lacks the scope this endpoint needs.No. Add the scope or use another key.
403API_QUOTA_EXCEEDEDThe plan's monthly API call allowance is used up.Next month, or after an upgrade.
403CAPACITY_LIMIT_REACHEDCreating this would go over a plan limit, such as contacts or campaigns a month.No.
404NOT_FOUNDNothing by that name or id in your workspace: template, number, contact, campaign, message.No.
422VALIDATION_ERRORA field is missing or the wrong type. details lists each one.No. Fix the request.
429Too many requests. Each key may make 60 a minute.Yes, after the number of seconds in the Retry-After header.
500, 502, 503Something failed on our side or at WhatsApp.Yes, with a growing delay (1s, 2s, 4s and so on).

WhatsApp delivery failures

A message can be accepted (status: "sent") and still fail on the way to the phone. That shows up later, in Get message status or the status webhook, with WhatsApp's own code. The common ones:

CodeWhat it means
131026The number is not on WhatsApp, or the person has blocked you. Stop sending to it.
131049WhatsApp held back a marketing message to protect the person from too many. It is not an error in your request; try again another day, or reach them when they next write to you.
131047The 24-hour window had closed by the time the reply went out. Send a template.
132000, 132012The template's variables or buttons did not match what was approved.
    Errors - Wamafy API