Error Codes
This page documents all error codes returned by the DocBit AI API and how to handle them.Error Response Format
All errors follow this format:HTTP Status Codes
400 Bad Request
The request was malformed or missing required data.| Error Message | Cause | Solution |
|---|---|---|
Missing required header: X-External-Org-Id | Header not provided | Add the header to your request |
Missing required header: X-External-User-Id | Header not provided | Add the header to your request |
Missing required header: X-External-Roles | Header not provided | Add the header to your request |
At least one role is required | Empty roles array | Provide at least one role |
Invalid JSON in request body | Malformed JSON | Check your JSON syntax |
Message is required | Empty or missing message | Provide a message in chat requests |
401 Unauthorized
Authentication failed.| Error Message | Cause | Solution |
|---|---|---|
Invalid API key format | Key doesn’t start with correct prefix | Check key format |
Invalid API key | Key not found | Verify your API key |
API key is inactive | Key was deactivated | Contact support for new key |
API key has expired | Key past expiry date | Contact support for new key |
404 Not Found
The requested resource doesn’t exist.| Error Message | Cause | Solution |
|---|---|---|
Conversation not found | Invalid conversation ID | Check the ID or start new conversation |
Document not found | Invalid document ID | Verify document exists |
413 Payload Too Large
The request body exceeds size limits.| Error Message | Cause | Solution |
|---|---|---|
Request entity too large | File too big | Reduce file size (max 100MB) |
429 Too Many Requests
Rate limit exceeded.| Error Message | Cause | Solution |
|---|---|---|
Rate limit exceeded | Too many requests | Wait and retry with backoff |
500 Internal Server Error
Something went wrong on our end.| Error Message | Cause | Solution |
|---|---|---|
Internal server error | Server issue | Retry, contact support if persists |
Handling Errors
JavaScript
Python
Best Practices
Always check for errors
Always check for errors
Never assume API calls succeed. Always handle error responses.
Implement retry logic for 429 and 5xx
Implement retry logic for 429 and 5xx
Use exponential backoff for rate limits and transient errors.
Don't expose raw errors to users
Don't expose raw errors to users
Map API errors to user-friendly messages in your application.
Log errors for debugging
Log errors for debugging
Log error details server-side for troubleshooting.