Error Response Format
HTTP Status Codes
Errors any endpoint can return
Each endpoint page in the API reference lists the errors specific to that endpoint. The errors below can come from any endpoint, so they are documented only here.Validation errors
A request that does not match the endpoint’s schema returns422 with code VALIDATION_FAILED. The detail object says what failed:
onnames the part of the request that failed:body,query,paramsorheaders.errorslists each problem. Every entry has apathto the field and amessage. Most entries also carry acodefor the rule that failed.
cardType instead of type to POST /cards returns:
config.maxAmount.
A few checks run after schema validation, such as decoding a pagination cursor. These also return VALIDATION_FAILED, with a shorter detail in place of errors.
Handling Errors
Use thecode field for programmatic error handling. Branch on code rather than the HTTP status, because several errors can share a status. For example, a few endpoints use 422 for their own business-rule errors alongside VALIDATION_FAILED.
Retries
For5xx errors, retry with exponential backoff. For 429, wait for the Retry-After header. For other 4xx errors, fix the request before retrying.