Perché VOLTOM
Prodotti
FaceGateConferma che sia presente una persona reale.FaceKeyConferma che la persona reale sia il titolare dell’account.FacePairConfronta una persona reale con una foto di riferimento.FaceBindConfronta una persona reale con il suo documento d’identità.
How it worksPrezziContattiDocumentazione
VOLTOMAccedi
VOLTOMPersone reali. Internet più sicuro.
ContattiChi siamoTerminiPrivacy
← All documentation

FaceBind

VOLTOM FaceBind

  • Quick start
  • Match an identity document
  • Configuration
  • Instance options
  • Methods
  • Results
  • Events
  • REST API
  • Limits and support
  • Pricing explained

Other guides

  • Explore FaceGate
  • Explore FaceKey
  • Explore FacePair

Quick start

Use your dashboard client key in the browser. Set VOLTOM_SECRET_KEY on your server. These examples use authenticated Express routes.

npm install @voltom.io/sdk

View the FaceBind demo source on GitHub

Match ID

Use the same SDK instance for both captures and the final match.

Server · Create intent

app.post('/api/facebind/intent', async (request, response) => {
  const upstream = await fetch('https://api.voltom.io/facebind', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      authorization: `Bearer ${process.env.VOLTOM_SECRET_KEY}`,
    },
    body: JSON.stringify({}),
  });
  if (!upstream.ok) return response.sendStatus(upstream.status);
  const intent = await upstream.json();

  request.session.faceBindResultId = intent.id;
  response.json(intent);
});

Browser

import VoltomFaceBind from '@voltom.io/sdk/facebind';

const sdk = new VoltomFaceBind({ clientKey: 'YOUR_CLIENT_KEY' });

const start = async () => {
  const response = await fetch('/api/facebind/intent', { method: 'POST' });
  const intent = await response.json();
  const result = await sdk.verify(intent);
  if (result === null) return;

  const decision = await fetch('/api/facebind/complete', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ resultId: intent.id }),
  });
  if (decision.ok) window.location.assign('/account');
};

Server · Verify result

app.post('/api/facebind/complete', async (request, response) => {
  const { resultId } = request.body;
  if (resultId !== request.session.faceBindResultId) return response.sendStatus(403);

  const upstream = await fetch(`https://api.voltom.io/facebind/${resultId}`, {
    headers: { authorization: `Bearer ${process.env.VOLTOM_SECRET_KEY}` },
  });
  if (!upstream.ok) return response.sendStatus(upstream.status);
  const outcome = await upstream.json();

  if (outcome.status !== 'resolved') return response.sendStatus(403);
  if (outcome.outcome !== 'pass') return response.sendStatus(403);

  await continueOnboardingOnce({ request, resultId, identity: outcome.identity });
  response.json({ completed: true });
});

verify(intent) captures the face first, then the document. If a capture fails verification, the SDK repeats that step. Both captures belong to the same intent. match() sends only the intent token in the request body so the server can compare the stored captures. For manual capture, call begin(intent) first, then call acquireFace() and acquireDocument() from separate buttons. Call forgetFace() and forgetDocument() before you verify another person or document. Expired intent tokens fail with INTENT_TOKEN_INVALID; retry the whole operation.

To use the script integration, load https://sdk.voltom.io/v1/facebind.dist.js and create new window.VoltomFaceBind(options). The options are the same.

Configuration Reference

OptionTypeDefaultDescription
clientKeystringRequiredPublic client key from the VOLTOM dashboard.
documentBoxColorstring#22d3eeDocument box line color.
documentFaceBoxColorstring#22d3eeDocument face box line color.
documentFaceMeshColorstring#38efb0Document face mesh line color.
documentOverlayColorstringtransparentDocument overlay fill color.
faceMeshColorstring#38efb0Face mesh line color.
faceOverlayColorstringtransparentFace overlay fill color.
languageLanguageBrowser language, then enSDK interface language. Supports ar, ch, de, en, es, fr, it, ja, pt, ru, zh. Chinese locales zh-TW, zh-HK, and zh-MO select ch.
posesPose[] | 'all'faceStraight, faceUp, faceLeft, faceRightRequires these four poses, no duplicates, and faceStraight first. Additional poses: faceDown, faceSmile, faceWinkLeft, faceTiltLeft, faceTiltRight.
preparebooleantruePrepares the SDK at construction. Set false to prepare on demand. Camera access starts when an operation runs.
randomizeFaceSequencebooleantrueRandomizes pose order after faceStraight.
showDocumentOverlaybooleanfalseDraws document and document face overlays. Separate from capture guidance.
showFaceOverlaybooleanfalseDraws the face detector overlay. Separate from capture guidance.
showTextOverlaybooleanfalseDraws OCR text when showDocumentOverlay is true.
textColorstring#22d3eeOCR overlay text color.
theme'light' | 'dark'Host theme, then systemOverrides host .light, .dark, or data-theme selectors and system preference.

Instance Options Reference

Use configure(options) to update instance options. Each flow reads a snapshot at startup. Changes during a flow apply to its next run, including retry. Use stop() to cancel. Omitted options and undefined retain current values.

OptionTypeDefaultDescription
posesPose[] | 'all'Instance valueRequires these four poses, no duplicates, and faceStraight first. Additional poses: faceDown, faceSmile, faceWinkLeft, faceTiltLeft, faceTiltRight.
randomizeFaceSequencebooleanInstance valueRandomizes pose order after faceStraight.
showDocumentOverlaybooleanInstance valueDraws document and document face overlays. Separate from capture guidance.
showFaceOverlaybooleanInstance valueDraws the face detector overlay. Separate from capture guidance.
showTextOverlaybooleanInstance valueDraws OCR text when showDocumentOverlay is true.

Methods Reference

MethodResult
acquireDocument()Captures and verifies an identity document. Requires a successful face verification first; otherwise it throws CAPTURES_INCOMPLETE. Returns whether the capture was accepted.
acquireFace()Captures and verifies a live face. Clears any stored document data. Returns whether the capture was accepted.
begin(intent)Starts one intent for manual capture. Repeating the start records one usage unit in total.
caniuse()Returns { supported, unsupportedFeatures } for the current browser.
configure(options)Updates poses, randomizeFaceSequence, overlays, and debug. Invalid values throw INVALID_OPTIONS for the next flow.
dispose()Disposes the client permanently. Releases the camera, removes subscriptions, and clears collected data. Create a new client to continue.
forgetDocument()Clears document captures, the parsed identity, document codes, document analysis, and the stored document verification identifier. Emits voltom:captures-change.
forgetFace()Clears face and document captures, the parsed identity, document codes, and the stored verification identifiers. Emits voltom:captures-change.
getState()Returns the current FaceBindPresentationState snapshot.
match()Compares the verified face and document. Both acquisitions must succeed on this instance first.
preload()Loads the language and models before a verification flow. Rejects with MODEL_LOAD_FAILED on failure.
prepare()Calls preload(), validates the client key, initializes models, and prepares the capture interface. The constructor calls it unless prepare is false.
stop()Aborts the active operation with OPERATION_CANCELLED, stops the camera, and closes the overlay.
subscribe(listener)Observes presentation state changes and returns an unsubscribe function.
verify(intent)Runs the capture steps and match. Returns true, false, or null.

Results

Technical failures and cancellation reject the operation with a VoltomSdkError. Completed verification and match rejections return a result. Use error.code for decisions. error.message contains stable English text; the SDK UI translates messages separately. HTTP errors include status. Errors for completed results include resultId when available.

import { Errors, isSdkError } from '@voltom.io/sdk/facepair';

try {
  const result = await facePair.match();
  console.log(result);
} catch (error) {
  if (!isSdkError(error)) throw error;
  if (error.code !== Errors.OPERATION_CANCELLED) {
    console.error(error.code, error.message, error.status, error.resultId);
  }
}

Script integrations use VoltomFacePair.Errors and VoltomFacePair.isSdkError. Shared codes include OPERATION_CANCELLED, OPERATION_TIMEOUT, OPERATION_IN_PROGRESS, SDK_DISPOSED, INTENT_TOKEN_INVALID, NETWORK_ERROR, and INVALID_SERVICE_RESPONSE. Cancellation and network errors do not confirm whether a server operation completed. Resolve the result on your server before you retry a protected action.

Capture methods return true when accepted, false for a retake, and null on cancellation. The final result is available from match(), verify(), and sdk.result. Technical errors reject the promise. Read the outcome on your server before applying the business action.

Events

Listen for these events on faceBind.events.

EventWhen it firesEvent data
voltom:in-progressA verification operation starts.None
voltom:readyA verification operation finishes, including after an error.None
voltom:camera-changeCamera activity changes.{ active: boolean }
voltom:captures-changeCaptured data, the parsed identity, or the document analysis changes.FaceBindCaptureResult

Useful fields of the voltom:captures-change payload include identity, document, documentCodes, and captures. Entries in captures are Blob images keyed by pose or document side, for example captures.faceStraight, captures.documentFront, or captures.documentBack.

type FaceBindCaptureResult = {
  identity: IdentityPayload | null;
  captures: FaceBindCaptures;
  documentCodes: DocumentCode[];
  preparedCaptures: FaceBindPreparedCaptures;
  document?: ClassifiedDocument;
};
faceBind.events.addEventListener('voltom:captures-change', (event) => {
  const birthDate = event.detail.identity?.holder.birth_date ?? null;
  console.log(birthDate); // 'YYYY-MM-DD' | null
});

REST API

Create the intent on your server with the secret key, consume it in the browser with the SDK, then resolve the outcome on your server with the secret key.

Send Authorization: Bearer YOUR_SECRET_KEY from your server. POST requests use Content-Type: application/json. Successful responses return HTTP 200 and JSON. The TypeScript shapes below describe JSON payloads; ? marks optional fields. Response timestamps use ISO 8601. ErrorCode values use the SDK error codes listed above. GET requests read an outcome; they do not run the protected application action.

MethodURLKeyPurpose
PUThttps://api.voltom.io/facebind/{id}/errorPublic or secret keyRecord a terminal camera or model loading error on the active intent.
POSThttps://api.voltom.io/facebindSecret keyCreate one intent for the complete verification attempt.
PUThttps://api.voltom.io/facebind/{id}/beginPublic or secret keyStart the attempt and record one usage unit.
PUThttps://api.voltom.io/facebind/{id}/facePublic or secret keySubmit the locally accepted face captures and poses.
PUThttps://api.voltom.io/facebind/{id}/documentPublic or secret keySubmit the locally accepted document images as data URLs.
PUThttps://api.voltom.io/facebind/{id}/matchPublic or secret keyConsume this intent and compare its accepted captures. Repeating the submission returns the stored outcome after completion.
GEThttps://api.voltom.io/facebind/{id}Secret keyRead the FaceBind intent outcome. Accept only a resolved status and pass outcome. The identity field contains the stored document data when available.

PUT https://api.voltom.io/facebind/{id}/error

Record a terminal camera or model loading error on the active intent.

Request payload

type RequestBody = { token: string; code: ClientFlowError };

Response payload

type ResponseBody = null;

POST https://api.voltom.io/facebind

Create one intent for the complete verification attempt.

Request payload

{}

Response payload

type ResponseBody = { id: string; token: string };

PUT https://api.voltom.io/facebind/{id}/begin

Start the attempt and record one usage unit.

Request payload

type RequestBody = { token: string };

Response payload

null

PUT https://api.voltom.io/facebind/{id}/face

Submit the locally accepted face captures and poses.

Request payload

type RequestBody = { token: string; poses: string[]; faces: string[]; poseReference?: string; poseReferences?: string[][] };

Response payload

type ResponseBody = { accepted: boolean; reason: ErrorCode | null };

PUT https://api.voltom.io/facebind/{id}/document

Submit the locally accepted document images as data URLs.

Request payload

type RequestBody = { token: string; documentFront: string; documentBack?: string };

Response payload

type ResponseBody = { accepted: boolean; reason: ErrorCode | null };

PUT https://api.voltom.io/facebind/{id}/match

Consume this intent and compare its accepted captures. Repeating the submission returns the stored outcome after completion.

Request payload

type RequestBody = { token: string };

Response payload

type ResponseBody = {
  resultId: string; outcome: 'pass' | 'fail' | 'error';
  reason: ErrorCode | null; completedAt: string; createdAt: string;
  documentCode: string | null; identity: IdentityPayload | null;
};

GET https://api.voltom.io/facebind/{id}

Read the FaceBind intent outcome. Accept only a resolved status and pass outcome. The identity field contains the stored document data when available.

Request payload

// Path: id (UUID). No query parameters or request body.

Response payload

type ResponseBody = {
  id: string; // UUID
  product: 'facebind';
  status: 'pending' | 'consumed' | 'resolved' | 'expired' | 'failed';
  outcome: 'pass' | 'fail' | 'error' | null;
  reason: ErrorCode | null;
  documentCode: string | null;
  identity: IdentityPayload | null;
  createdAt: string; // ISO 8601
  expiresAt: string; // ISO 8601
  startedAt: string | null;
  processedAt: string | null;
  completedAt: string | null;
};

Limits and Support

One intent covers both captures, retakes, and the final match. The token expires after 10 minutes.

FaceBind supports these documents:

  • Passports with a machine readable zone.
  • Identity cards with a machine readable zone.
  • Driving licences with a machine readable zone, an AAMVA barcode, or a European layout.

Coverage depends on the document format and the issuing country. A document without a machine readable code, barcode, or supported layout fails with a document error code. For support, write to us through Contact Us.

To build a minimum age check, read the birth date from holder.birth_date and compare it with your own rule.

To reduce document errors, keep the passport, identity card, or licence visible during the document step.

A pass is a face-to-document match only. It is not proof of document authenticity.

Pricing Explained

The standard price is $0.02 per FaceBind verification flow. The default account discount is $1.00 per month.

Creating an intent is free. The first accepted browser submission counts as one unit, even if the user stops before match. Later stages and a negative match add no units. A terminal technical error removes the unit.