issuetracker / API / API Error Contract

API Error Contract

API errors should have a stable machine-readable shape.

1 min readApplies to v0.6.0
On this page ▾
  1. Recommended status mapping

Recommended structure:

json
{
  "detail": "Human-readable explanation",
  "code": "stable_error_code"
}

For validation errors, preserve field-level information when the framework provides it.

Status Meaning
400 Malformed or invalid request
401 Authentication required/invalid
403 Authenticated but not authorized
404 Resource does not exist or is not visible
409 State/conflict violation
422 Validation failure where framework semantics use 422
429 Rate limit exceeded
500 Unexpected server error

Do not expose stack traces, database errors, credentials, or internal service details in production responses.