API Reference

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."
    ]
}

Error details with status codes

Status Text Description
200 OK Everything worked as expected
400 Bad Request The request was unacceptable, often due to missing a required parameter
401 Bad Request The request was unacceptable, often due to missing a required parameter
403 Forbidden The API key doesn't have permissions to perform the request
404 Not Found The requested resource doesn't exist
409 Conflict The request conflicts with another request (perhaps using the same idempotency key).
429 Too Many Requests Too many requests hit the API too quickly (due to rate limiting)
500, 502, 503, 504 Server Errors Something went wrong on the platform