Skip to main content

API Error Handling Overview

When using the MyCreditApp API, errors are communicated via HTTP status codes and structured response objects. Properly handling these errors ensures your application can respond gracefully and provide useful feedback to users. Most error responses contain a detail field, which is a list of error objects. Each error object typically includes:
  • loc: Shows the dynamic location of the error. If blank - the error is static.
  • msg: A human-readable error message.
  • type: The category of the error.
  • code: A unique error code identifying the error type.

Example of Errors

{
  "detail": [
    {
      "loc": [],
      "msg": "The client authentication failed!",
      "type": "oauth",
      "code": "oauth_invalid_client_credentials"
    }
  ]
}
{
  "detail": [
    {
      "loc": [],
      "msg": "Service is under maintenance, please try later!",
      "type": "maintenance",
      "code": "service_under_maintenance"
    }
  ]
}

Summary

  • Use HTTP status codes to determine the type of error;
  • Error codes typically include a single error object in detail, except for 422 Unprocessable Entity, which may return multiple validation errors;
  • Always check both msg and code fields to handle errors programmatically.