Overview
Happy Money uses conventional HTTP response codes to indicate the success or failure of an API request.
For error situations, Happy Money returns two fields, an error code and a list of error messages.
The error code is useful to categorize error messages. For instance, if a request errors out, the calling function could run through the appropriate error-handling block based on the value of this field.
Error codes
In general:
- Codes in the 2xx range indicate success.
- Codes in the 4xx range indicate an error that failed given the information provided
- Codes in the 5xx range indicate an error within Happy Money.
Error details
Happy Money provides the following error codes:
- api_error - this code indicates an internal server error, an error occurred on the happy money servers.
- invalid_request_error - This code indicates that the request was malformed, contained invalid data, or was missing required information.
- missing_authentication - this code indicates that the required authentication token was not provided in the request.
- unauthorized - this code indicates that the provided authentication token is invalid.
- expired_authentication - this code indicates that an expired authentication token was provided.
- blocked_by_firewall - this code indicates that the Happy Money firewall has blocked the request.
- insufficient_permissions - this code indicates that the credentials provided to the request were insufficient to execute this API call.
- requested_loan_application_not_found - this code states that the loan application ID provided in the request is invalid.
- duplicate_loan_application - this code indicates that the applicant already has a loan application with Happy Money and cannot create another one.
Sample error response
A sample response would look like this
{
"code": "invalid_request_error",
"errors": [
"Last name is a required field",
"Email is a required field.",
"Loan purpose is a required field."
]
}