Error Handling
When using our API, you may encounter various error responses. This section outlines the common error codes, their meanings, and how to handle them properly.
Common Error Responses
Our API follows standard HTTP response status codes to indicate the success or failure of a request.
400 Bad Request
Occurs when the request payload is invalid or improperly formatted.
Example Response:
json{ "message": "Validation error. Please review your request payload.", "errors": { "email": ["Invalid email"], "address.zipCode": ["ZIP code must have 5 digits"] } }
The errors object is keyed by the field that failed validation and lists every problem found for that field. Invalid query parameters return a 400 with a message only.
401 Unauthorized
Occurs when the API key is missing or invalid.
Example Response:
json{ "message": "Unauthorized. Please check your credentials (login or API key) to access this resource." }
Solution: Check your API key and ensure it is valid. Refer to our Getting Started Guide for details on generating a new API key.
403 Forbidden
Occurs when the request is valid but the user does not have sufficient permissions to access the resource.
Example Response:
json{ "message": "Forbidden. You do not have the necessary permissions to access this resource." }
Solution: Ensure your account has the necessary permissions to access this resource.
404 Not Found
Occurs when the requested resource does not exist.
Example Response:
json{ "message": "Resource not found. The requested endpoint does not exist." }
Lookups by ID return a resource-specific message when the record does not exist in your store, for example "Quote not found.".
Solution: Check the API endpoint URL for typos or incorrect resource IDs.
429 Too Many Requests
Occurs when the request rate limit has been exceeded.
Example Response:
json{ "error": "Too many requests. Please try again later.", "retryAfter": 12 }
The response also includes a Retry-After header with the number of seconds to wait, plus X-RateLimit-Limit, X-RateLimit-Remaining, and X-RateLimit-Reset headers. See API Rate Limits.
Solution: Wait for the number of seconds in Retry-After (or retryAfter) before retrying.
500 Internal Server Error
Occurs when an unexpected error happens on the server.
Example Response:
json{ "message": "Internal server error. Please try again later." }
Solution: This is usually a temporary issue. Retry after some time or contact support if the issue persists.
Handling Errors Effectively
To ensure a smooth integration with our API, we recommend:
- Logging error responses for debugging purposes.
- Implementing retry mechanisms for
500and429errors. - Ensuring valid authentication credentials to avoid
401errors. - Checking request payloads to prevent
400validation errors.
For further assistance, refer to our API Documentation or contact our support team at support@myrepairapp.com.