Concepts

Errors

Failed requests return a non-2xx status and a JSON body of the form { "error": { "code", "message", "request_id" } }. Branch on code, and quote request_id to support.

Tusk WhatsApp API: Errors

What does an error look like?

404 Not Found
{
  "error": {
    "code": "not_found",
    "message": "Session not found",
    "request_id": "req_8f2c1a9d03b44e7a1c5d"
  }
}

Which error codes can I get?

HTTPcodeMeaning
400bad_requestThe request could not be processed, for example the body is not valid JSON.
401invalid_credentialsMissing, wrong or revoked API key.
402payment_requiredYour WhatsApp plan is not active. Renew it.
402subscription_requiredSending or webhooks need a WhatsApp plan, and you have none.
402subscription_expiredYour plan or trial ended. Sending and webhooks stop until you renew.
403webhook_limitYou reached the number of webhooks your plan includes.
409session_not_readyThe session is not connected, so it cannot send.
422invalid_webhook_urlThe webhook URL is not https on a public host.
422invalid_phoneThe phone number could not be read.
422invalid_chat_idThe chat id is malformed.
502gateway_unavailableTemporary problem reaching WhatsApp. Retry with backoff.
402session_limitYou reached the number of sessions your plan includes.
403forbiddenThe account is disabled.
404not_foundUnknown session, chat, group, webhook, template or message. Also returned for sessions that belong to someone else.
409conflictThe request conflicts with the current state of the resource.
413payload_too_largeThe request body is over 30 MB.
422validation_errorA field is missing or invalid, including a webhook URL that is not public.
429rate_limitedToo many requests. See Retry-After.
501not_supportedThe operation is not supported for this session.
502upstream_errorWhatsApp could not complete the request. Safe to retry with backoff.

How should I handle errors?

  • 4xx (except 429): fix the request or the account state. Retrying will not help.
  • 429: wait for Retry-After, then retry.
  • 5xx: retry with exponential backoff.