Complete reference for API errors, status codes, and how to handle them gracefully in your applications.
All API errors return a consistent JSON structure:
| Status | Type | Description |
|---|---|---|
400 |
Bad Request | Invalid request parameters |
401 |
Unauthorized | Invalid or missing API key |
403 |
Forbidden | Insufficient permissions |
404 |
Not Found | Resource doesn't exist |
429 |
Rate Limited | Too many requests |
500 |
Server Error | Internal server error |
503 |
Service Unavailable | API temporarily overloaded |
The request was malformed or contained invalid parameters.
Check the error message for the specific parameter that's invalid. Validate your request body against the API documentation.
Authentication failed. The API key is missing, invalid, or expired.
Verify your API key in the dashboard. Ensure it's passed correctly in the Authorization header as "Bearer sk-..."
Your API key doesn't have permission to access this resource.
Check your account status and plan limits in the dashboard. Ensure your API key has the required permissions.
You've exceeded your rate limit. Too many requests or tokens in a short period.
Implement exponential backoff and retry. Check the Retry-After header. Consider upgrading your plan for higher limits.
An unexpected error occurred on our servers. This is not your fault.
Retry the request after a short delay. If the issue persists, check our status page or contact support.
The API is temporarily overloaded or under maintenance.
Wait a few minutes and retry. Check the status page for ongoing incidents.
from mythicdot import MythicDot from mythicdot import ( APIError, AuthenticationError, RateLimitError, BadRequestError ) client = MythicDot() try: response = client.chat.completions.create( model="mythic-4", messages=[{"role": "user", "content": "Hello!"}] ) except AuthenticationError: print("Invalid API key. Check your credentials.") except RateLimitError as e: print(f"Rate limited. Retry after: {e.retry_after}s") except BadRequestError as e: print(f"Bad request: {e.message}") except APIError as e: print(f"API error: {e.status_code} - {e.message}")