Sendable Docs

Error Handling

Understanding error codes and handling failures in Sendable API.

HTTP Status Codes

CodeMeaningDescription
200OKRequest succeeded
400Bad RequestInvalid request parameters
401UnauthorizedInvalid or missing API key
403ForbiddenAPI key lacks permission
404Not FoundResource doesn't exist
429Too Many RequestsRate limit exceeded
500Server ErrorInternal server error

Error Response Format

All errors follow this structure:

{
  "success": false,
  "error": {
    "code": "INVALID_PHONE_NUMBER",
    "message": "The phone number format is invalid",
    "details": {
      "field": "to",
      "value": "123456"
    }
  }
}

Common Error Codes

Authentication Errors

CodeDescriptionSolution
UNAUTHORIZEDAPI key is missing or invalidCheck your API key header
KEY_REVOKEDAPI key has been revokedGenerate a new API key
SESSION_EXPIREDSession has expiredReconnect your session

Request Errors

CodeDescriptionSolution
INVALID_PHONE_NUMBERPhone number format is invalidUse international format (e.g., 6281234567890)
MESSAGE_TOO_LONGText exceeds maximum lengthSplit into multiple messages
MEDIA_DOWNLOAD_FAILEDCould not download media URLCheck URL is accessible
SESSION_NOT_CONNECTEDWhatsApp session is not connectedReconnect your session

Rate Limit Errors

CodeDescriptionSolution
RATE_LIMITEDToo many requestsImplement exponential backoff
QUOTA_EXCEEDEDMonthly quota exceededUpgrade your plan

Retry Strategy

Implement exponential backoff for transient errors:

async function sendWithRetry(message: any, maxRetries = 3) {
  for (let i = 0; i < maxRetries; i++) {
    try {
      return await sendMessage(message)
    } catch (error) {
      if (error.status === 429 || error.status >= 500) {
        const delay = Math.pow(2, i) * 1000 // 1s, 2s, 4s
        await new Promise(r => setTimeout(r, delay))
        continue
      }
      throw error
    }
  }
}

On this page