graphlife Docs graphlife.app

Accounts and access

3. Error format

3.1 Standard errors#

Every route except the OAuth protocol endpoints reports failure as an HTTP status with this body:

{
  "error": {
    "code": "not_found",
    "message": "Not found, or not visible to this credential.",
    "requestId": "3f1c2a9e-51b0-4c1e-9a67-0d2e8b7a4c11"
  }
}

code is a stable, machine-readable string; treat it as the contract. message is one sentence for a person reading a log; it may be reworded, so do not match on it. requestId identifies the request and is also sent as the X-Request-Id response header; quote it when you report a problem to whoever runs the server. Some errors add fields beside these (for example arg on bad_args, retryAfter on rate_limited). See Errors and request ids for the full description.

Codes that can come back from many routes:

Status code Meaning
400 invalid A required field is missing or has an unusable value.
400 bad_json The body is not valid JSON in UTF-8.
400 bad_args A field has the wrong JSON type; arg names it.
401 unauthorized No token, an expired or malformed token, a revoked session, or a failed re-authentication on the account deletion and export routes (section 2.2).
403 forbidden The caller is in the organisation but lacks the role this route needs.
404 not_found No such route, no such resource, or a resource the caller may not see.
413 too_large The body is over the size cap (about 66 MB).
429 rate_limited A rate limit was exceeded (section 4). The Retry-After header and error.retryAfter give the wait in seconds.
500 internal An unhandled server error. The response carries no detail beyond requestId.

Two behaviours are worth knowing when you build a client:

  • A request body that is not valid JSON is answered with 400 bad_json; one over the body limit (about 66 MB) with 413 too_large; an argument of the wrong JSON type with 400 bad_args, whose arg field names it (see Malformed requests).
  • A body that is valid JSON but not an object (an array, a string) is read as an empty object.

Route-specific codes are listed with each route.

3.2 OAuth errors#

The OAuth endpoints (/oauth/register, /oauth/token) follow RFC 6749 and report failure as:

{ "error": "invalid_grant", "error_description": "code expired" }

with Cache-Control: no-store. error_description is optional. Their rate-limit response is the exception: it uses the standard format above (429 with {"error":{"code":"rate_limited", ...}} and a Retry-After header).

The browser-facing OAuth and SSO pages (/oauth/authorize, /v1/sso/start, /v1/sso/callback) report problems as HTML pages with an appropriate status code, because their caller is a person in a browser.