Skip to main content
Identity verification (KYC) is the process of confirming that a user is who they claim to be. You should verify users before they participate in high-value transactions, onboard onto a marketplace, or access regulated features. Vouch makes this straightforward by providing both a guided modal flow and a lower-level API for building your own verification UI.
1

Initialize Vouch

Install the SDK and create a client instance. Store your API key in an environment variable — never hard-code it.
2

Option A: Use the Identity Modal

Call vouch.identity.verify() with the user’s ID from your platform. This opens a guided iframe that walks the user through document capture and a selfie liveness check. The promise resolves once the user completes (or abandons) the flow.
The modal handles camera permissions, document framing guidance, and liveness detection automatically. Your code only needs to act on the resolved result.
3

Option B: Build Your Own UI

If you need full control over the capture experience, use vouch.identity.submitVerification() directly. You provide the document image and an array of selfie frames, then process the result yourself.
For best liveness detection accuracy, capture at least three frames taken 300–500 ms apart during normal head movement.
4

Handle the Result

The result object contains everything you need to gate access or surface a rejection reason to the user.
Calling vouch.identity.verify() or vouch.identity.submitVerification() for an externalUserId that already has a verification record updates their profile rather than creating a duplicate. Use this to trigger re-verification after a failed attempt or when a user’s document expires.
In production, never call the Vouch SDK directly from browser code where the API key would be exposed. Route verification calls through a server-side endpoint or a backend-for-frontend (BFF) layer. Your server holds the key and returns the result to the client.

Complete Example: React Component

The following component demonstrates the full modal-based KYC flow in a React application.