Documentation
Everything you need to add kyc2s to your site.
Quick start
- Create your account: your first flow is ready, with every module.
- In Flows, choose the modules of the flow (Modules) and your webhook URL (URLs).
- Open Integrate: copy the script of the flow and its secret.
- 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:
ref | Your id of the person (letters, digits and _ . : @ -, up to 190 characters). It comes back in the token and the webhook. |
lang | Language 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. |
onResult | Called with the signed token and the status when the verification ends. |
onClose | Called when the person closes the window. WLVerify.close() closes it from your page. |
container | Optional: 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. |
flow | Optional: 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.
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.
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.
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
- Create a key in your client area, page API keys.
- Copy it at once: it is shown only once (kyc2s keeps only its SHA-256).
- Send it in the header Authorization: Bearer followed by the key, or in the header X-Kyc2s-Key when your host drops Authorization.
- A key makes up to 600 requests an hour. To revoke it: API keys > Edit > Disabled, it stops at once.
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/? | The 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/? | 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.
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).
400 | invalid-json — the body is not JSON. |
401 | unauthorized — no key, or a wrong or revoked key. |
404 | flow-not-found verification-not-found — this flow or this verification is not one of yours. |
405 | method-not-allowed — method not allowed on this address (the header Allow gives the right ones). |
409 | name-taken flow-has-verifications — another flow has this name, or the flow has verifications and cannot be deleted. |
422 | invalid-name invalid-flow invalid-status — a field is wrong: see errors. |
429 | rate-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
approved | every module passed. |
rejected | at least one module failed (after its tries). |
review | a module is not sure (e.g. an age close to the limit): look at it before you decide. |
expired | not finished within 30 minutes. |
Modules and settings
Each flow chooses its modules and their settings in Flows > Modules.
liveness | Liveness — Minimum score (0.5 to 0.99, default 0.8). |
age | Age — Minimum age (13 to 25) and review margin. With the ID document module, the date of birth of the document decides. |
document | ID 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. |
face | Face match — Minimum similarity between the selfie and the photo of the document. |
aml | Sanctions 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). |
address | Proof 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. |