clientKey is a custom identifier that you define and use to link KYC sessions to your users, applications, or contracts.
Through clientKey you can:
- find a KYC session by your key;
- match the verification results with your objects (userId, orderId, loanId, etc.);
- filter sessions via the REST API;
- process webhooks more easily.
Important: you create the clientKey value yourself, the platform does not generate it automatically.
Format and restrictions
- Type:
string - Maximum length: 36 characters
- Format: any string; Latin letters, digits and separators (
[a-zA-Z0-9_-]) are the most convenient
The key must be unique for each verification attempt within your account. If you pass a key that has already been used, the earlier session with this key opens instead of a new one.
Recommended values:
clientKey = "<userId>:<orderId>:<attempt number>", for exampleu1024:o77:1— if KYC is linked to an application, order, or contract;clientKey = UUID— if it's more convenient to work only with the KYC identifier.
To find all attempts of one user, pass the user's identifier in clientUser.
Two forms of clientKey: "raw" and encrypted
For the Web SDK integration, keep in mind that there are two values:
- Original value (
clientKeyRaw) — the value you came up with: for example,"user_123"or"loan-42". - Encrypted value (
clientKey) — the value you actually pass to the widget. It is the result of encryptingclientKeyRawwith the scenario secret key from your account.
Workflow:
- On your server, build
clientKeyRaw(up to 36 characters), encrypt it with the scenario secret key and send the encryptedclientKeyto the browser. - In the browser, pass the encrypted
clientKeytoKYCWidget.setupKYC(...). - NeuroVision decrypts the value and stores the original
clientKeyRawin the session — you can search sessions by it and get results via the API and webhooks.
In the API (
/kyc/session/status,/kyc/sessions/filter) and in webhooks you work with the original value that you set yourself. Encryption is needed only to passclientKeyto the browser securely.
Where clientKey is used
In the Web SDK
Widget call:
window.KYCWidget.setupKYC({
scenarioId: "SCENARIO_ID", // Scenario ID
clientKey: "ENCRYPTED_CLIENT_KEY", // encrypted clientKeyRaw
theme: "light",
closeCb: () => console.log("CLOSE"),
successCb: (payload) => {
console.log("SUCCESS", payload);
// you already know the original clientKeyRaw: you set it on your server
},
}); Verification result in the browser
successCbarrives only for thesuccessoutcome. It does not mean the window is closed: the user still sees the result screen.- For any other outcome (rejection, error, the user closed the widget) only
closeCbfires, without a status. 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.
In the REST API
/kyc/session/status— you can passclientKeyto clarify the status for a specific key;/kyc/sessions/filter— there is aclientKeyfilter to get all sessions by key.
Here you pass the original value (clientKeyRaw), without encryption.
Generating and encrypting clientKey on your server
Keep the scenario secret key only on your server. Never send it to the browser.
Steps:
- Take
clientKeyRaw(up to 36 characters). - Take the scenario secret key from your account.
- On your server, encrypt
clientKeyRawwith AES-256-CBC and a random IV. - Pass the resulting Base64 string to the widget as
clientKey.
The encryption is symmetric: NeuroVision decrypts clientKey with the same scenario secret key. Ready-made examples in Node.js, PHP, Python and Go are in the scenario card: the "Integration Docs" tab → "Client Key Encryption".
Node.js example (AES-256-CBC)
const crypto = require("crypto");
// 1. Original ID (what you want to see in the API and webhooks)
const clientKeyRaw = "user_123"; // up to 36 characters
// 2. Scenario secret key from your account (DO NOT pass to the browser!)
const password = "SCENARIO_SECRET_KEY";
// 3. Get a 32-byte key from the password
const key = crypto.createHash("sha256").update(password).digest('hex').substr(0, 32);
// 4. Generate a random IV (16 bytes)
const iv = crypto.randomBytes(16);
// 5. Encrypt clientKeyRaw
const cipher = crypto.createCipheriv("aes-256-cbc", key, iv);
const encrypted = Buffer.concat([cipher.update(clientKeyRaw, "utf8"), cipher.final()]);
// 6. Concatenate IV + ciphertext and encode it in Base64 — this is the clientKey for the widget
const encryptedBase64 = Buffer.concat([iv, encrypted]).toString("base64");
console.log("clientKeyRaw:", clientKeyRaw);
console.log("clientKey (encrypted):", encryptedBase64); This is the encrypted clientKey you substitute into:
window.KYCWidget.setupKYC({
scenarioId: "SCENARIO_ID",
clientKey: encryptedBase64,
// ...
}); The "Check" button next to the scenario secret key in your account encrypts the value with the same algorithm and helps you quickly make sure
clientKeyis built correctly. In a production integration, always encryptclientKeyon your server.
How to test clientKey
- In your account, open the scenario and find its secret key.
- Click the "Check" button and enter the test
clientKeyRaw(e.g.,test_user_1). - The account returns an encrypted value — it can be temporarily substituted into integration examples (instead of
"ENCRYPTED_CLIENT_KEY"). - Make sure the widget opens without errors, and the session list in your account and the
/kyc/sessions/filterresponse byclientKeyshow the originalclientKeyRaw.
Frequently asked questions and errors
"Where do I get the values for clientKey and clientUser?"
clientKey— any string up to 36 characters that you define yourself, unique for each attempt: for example, an application number with an attempt number. The parameter is required unless the widget is opened bytaskId.clientUser— an optional string up to 36 characters, not required to be unique: you can use it later to find all sessions (attempts) of a single user.
Good practice: make
clientKeyRawunique for the attempt (for example,u1024:o77:1), pass the user's identifier inclientUser, encryptclientKeyRawand pass only the encryptedclientKeyto the widget.
Error "Incorrect client key value"
The widget shows this message when it cannot decrypt clientKey with the scenario secret key. Most often it means that:
- the widget received an unencrypted
clientKeyRaw; - or a different secret key was used, not the key of this scenario;
- or the
clientKeyvalue was corrupted/truncated (e.g., during copying).
Check:
- That you pass to the widget exactly the Base64 string obtained after encryption (see example above).
- That the secret key you encrypt with belongs to the same scenario whose
scenarioIdis passed to the widget.
"How do I find the clientKey to decrypt the webhook?"
To decrypt the webhook body, clientKey is not needed:
- the webhook body is encrypted with AES-256-CBC using the scenario secret key, the same key you use to encrypt
clientKey. Encryption is turned on by the "Encrypt POST body with secret key" flag in the scenario's webhook settings; - to decrypt it, you only need the scenario secret key and the
encryptedfield of the POST request.
clientKey in the webhook is simply one of the JSON fields inside the already decrypted body, and its value will be exactly what you set in clientKeyRaw.
"Why does every test webhook come with a different encrypted string, even though the JSON is the same?"
This is expected:
- encryption uses a random IV (initialization vector);
- even with the same JSON and encryption key, the ciphertext is different each time;
- after decryption, the body will be the same JSON.
"How is the overall success/failed status related to checks and databases?"
Overall KYC session status:
success— all checks of the scenario steps passed;failed— at least one step check (recognition, forgery signs, face matching, Liveness) did not pass.
External database checks (sanctions lists, debts, etc.) affect the session status only if the check is marked as blocking in the scenario: if it fails, the session gets failed with the [legal] database check failed code in errors. Non-blocking checks do not affect the status. Detailed check results come separately — via the kyc/session/databases method or the database-checks-complete webhook.
Recommended workflow with clientKey
- On your server, when the check starts, choose a new
clientKeyRawfor this attempt (e.g.u1024:o77:1), encrypt it with the scenario secret key and storeclientKeyRawtogether with youruserId/orderId. - In the browser, pass the encrypted value to
KYCWidget.setupKYC(...). - Get the result from the webhook (the
clientKeyfield of the decrypted body) or with/kyc/sessions/filterwithclientKey = clientKeyRaw— it returns the session for this key.
This way you can always unambiguously determine which user or application any KYC session belongs to.