Skip to content

Errors

CubeConnect uses standard HTTP status codes to indicate the success or failure of API requests.

HTTP Status Codes

CodeStatusDescription
200OKRequest succeeded
202AcceptedMessage queued for delivery
400Bad RequestInvalid request format
401UnauthorizedMissing or invalid API key
403ForbiddenInsufficient permissions
404Not FoundResource not found
422Unprocessable EntityValidation error
429Too Many RequestsRate limit exceeded
500Internal Server ErrorServer-side error
502Bad GatewayWhatsApp API unreachable
503Service UnavailableService temporarily down

Response Format

All API responses use a unified envelope format.

Success

json
{
  "success": true,
  "data": {
    "status": "queued",
    "message_log_id": 4521,
    "conversation_category": "SERVICE",
    "cost": 0.0
  }
}

Error

json
{
  "success": false,
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Human-readable error description.",
    "details": {}
  }
}

The details field is only present for validation errors and contains field-level messages.

Error Codes

Authentication

CodeHTTPDescription
AUTHENTICATION_REQUIRED401Missing API key
INVALID_API_KEY401Invalid API key
API_KEY_NO_TENANT403API key is not linked to any tenant
TENANT_NOT_FOUND403Specified tenant not found for this API key
FORBIDDEN403Insufficient permissions

Validation

CodeHTTPDescription
VALIDATION_ERROR422Invalid request data (includes field-level details)
INVALID_PHONE_NUMBER422Invalid phone number format

WhatsApp

CodeHTTPDescription
NO_ACTIVE_ACCOUNT422No connected WhatsApp account for this tenant
MISSING_ACCESS_TOKEN422WhatsApp account is missing its Meta access token
TEMPLATE_NOT_FOUND404WhatsApp template not found
MESSAGE_SEND_FAILED500Failed to send message via WhatsApp API

Billing

CodeHTTPDescription
RATE_LIMIT_EXCEEDED429API rate limit exceeded for your plan
PLAN_LIMIT_REACHED429You have reached your plan's messaging limit
SUBSCRIPTION_EXPIRED429Your subscription has expired

General

CodeHTTPDescription
NOT_FOUND404The requested resource was not found
TENANT_CONTEXT_MISSING500Tenant context is missing from the request
INTERNAL_ERROR500An internal server error occurred

Common Errors

Authentication Errors

json
// 401 - Missing API key
{
  "success": false,
  "error": {
    "code": "AUTHENTICATION_REQUIRED",
    "message": "API key is required."
  }
}

// 401 - Invalid API key
{
  "success": false,
  "error": {
    "code": "INVALID_API_KEY",
    "message": "Invalid API key."
  }
}

// 403 - API key has no tenant
{
  "success": false,
  "error": {
    "code": "API_KEY_NO_TENANT",
    "message": "API key is not linked to a tenant."
  }
}

// 403 - Tenant not found
{
  "success": false,
  "error": {
    "code": "TENANT_NOT_FOUND",
    "message": "Tenant not found for this API key."
  }
}

Message Errors

json
// 422 - No active WhatsApp account
{
  "success": false,
  "error": {
    "code": "NO_ACTIVE_ACCOUNT",
    "message": "No active WhatsApp account found."
  }
}

// 422 - Missing access token
{
  "success": false,
  "error": {
    "code": "MISSING_ACCESS_TOKEN",
    "message": "Meta access token is missing."
  }
}

// 422 - Validation error
{
  "success": false,
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "The given data was invalid.",
    "details": {
      "phone": ["The phone field is required."],
      "data.text": ["The data.text field is required when message type is text."]
    }
  }
}

Rate Limiting & Billing

json
// 429 - Rate limit exceeded
{
  "success": false,
  "error": {
    "code": "RATE_LIMIT_EXCEEDED",
    "message": "Rate limit exceeded for your current plan."
  }
}

// 429 - Plan limit reached
{
  "success": false,
  "error": {
    "code": "PLAN_LIMIT_REACHED",
    "message": "You have reached your plan limit."
  }
}

// 429 - Subscription expired
{
  "success": false,
  "error": {
    "code": "SUBSCRIPTION_EXPIRED",
    "message": "Your subscription has expired."
  }
}

WhatsApp API Errors

When the WhatsApp Cloud API returns an error, it is forwarded in the webhook status update:

json
{
  "statuses": [
    {
      "id": "wamid.xxx",
      "status": "failed",
      "errors": [
        {
          "code": 131047,
          "title": "Message failed to send because more than 24 hours have passed since the customer last replied."
        }
      ]
    }
  ]
}

Common WhatsApp error codes:

CodeDescription
13104724-hour messaging window expired
131048Spam rate limit hit
131051Unsupported message type
131026Message undeliverable (blocked or invalid number)
130472Number not registered on WhatsApp
132000Template parameter count mismatch
132012Template not found
132015Template paused or disabled

Handling Errors

Best Practice

Always check the HTTP status code before processing the response body. Implement retry logic for 429 and 5xx errors, but do not retry 4xx errors without fixing the request.

CubeConnect WhatsApp Business Platform