Errors
Errors and limits

WhatsApp API errors

A refused WhatsApp API call answers with an HTTP error status and a JSON error with a stable code, so your code can tell what went wrong and what to do next.

Error shape#

A refused call answers with an error status and this body:

jsonError
{
  "error": {
    "code": "CONTACT_NOT_FOUND",
    "message": "…",
    "request_id": "req_5f0c2a9e8b7d6c4a3b2e1f0d"
  }
}
  • Match on code in your code. message is written for people.
  • request_id is the same id as the answer's X-Request-Id header. Quote it when you contact support.

Validation errors#

A 400 VALIDATION_FAILED adds details, one entry per field that failed:

jsonValidation error
{
  "error": {
    "code": "VALIDATION_FAILED",
    "message": "…",
    "details": [
      {
        "path": "phone",
        "message": "…"
      }
    ],
    "request_id": "req_…"
  }
}

HTTP statuses#

  • 400

    Codes: VALIDATION_FAILED

    What to do: Fix the request. details lists each field.

  • 401

    Codes: UNAUTHORIZED

    What to do: Check the key and the Authorization header.

  • 402

    Codes: PLAN_LIMIT_REACHED, API_SUBSCRIPTION_REQUIRED

    What to do: Check the workspace's plan and message allowance.

  • 403

    Codes: FORBIDDEN

    What to do: The person the key belongs to cannot do this.

  • 404

    Codes: NOT_FOUND, CONTACT_NOT_FOUND, …

    What to do: Check the id. It must belong to this workspace.

  • 409

    Codes: WINDOW_CLOSED, CONTACT_OPTED_OUT, NO_CONNECTION, PHONE_DUPLICATE, IDEMPOTENCY_IN_PROGRESS

    What to do: The request clashes with the current state. Read the code.

  • 422

    Codes: IDEMPOTENCY_KEY_REUSED

    What to do: Use a new Idempotency-Key for a new request.

  • 429

    Codes: RATE_LIMITED

    What to do: Wait the seconds in Retry-After, then retry.

  • 500

    Codes: INTERNAL

    What to do: Retry later. If it keeps failing, contact support with the request_id.

Error codes#

  • VALIDATION_FAILED

    Status: 400

    What it means: An input failed its schema. The details list each field.

  • UNAUTHORIZED

    Status: 401

    What it means: The key is missing, wrong or no longer valid.

  • API_SUBSCRIPTION_REQUIRED

    Status: 402

    What it means: This action needs an active WhatsApp API plan.

  • PLAN_LIMIT_REACHED

    Status: 402

    What it means: The monthly message allowance or a plan cap is used up, or the plan does not include the API. It is included in API Growth and API Ultra.

  • INBOX_SEAT_REQUIRED

    Status: 402

    What it means: The person this key belongs to has no inbox seat on the plan.

  • FORBIDDEN

    Status: 403

    What it means: The person this key belongs to is not an owner or admin, and the action needs one.

  • OPT_IN_DASHBOARD_ONLY

    Status: 403

    What it means: Opting a contact back in is done by a person in the dashboard.

  • NOT_FOUND, CONTACT_NOT_FOUND, …

    Status: 404

    What it means: Nothing with that id exists in this workspace.

  • PHONE_DUPLICATE

    Status: 409

    What it means: That number is already a contact.

  • DUPLICATE_AUTO_REPLY

    Status: 409

    What it means: Another auto reply already answers that word.

  • WINDOW_CLOSED

    Status: 409

    What it means: Free text is only allowed within 24 hours of the customer's last message. Use a template.

  • NO_CONNECTION

    Status: 409

    What it means: No WhatsApp number is connected.

  • CONTACT_OPTED_OUT

    Status: 409

    What it means: The contact unsubscribed, so it cannot be sent to.

  • IDEMPOTENCY_IN_PROGRESS

    Status: 409

    What it means: The first call with this Idempotency-Key is still running.

  • IDEMPOTENCY_KEY_REUSED

    Status: 422

    What it means: This Idempotency-Key was already used for a different request.

  • RATE_LIMITED

    Status: 429

    What it means: Too many requests or sends for this key. Wait for Retry-After seconds.

  • INTERNAL

    Status: 500

    What it means: Something failed on SheetWA's side.

Which errors to retry#

  • 429: wait the seconds in Retry-After, then retry.
  • 500: retry with a growing wait. Send writes with the same Idempotency-Key so nothing runs twice.
  • 409 IDEMPOTENCY_IN_PROGRESS: retry shortly with the same key.
  • Any other 4xx: fix the request first. Sending it again gives the same answer.