Overview
The Iris API uses standard HTTP status codes and structured response patterns to communicate errors. Understanding these patterns is essential for building robust integrations.HTTP Status Codes
The API returns the following status codes:Request processed successfully. Returns a JSON response with match results.
Rate limit exceeded for your IP address. Slow down request frequency.
Unexpected server error. Contact support if persistent.
Status Code Reference
| Code | Meaning | Description | Action Required |
|---|---|---|---|
| 200 | OK | Request successful, results returned | None |
| 429 | Too Many Requests | Rate limit exceeded | Implement backoff, reduce frequency |
| 500 | Internal Server Error | Server-side processing failure | Retry with exponential backoff |
Rate Limiting (429)
Rate Limit Configuration
The API implements per-IP rate limiting with the following parameters:- Sustained Rate: 5 requests per second per IP address
- Burst Allowance: Up to 10 requests in a short burst
- Scope: All endpoints (
/compare,/stats,/health) - Enforcement: IP-based using the Governor library
Rate Limit Response
When rate limited, you’ll receive:The API returns only the status code without additional error details. Your client must detect the 429 status and implement appropriate retry logic.
Handling Rate Limits
Implement these strategies to handle rate limiting gracefully:Best Practices for Rate Limiting
Stay Under the Limit
Design your client to send no more than 4-5 requests per second, leaving headroom for burst traffic.
Implement Exponential Backoff
When receiving 429 responses, increase retry delays exponentially (1s, 2s, 4s, 8s).
Empty Match Responses
The API returns successful responses (200 OK) even when no faces match or no faces are detected.Empty Matches Scenarios
No Face Detected in Target Image
No Face Detected in Target Image
When the target image contains no detectable faces:Common Causes:
- Image quality too low
- Face occluded or at extreme angle
- Face too small in the image
- Image is not a face (landscape, object, etc.)
main.rs:87-89No Matching Faces Found
No Matching Faces Found
When faces are detected but none meet the similarity threshold:Matching Logic:
- Similarity threshold: 0.363 (cosine similarity)
- Only matches above threshold are returned
- Results sorted by probability (descending)
main.rs:104Image Download/Decode Failure
Image Download/Decode Failure
When person images fail to download or decode, they’re silently skipped:Silent Failure Behavior:
- Individual person image failures don’t halt processing
- Other valid images are still processed
- No error details in response
main.rs:93Detecting Empty Response Causes
Since the API returns the same empty array for different failure modes, use these debugging strategies:- Isolated Testing
- Image Validation
- Server Logs
Test components individually:
Image Decode Errors
Image processing failures occur silently but can be detected through careful testing.Common Image Issues
Invalid Data URI
Malformed base64 data URIs missing comma separator.Error Location:
main.rs:49Base64 Decode Failure
Corrupted or invalid base64 encoding.Error Location:
main.rs:50Image Decode Failure
Invalid image data or unsupported format.Error Location:
main.rs:57Empty Image
Image decoded but contains no pixel data.Error Location:
main.rs:58Supported Image Formats
The API uses OpenCV’simdecode function, which supports:
- JPEG (.jpg, .jpeg)
- PNG (.png)
- BMP (.bmp)
- TIFF (.tiff, .tif)
- WebP (.webp)
Image URL Requirements
- HTTP/HTTPS URLs
- Data URIs
- Publicly accessible URLs
- Must respond within reasonable timeout
- Should return proper Content-Type headers
- No authentication required (API can’t pass credentials)
Error Recovery Strategies
Use Image CDNs
Host images on reliable CDN services (Cloudinary, imgix, AWS S3) to minimize download failures.
Debugging Checklist
When troubleshooting API issues:Error Response Examples
Getting Help
Check Server Logs
Review application logs for detailed error messages not exposed in API responses.
Test with Examples
Use working examples from the integration guide to verify your setup.
Verify Rate Limits
Check
/stats endpoint to monitor your request patterns.Image Guidelines
Review image requirements and best practices in the API reference.