Error Handling
Understand API errors and how to handle them.
Error Response Format
All errors return a consistent JSON format:
{
"error": {
"code": "error_code",
"message": "Human readable message"
}
}
HTTP Status Codes
| Code | Meaning | Description |
|---|---|---|
| 200 | OK | Request succeeded |
| 400 | Bad Request | Invalid parameters |
| 401 | Unauthorized | Invalid or missing API key |
| 403 | Forbidden | API key invalid or revoked |
| 413 | Payload Too Large | Image file too large |
| 429 | Too Many Requests | Rate limit exceeded |
| 500 | Internal Error | Server error |
Error Codes
| Code | Message | Solution |
|---|---|---|
| invalid_api_key | API key is invalid | Check your API key |
| quota_exceeded | Subscription quota exceeded | Upgrade your plan |
| no_front_photo | No front photo provided | Upload front photo |
| no_side_photo | No side photo provided | Upload side photo |
| invalid_height | Invalid height value | Provide height 100-230cm |
| image_too_small | Image resolution too low | Use larger image (min 256x256) |
| image_too_dark | Image is too dark | Take photo in better light |
| image_too_bright | Image is too bright | Avoid direct flash |
| full_body_required | Full body not visible | Show full body in photo |
Handling Errors in Code
# Python
try:
result = client.measurements.extract(
front="front.jpg",
side="side.jpg",
height=175
)
except aiscan.APIError as e:
print(f"Error {e.code}: {e.message}")
except aiscan.RateLimitError as e:
print(f"Rate limited. Retry in {e.retry_after}s")