ERROR HANDLING

Robust error handling is critical for a secure and reliable biometric authentication system. The PrivateID Session API returns detailed error information through standardized error codes and HTTP status responses. These mechanisms facilitate precise debugging, support automated retry strategies, and ensure that critical security events are promptly flagged.


Error Codes

The API defines a set of error codes to distinguish between various failure modes. Each code is classified as either Fatal (ends the session and triggers the webhook) or Diagnostic (accumulated in the errorCodes array for observability without ending the session).

Error CodeNameTypeDescription
1SPOOFFatalSpoofing Attempt Detected — Static image, deepfake, or synthetic biometric detected.
-5DESKTOPFatalDesktop Mode Restricted — Attempted operation in disallowed desktop environment.
-7CAMERA_FAILFatalCamera Failure — Could not initialize or capture from camera.
-8SESSION_EXPIREDFatalSession Expired — Verification session has exceeded its configured time-to-live (TTL) and is no longer valid.
-9FACE_NOT_MATCHFatalFace Not Matching — The captured face does not match the biometric data associated with the provided customerId.
-10LOW_LIGHTFatalLow Ambient Light — Insufficient lighting for reliable biometric capture.
-11MULTIPLE_FACESFatalMultiple Faces Detected — Ambiguity during biometric analysis.
-14FatalUnauthorized Callback — Callback attempted without valid credentials.
-15FatalToken Already Used — Possible replay attack detected.
-16FatalDevice Mismatch — Device differs from registration source.
-20MODEL_LOAD_FAILEDDiagnosticFace/document scanning models failed to load.
-22FACE_SCAN_ERRORDiagnosticFace scanning SDK encountered an error.
-23DOCUMENT_SCAN_ERRORDiagnosticDocument scan failed due to corrupted embeddings.
-24SESSION_LOAD_FAILEDDiagnosticClient failed to fetch session from API.

General HTTP Status Errors

Standard HTTP status codes also indicate common failure modes:

HTTP Status CodeMeaningPossible Causes
401UnauthorizedMissing or invalid x_api_key, clientID, clientSecret, or SLC.
400Bad RequestMalformed JSON, missing parameters, or invalid field types.
500Internal Server ErrorTransient server-side issue or cryptographic operation failure.

Error Response Format

When an error occurs, the API returns a structured JSON payload:

{
  "status": "error",
  "message": "Camera failure detected",
  "errorCodes": [-7]
}

Fields:

  • status: Always set to "error" on failure.
  • message: Human-readable message.
  • errorCodes: Array of numeric codes.

Cryptographic and Audit Considerations

  • Immutable Audit Trails: All error events are logged with cryptographically signed audit trails. This ensures that the logs are tamper-evident and can be reliably used for forensic analysis without compromising sensitive biometric data.

  • Error Isolation and Granularity: The defined error codes are granular enough to distinguish between security-critical issues (e.g., spoofing attempts) and operational issues (e.g., low-light conditions), enabling tailored remediation strategies.

  • Automated Remediation: The detailed error responses allow clients to implement automated error-handling routines.

  • Data Integrity: Errors occurring during cryptographic token generation or comparison trigger immediate alerts, ensuring that any discrepancies are promptly addressed. This minimizes the risk of compromised authentication integrity.


Implementation Recommendations

  • Logging and Monitoring: Integrate robust logging mechanisms that capture both the error response and associated audit metadata. Ensure that these logs are stored securely and are accessible for forensic analysis.

  • Automated Alerts: Configure monitoring systems to trigger alerts on detection of critical errors (e.g., SPOOF attempts or repeated CAMERA_FAIL events) to enable immediate investigation and remediation.

  • Client-Side Handling: Implement client-side error handling that differentiates between permanent errors (e.g., invalid credentials) and transient errors (e.g., low ambient light) to optimize the user experience and system throughput.

Was this page helpful?