KYC flow

This guide walks through integrating Nani's hosted KYC flow into your product.

Overview

Your App → POST /v1/sessions → redirect to verify_url → webhook → verified

Step 1: Create a session on your backend

Always create sessions server-side — never expose your API key to the browser.

const res = await fetch('https://api.nani.dev/v1/sessions', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'x-api-key': process.env.NANI_API_KEY!,
  },
  body: JSON.stringify({
    country: user.country,
    flow: 'user',
    tier: 'tier2',
    external_user_reference: user.id,
    redirect_url: `${process.env.APP_URL}/onboarding/complete`,
  }),
});

const { verify_url } = await res.json();
// Redirect your user to verify_url

Step 2: User completes the hosted flow

Nani's hosted UI at verify_url handles consent, document selection, capture, liveness (when required), and AI review.

Step 3: Receive the webhook

Configure your endpoint in the console under Settings → Webhooks. Verify the x-nani-signature HMAC on every delivery.

Step 4: Activate the user in your product

Use identity_id from the webhook to fetch verified attributes via GET /v1/identities/:id.

Was this page helpful?