Error Response Format
When an API request fails, the response will include astatus of false and a descriptive message:
HTTP Status Codes
The Bila API uses standard HTTP status codes to indicate the success or failure of requests.Success Codes
| Code | Description |
|---|---|
200 OK | Request succeeded |
201 Created | Resource created successfully |
Client Error Codes
| Code | Description |
|---|---|
400 Bad Request | Invalid request parameters |
401 Unauthorized | Missing or invalid API key |
403 Forbidden | Valid API key but insufficient permissions |
404 Not Found | Requested resource doesn’t exist |
409 Conflict | Resource already exists (duplicate reference) |
422 Unprocessable Entity | Request body failed validation |
429 Too Many Requests | Rate limit exceeded |
Server Error Codes
| Code | Description |
|---|---|
500 Internal Server Error | Something went wrong on our end |
502 Bad Gateway | Upstream service unavailable |
503 Service Unavailable | API is temporarily unavailable |
Common Error Messages
Authentication Errors
Validation Errors
Resource Not Found
Duplicate Reference
Insufficient Balance
Handling Errors
Best Practices
Always check the status field
Always check the status field
Don’t rely solely on HTTP status codes. Always check the
status field in the response body.Log error messages
Log error messages
Log the error
message for debugging purposes.Implement retry logic
Implement retry logic
For
5xx errors and rate limiting, implement exponential backoff retry logic.Handle edge cases
Handle edge cases
Account for scenarios like network timeouts, invalid JSON responses, and service unavailability.

