The SnapValid API uses standard HTTP status codes to indicate the result of a request.
| Status Code | Name | Description |
|---|---|---|
| 200 | OK | The request was successful |
| 400 | Bad Request | Missing or invalid request parameters |
| 401 | Unauthorized | Invalid or missing API key |
| 402 | Payment Required | Insufficient API credits |
| 403 | Forbidden | Request not allowed |
| 404 | Not Found | Resource not found (e.g., invalid file ID) |
| 429 | Too Many Requests | Rate limit exceeded |
| 500 | Internal Server Error | Unexpected server-side error |
| 503 | Service Unavailable | Temporary server overload or maintenance |
Handling Errors
When a request fails, the API returns:
- An appropriate HTTP status code
- A JSON error response
Example (401 Unauthorized):
{
"message": "Unauthorized"
}
Best Practices
-
Always validate the HTTP status code before parsing the response
-
Implement retry logic for 429 and 503 errors
-
Do not retry 401 or 403 without fixing authentication
-
Monitor API usage to prevent rate limiting
