Documentation

Everything you need to add kyc2s to your site.

Quick start

  1. Create your account: your first flow is ready, with every module.
  2. In Flows, choose the modules of the flow (Modules) and your webhook URL (URLs).
  3. Open Integrate: copy the script of the flow and its secret.
  4. On your page, open the verification with the id of your user, then send the token to your server.

The widget

WLVerify.open() opens the verification in a window over your page. Options:

<script src="https://kyc2s.com/products/scripts/FLOW_ID/"></script> <script> WLVerify.open({ ref: 'user-42', lang: 'en', onResult: function(token, status){ /* status: approved, rejected, review */ }, onClose: function(){ } }); </script>
refYour id of the person (letters, digits and _ . : @ -, up to 190 characters). It comes back in the token and the webhook.
langLanguage of the screens: en, fr, it, de, es, pt or br (Brazilian Portuguese). Default: the language of the browser. The person can change it with the flag.
onResultCalled with the signed token and the status when the verification ends.
onCloseCalled when the person closes the window. WLVerify.close() closes it from your page.
containerOptional: an element (or a CSS selector) to open the verification inside it, instead of a window over the page. Give it a height of 600 px or more.
flowOptional: the id of the flow to open, when the page loads the scripts of several flows. Default: the flow of the first script loaded.

The token

Never trust the browser alone: check the token on your server with the secret of the flow. Its format is base64url(payload) . base64url(HMAC-SHA256(first part, secret)), valid 10 minutes.

Payload: vid (verification), ref, flow, status, checks (result of each module: true, false or null to review), min_age, iat, exp.

// PHP [$body, $sign] = explode('.', $token) + ['', '']; $good = hash_equals(rtrim(strtr(base64_encode(hash_hmac('sha256', $body, $secret, true)), '+/', '-_'), '='), $sign); $payload = json_decode(base64_decode(strtr($body, '-_', '+/')), true); $ok = $good && $payload['exp'] > time() && $payload['status'] === 'approved' && $payload['ref'] === $userId;
// Node.js const crypto = require('crypto'); const [body, sign] = token.split('.'); const expected = crypto.createHmac('sha256', secret).update(body).digest('base64url'); const good = sign.length === expected.length && crypto.timingSafeEqual(Buffer.from(sign), Buffer.from(expected)); const payload = JSON.parse(Buffer.from(body, 'base64url').toString()); const ok = good && payload.exp > Date.now() / 1000 && payload.status === 'approved' && payload.ref === userId;

The webhook

When a verification ends, kyc2s sends a POST (JSON) to the webhook URL of the flow, up to 3 tries. Check the header X-Kyc2s-Signature: sha256= followed by HMAC-SHA256 of the raw body with the secret of the flow, in hexadecimal. Answer with a 2xx code.

The webhook also carries the data of each module (for the ID document: type, country, names, dates, end of the number). Never any image.

{ "event": "verification.completed", "verification": { "vid": 1042, "ref": "user-42", "flow": 7, "status": "approved", "completed_at": "2026-10-18 12:00:00", "modules": { "liveness": { "passed": true, "score": 0.97, "data": {} }, "age": { "passed": true, "score": 31.4, "data": { "min_age": 18 } } } }, "token": "eyJ2aWQiOjEwNDIs…" }

Check API

You can also ask kyc2s to check a token: POST with the id of the flow (product), its secret and the token. The answer gives the payload and the current status.

curl -X POST https://kyc2s.com/products/verify/check/ \ -d product=FLOW_ID -d secret=SECRET -d token=TOKEN # {"code":1,"payload":{...},"status":"approved"} or {"code":0,"message":"invalid-token"}

REST API

Manage your flows and read your verifications from your servers or your plugins. Requests and answers are in JSON; a successful answer has code 1.

API keys

  1. Create a key in your client area, page API keys.
  2. Copy it at once: it is shown only once (kyc2s keeps only its SHA-256).
  3. Send it in the header Authorization: Bearer followed by the key, or in the header X-Kyc2s-Key when your host drops Authorization.
  4. A key makes up to 600 requests an hour. To revoke it: API keys > Edit > Disabled, it stops at once.
curl https://kyc2s.com/api/v1/account/ -H "Authorization: Bearer kyc2s_…" # {"code":1,"account":{"id":12,"name":"Acme","email":"dev@acme.example","flows":2, # "verifications_month":31,"verifications_total":204,"free_verifications":50,…}}

Endpoints

GET /api/v1/account/Your account: name, email, number of flows, verifications of the month and in total, free verifications.
GET /api/v1/modules/?ln=frThe verification modules: feature (id), tag, name and intro in the language ln (en by default), input, settings with their bounds.
GET /api/v1/flows/Your flows: modules in order with their settings, URLs (domain, return, webhook), secret, script of the widget, number of verifications.
POST /api/v1/flows/Creates a flow (answer 201). Without modules, the flow gets every module, in order.
GET /api/v1/flows/<id>/One flow.
PUT /api/v1/flows/<id>/Changes only the fields sent: name, modules, urls. The secret stays the same.
DELETE /api/v1/flows/<id>/Deletes a flow that has no verification yet (otherwise 409).
POST /api/v1/flows/<id>/secret/A new secret for the flow: the next tokens and webhooks are signed with it.
GET /api/v1/verifications/?flow=&ref=&status=&page=&per_page=Your verifications, newest first. Filters: flow (id), ref, status (running, approved, rejected, review, expired). page and per_page (50 by default, 100 at most); the answer gives page, per_page and total.
GET /api/v1/verifications/<vid>/One verification: status, dates, result of each module (passed, score, data, tries). Never any image.

Create or change a flow

POST and PUT on the flows take this JSON. Each module by its feature (id) or its tag, once, with its settings (kept within their bounds, see Modules and settings). The modules always run in the same order (liveness, age, document, face, aml, address) and a module adds the ones it needs (document for face, aml and address; liveness for age and face). The URLs are http(s), or an empty text to remove one.

curl -X POST https://kyc2s.com/api/v1/flows/ \ -H "Authorization: Bearer kyc2s_…" \ -H "Content-Type: application/json" \ -d '{ "name": "Shop checkout", "modules": [ { "tag": "liveness", "settings": { "threshold": 0.8 } }, { "tag": "age", "settings": { "min_age": 18 } } ], "urls": { "domain": "https://shop.example", "return": "https://shop.example/account/", "webhook": "https://shop.example/kyc2s/webhook/" } }' # 201 {"code":1,"flow":{"id":8,"name":"Shop checkout","modules":[…],"urls":{…}, # "secret":"…","script":"https://kyc2s.com/products/scripts/8/","verifications":0,…}}

Errors

An error comes with its HTTP code and a JSON body: code 0, message (a fixed word) and, when fields are wrong, errors (each field with its problem).

{ "code": 0, "message": "invalid-flow", "errors": { "modules.1": "unknown module", "urls.webhook": "an http(s) URL" } }
400invalid-json — the body is not JSON.
401unauthorized — no key, or a wrong or revoked key.
404flow-not-found verification-not-found — this flow or this verification is not one of yours.
405method-not-allowed — method not allowed on this address (the header Allow gives the right ones).
409name-taken flow-has-verifications — another flow has this name, or the flow has verifications and cannot be deleted.
422invalid-name invalid-flow invalid-status — a field is wrong: see errors.
429rate-limited — more than 600 requests in an hour with this key: wait, then try again.

WordPress and WooCommerce

The kyc2s plugin for WordPress uses this API: in Settings > kyc2s, paste an API key. It connects to your account, keeps your flows in sync and adds the age gate, the verification at registration and before the WooCommerce checkout.

Statuses

approvedevery module passed.
rejectedat least one module failed (after its tries).
reviewa module is not sure (e.g. an age close to the limit): look at it before you decide.
expirednot finished within 30 minutes.

Modules and settings

Each flow chooses its modules and their settings in Flows > Modules.

livenessLiveness — Minimum score (0.5 to 0.99, default 0.8).
ageAge — Minimum age (13 to 25) and review margin. With the ID document module, the date of birth of the document decides.
documentID document — Refuse expired documents (yes by default), photos of a screen (0 ignore, 1 review by default, 2 refuse). Passports, ID cards (TD1, TD2, TD3) and French ID cards before 2021.
faceFace match — Minimum similarity between the selfie and the photo of the document.
amlSanctions screening — No capture: the name and date of birth read by the ID document module (place it before) are screened against the OFAC, UN, UK and French (with EU measures) sanctions lists, updated every day. Name score for a review (85) and to refuse (92, date of birth not different).
addressProof of address — Photo of a utility bill or bank statement: its most recent date (90 days at most by default), the name of the ID document found in it (score 80), the address lines. The webhook gets the date, the score and the address.