L O R I C A / docs
API REFERENCE

Errors

Every error response has the same shape. The code field is stable across versions; the message is human-readable and may change. Always handle on code.

Response shape

{
  "error": "invalid_credentials",
  "code": "invalid_credentials",
  "message": "The supplied bearer token is malformed or expired.",
  "request_id": "req_xK2mP9nL3jH"
}

Code reference

HTTPCodeMeaningAction
400invalid_requestRequired field missing or malformedFix payload, retry
401invalid_credentialsBearer token missing or malformedRe-fetch key from dashboard
403key_expiredAPI key past expirationRotate key, retry
403tenant_disabledTenant suspended (billing or ToS)Contact billing
404user_not_enrolledNo embedding for this user_idRun /enroll first
409duplicate_requestIdempotency key already processedUse prior response
409already_enrolleduser_id already has an embeddingRun /delete then /enroll
422low_confidenceVerify completed but score < thresholdSurface for review or block
422liveness_failedAnti-spoof scorer triggered blockUser retries; escalate to active liveness
422no_face_detectedSupplied frames missing a faceRetry with new frames
422multiple_faces_detectedOne or more frames has > 1 faceRetry with single-face frames
429rate_limitedPer-key or per-tenant cap exceededRetry with backoff (Retry-After header set)
500internal_errorLorica-side fault — auto-pagedRetry with backoff; check status page
503maintenanceScheduled maintenance windowRetry per Retry-After

Idempotency

Pass X-Lorica-Idempotency-Key on any POST to enable safe retries. If the same key is replayed within 24 hours, the original response is returned (verbatim, including the same JWT). Recommended for any retry-on-error path. Idempotency keys must be unique per logical request — using one across two distinct verifies will return the first one's verdict for both, which is almost certainly not what you want.

Tip
Treat 422 low_confidence as a soft fail, not a hard error. The verify call completed; the score just fell below your threshold. For some action classes (small trades, reads) you may accept a lower threshold than for others (whale withdrawals, beneficiary changes).