Skip to main content

Error Response Format

All errors follow this structure:
{
  "data": null,
  "error": {
    "code": "ERROR_CODE",
    "message": "Human-readable error message"
  },
  "meta": {
    "request_id": "d6a8f6f2-3b5a-4f0a-81ab-1b4a4c9dd5ea"
  }
}

Error Codes

CodeHTTP StatusDescription
INVALID_INPUT400Request body is missing or malformed
MESSAGE_TOO_LONG400Message exceeds 5000 characters
BLOCKED_KEYWORD400Message contains blocked content
COUNTRY_NOT_ALLOWED400Country not allowed
IP_COUNTRY_NOT_ALLOWED400IP geo-location blocked
LANGUAGE_NOT_ALLOWED400Language not allowed
UNAUTHORIZED401Missing API key
MISSING_API_KEY401API key header missing
INVALID_API_KEY403Invalid API key
API_KEY_DISABLED403API key disabled
DAILY_LIMIT_EXCEEDED429Daily request limit exceeded
MONTHLY_LIMIT_EXCEEDED429Monthly request limit exceeded
INTERNAL_ERROR500Server error
REDIS_UNAVAILABLE503Rate limiter temporarily unavailable

Common Errors

Missing API Key (401)

{
  "data": null,
  "error": {
    "code": "MISSING_API_KEY",
    "message": "A valid API key must be supplied in the x-api-key header."
  },
  "meta": { "request_id": "..." }
}
Solution: Add your API key to the x-api-key header.

Invalid API Key (403)

{
  "data": null,
  "error": {
    "code": "INVALID_API_KEY",
    "message": "Invalid API key."
  },
  "meta": { "request_id": "..." }
}
Solution: Check that your API key is correct and not revoked.

Rate Limit Exceeded (429)

{
  "data": null,
  "error": {
    "code": "DAILY_LIMIT_EXCEEDED",
    "message": "Daily request limit exceeded."
  },
  "meta": { "request_id": "..." }
}
Solution: Wait for the rate limit to reset or upgrade your plan.

Handling Errors in Code

try {
  const response = await client.analyzeMessage("...");

  if (response.error) {
    console.error(`Error: ${response.error.code}`);
    console.error(`Message: ${response.error.message}`);
    // Handle specific error codes
    if (response.error.code === 'DAILY_LIMIT_EXCEEDED') {
      // Implement backoff
    }
  }
} catch (error) {
  console.error('Network error:', error);
}

Request IDs

Every response includes a request_id in the meta object. Include this ID when contacting support for faster issue resolution.