Errors

Error response shapes used by the current API.

Most handler errors return a JSON envelope with a machine-readable code, a short message, and optional details.

{
  "code": "validation_error",
  "message": "Email is required",
  "details": null
}

Authentication failures from middleware return:

{
  "code": "authentication_error",
  "message": "unauthorized",
  "details": null
}

Some OpenAPI-generated validation failures use the Fuego HTTPError shape:

{
  "status": 400,
  "title": "Bad Request",
  "detail": "validation or deserialization error",
  "errors": [
    { "name": "email", "reason": "required" }
  ]
}

Common status codes

CodeMeaning
400Bad request, malformed body, or validation failure
401Missing or invalid authentication
403Authenticated user is not allowed to perform the action
404Resource was not found
409Request conflicts with existing state
422Request is valid JSON but invalid for the resource state
429Rate limit exceeded
500Server error

Examples

Missing authentication

curl https://api.getpaidhq.com/api/customers
{
  "code": "authentication_error",
  "message": "unauthorized",
  "details": null
}

Invalid subscription state

PUT /api/subscriptions/sub_123/cancel
{
  "code": "validation_error",
  "message": "Cannot cancel subscription in its current state",
  "details": null
}

Client handling

Branch first on HTTP status, then on code when present. Treat unknown 5xx responses as retryable only when the operation is idempotent.