Errors

When there is an error, Modern Treasury returns an object with as much descriptive information as we can.

The response body contains two top-level fields:

  • errors — An object describing the first error encountered. This field returns a single error with code, message, and parameter keys.
  • error_list — An array of all errors encountered during the request. Each element is an object with code, message, and parameter keys. This is useful when a request has multiple validation failures, as the errors field only surfaces the first one.

A list of common error codes can be found below.

Error CodeDescription
parameter_invalidThe value provided for the parameter is invalid
parameter_missingNo value has been provided for the parameter
resource_not_foundThe resource couldn't be found for the identifier
{
  "errors": {
    "code":"resource_not_found",
    "message":"Resource not found",
    "parameter":"id"
  },
  "error_list": [
    {
      "code": "resource_not_found",
      "message": "Resource not found",
      "parameter": "id"
    }
  ]
}

{
  "errors": {
    "code": "parameter_missing",
    "message": "Legal entity type is required",
    "parameter": "legal_entity_type"
  },
  "error_list": [
    {
      "code": "parameter_missing",
      "message": "Legal entity type is required",
      "parameter": "legal_entity_type"
    },
    {
      "code": "parameter_invalid",
      "message": "First name is invalid",
      "parameter": "first_name"
    }
  ]
}