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 withcode,message, andparameterkeys.error_list— An array of all errors encountered during the request. Each element is an object withcode,message, andparameterkeys. This is useful when a request has multiple validation failures, as theerrorsfield only surfaces the first one.
A list of common error codes can be found below.
| Error Code | Description |
|---|---|
| parameter_invalid | The value provided for the parameter is invalid |
| parameter_missing | No value has been provided for the parameter |
| resource_not_found | The 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"
}
]
}