Skip to main content

HTTP Status Codes

CodeMeaning
200Success
201Created
204No content (e.g. after DELETE)
400Bad request — malformed JSON or missing required parameter
401Unauthorized — invalid or missing API key
404Resource not found
409Conflict — e.g. account not connected
422Validation error — check details for field errors
429Rate limit or daily quota exceeded
502Meta API error

Error Response Format

All errors return a JSON object with an error key:
{
  "error": "Business account not found"
}
Validation errors include a details object with per-field messages:
{
  "error": "Validation failed",
  "details": {
    "url": ["must be HTTPS", "can't be blank"],
    "email": ["is invalid"]
  }
}
Plan limit errors on free plan include an upgrade URL:
{
  "error": "free_plan_limit_reached",
  "upgrade_url": "https://whatsrb.com/pricing"
}

Retry Strategy

For 429 and 5xx errors, implement exponential backoff. Start with a 1s delay and double it each attempt:
retries = 0
begin
  client.business_messages(account_id).create(...)
rescue WhatsrbCloud::RateLimitError, WhatsrbCloud::ServerError => e
  raise if retries >= 3
  sleep(2 ** retries)
  retries += 1
  retry
end