Connection

KYC Widget

A browser-based identity verification flow: document capture, selfie, and liveness check (anti-spoofing). There are four ways to integrate it:

  1. <script> tag in a plain JavaScript app — window.KYCWidget.setupKYC({...})
  2. npm package kyc-widget-nv in a React app — <KycWidget ... />
  3. <script> tag in a React app
  4. Direct link (no integration) — https://kyc.neuro-vision.ru

Before you start

  1. 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.com allows all subdomains of example.com, but not example.com itself. Changes take effect within two minutes. The list can be changed by the account owner or a user with the delegation right.
  2. Serve the page over HTTPS. Browsers grant camera access only on secure pages.
  3. 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.
  4. 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:

SituationWhat the user sees
Camera access deniedA request to allow camera access on this device
The camera does not support the required resolutionA request to try again from a more modern device
The scenario does not allow a computer cameraA QR code and a link to continue on a smartphone
The device is in landscape orientationA request to rotate the device to portrait mode
No internet connectionA message that there is no connection
Wrong date or time on the deviceA request to fix the date and time
The browser blocks the verificationA request to open the link in another browser or on another device

Configuration parameters

ParameterTypeRequiredDefaultDescription
scenarioIdstringYes*–Unique scenario identifier from the “KYC/AML” section of your dashboard (*not required when using taskId)
clientKeystringYes*–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)
clientUserstringNo–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
taskIdstringNo–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
isOpenbooleanYes*–Widget visibility (*required only for the React component)
themestringNofrom the scenario settingsColor theme: light or dark
stickySessionbooleanNofalse“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
closeCbfunctionNo–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
successCbfunctionNo–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”
finalizedCbfunctionNo–Callback fired when the widget is opened for a session that was already finalized earlier. Receives { status }
topOffsetnumberNo0Top offset in pixels
bottomOffsetnumberNo0Bottom offset in pixels
blurHostbooleanNofalseIf 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
mountElementIdstringNo–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 setupKYC again while the widget is open replaces the open instance with a new one; closeCb of the previous one is not called. Do not call setupKYC again 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

  • successCb arrives only for the success outcome. 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 closeCb fires, 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)

  1. Create a button in an initial loading state.
  2. Load the script dynamically and enable the button once it's ready.
  3. 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

  1. Install the npm package kyc-widget-nv: npm i kyc-widget-nv.
  2. Import it into your app: import { KycWidget } from "kyc-widget-nv".
  3. Set up a state variable to control the widget's visibility.
  4. Pass props to the KycWidget component (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.

  1. Load the widget script dynamically in useEffect.
  2. Track the loading state with useState.
  3. Show the button only after the script has loaded.
  4. 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 success outcome — 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