Error Response Format
The GetBill API uses conventional HTTP response codes to indicate the success or failure of an API request. All error responses follow a consistent JSON format:boolean
Always
true for error responsesstring
A human-readable description of the error
integer
The HTTP status code
object
Additional error details, often including field-specific validation errors
HTTP Status Codes
2xx Success
2xx Success
- 200 OK: The request was successful
- 201 Created: A new resource was successfully created
- 202 Accepted: Asynchronous processing was queued; poll the URL in
Location
4xx Client Errors
4xx Client Errors
- 400 Bad Request: The request was invalid or malformed
- 401 Unauthorized: Authentication credentials are missing or invalid
- 403 Forbidden: The authenticated user doesn’t have permission to access the resource
- 404 Not Found: The requested resource doesn’t exist
- 409 Conflict: The request conflicts with current resource or idempotency state
- 413 Content Too Large: The request body exceeds the endpoint limit
- 422 Unprocessable Entity: The request is valid but contains semantic errors
- 429 Too Many Requests: Rate limit exceeded
5xx Server Errors
5xx Server Errors
- 500 Internal Server Error: An unexpected error occurred on the server
- 502 Bad Gateway: The server received an invalid response from an upstream server
- 503 Service Unavailable: The service is temporarily unavailable
- 504 Gateway Timeout: The server didn’t receive a response from an upstream server in time
Common Error Scenarios
Authentication Errors
Authorization header.
Authorization Errors
Validation Errors
details object for field-specific errors and correct your request data.
Resource Not Found
Rate Limiting
retry_after value.
Campaign snapshot errors
Campaign endpoints retain the numeric HTTP status incode and put the stable machine-readable value in details.reason. Validation may also identify a one-based details.row and details.field.
The terminal status API may report safe failure reasons such as
client_aborted_upload, stale_snapshot_upload, snapshot_retries_exhausted, or a validation reason. It never returns raw rows, SQL, paths, implementation details, or exception text.
Error Handling Best Practices
1. Implement Proper Error Handling
2. Implement Retry Logic
3. Log Errors for Debugging
4. Handle Specific Error Types
- Network Errors
- Timeout Errors
- Token Expiry
Debugging Tips
1. Check Response Headers
Important headers to examine:X-RateLimit-Remaining: Number of requests remaining in the current windowX-RateLimit-Reset: When the rate limit window resetsRetry-After: How long to wait before retrying (for 429 responses)
2. Validate Request Format
Common issues:- Missing or incorrect
Content-Typeheader - Malformed JSON in request body
- Invalid field values or types
- Missing required fields
3. Use API Testing Tools
Test your requests using tools like:- Postman
- curl
- Insomnia
- HTTPie
4. Enable Debug Logging
Include request/response logging in your application to track API interactions and identify patterns in errors.Support
If you encounter persistent errors or need help with error handling:- Check our Status Page for ongoing incidents
- Review the specific endpoint documentation
- Contact support at contact@getbill.io with:
- The specific error message
- Your request details (without sensitive data)
- Steps to reproduce the issue