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
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' });
// check.is_fraudulent, check.overall_score,
// check.signals.{fake_document, photo_substitution, tampering, copy_or_screen}
await client.fraud.get(fcId); // GET /v1/fraud/checks/:id
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
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
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);