Skip to main content
Use the SDK’s primitive methods to build your own verification flow — scan documents, detect faces, compare images, and estimate ages with full control over the pipeline. No hosted UI involved.

When to use this vs. hosted sessions

Flow overview

Each primitive accepts a FileInput — a Uint8Array/Buffer, a ReadableStream, a base64 / data-URL string, or (on Node, Deno, and Bun) a file path string. The SDK handles presigned upload internally.

Document scan

Extract structured OCR data from an identity document:
documentType defaults to 'auto' — the API detects the type. Specifying it can improve accuracy. The result includes fullName, dateOfBirth, documentNumber, expirationDate, issuingCountry, an OCR confidence (0–1), and more. See the Document Scan reference for every field, and the REST Document Scan endpoint for the full schema.

Face detection

Detect a face and get confidence, a bounding box, and landmarks:
REST reference: Face Detect.

Face comparison

Compare two face images to check if they’re the same person. Both images upload in parallel for speed:
confidence and threshold are reported on a 0–100 scale. REST reference: Face Compare.

Age estimation

Estimate age and gender from a face image:
REST reference: Face Estimate Age.

Identity verification (shortcut)

identity.verify() combines document scan + face detection + face comparison into a single orchestrated call. Both images upload in parallel:
All three sub-results (document, faceDetection, faceMatch) are always present on a 2xx response, even when verified is false. REST reference: Identity Verify.

Building a custom pipeline

Combine primitives with your own business logic:
Wrap calls in try/catch to handle typed failures (bad input, auth, rate limits, timeouts) — see Error Handling.