API Responses
Learn about Suonora API responses, status codes, and how to handle errors in your application.
Success Responses
Successful API calls return a 200 OK
status code with a simple response format:
All successful responses include a success: true
flag.
Error Responses
When an error occurs, the API returns an appropriate HTTP status code and a simple error response:
Error responses include a success: false
flag and a message
describing the error.
Common Error Types
HTTP Status: 401 Unauthorized
HTTP Status: 401 Unauthorized
HTTP Status: 429 Too Many Requests
HTTP Status: 400 Bad Request
Error Handling
Here’s how to handle common errors in your application:
Always implement proper error handling in your application to gracefully handle API errors and provide a good user experience.
Best Practices
-
Implement Retry Logic
- Use exponential backoff for rate limit errors
- Respect the
Retry-After
header - Set reasonable retry limits
-
Handle Authentication
- Store API keys securely
- Rotate keys regularly
- Monitor for unauthorized access
-
Validate Input
- Check parameters before sending
- Handle validation errors gracefully
- Provide clear error messages to users
-
Monitor Usage
- Track API call success rates
- Monitor rate limit usage
- Set up alerts for unusual patterns
For production applications, consider implementing a robust error handling system that includes logging, monitoring, and alerting.