Error Handling

The JAVIS API follows a consistent JSON error structure to help developers diagnose and resolve issues quickly. This section outlines common errors, their meanings, and best practices for handling them.


🔗 Standard Error Response Format

All error responses follow this JSON structure:

{
  "status": "error",
  "error": {
    "code": 400,
    "message": "Invalid request parameters.",
    "details": "The 'orderId' field is required."
  }
}
  • status → Indicates an error (error)
  • error.code → HTTP status code
  • error.message → Human-readable description of the error
  • error.details → Additional information for debugging (optional)

📡 Common HTTP Errors & Status Codes

Status CodeMeaningDescription
400Bad RequestThe request is malformed or missing required fields.
401UnauthorizedThe request lacks valid authentication credentials.
403ForbiddenThe user does not have permission to access this resource.
404Not FoundThe requested resource does not exist.
409ConflictThe request conflicts with the current state of the resource.
422Unprocessable EntityThe request was valid, but the server could not process it.
429Too Many RequestsThe client has exceeded the API rate limits.
500Internal Server ErrorA server-side error occurred. Try again later.
504Gateway TimeoutThe request took too long to process. Retry the request.

⏳ Handling Rate Limits (429 Too Many Requests)

If you exceed the rate limit, the API returns:

{
  "status": "error",
  "error": {
    "code": 429,
    "message": "Rate limit exceeded. Try again after 30 seconds."
  }
}

🔄 Retry Strategy: Exponential Backoff

To avoid hitting rate limits repeatedly, implement exponential backoff:

  1. Wait 1 second, retry.
  2. If it fails, wait 2 seconds, retry.
  3. If it still fails, wait 4 seconds, retry.
  4. Continue doubling wait time (e.g., 8s, 16s) up to 5 retries.

🔥 Handling Server & Timeout Errors (500, 504)

If a server-side error occurs (500 Internal Server Error, 504 Gateway Timeout), follow these best practices:

Retry the request using exponential backoff.
✅ If retries fail multiple times, contact support.


🛠 Troubleshooting & Support

If you encounter persistent issues:

Check the error message and HTTP status code.
Ensure your request follows the API specification. ✅ Refer to the API documentation for required fields. ✅ Contact support if issues persist.

📧 Support Email: [email protected]