Errors

The Stables API returns error objects with a consistent structure.

Error Object Schema

{
  "statusCode": 404,
  "error": "Not Found",
  "message": "string",
  "code": "NOT_FOUND"
}

Validation errors (400 Bad Request) may also include a fields array with per-field details:

{
  "statusCode": 400,
  "error": "Bad Request",
  "message": "string",
  "code": "string",
  "fields": [
    {
      "field": "string",
      "message": "string"
    }
  ]
}

Fields

FieldTypeDescription
statusCodenumberHTTP status code
errorstringHTTP reason phrase (e.g. "Not Found", "Bad Request")
messagestringHuman-readable explanation. It can change, so do not parse it, except for the code prefixes described under each endpoint
codestring(optional) Machine-readable error code, safe to branch on (e.g. NOT_FOUND, UNPROCESSABLE_ENTITY). Some endpoint-specific errors omit it and prefix the code to message instead
fieldsarray(optional, validation errors only) Field-level errors: { field, message }

Common Error Responses

  • 400: Bad Request / Validation Error
  • 401: Unauthorized
  • 402: Payment Required (your balance cannot cover a fee charged for the request)
  • 403: Forbidden
  • 404: Not Found
  • 409: Conflict
  • 422: Unprocessable Entity
  • 500: Internal Server Error
  • 502: Bad Gateway
  • 503: Service Unavailable (retry shortly)
  • 504: Gateway Timeout

For unexpected 5xx errors message is a generic description and code is the status name (for example INTERNAL_SERVER_ERROR).

(More specific error messages appear under each endpoint's response schema.)

On this page