Client & methods
All methods accept images as File, Blob, ArrayBuffer, Uint8Array, or Node Buffer, and return the API's JSON response typed.
Document OCR
const r = await client.ocr.scanDocument(image, {
backImage, // optional back side
type: 'cid', // optional hint: 'cid' | 'passport' (others auto-detect)
customerRef: 'u-123',
});
// r.document_type, r.document_type_confidence, r.fields (per-type shape), r.ocr_id
// Server-side only (secret key): a session token gets 403.
await client.ocr.get(id); // GET /v1/ocr/:id
await client.ocr.list();
await client.ocr.delete(id);
Fraud detection
const check = await client.fraud.detect(image, { documentType: 'cid' });
// Scanned the same files already? Pass the scan's id and the gateway skips its OCR pass:
const quick = await client.fraud.detect(image, { backImage, ocrId: scan.ocr_id });
// Branch on check.summary.action ('accept' | 'review' | 'reject' | 'retake' | 'retry').
// With a secret key, check.is_fraudulent, check.overall_score and
// check.signals.{fake_document, photo_substitution, tampering, copy_or_screen}
// are evidence for your review tooling, not a verdict.
// With a session token: the end-user view, check.decision and
// check.summary.{action, reason, reason_codes} only.
await client.fraud.get(fcId); // GET /v1/fraud/checks/:id, secret key only
Liveness — passive, burst, challenge
// Passive: one frame, no user action
const p = await client.liveness.check(selfie);
// Burst: 3–5 frames, worst frame decides
const b = await client.liveness.check([f1, f2, f3], { mode: 'burst' });
// Challenge: server-chosen action the user must perform. Send a neutral
// first frame, then 4–6 upright, unmirrored frames captured while the user
// acts and returns to centre; see Camera capture for captureSequence().
const ch = await client.liveness.createChallenge(); // { action, challenge_token, expires_at }
const c = await client.liveness.check(frames, {
mode: 'challenge',
challengeToken: ch.challenge_token, // one-shot, ~120 s
});
// result: is_live, score, threshold, reason
Face verification & gallery
// 1:1 — document portrait vs selfie. Cards with a ghost portrait are
// handled: the main portrait is matched.
const v = await client.verify(documentImage, selfie); // v.match, v.similarity
// 1:N gallery: server-side only (secret key)
await client.verification.registerFace(image, 'customer-ref');
await client.verification.searchFace(image, { limit: 5, minSimilarity: 0.4 });
await client.verification.detectDuplicate(image);
await client.verification.listRegistrations();
await client.verification.deleteRegistration(id);