Skip to Content
Errors

Errors

All errors use a single, consistent shape — the Error Envelope. Error responses never include stack traces, datastore internals, plaintext secrets/tokens, or PHI values.

{ "error": { "code": "CONSENT_REQUIRED", "message": "No active consent grant covers the requested scope." } }
  • error.code — a non-empty, stable platform error code.
  • error.message — a non-empty, human-readable, leak-free message.
  • Some errors include extra safe fields (e.g. RATE_LIMITED adds retryAfterSeconds; INSUFFICIENT_SCOPE adds requiredScope).
⚠️

Always branch on error.code, not on the message text.

Error code reference

CodeHTTPTrigger
UNSUPPORTED_VERSION400The request targets an API version that is not supported. Never rerouted to a different version.
VALIDATION_ERROR400Params/body fail validation, exceed the 1 MB body limit, exceed a field’s max length, or reuse an Idempotency-Key with a different body. No partial write.
UNAUTHORIZED401Missing, malformed, unknown, or revoked credential. Identical body across all such failures so client existence is never disclosed.
TOKEN_EXPIRED401The access token is recognized but expired. No data is returned.
INSUFFICIENT_SCOPE403The token lacks the endpoint’s required scope, or presents an undefined scope. Names the missing scope.
CONSENT_REQUIRED403No active, unexpired consent grant covers the client + user + scope.
NOT_FOUND404A resource does not exist, or exists but is not owned by the user. Both cases return an identical response.
RATE_LIMITED429Per-clientId (600/60s) or global IP limit exceeded. Includes retryAfterSeconds.
ACCESS_NOT_RECORDED500The audit entry for a PHI access could not be written, so the access is rejected.
INTERNAL_ERROR500An unexpected server error. No internal details exposed.
CodeSuggested action
TOKEN_EXPIREDRefresh the access token and retry once.
CONSENT_REQUIREDRe-initiate the consent flow.
INSUFFICIENT_SCOPERequest the missing scope in a new authorization.
RATE_LIMITEDBack off for retryAfterSeconds before retrying.
VALIDATION_ERRORFix the request; do not blindly retry.
UNAUTHORIZEDRe-authenticate; check your credentials.
NOT_FOUNDTreat as “no such accessible resource”.