KYC Widget
A browser-based identity verification flow: document capture, selfie, and liveness check (anti-spoofing). There are four ways to integrate it:
<script>tag in a plain JavaScript app —window.KYCWidget.setupKYC({...})- npm package kyc-widget-nv in a React app —
<KycWidget ... /> <script>tag in a React app- Direct link (no integration) — https://kyc.neuro-vision.ru
Before you start
- Add your site's domain to the allowed list. In the dashboard, open "Access" → "Allowed domains" and add the domains where you embed the widget. The widget runs only on domains from this list and only on https sites. The mask
*.example.comallows all subdomains ofexample.com, but notexample.comitself. Changes take effect within two minutes. The list can be changed by the account owner or a user with the delegation right. - Serve the page over HTTPS. Browsers grant camera access only on secure pages.
- If the page with the widget is itself opened inside an
<iframe>, allow the camera for that frame:<iframe src="..." allow="camera">. Without it the browser will not grant the camera. Inline mode (mountElementId) does not work inside an iframe — see the parameter table. - Mobile app. Running inside a WebView needs app-side settings — see Mobile apps and WebView.
Interface language
The widget has no language parameter. The language is chosen in this order: the user's saved choice in this browser → the browser language → English. The list is limited to the languages enabled in the scenario; the user can switch the language in the widget. 29 languages are available.
Environment screens
If the device or browser is not suitable, the widget shows the user a screen with a hint instead of an error:
| Situation | What the user sees |
|---|---|
| Camera access denied | A request to allow camera access on this device |
| The camera does not support the required resolution | A request to try again from a more modern device |
| The scenario does not allow a computer camera | A QR code and a link to continue on a smartphone |
| The device is in landscape orientation | A request to rotate the device to portrait mode |
| No internet connection | A message that there is no connection |
| Wrong date or time on the device | A request to fix the date and time |
| The browser blocks the verification | A request to open the link in another browser or on another device |
Configuration parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| scenarioId | string | Yes* | – | Unique scenario identifier from the “KYC/AML” section of your dashboard (*not required when using taskId) |
| clientKey | string | Yes* | – | Unique string (max 36 characters) that is passed encrypted; sample encryption code is available in the dashboard under “KYC/AML” (*not required when using taskId) |
| clientUser | string | No | – | Client-side user identifier, max 36 characters. It doesn’t have to be unique: pass the same value across different sessions so you can later search by it and find all sessions (attempts) for that user |
| taskId | string | No | – | Verification task identifier. Needed only if you were given a task link of the form https://kyc.neuro-vision.ru/<taskId>: the widget opens that task, and scenarioId/clientKey are not needed. Regular integration and one-time links from the “KYC Links” section use scenarioId and clientKey |
| isOpen | boolean | Yes* | – | Widget visibility (*required only for the React component) |
| theme | string | No | from the scenario settings | Color theme: light or dark |
| stickySession | boolean | No | false | “Sticky” sessions: the widget remembers the clientKey for the scenario (in localStorage, for 15 minutes). Reopening it in this window continues the previous session, even if a different clientKey is passed |
| closeCb | function | No | – | Fired when the widget closes: by the × button, by the return button on the result screen (for any outcome) or on a widget failure. Not fired on a repeated setupKYC call (the previous instance is replaced without a callback) or if the element with mountElementId is missing from the page |
| successCb | function | No | – | Fired once and only for the success outcome, when the widget shows the result screen: the window is still open at that moment. Receives the session result as a JSON string. For other outcomes see “How to get the verification result” |
| finalizedCb | function | No | – | Callback fired when the widget is opened for a session that was already finalized earlier. Receives { status } |
| topOffset | number | No | 0 | Top offset in pixels |
| bottomOffset | number | No | 0 | Bottom offset in pixels |
| blurHost | boolean | No | false | If true, the widget background is rendered as “frosted glass” over the host page (no background image and no right-hand blur panel) — the host page shows through a semi-transparent blurred layer |
| mountElementId | string | No | – | Only for the script-tag integration (widget-lib.js). If set, the widget is mounted inline inside the element with this id instead of over the whole page. The widget fills the host element (width/height: 100%), so give the element explicit dimensions. See the example below. Not supported inside a cross-origin iframe — the browser will block the camera; in that case closeCb is called so the host can reset its state. Do not call setupKYC inside closeCb — repeated iframe detections will loop. If there is no element with this id in the DOM, the widget silently does not start: no window, and closeCb is not called |
successCb callback payload
successCb receives the verification result as a JSON string. The exact set of fields depends on the scenario steps (a document step arrives as "type": "document", liveness as "type": "liveness", and so on). The schemaId field in the result is the scenario identifier, the same as scenarioId. Abbreviated example:
{
"sessionId": "098d57-...",
"status": "success",
"errors": [],
"results": [
{
"type": "liveness",
"status": "success",
"errors": [],
"tries": 1,
"startedAt": "2026-07-19T09:41:37.590Z",
"faces": ["https://..."],
"video": "https://..."
}
],
"schemaId": "3676-...",
"clientKey": "46d1c-...",
"clientUser": "",
"createdAt": "2026-07-19T09:41:37.000Z",
"secondsToLive": 0
} Widget lifecycle
- There is no function to close or destroy the widget: the user closes it — with the × button or the return button on the result screen.
- Calling
setupKYCagain while the widget is open replaces the open instance with a new one;closeCbof the previous one is not called. Do not callsetupKYCagain while the widget is open. - If the widget was mounted into an element (
mountElementId), the element's content is cleared on close.
How to get the verification result
successCbarrives only for thesuccessoutcome. It does not mean the window is closed: the user still sees the result screen.- Any other outcome (rejection, error, the user closed the widget) does not arrive as a callback: only
closeCbfires, without a status. In that case get the session result from the webhook or by requesting the session status. - Decide whether verification passed on your server, by the webhook or session status, not by browser callbacks.
1. Example: integrating into a JavaScript app via a script tag (index.html)
- Create a button in an initial loading state.
- Load the script dynamically and enable the button once it's ready.
- Call
window.KYCWidget.setupKYC()on button click.
File: index.html
<body>
<button id="btn" disabled>Loading...</button>
<script>
const btn = document.getElementById("btn");
const script = document.createElement("script");
script.src = "https://kyc.neuro-vision.ru/lib/widget-lib.js";
script.onload = () => {
btn.disabled = false;
btn.textContent = "Open KYC widget";
};
script.onerror = () => {
btn.textContent = "Failed to load KYC widget";
};
document.body.appendChild(script);
const openWidget = () => {
window.KYCWidget.setupKYC({
scenarioId: "scenarioId",
clientKey: "clientKey",
clientUser: "clientUser",
theme: "light",
stickySession: true,
topOffset: 0,
bottomOffset: 0,
// Optional. If set, the widget is mounted INSIDE the element
// with this id (inline block) instead of over the whole page. The
// element must exist in the DOM. On close, the element is cleared.
// ⚠️ Do not open the host page inside a cross-origin <iframe> —
// the browser will block getUserMedia and the camera won't start.
// mountElementId: "kyc-here",
closeCb: () => console.log("CLOSE CALLBACK"),
successCb: (sessionJson) => console.log("SUCCESS CALLBACK", sessionJson),
finalizedCb: ({ status }) => console.log("FINALIZED CALLBACK", status),
});
};
btn.addEventListener("click", openWidget);
</script>
</body> 2. Example: integrating into a React app via the npm package
- Install the npm package kyc-widget-nv:
npm i kyc-widget-nv. - Import it into your app:
import { KycWidget } from "kyc-widget-nv". - Set up a state variable to control the widget's visibility.
- Pass props to the
KycWidgetcomponent (see "Configuration parameters" above).
The package does not bundle React — react and react-dom must be installed in your app.
File: App.js
import { useState } from "react";
import { KycWidget } from "kyc-widget-nv";
function App() {
const [isOpen, setIsOpen] = useState(false);
return (
<>
<button onClick={() => setIsOpen(true)}>Open</button>
<KycWidget
scenarioId="scenarioId"
clientKey="clientKey"
clientUser="clientUser"
isOpen={isOpen}
stickySession={true}
theme="light"
topOffset={0}
bottomOffset={0}
closeCb={() => setIsOpen(false)}
successCb={(sessionJson) => console.log("SUCCESS CALLBACK", sessionJson)}
finalizedCb={({ status }) => console.log("FINALIZED CALLBACK", status)}
/>
</>
);
}
export default App; 3. Example: integrating into a React app via a script tag
Use this approach if you can't install the npm package and need to load the widget via a script tag.
- Load the widget script dynamically in
useEffect. - Track the loading state with
useState. - Show the button only after the script has loaded.
- Call
window.KYCWidget.setupKYC()on button click.
File: App.js
import { useState, useEffect, useCallback } from "react";
function App() {
const [widgetLoaded, setWidgetLoaded] = useState(false);
const openWidgetHandler = () => {
window.KYCWidget.setupKYC({
scenarioId: "scenarioId",
clientKey: "clientKey",
clientUser: "clientUser",
theme: "light",
topOffset: 0,
bottomOffset: 0,
// Optional. If set, the widget is mounted INSIDE the element
// with this id (inline block) instead of over the whole page. The
// element must exist in the DOM. On close, the element is cleared.
// ⚠️ Do not open the host page inside a cross-origin <iframe> —
// the browser will block getUserMedia and the camera won't start.
// mountElementId: "kyc-here",
closeCb: () => console.log("CLOSE CALLBACK"),
successCb: (sessionJson) => console.log("SUCCESS CALLBACK", sessionJson),
finalizedCb: ({ status }) => console.log("FINALIZED CALLBACK", status),
});
};
const loadWidgetScript = useCallback(() => {
const widgetScript = document.getElementById("kyc-widget-script");
if (widgetScript) return;
const script = document.createElement("script");
script.id = "kyc-widget-script";
script.src = 'https://kyc.neuro-vision.ru/lib/widget-lib.js';
script.defer = true;
script.crossOrigin = "anonymous";
script.onload = () => {
setWidgetLoaded(true);
};
script.onerror = () => {
console.error("Failed to load the KYC widget script");
};
document.head.appendChild(script);
}, []);
useEffect(() => {
if (window.KYCWidget) {
setWidgetLoaded(true);
return;
}
loadWidgetScript();
}, [loadWidgetScript]);
return (
<>
{widgetLoaded && (
<button onClick={openWidgetHandler}>Open KYC widget</button>
)}
</>
);
}
export default App; 4. Verification via a link
To go through verification, you can use the https://kyc.neuro-vision.ru service directly.
Opening a link of the following form creates a session:
https://kyc.neuro-vision.ru/scenarioId/encrypted(clientKey)
https://kyc.neuro-vision.ru/scenarioId/encrypted(clientKey)/clientUser - scenarioId: unique scenario identifier; obtain it in the dashboard under "KYC/AML".
- clientKey: unique string (max 36 characters) that is passed encrypted; sample encryption code is available in the dashboard under "KYC/AML". The encrypted key is base64 (it may contain
/and+), so it must be URL-encoded when building the link. - clientUser: optional. Client-side user identifier, max 36 characters. It doesn't have to be unique — pass the same value across different sessions so you can later find all sessions (attempts) for that user.
One-time links with a limited lifetime and number of uses are created in the dashboard, in the "KYC Links" section.
Returning to your site after verification
If the scenario's main settings contain "Mobile redirect URL on success", the widget opened via a direct link returns the user to that address and appends the parameters ?sessionId=<session id>&status=<final status>:
- for the
successoutcome — automatically after 5 seconds; - for any outcome — via the return button on the result screen.
When the widget is embedded in your site (setupKYC, npm package), there is no redirect: the return button closes the widget and calls closeCb. Treat the status in the return URL as a UI hint; verify the result on your server.
Task link
If you were given a verification task link, it looks like this:
https://kyc.neuro-vision.ru/taskId
https://kyc.neuro-vision.ru/taskId/cu/clientUser