releases.sh
Errors
View .md

Errors

Every non-2xx response uses one JSON shape:

{
  "error": {
    "code": "not_found",
    "type": "not_found",
    "message": "Organization not found",
    "details": {}
  }
}
  • type — a coarse category from a fixed set. It determines the HTTP status, so it's the safe field to switch on.
  • code — a more specific, stable machine string. Never reworded once shipped, but open-ended: treat an unrecognized code by falling back to its type (or the HTTP status).
  • message — human-readable, may change between releases. Don't parse it.
  • details — optional structured context carried by a few codes (e.g. setup steps for database_not_initialized). Absent otherwise.

The HTTP status is authoritative and always agrees with type.

Error types

typeHTTPMeaning
validation400The request was malformed or failed a field/shape check.
unauthorized401Missing or invalid credentials.
forbidden403Authenticated, but not allowed.
insufficient_scope403The token is valid but lacks the required scope.
not_found404No matching resource.
conflict409The request conflicts with existing state (e.g. a duplicate).
rate_limited429Too many requests — retry after a short wait.
upstream502A dependency the API called failed.
unavailable503The endpoint is temporarily unavailable.
internal500An unexpected server error.

Common codes

code is more specific than type. The ones you'll see most often:

codetypeWhen
validation_failedvalidationA request body failed schema validation.
bad_requestvalidationA business rule rejected the request.
invalid_jsonvalidationThe body wasn't valid JSON.
payload_too_largevalidationThe request body exceeded the size cap.
unauthorizedunauthorizedSign-in or a valid token is required.
forbiddenforbiddenThe caller isn't permitted to do this.
insufficient_scopeinsufficient_scopeThe token lacks the scope this endpoint needs.
not_foundnot_foundThe resource doesn't exist.
conflictconflictA uniqueness or state conflict.
rate_limitedrate_limitedThe rate limit was hit; honor Retry-After.
service_unavailableunavailableThe endpoint is disabled or temporarily down.

This isn't the full set — new codes can appear over time, so branch on type (or the HTTP status) and treat code as an optional refinement. The exhaustive list lives in the OpenAPI spec.