
Verify real people with ZabVerify
Create a verification link for your user with your server address and key, or add an SDK, and get the result on your server. ZabVerify is in beta.
Verification link Quick start How it works Supported countries API reference Product details
Verify real people, in any app.
ZabVerify checks that a live person is in front of the camera and, when you ask for it, reads their identity documents and matches the face on them. Your server creates a verification link with its key, or you add an SDK. The person opens the link, or scans it as a QR code, and follows the steps.
A link in, a result out
Send the person a verification link, or show it as a QR code. Their device does the camera work. You get a signed result token.
Documents for every country
Passports of every country and the ID cards, licences and permits of the others, read and matched to a live face.
You confirm, not the browser
A result is only a claim until your server confirms it with the secret key.
Pick your platform
Apps and browsers access key
These show the link or the QR code and follow the check. They use the access key (zapk_…) and never the secret key.
A script tag, a key, one call. Draws the QR and the green tick or red cross.
A provider, two hooks and a ready-made component, on top of the Web SDK.
A widget for Android, iOS, web and desktop, and a plain-Dart core. No third-party packages.
Coroutines and Flow. A Compose sample app is included.
Swift concurrency and a SwiftUI view. Swift Package Manager.
One client for servers (secret key) and apps (access key). IAsyncEnumerable events and DI support.
Servers secret key
These confirm results, read document records, manage PINs and erase data. They use the secret key (zask_…).
Confirm results, read documents, manage PINs. Zero dependencies, typed.
Dataclasses, type hints, standard library only.
PPHPTyped, readonly classes. Uses curl when present and streams otherwise.
GoGoContext-aware, concurrency-safe, standard library only.
JJavajava.net.http, no dependencies, a small JSON reader included.
The whole flow in one picture
Steps 1 to 4 are what an app or browser SDK does for you. Steps 5 and 6 are yours: send the result token to your server and confirm it. The server SDKs make step 6 one call.
What is in the box
| Piece | What it is |
|---|---|
| 11 SDKs | Web, React, Flutter, Android, iOS, .NET, Node.js, Python, PHP, Go, Java. |
| 11 example apps | Each SDK ships a complete example that you can run in a minute. |
| REST API | Every SDK is a thin client of the same HTTP API, documented in the API reference. |
| Smoke tests | Several SDKs are tested against a real ZabVerify server; platform status says exactly which. |
Verification link
You do not need to show a QR code, and you do not need an SDK. Your server calls the API with its address and secret key, ZabVerify answers with a verification link for that one person, and you send it the way you like.
- Create. Your server asks for a check and gives your own details about the person.
- Send. Send the link (
qr_urlin the answer) by SMS, email or chat, or redirect the person to it. - Wait. Your server waits for the person to finish.
- Confirm and store. Confirm the result token, then save the result on your server.
Create the link with one request
curl -X POST https://YOUR-ZABVERIFY-HOST/v1/face/sessions \
-H "Authorization: Bearer zask_..." \
-H "Content-Type: application/json" \
-d '{"purpose":"liveness","user_id":"user-42","note":"order 1234"}'{
"session_id": "c002…",
"poll_token": "…",
"purpose": "liveness",
"status": "pending",
"qr_url": "https://YOUR-ZABVERIFY-HOST/v/…",
"qr_image": "data:image/png;base64,…",
"expires_at": "2026-11-20T19:32:22Z",
"expires_in": 120,
"max_attempts": 3,
"note": "order 1234"
}What you can send
| Field | What it is for |
|---|---|
purpose | liveness (default), kyc, verify, enroll, fingerprint or fingerprint_enroll. |
user_id | Your own ID for the person. Needed for verify and enroll. |
note | A reference of your own, up to 200 characters. It is shown to you and never to the person. |
identifier | A document type and number to check against the person's face. |
Get the result on your server
const s = await za.createSession({ purpose: 'liveness', userId: 'user-42', note: 'order 1234' });
await sendToUser(s.qrUrl); // your own SMS, email or chat
const done = await za.waitForResult(s); // waits until the person finishes
const r = await za.verifyResult(done.resultToken); // confirm it
await saveResult(r); // store it in your databaseThe Python, PHP, Go, Java and .NET SDKs have the same wait call. Without an SDK, ask GET /v1/face/sessions/{session_id}?wait=20&rev=N with the secret key until the status is approved, rejected, expired or cancelled. An approved answer has a result_token: confirm it with POST /v1/face/results/verify. See the REST API.
A link works once, for the first device that opens it, and only for a short time (expires_in). The usual time is two minutes. You can set it longer for a key or an account in the console, up to the service maximum, so create the link when the person is ready for it.
Cloud service, storage and security
ZabVerify is a cloud service run by ZabSys. There is nothing to install: you receive your service address and keys, call the REST API or an SDK, and we run the servers.
A hosted service, run and watched by ZabSys.
Pictures, document data and face templates are stored encrypted.
Read them and delete them with your secret key or in your console.
What we store, and how it is protected
| Data | How it is protected | How long it is kept |
|---|---|---|
| Pictures of each attempt | Encrypted with AES-256-GCM | Until you delete them, or the service's retention period ends |
| Document photos and the data read from them | Encrypted with AES-256-GCM | Until you delete the record |
| Face templates of registered users | Encrypted with AES-256-GCM | Until you erase them |
| Document numbers | Stored as a keyed hash; only the last four characters are shown | Until the person's record is erased |
| Document API answers | Encrypted. The pictures sent to the Document API are not stored | 30 days by default |
Who can open it
Your account, through your console or your server with the secret key, and the ZabVerify platform administrator. No other customer can. A copy of the database alone cannot be read without the service's encryption keys.
Read and delete your records by REST API
A document verification is saved as a record on our servers. Your server reads it, downloads its pictures or erases it with the secret key.
curl https://YOUR-ZABVERIFY-HOST/v1/kyc/records \
-H "Authorization: Bearer zask_..."| Call | What it does |
|---|---|
GET /v1/kyc/records | List document verification records, newest first, or those of one person with ?pin= |
GET /v1/kyc/records/{id} | The result and everything that was read from the document |
GET /v1/kyc/records/{id}/image/{side} | A stored picture of the document |
DELETE /v1/kyc/records/{id} | Erase one record |
GET /v1/pins/{pin} | One person: times verified and linked documents |
DELETE /v1/pins/{pin} | Forget a person: face data and every linked number |
DELETE /v1/face/templates/{user_id} | Erase one user's face template and logged pictures |
See the REST API for the request and answer of every call.
Security checks
- Every call and page uses HTTPS.
- The secret key is shown once and stored only as a hash. A secret key sent from a browser is refused.
- Access keys can be limited to your own websites and apps, and revoked at once.
- A verification link works once and expires. A result token is signed and expires after five minutes.
- Requests are limited for each key, and checks for each account.
- Uploaded pictures are checked and rebuilt before they are read.
- Automated security tests cover how uploads are handled and that one account cannot see another's records.
Face pictures and identity documents are sensitive or biometric data in many countries. Tell your users what you collect, get their consent where the law asks for it, and delete what you no longer need.
Supported countries and documents
The documents ZabVerify can be sent today, country by country.
Listed below by region.
Read from the machine readable lines, with their check digits.
National ID cards, driving licences, residence permits and more.
No country or document matches your search.
Asia 50Europe 46Africa 54North America 23South America 12Oceania 14
Asia
| Country | Passport ID | Other documents |
|---|---|---|
| Afghanistan AF | af_passport | Tazkira (national ID) Driving licence |
| Armenia AM | am_passport | Residence card ID card Driving licence |
| Azerbaijan AZ | az_passport | Temporary residence card ID card Driving licence |
| Bahrain BH | bh_passport | Residence permit CPR smart card Driving licence |
| Bangladesh BD | bd_passport | Work permit / residence visa National ID card Driving licence |
| Bhutan BT | bt_passport | Work permit Citizenship ID card (CID) Driving licence |
| Brunei BN | bn_passport | Residence pass Identity card (IC) Driving licence |
| Cambodia KH | kh_passport | Work permit / extended visa Cambodian identity card Driving licence |
| China CN | cn_passport | Foreigner permanent residence ID card Mainland travel permit (Hong Kong, Macao, Taiwan residents) Resident Identity Card Driving licence |
| Georgia GE | ge_passport | Residence permit card ID card Driving licence |
| Hong Kong HK | hk_passport | Visa / entry permit HKID card (Hong Kong identity card) Driving licence |
| India IN | in_passport | Aadhaar card Driving licence PAN card Voter ID card (EPIC) |
| Indonesia ID | id_passport | KITAS / KITAP (residence permit) KTP (e-KTP identity card) SIM (driving licence) |
| Iran IR | ir_passport | Amayesh card (foreign nationals) National card (Kart-e Melli) Driving licence |
| Iraq IQ | iq_passport | Civil status ID Residence permit Unified national ID card Driving licence |
| Israel IL | il_passport | Residence permit (A/5 visa) Teudat Zehut (ID card) Driving licence |
| Japan JP | jp_passport | Residence card (zairyu card) Special permanent resident certificate My Number card Driving licence |
| Jordan JO | jo_passport | Residence permit National ID card Driving licence |
| Kazakhstan KZ | kz_passport | Residence permit (VNZh) Identity card Driving licence |
| Kuwait KW | kw_passport | Residency (Article 18 / 20) Civil ID Driving licence |
| Kyrgyzstan KG | kg_passport | Residence permit ID card Driving licence |
| Laos LA | la_passport | Work permit Lao ID card Driving licence |
| Lebanon LB | lb_passport | Residence permit Lebanese ID card Driving licence |
| Macau MO | mo_passport | Non-resident worker card Macao resident identity card (BIR) Driving licence |
| Malaysia MY | my_passport | MyPR (permanent resident card) i-Kad (foreign worker card) Employment pass / residence pass MyKad Driving licence |
| Maldives MV | mv_passport | Work permit National ID card Driving licence |
| Mongolia MN | mn_passport | Foreigner residence card Mongolian ID card Driving licence |
| Myanmar MM | mm_passport | Citizenship Scrutiny Card Foreigner registration card National Registration Card (NRC) Driving licence |
| Nepal NP | np_passport | Citizenship certificate National ID card Driving licence Voter ID card |
| North Korea KP | kp_passport | Citizen ID card |
| Oman OM | om_passport | Residence card Resident / civil ID card Driving licence |
| Pakistan PK | pk_passport | NICOP (overseas Pakistani card) POR card (Proof of Registration) CNIC (computerised national ID) Driving licence |
| Palestine PS | ps_passport | Palestinian ID card Driving licence |
| Philippines PH | ph_passport | UMID card PRC professional ID Postal ID ACR I-Card (alien registration) PhilSys National ID Driver's licence Voter's ID |
| Qatar QA | qa_passport | Residence permit Qatar ID (QID) Driving licence |
| Saudi Arabia SA | sa_passport | Iqama (resident ID) National ID card Driving licence |
| Singapore SG | sg_passport | FIN card (Employment Pass / S Pass / Dependant's Pass) Permanent resident re-entry permit NRIC (identity card) Driving licence |
| South Korea KR | kr_passport | Alien registration card / residence card Resident registration card (mobile ID) Driving licence |
| Sri Lanka LK | lk_passport | Residence visa National Identity Card (NIC) Driving licence |
| Syria SY | sy_passport | Residence permit Civil ID card Driving licence |
| Taiwan TW | tw_passport | Alien Resident Certificate (ARC) National ID card Driving licence |
| Tajikistan TJ | tj_passport | Residence permit Internal passport / ID card Driving licence |
| Thailand TH | th_passport | Pink ID card (foreign residents) Work permit Thai national ID card Driving licence |
| Timor-Leste TL | tl_passport | Residence card Bilhete de Identidade (ID card) Driving licence Voter card |
| Turkey TR | tr_passport | Residence permit (ikamet) T.C. Kimlik Karti (identity card) Driving licence |
| Turkmenistan TM | tm_passport | Residence permit Internal passport / ID card Driving licence |
| United Arab Emirates AE | ae_passport | Residence visa Emirates ID Driving licence |
| Uzbekistan UZ | uz_passport | Residence permit ID card (biometric) Driving licence |
| Vietnam VN | vn_passport | Temporary residence card Citizen identity card (CCCD) Driving licence |
| Yemen YE | ye_passport | National ID card Driving licence |
Europe
| Country | Passport ID | Other documents |
|---|---|---|
| Albania AL | al_passport | Residence permit National ID card Driving licence |
| Andorra AD | ad_passport | Residence permit National ID card Driving licence |
| Austria AT | at_passport | Aufenthaltstitel Personalausweis Fuhrerschein |
| Belarus BY | by_passport | Residence permit National ID card Driving licence |
| Belgium BE | be_passport | Residence card for foreigners (A-F card) eID (identiteitskaart) Driving licence |
| Bosnia and Herzegovina BA | ba_passport | Residence permit National ID card Driving licence |
| Bulgaria BG | bg_passport | Residence permit National ID card Driving licence |
| Croatia HR | hr_passport | Residence permit National ID card Driving licence |
| Cyprus CY | cy_passport | Residence permit National ID card Driving licence |
| Czechia CZ | cz_passport | Residence permit Obcansky prukaz Ridicsky prukaz |
| Denmark DK | dk_passport | Residence card Driving licence |
| Estonia EE | ee_passport | Residence permit National ID card Driving licence |
| Finland FI | fi_passport | Residence permit card Identity card Driving licence |
| France FR | fr_passport | Titre de sejour Carte nationale d'identite Permis de conduire |
| Germany DE | de_passport | Aufenthaltstitel (eAT) Personalausweis Fuhrerschein |
| Greece GR | gr_passport | Residence permit Police identity card Driving licence |
| Hungary HU | hu_passport | Residence permit Szemelyi igazolvany Driving licence |
| Iceland IS | is_passport | Residence permit National ID card Driving licence |
| Ireland IE | ie_passport | IRP card (Irish Residence Permit) Passport card Public Services Card Garda age card Driving licence |
| Italy IT | it_passport | Permesso di soggiorno Carta d'identita elettronica (CIE) Patente di guida |
| Kosovo XK | xk_passport | Residence permit National ID card Driving licence |
| Latvia LV | lv_passport | Residence permit National ID card Driving licence |
| Liechtenstein LI | li_passport | Residence permit National ID card Driving licence |
| Lithuania LT | lt_passport | Residence permit National ID card Driving licence |
| Luxembourg LU | lu_passport | Residence permit Identity card Driving licence |
| Malta MT | mt_passport | Residence permit National ID card Driving licence |
| Moldova MD | md_passport | Residence permit National ID card Driving licence |
| Monaco MC | mc_passport | Residence permit National ID card Driving licence |
| Montenegro ME | me_passport | Residence permit National ID card Driving licence |
| Netherlands NL | nl_passport | Verblijfsvergunning Identiteitskaart Rijbewijs |
| North Macedonia MK | mk_passport | Residence permit National ID card Driving licence |
| Norway NO | no_passport | Residence card National ID card Driving licence |
| Poland PL | pl_passport | Karta pobytu Dowod osobisty Prawo jazdy |
| Portugal PT | pt_passport | Autorizacao de residencia Cartao de Cidadao Carta de conducao |
| Romania RO | ro_passport | Residence permit Carte de identitate Driving licence |
| Russia RU | ru_passport | Residence permit (VNZh) Internal passport Driving licence |
| San Marino SM | sm_passport | Residence permit National ID card Driving licence |
| Serbia RS | rs_passport | Residence permit National ID card Driving licence |
| Slovakia SK | sk_passport | Residence permit National ID card Driving licence |
| Slovenia SI | si_passport | Residence permit National ID card Driving licence |
| Spain ES | es_passport | TIE (foreigner identity card) DNI Permiso de conducir |
| Sweden SE | se_passport | Residence permit card National ID card Driving licence |
| Switzerland CH | ch_passport | Foreign national ID (permit B / C / L) Identity card Driving licence |
| Ukraine UA | ua_passport | Temporary residence permit ID card / internal passport Driving licence |
| United Kingdom GB | gb_passport | Biometric residence permit / eVisa PASS proof-of-age card Photocard driving licence |
| Vatican City VA | va_passport | Residence permit National ID card Driving licence |
Africa
| Country | Passport ID | Other documents |
|---|---|---|
| Algeria DZ | dz_passport | Residence card Biometric national ID card Driving licence |
| Angola AO | ao_passport | Residence permit National ID card Driving licence |
| Benin BJ | bj_passport | Residence permit National ID card Driving licence |
| Botswana BW | bw_passport | Residence permit National ID card Driving licence |
| Burkina Faso BF | bf_passport | Residence permit National ID card Driving licence |
| Burundi BI | bi_passport | Residence permit National ID card Driving licence |
| Cabo Verde CV | cv_passport | Residence permit National ID card Driving licence |
| Cameroon CM | cm_passport | Residence permit National ID card Driving licence |
| Central African Republic CF | cf_passport | Residence permit National ID card Driving licence |
| Chad TD | td_passport | Residence permit National ID card Driving licence |
| Comoros KM | km_passport | Residence permit National ID card Driving licence |
| Cote d'Ivoire CI | ci_passport | Residence permit National ID card Driving licence |
| Djibouti DJ | dj_passport | Residence permit National ID card Driving licence |
| DR Congo CD | cd_passport | Residence permit National ID card Driving licence |
| Egypt EG | eg_passport | Residence permit National ID card Driving licence |
| Equatorial Guinea GQ | gq_passport | Residence permit National ID card Driving licence |
| Eritrea ER | er_passport | Residence permit National ID card Driving licence |
| Eswatini SZ | sz_passport | Residence permit National ID card Driving licence |
| Ethiopia ET | et_passport | Residence permit Fayda national ID / Kebele ID Driving licence |
| Gabon GA | ga_passport | Residence permit National ID card Driving licence |
| Gambia GM | gm_passport | Residence permit National ID card Driving licence |
| Ghana GH | gh_passport | Residence permit Ghana Card Driving licence Voter ID card |
| Guinea GN | gn_passport | Residence permit National ID card Driving licence |
| Guinea-Bissau GW | gw_passport | Residence permit National ID card Driving licence |
| Kenya KE | ke_passport | Alien card National ID card Driving licence |
| Lesotho LS | ls_passport | Residence permit National ID card Driving licence |
| Liberia LR | lr_passport | Residence permit National ID card Driving licence |
| Libya LY | ly_passport | Residence permit National ID card Driving licence |
| Madagascar MG | mg_passport | Residence permit National ID card Driving licence |
| Malawi MW | mw_passport | Residence permit National ID card Driving licence |
| Mali ML | ml_passport | Residence permit National ID card Driving licence |
| Mauritania MR | mr_passport | Residence permit National ID card Driving licence |
| Mauritius MU | mu_passport | Residence permit National ID card Driving licence |
| Morocco MA | ma_passport | Carte de sejour CNIE Driving licence |
| Mozambique MZ | mz_passport | Residence permit National ID card Driving licence |
| Namibia NA | na_passport | Residence permit National ID card Driving licence |
| Niger NE | ne_passport | Residence permit National ID card Driving licence |
| Nigeria NG | ng_passport | ECOWAS residence card National ID (NIN) card Driving licence Permanent Voter's Card (PVC) |
| Republic of the Congo CG | cg_passport | Residence permit National ID card Driving licence |
| Rwanda RW | rw_passport | Residence permit National ID card Driving licence |
| Sao Tome and Principe ST | st_passport | Residence permit National ID card Driving licence |
| Senegal SN | sn_passport | Residence permit National ID card Driving licence |
| Seychelles SC | sc_passport | Residence permit National ID card Driving licence |
| Sierra Leone SL | sl_passport | Residence permit National ID card Driving licence |
| Somalia SO | so_passport | Residence permit National ID card Driving licence |
| South Africa ZA | za_passport | Permanent residence permit Smart ID card Driving licence |
| South Sudan SS | ss_passport | Residence permit National ID card Driving licence |
| Sudan SD | sd_passport | Residence permit National ID card Driving licence |
| Tanzania TZ | tz_passport | Residence permit NIDA national ID Driving licence |
| Togo TG | tg_passport | Residence permit National ID card Driving licence |
| Tunisia TN | tn_passport | Carte de sejour CIN (national identity card) Driving licence |
| Uganda UG | ug_passport | Residence permit National ID (NIN) card Driving licence |
| Zambia ZM | zm_passport | Residence permit National ID card Driving licence |
| Zimbabwe ZW | zw_passport | Residence permit National ID card Driving licence |
North America
| Country | Passport ID | Other documents |
|---|---|---|
| Antigua and Barbuda AG | ag_passport | Residence permit National ID card Driving licence |
| Bahamas BS | bs_passport | Residence permit National ID card Driving licence |
| Barbados BB | bb_passport | Residence permit National ID card Driving licence |
| Belize BZ | bz_passport | Residence permit National ID card Driving licence |
| Canada CA | ca_passport | Permanent resident card Provincial photo ID card Provincial driver's licence |
| Costa Rica CR | cr_passport | Residence permit National ID card Driving licence |
| Cuba CU | cu_passport | Residence permit National ID card Driving licence |
| Dominica DM | dm_passport | Residence permit National ID card Driving licence |
| Dominican Republic DO | do_passport | Residence permit National ID card Driving licence |
| El Salvador SV | sv_passport | Residence permit National ID card Driving licence |
| Grenada GD | gd_passport | Residence permit National ID card Driving licence |
| Guatemala GT | gt_passport | Residence permit National ID card Driving licence |
| Haiti HT | ht_passport | Residence permit National ID card Driving licence |
| Honduras HN | hn_passport | Residence permit National ID card Driving licence |
| Jamaica JM | jm_passport | Residence permit National ID card Driving licence |
| Mexico MX | mx_passport | Tarjeta de residente Licencia de conducir INE credencial para votar |
| Nicaragua NI | ni_passport | Residence permit National ID card Driving licence |
| Panama PA | pa_passport | Residence permit National ID card Driving licence |
| Saint Kitts and Nevis KN | kn_passport | Residence permit National ID card Driving licence |
| Saint Lucia LC | lc_passport | Residence permit National ID card Driving licence |
| Saint Vincent and the Grenadines VC | vc_passport | Residence permit National ID card Driving licence |
| Trinidad and Tobago TT | tt_passport | Residence permit National ID card Driving licence |
| United States US | us_passport | State identification card Permanent resident card (Green card) Employment authorization card (EAD) U.S. passport card State driver's licence |
South America
| Country | Passport ID | Other documents |
|---|---|---|
| Argentina AR | ar_passport | DNI for foreigners DNI Licencia de conducir |
| Bolivia BO | bo_passport | Residence permit National ID card Driving licence |
| Brazil BR | br_passport | CRNM (migrant registration) Registro Geral (RG / CIN) CNH |
| Chile CL | cl_passport | Cedula for foreigners Cedula de identidad Licencia de conducir |
| Colombia CO | co_passport | Cedula de extranjeria PPT (temporary protection permit) Cedula de ciudadania Licencia de conduccion |
| Ecuador EC | ec_passport | Cedula for foreigners Cedula de identidad Licencia de conducir |
| Guyana GY | gy_passport | Residence permit National ID card Driving licence |
| Paraguay PY | py_passport | Residence permit National ID card Driving licence |
| Peru PE | pe_passport | Carne de extranjeria DNI Licencia de conducir |
| Suriname SR | sr_passport | Residence permit National ID card Driving licence |
| Uruguay UY | uy_passport | Residence card Cedula de identidad Libreta de conducir |
| Venezuela VE | ve_passport | Cedula de identidad Licencia de conducir |
Oceania
| Country | Passport ID | Other documents |
|---|---|---|
| Australia AU | au_passport | State photo card Visa (VEVO) / ImmiCard State driver's licence |
| Fiji FJ | fj_passport | Residence permit National ID card Driving licence |
| Kiribati KI | ki_passport | Residence permit National ID card Driving licence |
| Marshall Islands MH | mh_passport | Residence permit National ID card Driving licence |
| Micronesia FM | fm_passport | Residence permit National ID card Driving licence |
| Nauru NR | nr_passport | Residence permit National ID card Driving licence |
| New Zealand NZ | nz_passport | 18+ card (Kiwi Access) Resident visa Driver licence |
| Palau PW | pw_passport | Residence permit National ID card Driving licence |
| Papua New Guinea PG | pg_passport | Residence permit National ID card Driving licence |
| Samoa WS | ws_passport | Residence permit National ID card Driving licence |
| Solomon Islands SB | sb_passport | Residence permit National ID card Driving licence |
| Tonga TO | to_passport | Residence permit National ID card Driving licence |
| Tuvalu TV | tv_passport | Residence permit National ID card Driving licence |
| Vanuatu VU | vu_passport | Residence permit National ID card Driving licence |
A listed document can be read; how well depends on the document and the picture. Some countries have their own card reader and the others use a general reader guided by the printed labels. Test with your own samples, and let the person confirm what was read. Reading a document does not prove it is genuine.
Send the ID shown here as document_type. Rest the pointer on a card to see its ID, or ask the service for the full list: GET /v1/documents/types?country=JP.
Flag artwork: Twemoji © Twitter / X Corp, CC BY 4.0.
Quick start
From nothing to a verified person: create keys, give the person a link or a QR code, confirm the result. To only send a link from your server, see Verification link.
1. Create your keys
- Sign in to your ZabVerify customer console (your service address,
/console/). - Open Access keys and create a key. You get a pair: the access key
zapk_…(public) and the secret keyzask_…(shown once). - Put the websites that will show the QR in allowed websites, for example
https://shop.example.com. For an app addapp://com.example.app. An empty list accepts any caller (fine for testing). - Check that the customer has the services you need switched on (human check, documents).
Two keys, two places. The access key goes into your web page or app. The secret key stays on your server. The SDKs and the server both refuse a secret key used from a browser.
2. Show a QR code with an SDK
Pick the SDK of your front end. Everything else on this page is the same for all of them.
<div id="qr"></div>
<script>var ZABVERIFY_ACCESS_KEY = "zapk_...";</script>
<script src="https://YOUR-ZABVERIFY-HOST/sdk/zabverify.js"></script>
<script>
ZabVerify.verifyFace({
container: "#qr",
onSuccess: (r) => fetch("/api/confirm", { method: "POST", body: JSON.stringify({ resultToken: r.resultToken }) }),
onFailed: (e) => console.log(e.code),
});
</script><ZabVerifyProvider accessKey="zapk_..." baseUrl="https://auth.example.com">
<ZabVerifyView onSuccess={(r) => confirmOnMyServer(r.resultToken)} />
</ZabVerifyProvider>ZabVerifyView(
client: ZabVerifyClient(baseUrl: 'https://auth.example.com', accessKey: 'zapk_...', appId: 'com.example.app'),
onSuccess: (r) => confirmOnMyServer(r.resultToken),
)za.verify().collect { e ->
if (e is VerificationEvent.Success) confirmOnMyServer(e.result.resultToken)
}ZabVerifyView(client: za) { result in confirmOnMyServer(result.resultToken) } onFailed: { _ in }await foreach (var e in client.StartVerification())
if (e is VerificationEvent.Success s) await ConfirmOnMyServer(s.Result.ResultToken);The person scans the QR with their phone camera and follows the spoken and written instructions. Your page shows progress and then a green tick or a red cross.
3. Confirm on your server
The browser or app can be tampered with, so the result token it receives is only a claim. Your server asks ZabVerify whether the token is real:
const r = await za.verifyResult(req.body.resultToken); // throws 'invalid_result' if it is not real
if (r.valid) grantAccess(r.pin);r = za.verify_result(token) # raises ZabVerifyError('invalid_result') if it is not real
grant_access(r.pin)$r = $za->verifyResult($token); // throws 'invalid_result' if it is not real
grantAccess($r->pin);res, err := za.VerifyResult(ctx, token)
if err != nil { /* invalid_result: reject */ }
grantAccess(res.PIN)ZabVerify.VerifiedResult r = za.verifyResult(token); // throws 'invalid_result' if it is not real
grantAccess(r.pin);var r = await za.VerifyResultAsync(body.ResultToken); // throws 'invalid_result' if it is not real
GrantAccess(r.Pin);curl -X POST https://YOUR-ZABVERIFY-HOST/v1/face/results/verify \
-H "Authorization: Bearer zask_..." -H "Content-Type: application/json" \
-d '{"result_token":"<token>"}'A valid token is signed, is valid for five minutes, and is bound to the customer that earned it. pin is the permanent ID of that person in your account: the same face always comes back with the same PIN.
4. Go further
| I want to... | Do this |
|---|---|
| Check documents too | Start the check with purpose: 'kyc' (or verifyDocument in the Web SDK) and choose the document types for the key in the console. The result token then comes with a kyc summary, and GET /v1/kyc/records/{id} returns everything that was read. |
| Match the same person later | Enrol from your server (purpose: 'enroll' with the secret key), then use verify. See purposes. |
| Link a document number to a person | pins.link(pin, 'nid', number) and pins.lookup('nid', number). See PINs. |
| Erase a person's data | faces.deleteTemplate(userId) or pins.delete(pin). See Security and privacy. |
How ZabVerify works
The model in one page: sessions, the two keys, purposes, result tokens, PINs and documents.
A verification is a session
- Create. Your page, app or server creates a session. ZabVerify answers with
session_id, apoll_token, the verification link (qr_url) and the same link drawn as a QR code (a PNG data URL). - Share. You send the link or show the QR code. Your server or the SDK long polls the session (
GET …?wait=20&rev=N), which returns the moment something changes. - Open. The person opens the link or scans the QR code. The first device to open it is bound to the session; a second phone gets
409 already_claimed. The phone page asks for the camera and gives random instructions. - Decide. ZabVerify checks the pictures (a face, a live person, optionally a document). A failed attempt with tries left is a retry with fresh instructions; the last failure rejects the session.
- Result. The status becomes
approvedwith aresult_token, orrejected,expiredorcancelled.
Sessions expire after about two minutes (expires_in), allow a few attempts (max_attempts, default 3) and can be cancelled at any time.
The two keys
| Access key | Secret key | |
|---|---|---|
| Looks like | zapk_… | zask_… |
| Goes in | your web page or app | your server only |
| Sent as | X-Access-Key header | Authorization: Bearer header |
| Can | start human and document checks, poll and cancel its own sessions | everything: confirm results, enrol, read documents, manage PINs, erase data |
| Locked to | the key's allowed websites (Origin) | never usable with an Origin header |
Purposes
| Purpose | What the phone does | Who may start it |
|---|---|---|
liveness (default) | A human check: a real, live person, no enrolment, nothing compared with anyone. | access or secret key |
kyc | Photographs the document (front and back), the person confirms what was read, then a live face check compares the face with the photo on the document. | access or secret key |
enroll | Stores the person's face under your user_id. | secret key only |
verify | A live check that must also match the face enrolled for user_id. | access or secret key |
Result tokens: never trust the browser
When a check passes, the page or app receives a resultToken. It is signed, valid for five minutes and bound to your account, but it travelled through a device you do not control. Your server must call POST /v1/face/results/verify with the secret key. Only a 200 {"valid": true} means the person is verified. What the browser never learns: whether a user is enrolled (shown as no_match) and the match score.
PINs: one number per person
The first time a face passes a live check in your account it gets a PIN such as PIN-4821-9376-5502. The same face always comes back with the same PIN (returning_pin: true). Document numbers are linked to the PIN, so you can ask "who owns this passport number?" (pins.lookup) or detect that a number already belongs to a different face. Numbers are stored as keyed hashes plus their last four characters, never in clear.
Documents
With purpose: kyc the phone asks for the documents you chose for the key in the console: the passport of any country, and the ID cards, licences and permits that have a reader. The extracted data comes back as one normalised JSON shape (zabverify.document.v1) for every document and country via GET /v1/kyc/records/{id}. The person confirms what was read before the verdict, and nothing is checked against a government database.
Document readers differ in maturity. The console's Countries & documents page lists which documents are built. How well one is read depends on the document and the picture, so test with your own samples.
Fingerprint verification
Check that the person touching a fingerprint sensor is the one who registered it, with the sensor of their own phone or laptop. ZabVerify never receives a fingerprint.
What this proves, and what it does not. The device matches the finger and signs a challenge with a key that never leaves it (WebAuthn, also called passkeys). ZabVerify learns: the device registered earlier was unlocked just now. A browser cannot say whether the unlock was a fingerprint, a face or the device PIN, so this is a strong possession-plus-biometric check, not a national fingerprint match. Raw fingerprint templates and USB scanners that need a vendor driver are not supported.
How it works
- Register once from your server: create a session with
purpose: fingerprint_enrolland the user's id, and show its QR (attachFace). The person scans it and touches the sensor. Needs the secret key. - Check later from the page:
ZabVerify.verifyFingerprint({ userId })shows a QR. The phone opens the check and asks for the fingerprint. On a laptop the person clicks the link under the QR and uses Windows Hello, Touch ID or a USB security key with a fingerprint reader. - Confirm on your server with the result token, like every other check.
Documents with a fingerprint step
In the console, Access keys, Edit has a switch: Ask for a fingerprint in every check made with this key. The phone then asks for the fingerprint before the face (after the documents in a document check). The passkey is tied to the person's PIN afterwards, so a later check can use the PIN as userId. A check with the switch on is never approved without it, and a server that cannot hold passkeys (an IP address) answers 409 fingerprint_unavailable_ip_address instead of skipping the step.
API
ZabVerify.verifyFingerprint({ userId: 'user-42', container: '#qr', onSuccess: (r) => confirmOnMyServer(r.resultToken) });const s = await za.createSession({ purpose: 'fingerprint_enroll', userId: 'user-42' }); // show s.qrImage, or pass it to ZabVerify.attachFace
await za.waitForResult(s);
const me = await za.fingerprints.get('user-42'); // { enrolled: true, devices: [...] }
await za.fingerprints.delete('user-42'); // erasecurl -X POST https://YOUR-ZABVERIFY-HOST/v1/face/sessions -H 'Authorization: Bearer zask_...' -H 'Content-Type: application/json' \n -d '{"purpose":"fingerprint_enroll","user_id":"user-42"}'
curl https://YOUR-ZABVERIFY-HOST/v1/fingerprint/users/user-42 -H 'Authorization: Bearer zask_...' # who has a device
curl -X DELETE https://YOUR-ZABVERIFY-HOST/v1/fingerprint/users/user-42 -H 'Authorization: Bearer zask_...'The other server SDKs can start the same sessions by passing the purpose; only the Web and Node.js SDKs have the dedicated helpers so far.
What is tested
Tested: the server verifies registrations and assertions (ES256), refuses a wrong challenge, site, key, missing user verification and a counter that does not go up, and ends a check after the allowed tries. A software authenticator in our tests plays the device. Try it on your own devices.
Web (JavaScript)
A script tag, a key, one call. Draws the QR and the green tick or red cross. App / browser
- Requires
- Any modern browser, or Node 18+ for headless use. No dependencies, no build step.
- Use it for
- an app or a web page that shows the QR and follows the check (access key,
zapk_…)
Install
<div id="qr"></div>
<script>var ZABVERIFY_ACCESS_KEY = "zapk_...";</script>
<script src="https://YOUR-ZABVERIFY-HOST/sdk/zabverify.js"></script>npm install @zabsys/verify-webQuick start
ZabVerify.verifyFace({
container: '#qr', // draws the QR, then a green tick or a red cross
onScanned: () => console.log('the phone opened the QR'),
onRetry: (i) => console.log(i.reason, i.attemptsLeft + ' tries left'),
onSuccess: (r) => {
// r.resultToken is only a claim: send it to YOUR server and confirm it there with the secret key
fetch('/api/confirm', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ resultToken: r.resultToken }) });
},
onFailed: (e) => console.log(e.code, e.reason),
});Never put the secret key in a page. The SDK throws secret_key_in_browser if you try, and the server refuses a secret key sent with an Origin header.
The browser page that shows the QR needs your site listed in the key's allowed websites (or an empty list while testing).
API
| Member | What it does | Type |
|---|---|---|
ZabVerify.verifyFace(options) | Human check: is a real person there? Returns a flow. | FaceFlow |
ZabVerify.verifyDocument(options) | Document check, then the live face against the photo on the document. | FaceFlow |
ZabVerify.verifyIdentity({ userId }) | Also checks it is the same face enrolled earlier for userId. | FaceFlow |
ZabVerify.attachFace(session, options) | Shows the QR of a session your server created with the secret key (enrolment). | FaceFlow |
ZabVerify.configure({ accessKey, baseUrl, fetch }) | Sets the shared key and server once. | ZabVerify |
new ZabVerify({ accessKey, baseUrl }) | A separate client, for several keys or servers. | ZabVerify |
flow.promise | Resolves with the result, rejects with a ZabVerifyError. | Promise |
flow.cancel() | Stops waiting and tells the server, so the QR stops working. | Promise<void> |
flow.destroy() | Removes the widget from the page. | void |
Options
| Option | Meaning |
|---|---|
container | CSS selector or element. Omit it for headless use. |
userId | Your own id for the person (required for verifyIdentity). |
note | Optional reference of your own (order 1234, 200 characters at most). Kept with the check and shown to you in the console and in your server's answers; never shown to the person. |
size | QR size in px, default 220. |
text | Override texts: waiting, scanned, success, failed, expired, tryAgain ... |
retryButton | false hides the Try again button. |
hideLink | true removes the 'open the check here' link, so the ZabVerify address is not in your page (see Keep your server address private). |
onQr / onScanned / onRetry / onSuccess / onFailed / onStatus | Callbacks. onStatus sees every state: creating, waiting, scanned, retry, success, failed, expired, cancelled. |
Events and results
Callbacks and the promise. States: creating → waiting → scanned → (retry)* → success | failed | expired | cancelled.
Errors
ZabVerifyError with code (rejected, expired, cancelled, invalid_key, origin_not_allowed, service_disabled, rate_limited, network, config, secret_key_in_browser) and, when rejected, reason (no_match, liveness_failed, no_face).
See the error reference for every code, what causes it and what to do.
Example app
A page with two tabs (human check and document check), an event log, and a Node server that confirms the token with the secret key. The files below are the real ones from sdk/.
cd sdk/web
ZABVERIFY_URL=https://auth.example.com ZABVERIFY_PK=zapk_... ZABVERIFY_SK=zask_... node examples/server.mjs
# open http://localhost:8000sdk/web/examples/index.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>ZabVerify Web SDK - example</title>
<style>
:root { --ink:#1a2433; --muted:#5b6678; --line:#d9dee7; --brand:#2557d6; --ok:#15803d; --bad:#b91c1c; --bg:#f6f8fb; }
* { box-sizing: border-box; }
body { margin:0; font:16px/1.55 system-ui,-apple-system,Segoe UI,Roboto,sans-serif; color:var(--ink); background:var(--bg); }
main { max-width: 880px; margin: 0 auto; padding: 32px 16px 64px; }
h1 { font-size: 26px; margin: 0 0 4px; } .sub { color: var(--muted); margin: 0 0 24px; }
.grid { display:grid; grid-template-columns: 1fr 1fr; gap: 20px; } @media (max-width: 720px) { .grid { grid-template-columns: 1fr; } }
.card { background:#fff; border:1px solid var(--line); border-radius:14px; padding:20px; }
.tabs { display:flex; gap:8px; margin-bottom:16px; }
.tab { flex:1; padding:10px; border:1px solid var(--line); background:#fff; border-radius:10px; font:inherit; cursor:pointer; color:var(--muted); }
.tab[aria-selected="true"] { border-color:var(--brand); color:var(--brand); background:#eef3ff; font-weight:600; }
button.go { font:inherit; padding:10px 18px; border:0; border-radius:10px; background:var(--brand); color:#fff; cursor:pointer; }
button.go:disabled { opacity:.5; cursor:default; }
#qr { display:flex; justify-content:center; min-height: 270px; align-items:center; }
ol { margin:0; padding-left:20px; color:var(--muted); } li { margin: 6px 0; }
.log { font:12.5px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace; background:#0f172a; color:#d6e0f5; border-radius:10px; padding:12px; max-height:260px; overflow:auto; white-space:pre-wrap; }
.verdict { margin-top:12px; padding:12px 14px; border-radius:10px; display:none; font-weight:600; }
.verdict.ok { display:block; background:#e8f7ee; color:var(--ok); } .verdict.bad { display:block; background:#fdeaea; color:var(--bad); }
code { background:#eef1f6; padding:1px 5px; border-radius:5px; font-size:.92em; }
</style>
</head>
<body>
<main>
<h1>ZabVerify Web SDK</h1>
<p class="sub">A complete example: start a check, scan the QR with your phone, and let <em>your server</em> confirm the result.</p>
<div class="grid">
<section class="card" aria-label="Verification">
<div class="tabs" role="tablist">
<button class="tab" role="tab" aria-selected="true" data-kind="face">Human check</button>
<button class="tab" role="tab" aria-selected="false" data-kind="document">Document check</button>
</div>
<div id="qr" role="status" aria-live="polite"></div>
<p style="text-align:center;margin:12px 0 0"><button class="go" id="go">Start the check</button></p>
<div class="verdict" id="verdict"></div>
</section>
<section class="card" aria-label="What happens">
<h2 style="margin-top:0;font-size:18px">What happens</h2>
<ol>
<li>The SDK asks ZabVerify for a session and draws its QR code.</li>
<li>You scan it; the phone shows the instructions (turn your head, or photograph the document first).</li>
<li>The browser gets a <code>resultToken</code>. <strong>That alone proves nothing</strong>: it can be faked in the page.</li>
<li>The page posts the token to <code>/api/confirm</code>; your server confirms it with the <em>secret</em> key.</li>
</ol>
<h3 style="font-size:15px;margin:18px 0 8px">Event log</h3>
<div class="log" id="log">waiting...</div>
</section>
</div>
</main>
<!-- 1. the PUBLIC access key, once, before the SDK (the server that serves this page fills it in) -->
<script>var ZABVERIFY_ACCESS_KEY = "{{PUBLIC_KEY}}";</script>
<!-- 2. the SDK, served by your ZabVerify server: no build step, no dependencies -->
<script src="{{ZABVERIFY_URL}}/sdk/zabverify.js"></script>
<script>
(function () {
var kind = 'face', flow = null;
var $ = function (id) { return document.getElementById(id); };
function log(line) { var l = $('log'); l.textContent = (l.textContent === 'waiting...' ? '' : l.textContent + '\n') + new Date().toLocaleTimeString() + ' ' + line; l.scrollTop = l.scrollHeight; }
function verdict(ok, text) { var v = $('verdict'); v.className = 'verdict ' + (ok ? 'ok' : 'bad'); v.textContent = text; }
Array.prototype.forEach.call(document.querySelectorAll('.tab'), function (t) {
t.onclick = function () {
kind = t.getAttribute('data-kind');
Array.prototype.forEach.call(document.querySelectorAll('.tab'), function (x) { x.setAttribute('aria-selected', String(x === t)); });
if (flow) { flow.cancel(); flow.destroy(); flow = null; }
$('verdict').className = 'verdict'; $('go').disabled = false;
};
});
$('go').onclick = function () {
$('go').disabled = true; $('verdict').className = 'verdict';
var opts = {
container: '#qr',
onQr: function (q) { log('QR ready (session ' + q.sessionId.slice(0, 8) + '...)'); },
onScanned: function () { log('the phone opened the QR'); },
onRetry: function (i) { log('retry: ' + i.reason + ', ' + i.attemptsLeft + ' tries left'); },
onStatus: function (s) { log('state: ' + s); },
onSuccess: function (r) {
log('browser says: verified. Asking our server to confirm...');
fetch('/api/confirm', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ resultToken: r.resultToken }) })
.then(function (x) { return x.json(); })
.then(function (j) { log('server says: ' + JSON.stringify(j)); verdict(j.verified === true, j.verified ? 'Confirmed by the server' : 'The server did not confirm this result'); })
.catch(function (e) { verdict(false, 'Could not reach the server: ' + e.message); })
.then(function () { $('go').disabled = false; });
},
onFailed: function (e) { log('failed: ' + e.code + (e.reason ? ' / ' + e.reason : '')); verdict(false, 'Not verified: ' + e.code + (e.reason ? ' (' + e.reason + ')' : '')); $('go').disabled = false; }
};
flow = kind === 'document' ? ZabVerify.verifyDocument(opts) : ZabVerify.verifyFace(opts);
};
})();
</script>
</body>
</html>sdk/web/examples/server.mjs
// Serves examples/index.html and confirms results with the Node server SDK.
//
// ZABVERIFY_URL=https://auth.example.com ZABVERIFY_PK=zapk_... ZABVERIFY_SK=zask_... node examples/server.mjs -> http://localhost:8000
//
// Put the page's address (http://localhost:8000) into the key's "allowed websites" in the console, or leave that list empty while testing.
import http from 'node:http';
import { readFileSync } from 'node:fs';
import { createRequire } from 'node:module';
import { dirname, join } from 'node:path';
import { fileURLToPath } from 'node:url';
const here = dirname(fileURLToPath(import.meta.url));
const { ZabVerify, ZabVerifyError } = createRequire(import.meta.url)(join(here, '..', '..', 'node', 'index.js'));
const { ZABVERIFY_URL: base = '', ZABVERIFY_PK: pk = '', ZABVERIFY_SK: sk = '', PORT: port = '8000' } = process.env;
if (!base || !pk || !sk) { console.error('Set ZABVERIFY_URL, ZABVERIFY_PK and ZABVERIFY_SK first.'); process.exit(1); }
const za = new ZabVerify({ baseUrl: base, secretKey: sk });
const page = readFileSync(join(here, 'index.html'), 'utf8').replace('{{PUBLIC_KEY}}', pk).replace('{{ZABVERIFY_URL}}', base.replace(/\/+$/, ''));
http.createServer(async (req, res) => {
const json = (s, b) => { res.writeHead(s, { 'Content-Type': 'application/json' }); res.end(JSON.stringify(b)); };
if (req.method === 'GET' && req.url === '/') { res.writeHead(200, { 'Content-Type': 'text/html; charset=utf-8' }); return res.end(page); }
if (req.method === 'POST' && req.url === '/api/confirm') {
let raw = '';
for await (const c of req) { raw += c; if (raw.length > 8192) return json(413, { error: 'too_large' }); }
try {
const r = await za.verifyResult(JSON.parse(raw || '{}').resultToken);
return json(200, { verified: true, purpose: r.purpose, pin: r.pin, returningPerson: r.returningPin, kyc: r.kyc });
} catch (e) {
if (e instanceof ZabVerifyError) return json(e.code === 'invalid_result' ? 400 : 502, { verified: false, error: e.code, message: e.message });
return json(500, { error: 'server_error' });
}
}
json(404, { error: 'not_found' });
}).listen(Number(port), () => console.log(`Web SDK example on http://localhost:${port}`));Before you go live
- Create an access key and a secret key in the console (Access keys). The secret key is shown once.
- Set the key's allowed websites (and, for an app,
app://your.app.id): an empty list accepts any caller, which is fine for testing and flagged in the console. - Use the service address we give you. It is served over HTTPS, which the camera needs.
- Confirm every result token on your server with the secret key before you trust it.
- Tell people what is stored (pictures are biometric data), and delete what you no longer need.Security and privacy.
React
A provider, two hooks and a ready-made component, on top of the Web SDK. App / browser
- Requires
- React 18+ and
@zabsys/verify-web. No JSX in the package, so no build step for it. - Use it for
- an app or a web page that shows the QR and follows the check (access key,
zapk_…)
Install
npm install @zabsys/verify-react @zabsys/verify-webQuick start
import { ZabVerifyProvider, ZabVerifyView, useVerification } from '@zabsys/verify-react';
export default function App() {
return (
<ZabVerifyProvider accessKey="zapk_..." baseUrl="https://auth.example.com">
{/* 1. the ready-made widget: a button, the QR, then a green tick or a red cross */}
<ZabVerifyView onSuccess={(r) => sendToMyServer(r.resultToken)} onFailed={(e) => console.log(e.code)} />
<Custom />
</ZabVerifyProvider>
);
}
// 2. your own design: the hook gives you the state
function Custom() {
const v = useVerification({ purpose: 'liveness', onSuccess: (r) => sendToMyServer(r.resultToken) });
return (
<div>
<p>{v.phase}</p>
{v.qrImage && <img src={v.qrImage} width={180} height={180} alt="Scan to verify" />}
<button onClick={() => v.start()}>Start</button>
</div>
);
}Front-end code is public. Only the access key (zapk_) belongs here. Confirm every result token on your server.
API
| Member | What it does | Type |
|---|---|---|
<ZabVerifyProvider accessKey baseUrl> | Gives every child the same client. The key must start with zapk_. | component |
<ZabVerifyView purpose userId size texts ...> | The ready-made widget. purpose is 'liveness' or 'kyc'. | component |
useVerification(options) | One check as state: phase, qrImage, qrUrl, attemptsLeft, retryReason, result, error and start(), cancel(), reset(). Cancels on unmount. | hook |
useZabVerify() | The Web SDK client of the nearest provider. | hook |
createVerification(client, options) | The framework-free store behind the hook (use it from any UI code). | function |
Options
| Option | Meaning |
|---|---|
purpose | 'liveness' (default), 'kyc' or 'verify'. |
userId | Your own id for the person. |
note | Optional reference of your own (order 1234, 200 characters at most). Kept with the check and shown to you in the console and in your server's answers; never shown to the person. |
autoStart | Start when the component mounts. |
texts | Override any string (also the way to translate the widget). |
onSuccess / onFailed / onScanned / onRetry | Callbacks. |
Events and results
State: phase is one of idle, creating, waiting, scanned, retry, success, failed, expired, cancelled. The snapshot object is immutable and works with useSyncExternalStore.
Errors
The same ZabVerifyError codes as the Web SDK. A configuration error (a missing key, a secret key) becomes state: phase: 'failed', error.code.
See the error reference for every code, what causes it and what to do.
Example app
A Vite app with the ready-made widget and a hook-based design side by side, confirming the token through your backend. The files below are the real ones from sdk/.
cd sdk/react/examples/vite-app
echo "VITE_ZABVERIFY_URL=https://auth.example.com" > .env
echo "VITE_ZABVERIFY_KEY=zapk_..." >> .env
npm install && npm run dev
# in another terminal: the Node example server that confirms tokens
# cd sdk/node && ZABVERIFY_URL=... ZABVERIFY_SK=zask_... node examples/server.mjssdk/react/examples/vite-app/src/main.jsx
import React from 'react';
import { createRoot } from 'react-dom/client';
import { ZabVerifyProvider } from '@zabsys/verify-react';
import App from './App.jsx';
import './style.css';
// The PUBLIC access key (zapk_...) and the address of your ZabVerify server. Put them in .env:
// VITE_ZABVERIFY_URL=https://auth.example.com
// VITE_ZABVERIFY_KEY=zapk_...
// Never put the secret key (zask_...) in front-end code: the SDK refuses it.
createRoot(document.getElementById('root')).render(
<React.StrictMode>
<ZabVerifyProvider accessKey={import.meta.env.VITE_ZABVERIFY_KEY} baseUrl={import.meta.env.VITE_ZABVERIFY_URL}>
<App />
</ZabVerifyProvider>
</React.StrictMode>
);sdk/react/examples/vite-app/src/App.jsx
import { useState } from 'react';
import { ZabVerifyView, useVerification } from '@zabsys/verify-react';
// Two ways to use the SDK on one page:
// 1. <ZabVerifyView/> the ready-made widget (button, QR, green tick or red cross)
// 2. useVerification() your own design: you get the state and draw everything yourself
async function confirmOnMyServer(resultToken) {
// The browser can be faked, so the token goes to YOUR backend, which confirms it with the secret key (see sdk/node/examples/server.mjs).
const res = await fetch('/api/confirm', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ resultToken }) });
return res.json();
}
function ReadyMade({ onConfirmed }) {
const [kind, setKind] = useState('liveness');
return (
<section className="card">
<h2>Ready-made widget</h2>
<div className="tabs" role="tablist">
{[['liveness', 'Human check'], ['kyc', 'Document check']].map(([k, label]) => (
<button key={k} role="tab" aria-selected={kind === k} onClick={() => setKind(k)}>{label}</button>
))}
</div>
<ZabVerifyView
key={kind}
purpose={kind}
onSuccess={async (r) => onConfirmed(await confirmOnMyServer(r.resultToken))}
onFailed={(e) => onConfirmed({ verified: false, error: e.code, reason: e.reason })}
/>
</section>
);
}
function Custom({ onConfirmed }) {
const v = useVerification({
purpose: 'liveness',
onSuccess: async (r) => onConfirmed(await confirmOnMyServer(r.resultToken)),
onFailed: (e) => onConfirmed({ verified: false, error: e.code, reason: e.reason }),
});
return (
<section className="card">
<h2>Your own design (hook)</h2>
<p className="muted">phase: <code>{v.phase}</code>{v.attemptsLeft != null && <> - tries left: {v.attemptsLeft}</>}</p>
{v.qrImage && v.phase !== 'success' && <img src={v.qrImage} width={180} height={180} alt="Scan to verify" />}
{v.phase === 'success' && <p className="ok">Verified in the browser. Waiting for your server...</p>}
<p>
<button className="go" onClick={() => v.start()} disabled={['creating', 'waiting', 'scanned', 'retry'].includes(v.phase)}>Start</button>{' '}
{['waiting', 'scanned', 'retry'].includes(v.phase) && <button onClick={() => v.cancel()}>Cancel</button>}
</p>
</section>
);
}
export default function App() {
const [answer, setAnswer] = useState(null);
return (
<main>
<h1>ZabVerify for React</h1>
<p className="muted">Scan the QR code with your phone. When the check passes, the token is confirmed by your own server.</p>
<div className="grid">
<ReadyMade onConfirmed={setAnswer} />
<Custom onConfirmed={setAnswer} />
</div>
{answer && <pre className={'answer ' + (answer.verified ? 'ok' : 'bad')}>{JSON.stringify(answer, null, 2)}</pre>}
</main>
);
}sdk/react/examples/vite-app/vite.config.js
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
// /api/confirm is YOUR backend (for example sdk/node/examples/server.mjs, which confirms the token with the secret key).
export default defineConfig({
plugins: [react()],
server: { port: 5173, proxy: { '/api': 'http://localhost:8000' } },
});sdk/react/examples/vite-app/package.json
{
"name": "zabverify-react-example",
"private": true,
"version": "1.0.0",
"type": "module",
"scripts": { "dev": "vite", "build": "vite build", "preview": "vite preview" },
"dependencies": {
"@zabsys/verify-react": "file:../..",
"@zabsys/verify-web": "file:../../../web",
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
"devDependencies": { "@vitejs/plugin-react": "^4.3.1", "vite": "^5.4.0" }
}Before you go live
- Create an access key and a secret key in the console (Access keys). The secret key is shown once.
- Set the key's allowed websites (and, for an app,
app://your.app.id): an empty list accepts any caller, which is fine for testing and flagged in the console. - Use the service address we give you. It is served over HTTPS, which the camera needs.
- Confirm every result token on your server with the secret key before you trust it.
- Tell people what is stored (pictures are biometric data), and delete what you no longer need.Security and privacy.
Flutter and Dart
A widget for Android, iOS, web and desktop, and a plain-Dart core. No third-party packages. App / browser
- Requires
- Flutter 3.10+ / Dart 3. The core (
ZabVerifyClient) also runs in plain Dart. - Use it for
- an app or a web page that shows the QR and follows the check (access key,
zapk_…)
Install
dependencies:
zabverify:
path: ../path/to/sdk/flutter # or your package sourceflutter pub add zabverify --path ../path/to/sdk/flutterQuick start
import 'package:flutter/material.dart';
import 'package:zabverify/zabverify.dart';
final client = ZabVerifyClient(
baseUrl: 'https://auth.example.com',
accessKey: 'zapk_...', // never the zask_ secret key: the SDK refuses it
appId: 'com.example.myapp', // sent as Origin: app://com.example.myapp (add it to the key's allowed websites)
);
class VerifyScreen extends StatelessWidget {
const VerifyScreen({super.key});
@override
Widget build(BuildContext context) => Scaffold(
body: Center(
child: ZabVerifyView(
client: client,
onSuccess: (r) => sendToMyServer(r.resultToken), // confirm it there with the secret key
onFailed: (e) => debugPrint('${e.code} ${e.reason}'),
),
),
);
}
// Without the widget: a stream of events
Future<void> run() async {
final v = client.startVerification();
await for (final e in v.events) {
switch (e) {
case Waiting(:final session): showQr(session.qrPngBytes); // Image.memory(Uint8List.fromList(bytes))
case Success(:final result): sendToMyServer(result.resultToken);
case Failed(:final error): print(error.code);
default: break;
}
}
}Apps have no website address. The SDK sends Origin: app://<appId>. Add that exact value to the key's allowed websites in the console, or leave the list empty while testing.
Flutter web uses the browser's own Origin and a transport built on dart:html that is not covered by the automated tests.
API
| Member | What it does | Type |
|---|---|---|
ZabVerifyClient(baseUrl, accessKey, appId?, origin?, http?) | The client. Refuses a zask_ key. | class |
client.startVerification({purpose, userId, note}) | Starts a check; returns a Verification. note is an optional reference of your own (200 characters), never shown to the person. | Verification |
client.attach(session) | Follows a session your server created with the secret key. | Verification |
verification.events | Stream of events; a late listener first receives what already happened. | Stream<VerificationEvent> |
verification.result | Completes with the result, or with a ZabVerifyException. | Future |
verification.cancel() | Stops waiting and tells the server. | Future<void> |
ZabVerifyView(client, purpose, userId, size, onSuccess, onFailed, texts ...) | The widget: QR, progress, tick or cross, retry button. | widget |
ZabHttp | Replace the HTTP transport (proxies, pinning, tests). | interface |
Options
| Option | Meaning |
|---|---|
purpose | VerificationPurpose.liveness (default), kyc or verify. |
appId / origin | How an app identifies itself (see the note below). |
texts | ZabVerifyTexts(...) overrides every string, which is also how you translate it. |
onOpenLink | Shows an "open the check here" link for a person who is already on their phone; open it with url_launcher. |
Events and results
Creating → Waiting(session) → Scanned → Retry(reason, attemptsLeft)* → Success(result) | Failed(error) as a sealed class, so a switch is checked for completeness.
Errors
ZabVerifyException with code (rejected, expired, cancelled, invalid_key, origin_not_allowed, secret_key_in_app, network, config) and reason.
See the error reference for every code, what causes it and what to do.
Example app
A setup screen (server, access key, app id, your backend), then the widget, and a call to your backend with the result token. The files below are the real ones from sdk/.
cd sdk/flutter/example
flutter create . # once: adds the android/ios/web folders
flutter runsdk/flutter/example/lib/main.dart
// A complete example: a "secure sign-in" screen that asks the person for a ZabVerify check and then lets YOUR backend confirm it.
//
// cd sdk/flutter/example
// flutter create . (once: adds the android/ios/web folders; keeps this lib/ and pubspec.yaml)
// flutter run
//
// Fill in the three fields on the first screen:
// - ZabVerify server the address of your ZabVerify server, e.g. https://auth.example.com
// - Access key the zapk_... key. Never the zask_ secret key: the SDK refuses it.
// - Your backend an endpoint of YOUR server that receives {"resultToken": "..."} and confirms it with a server SDK
// (see sdk/node/examples/server.mjs: POST /api/confirm). Leave empty to skip that step in the demo.
import 'dart:convert';
import 'dart:io' show ContentType, HttpClient;
import 'package:flutter/material.dart';
import 'package:zabverify/zabverify.dart';
void main() => runApp(const ExampleApp());
class ExampleApp extends StatelessWidget {
const ExampleApp({super.key});
@override
Widget build(BuildContext context) => MaterialApp(
title: 'ZabVerify example',
theme: ThemeData(colorScheme: ColorScheme.fromSeed(seedColor: const Color(0xFF2557D6)), useMaterial3: true),
home: const SetupScreen(),
);
}
class SetupScreen extends StatefulWidget {
const SetupScreen({super.key});
@override
State<SetupScreen> createState() => _SetupScreenState();
}
class _SetupScreenState extends State<SetupScreen> {
final _server = TextEditingController(text: 'https://');
final _key = TextEditingController();
final _backend = TextEditingController();
final _app = TextEditingController(text: 'com.example.zabverify');
VerificationPurpose _purpose = VerificationPurpose.liveness;
String? _error;
void _go() {
try {
// An app has no website address: the SDK sends `Origin: app://<appId>`. Add that value to the key's allowed websites in the console
// (or leave the list empty).
final client = ZabVerifyClient(baseUrl: _server.text.trim(), accessKey: _key.text, appId: _app.text.trim());
Navigator.of(context).push(MaterialPageRoute<void>(builder: (_) => CheckScreen(client: client, purpose: _purpose, backend: _backend.text.trim())));
} on ZabVerifyException catch (e) {
setState(() => _error = e.message);
}
}
@override
Widget build(BuildContext context) => Scaffold(
appBar: AppBar(title: const Text('ZabVerify example')),
body: ListView(padding: const EdgeInsets.all(20), children: [
TextField(controller: _server, decoration: const InputDecoration(labelText: 'ZabVerify server'), keyboardType: TextInputType.url),
TextField(controller: _key, decoration: const InputDecoration(labelText: 'Access key (zapk_...)'), autocorrect: false),
TextField(controller: _app, decoration: const InputDecoration(labelText: 'App id (sent as Origin: app://...)')),
TextField(controller: _backend, decoration: const InputDecoration(labelText: 'Your backend /api/confirm (optional)'), keyboardType: TextInputType.url),
const SizedBox(height: 12),
SegmentedButton<VerificationPurpose>(
segments: const [
ButtonSegment(value: VerificationPurpose.liveness, label: Text('Human check')),
ButtonSegment(value: VerificationPurpose.kyc, label: Text('Documents')),
],
selected: {_purpose},
onSelectionChanged: (s) => setState(() => _purpose = s.first),
),
if (_error != null) Padding(padding: const EdgeInsets.only(top: 12), child: Text(_error!, style: TextStyle(color: Theme.of(context).colorScheme.error))),
const SizedBox(height: 20),
FilledButton.icon(onPressed: _go, icon: const Icon(Icons.verified_user_outlined), label: const Text('Start the check')),
]),
);
}
class CheckScreen extends StatefulWidget {
const CheckScreen({super.key, required this.client, required this.purpose, required this.backend});
final ZabVerifyClient client;
final VerificationPurpose purpose;
final String backend;
@override
State<CheckScreen> createState() => _CheckScreenState();
}
class _CheckScreenState extends State<CheckScreen> {
String _confirmation = '';
/// The result token is only a claim. YOUR backend confirms it with the secret key and tells the app what it decided.
Future<void> _confirm(VerificationResult r) async {
if (widget.backend.isEmpty) {
setState(() => _confirmation = 'Token received. In a real app, send it to your backend now:\n${r.resultToken.substring(0, 24)}...');
return;
}
try {
final c = HttpClient();
final req = await c.postUrl(Uri.parse(widget.backend));
req.headers.contentType = ContentType.json;
req.write(jsonEncode({'resultToken': r.resultToken}));
final res = await req.close();
final body = await res.transform(utf8.decoder).join();
setState(() => _confirmation = 'Backend says (${res.statusCode}):\n$body');
} catch (e) {
setState(() => _confirmation = 'Could not reach your backend: $e');
}
}
@override
Widget build(BuildContext context) => Scaffold(
appBar: AppBar(title: const Text('Verify')),
body: Center(
child: SingleChildScrollView(
padding: const EdgeInsets.all(20),
child: Column(mainAxisSize: MainAxisSize.min, children: [
const Text('Scan the code with another phone,\nor open the check on this one.', textAlign: TextAlign.center),
const SizedBox(height: 16),
ZabVerifyView(
client: widget.client,
purpose: widget.purpose,
onSuccess: _confirm,
onFailed: (e) => setState(() => _confirmation = 'Not verified: ${e.code}${e.reason != null ? ' (${e.reason})' : ''}'),
// Open the link with url_launcher in your app: launchUrl(uri, mode: LaunchMode.externalApplication)
onOpenLink: (uri) => setState(() => _confirmation = 'Open: $uri'),
),
const SizedBox(height: 20),
if (_confirmation.isNotEmpty) SelectableText(_confirmation, textAlign: TextAlign.center),
]),
),
),
);
}sdk/flutter/example/pubspec.yaml
name: zabverify_example
description: A complete example app for the ZabVerify Flutter SDK.
publish_to: none
version: 1.0.0
environment:
sdk: ">=3.0.0 <4.0.0"
dependencies:
flutter:
sdk: flutter
zabverify:
path: ..
dev_dependencies:
flutter_test:
sdk: flutter
flutter:
uses-material-design: trueBefore you go live
- Create an access key and a secret key in the console (Access keys). The secret key is shown once.
- Set the key's allowed websites (and, for an app,
app://your.app.id): an empty list accepts any caller, which is fine for testing and flagged in the console. - Use the service address we give you. It is served over HTTPS, which the camera needs.
- Confirm every result token on your server with the secret key before you trust it.
- Tell people what is stored (pictures are biometric data), and delete what you no longer need.Security and privacy.
Android (Kotlin)
Coroutines and Flow. A Compose sample app is included. App / browser
- Requires
- Android 7.0 (API 24)+, Kotlin 1.9+, coroutines. Uses only the platform HTTP stack and
org.json. - Use it for
- an app or a web page that shows the QR and follows the check (access key,
zapk_…)
Install
// settings.gradle.kts
include(":zabverify")
project(":zabverify").projectDir = file("path/to/sdk/android/zabverify")
// app/build.gradle.kts
dependencies { implementation(project(":zabverify")) }Quick start
val za = ZabVerify(
baseUrl = "https://auth.example.com",
accessKey = "zapk_...", // never the zask_ secret key: the SDK refuses it
appId = packageName, // sent as Origin: app://<package> (add it to the key's allowed websites)
)
lifecycleScope.launch {
za.verify(Purpose.LIVENESS).collect { event ->
when (event) {
VerificationEvent.Creating -> showSpinner()
is VerificationEvent.Waiting -> {
val png = event.session.qrPng()
qrView.setImageBitmap(BitmapFactory.decodeByteArray(png, 0, png.size))
}
VerificationEvent.Scanned -> status.text = "Verifying on the phone..."
is VerificationEvent.Retry -> status.text = "Try again: ${event.reason} (${event.attemptsLeft} left)"
is VerificationEvent.Success -> sendToMyServer(event.result.resultToken) // confirm it there
is VerificationEvent.Failed -> status.text = event.error.code
}
}
} // cancelling the scope cancels the check and tells the serverPreview. Build the sample in your project first, and tell us what you see.
API
| Member | What it does | Type |
|---|---|---|
ZabVerify(baseUrl, accessKey, appId?, origin?) | The client. Refuses a zask_ key. | class |
verify(purpose, userId, note) | Cold Flow<VerificationEvent>. note: optional reference of your own, never shown to the person. Collecting starts the check; cancelling the collector cancels it on the server. | Flow |
createSession(purpose, userId, note) | Creates a session without following it. | suspend Session |
Session.qrPng() | The QR as PNG bytes for BitmapFactory. | ByteArray |
Options
| Option | Meaning |
|---|---|
Purpose | LIVENESS (default), KYC, VERIFY. |
appId | Your package name; becomes the Origin the key must allow. |
Events and results
Creating → Waiting(session) → Scanned → Retry(reason, attemptsLeft)* → Success(result) | Failed(error) as a sealed interface.
Errors
ZabVerifyException with code (rejected, expired, cancelled, invalid_key, origin_not_allowed, secret_key_in_app, network, config), status and reason.
See the error reference for every code, what causes it and what to do.
Example app
A Compose screen: server, access key, kind of check, the QR, every event, and the result token to send to your backend. The files below are the real ones from sdk/.
cd sdk/android
./gradlew :sample:installDebug # (create the Gradle wrapper first: gradle wrapper)
# emulator: your computer is http://10.0.2.2sdk/android/sample/src/main/java/com/zabsys/verify/sample/MainActivity.kt
package com.zabsys.verify.sample
import android.graphics.BitmapFactory
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.Button
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.OutlinedButton
import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.asImageBitmap
import androidx.compose.ui.unit.dp
import com.zabsys.verify.Purpose
import com.zabsys.verify.VerificationEvent
import com.zabsys.verify.ZabVerify
import com.zabsys.verify.ZabVerifyException
import kotlinx.coroutines.Job
import kotlinx.coroutines.launch
/**
* A complete sample: fill in your ZabVerify server and ACCESS key, tap "Start", scan the QR with another phone (or open the link on this one),
* and see every event of the check. The result token is what your own backend must confirm with the secret key.
*
* Emulator: your computer is http://10.0.2.2 (see usesCleartextTraffic in the manifest: for testing only).
*/
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent { MaterialTheme { Surface(Modifier.fillMaxSize()) { Screen(packageName) } } }
}
}
@Composable
private fun Screen(appId: String) {
var server by remember { mutableStateOf("https://") }
var key by remember { mutableStateOf("") }
var purpose by remember { mutableStateOf(Purpose.LIVENESS) }
var event by remember { mutableStateOf<VerificationEvent?>(null) }
var error by remember { mutableStateOf<String?>(null) }
var job by remember { mutableStateOf<Job?>(null) }
val scope = rememberCoroutineScope()
Column(
Modifier.fillMaxSize().padding(20.dp).verticalScroll(rememberScrollState()),
verticalArrangement = Arrangement.spacedBy(12.dp),
horizontalAlignment = Alignment.CenterHorizontally,
) {
Text("ZabVerify sample", style = MaterialTheme.typography.headlineSmall)
OutlinedTextField(server, { server = it }, label = { Text("ZabVerify server") }, modifier = Modifier.fillMaxWidth(), singleLine = true)
OutlinedTextField(key, { key = it }, label = { Text("Access key (zapk_...)") }, modifier = Modifier.fillMaxWidth(), singleLine = true)
Text("Sent as Origin: app://$appId - add it to the key's allowed websites.", style = MaterialTheme.typography.bodySmall)
Column(horizontalAlignment = Alignment.CenterHorizontally) {
OutlinedButton(onClick = { purpose = if (purpose == Purpose.LIVENESS) Purpose.KYC else Purpose.LIVENESS }) {
Text(if (purpose == Purpose.LIVENESS) "Human check (tap for documents)" else "Document check (tap for human check)")
}
}
Button(onClick = {
error = null
job?.cancel() // cancelling the collector also cancels the check on the server
val za = try { ZabVerify(server, key, appId = appId) } catch (e: ZabVerifyException) { error = e.message; return@Button }
job = scope.launch { za.verify(purpose).collect { event = it } }
}) { Text("Start the check") }
if (job?.isActive == true) OutlinedButton(onClick = { job?.cancel() }) { Text("Cancel") }
error?.let { Text(it, color = MaterialTheme.colorScheme.error) }
when (val e = event) {
VerificationEvent.Creating -> Text("Preparing...")
is VerificationEvent.Waiting -> {
val png = e.session.qrPng()
Image(BitmapFactory.decodeByteArray(png, 0, png.size).asImageBitmap(), "Scan this QR code with another phone", Modifier.size(240.dp))
Text("Scan with your phone camera")
Text(e.session.qrUrl, style = MaterialTheme.typography.bodySmall)
}
VerificationEvent.Scanned -> Text("Verifying on the phone...")
is VerificationEvent.Retry -> Text("Try again on the phone: ${e.reason}, ${e.attemptsLeft} tries left")
is VerificationEvent.Success -> {
Text("Verified on the phone", style = MaterialTheme.typography.titleMedium)
Text("Now send this token to YOUR backend; only it can confirm it:", style = MaterialTheme.typography.bodySmall)
Text(e.result.resultToken.take(40) + "...", style = MaterialTheme.typography.bodySmall)
}
is VerificationEvent.Failed -> Text("Not verified: ${e.error.code}${e.error.reason?.let { " ($it)" } ?: ""}", color = MaterialTheme.colorScheme.error)
null -> Unit
}
}
}sdk/android/zabverify/build.gradle.kts
plugins {
id("com.android.library")
id("org.jetbrains.kotlin.android")
}
android {
namespace = "com.zabsys.verify"
compileSdk = 34
defaultConfig {
minSdk = 24
consumerProguardFiles("consumer-rules.pro")
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
isCoreLibraryDesugaringEnabled = true // java.time.Instant on API 24-25
}
kotlinOptions { jvmTarget = "17" }
}
dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.8.1")
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.0.4")
}Before you go live
- Create an access key and a secret key in the console (Access keys). The secret key is shown once.
- Set the key's allowed websites (and, for an app,
app://your.app.id): an empty list accepts any caller, which is fine for testing and flagged in the console. - Use the service address we give you. It is served over HTTPS, which the camera needs.
- Confirm every result token on your server with the secret key before you trust it.
- Tell people what is stored (pictures are biometric data), and delete what you no longer need.Security and privacy.
iOS (Swift)
Swift concurrency and a SwiftUI view. Swift Package Manager. App / browser
- Requires
- iOS 15+ / macOS 12+, Swift 5.9, Xcode 15. Foundation only.
- Use it for
- an app or a web page that shows the QR and follows the check (access key,
zapk_…)
Install
.package(path: "../path/to/sdk/ios")
// target dependency:
.product(name: "ZabVerify", package: "ios")File > Add Package Dependencies > Add Local... > choose the sdk/ios folderQuick start
import SwiftUI
import ZabVerify
struct VerifyScreen: View {
let client = try! ZabVerify(
baseURL: "https://auth.example.com",
accessKey: "zapk_...", // never the zask_ secret key: the SDK refuses it
appId: Bundle.main.bundleIdentifier // sent as Origin: app://<bundle id>
)
var body: some View {
ZabVerifyView(client: client) { result in
sendToMyServer(result.resultToken) // confirm it there with the secret key
} onFailed: { error in
print(error.code, error.reason ?? "")
}
}
}
// Without the view: an AsyncStream of events
func run(_ za: ZabVerify) async {
for await event in za.verify() {
switch event {
case .waiting(let session): show(UIImage(data: session.qrImageData))
case .success(let result): sendToMyServer(result.resultToken)
case .failed(let error): print(error.code)
default: break
}
}
}Preview. Build the sample in your project first, and tell us what you see.
API
| Member | What it does | Type |
|---|---|---|
ZabVerify(baseURL:accessKey:appId:origin:) | Throws secret_key_in_app for a zask_ key. | struct |
verify(purpose:userId:note:) | AsyncStream<VerificationEvent>. note: optional reference of your own, never shown to the person. Ending the consuming task cancels the check on the server. | AsyncStream |
createSession(purpose:userId:note:) | Creates a session without following it. | async throws |
ZabVerifyView(client:purpose:userId:size:texts:onSuccess:onFailed:) | The SwiftUI view: QR, progress, tick or cross, retry button. | View |
Session.qrImageData | The QR as PNG Data. | Data |
Options
| Option | Meaning |
|---|---|
Purpose | .liveness (default), .kyc, .verify. |
appId | Your bundle identifier; becomes the Origin the key must allow. |
Texts | Every string of the view can be replaced. |
Events and results
.creating → .waiting(session) → .scanned → .retry(reason, attemptsLeft)* → .success(result) | .failed(error).
Errors
ZabVerifyError with code (rejected, expired, cancelled, invalid_key, origin_not_allowed, secret_key_in_app, network, config), status and reason.
See the error reference for every code, what causes it and what to do.
Example app
A SwiftUI form (server, access key, kind of check), the verify view, and the result token to send to your backend. The files below are the real ones from sdk/.
# In Xcode: File > New > Project > iOS App (SwiftUI)
# File > Add Package Dependencies > Add Local... > sdk/ios
# Replace the generated App and ContentView files with the two files above, then Run.sdk/ios/Examples/ZabVerifyExample/ContentView.swift
import SwiftUI
import ZabVerify
struct ContentView: View {
@State private var server = "https://"
@State private var accessKey = ""
@State private var purpose: Purpose = .liveness
@State private var client: ZabVerify?
@State private var outcome = ""
@State private var setupError = ""
var body: some View {
NavigationStack {
Form {
Section("Your ZabVerify server") {
TextField("https://auth.example.com", text: $server).keyboardType(.URL).textInputAutocapitalization(.never).autocorrectionDisabled()
TextField("Access key (zapk_...)", text: $accessKey).textInputAutocapitalization(.never).autocorrectionDisabled()
Text("Sent as Origin: app://\(Bundle.main.bundleIdentifier ?? "your.app.id"). Add it to the key's allowed websites in the console.")
.font(.footnote).foregroundColor(.secondary)
}
Section("Check") {
Picker("Kind", selection: $purpose) {
Text("Human check").tag(Purpose.liveness)
Text("Documents").tag(Purpose.kyc)
}.pickerStyle(.segmented)
Button("Start the check", action: start)
if !setupError.isEmpty { Text(setupError).foregroundColor(.red) }
}
if let client {
Section {
HStack {
Spacer()
// Scan with another phone, or tap "open the check here" on this one.
ZabVerifyView(client: client, purpose: purpose) { result in
outcome = "Verified on the phone. Send this token to YOUR backend:\n\(result.resultToken.prefix(32))..."
} onFailed: { error in
outcome = "Not verified: \(error.code)\(error.reason.map { " (\($0))" } ?? "")"
}
.id(purpose) // a new check when the kind changes
Spacer()
}
}
}
if !outcome.isEmpty { Section("Result") { Text(outcome).font(.callout) } }
}
.navigationTitle("ZabVerify example")
}
}
private func start() {
setupError = ""
outcome = ""
do {
client = try ZabVerify(baseURL: server, accessKey: accessKey, appId: Bundle.main.bundleIdentifier)
} catch let e as ZabVerifyError {
client = nil
setupError = e.message
} catch {
setupError = "\(error)"
}
}
}sdk/ios/Examples/ZabVerifyExample/ZabVerifyExampleApp.swift
import SwiftUI
// A complete example app. In Xcode: File > New > Project > iOS App (SwiftUI), then File > Add Package Dependencies > Add Local... and pick
// this repository's sdk/ios folder. Replace the generated App and ContentView files with the two files of this folder and run.
//
// The result token you get at the end is only a claim: your own backend must confirm it with the secret key (see sdk/node/examples/server.mjs).
@main
struct ZabVerifyExampleApp: App {
var body: some Scene {
WindowGroup { ContentView() }
}
}Before you go live
- Create an access key and a secret key in the console (Access keys). The secret key is shown once.
- Set the key's allowed websites (and, for an app,
app://your.app.id): an empty list accepts any caller, which is fine for testing and flagged in the console. - Use the service address we give you. It is served over HTTPS, which the camera needs.
- Confirm every result token on your server with the secret key before you trust it.
- Tell people what is stored (pictures are biometric data), and delete what you no longer need.Security and privacy.
.NET (C#)
One client for servers (secret key) and apps (access key). IAsyncEnumerable events and DI support. App / browserServer
- Requires
- .NET 6 or 8.
System.Text.JsonandHttpClient;Microsoft.Extensions.Httpfor the DI helper. - Use it for
- your backend (secret key) and your apps (access key)
Install
dotnet add reference path/to/sdk/dotnet/src/ZabSys.Verify/ZabSys.Verify.csproj
# or, once published:
dotnet add package ZabSys.VerifyQuick start
using ZabSys.Verify;
// ---- on your SERVER (secret key): confirm what the browser or app sent you ----
builder.Services.AddZabVerify(o => { o.BaseUrl = "https://auth.example.com"; o.Key = builder.Configuration["ZabVerify:SecretKey"]!; });
app.MapPost("/api/confirm", async (ConfirmRequest body, ZabVerifyClient za) =>
{
try
{
var r = await za.VerifyResultAsync(body.ResultToken); // throws ZabVerifyException("invalid_result") for a bad token
return Results.Ok(new { verified = true, r.Pin, r.ReturningPin });
}
catch (ZabVerifyException e) { return Results.BadRequest(new { verified = false, e.Code }); }
});
// ---- in an APP (access key): show the QR and follow the check ----
using var client = new ZabVerifyClient(new ZabVerifyOptions { BaseUrl = "https://auth.example.com", Key = "zapk_...", AppId = "com.example.app" });
await foreach (var e in client.StartVerification())
{
switch (e)
{
case VerificationEvent.Waiting w: ShowQr(w.Session.QrPngBytes); break;
case VerificationEvent.Success s: await SendToMyServer(s.Result.ResultToken); break;
case VerificationEvent.Failed f: Console.WriteLine(f.Error.Code); break;
}
}Preview. Build the sample in your project first, and tell us what you see.
Secret-only methods throw secret_key_required when the client holds an access key: the secret key never belongs in an app.
API
| Member | What it does | Type |
|---|---|---|
new ZabVerifyClient(ZabVerifyOptions, HttpClient?) | Key is zask_... on a server or zapk_... in an app. | class |
CreateSessionAsync(SessionOptions?) | Starts a check (Purpose: Liveness, Kyc, Verify, Enroll; Identifier for a document-number check; Note: optional reference of your own, 200 characters, never shown to the person). | Task<Session> |
GetSessionAsync / CancelSessionAsync | Read or cancel a session; long polling with wait and rev. | Task<SessionState> |
WaitForResultAsync(session) | Long polls until the session is over; throws for rejected, expired, cancelled, timeout. | Task<SessionState> |
VerifyResultAsync(resultToken) | Server only. Confirms a result token. | Task<VerifiedResult> |
StartVerification(options, ct) | App flow: events for the QR, progress and result. Cancelling the token cancels the check on the server. | IAsyncEnumerable<VerificationEvent> |
Kyc / Pins / Faces | Server only. Documents (ListAsync, GetAsync, ImageAsync, DeleteAsync), people (GetAsync, LookupAsync, LinkAsync, UnlinkAsync, DeleteAsync) and privacy erasure. | API groups |
AddZabVerify(options) | Registers a singleton client with the HttpClient factory. | IServiceCollection |
Options
| Option | Meaning |
|---|---|
BaseUrl / Key | Server address and key. |
AppId / Origin | Apps: sent as Origin: app://<AppId>. |
Timeout | One request; long polls add their wait. |
Events and results
Creating → Waiting(Session) → Scanned → Retry(Reason, AttemptsLeft)* → Success(Result) | Failed(Error) as records.
Errors
ZabVerifyException with Code (invalid_result, not_found, pin_not_found, rejected, expired, cancelled, timeout, network, config, secret_key_required ...), Status and Reason.
See the error reference for every code, what causes it and what to do.
Example app
An ASP.NET Core minimal API that serves the checkout page and confirms the token, plus a console app that runs the whole app flow with the access key. The files below are the real ones from sdk/.
cd sdk/dotnet/examples/AspNet
set ZABVERIFY__BASEURL=https://auth.example.com
set ZABVERIFY__PUBLICKEY=zapk_...
set ZABVERIFY__SECRETKEY=zask_...
dotnet runsdk/dotnet/examples/AspNet/Program.cs
// Full example (ASP.NET Core minimal API): a checkout page that asks the visitor for a human check and confirms the result on the server.
//
// set ZABVERIFY__BASEURL=https://auth.example.com
// set ZABVERIFY__PUBLICKEY=zapk_... (public: goes to the page)
// set ZABVERIFY__SECRETKEY=zask_... (secret: stays in this process)
// dotnet run -> http://localhost:5000
//
// The page loads the Web SDK from your ZabVerify server and shows a QR code; the person scans it with a phone; the browser gets a result token and
// POSTs it to /api/confirm; THIS server confirms it with the secret key and only then treats the person as verified.
using ZabSys.Verify;
var builder = WebApplication.CreateBuilder(args);
var cfg = builder.Configuration.GetSection("ZabVerify");
var baseUrl = cfg["BaseUrl"] ?? "";
var publicKey = cfg["PublicKey"] ?? "";
builder.Services.AddZabVerify(o =>
{
o.BaseUrl = baseUrl;
o.Key = cfg["SecretKey"] ?? "";
});
var app = builder.Build();
app.MapGet("/", () => Results.Content(Page(baseUrl, publicKey), "text/html; charset=utf-8"));
// Server-side start: you draw the QR yourself (no browser SDK needed).
app.MapGet("/api/session", async (ZabVerifyClient za) =>
{
var s = await za.CreateSessionAsync(new SessionOptions { UserId = "demo-user" });
return Results.Ok(new { sessionId = s.SessionId, qrImage = s.QrImage, qrUrl = s.QrUrl, expiresAt = s.ExpiresAt });
});
app.MapPost("/api/confirm", async (ConfirmRequest body, ZabVerifyClient za) =>
{
try
{
var r = await za.VerifyResultAsync(body.ResultToken ?? "");
// Only now is it safe to treat the person as verified.
return Results.Ok(new { verified = true, purpose = r.Purpose, pin = r.Pin, returningPerson = r.ReturningPin, score = r.Score });
}
catch (ZabVerifyException e)
{
return Results.Json(new { verified = false, error = e.Code, message = e.Message }, statusCode: e.Code == "invalid_result" ? 400 : 502);
}
});
app.Run();
static string Page(string baseUrl, string publicKey) => $$"""
<!doctype html><html lang="en"><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
<title>Checkout - ZabVerify example</title>
<style>body{font:16px/1.5 system-ui,sans-serif;max-width:520px;margin:40px auto;padding:0 16px;color:#1a2433}
button{font:inherit;padding:10px 18px;border:0;border-radius:8px;background:#2557d6;color:#fff;cursor:pointer}
#out{margin-top:16px;padding:12px;border-radius:8px;background:#f3f5f9;white-space:pre-wrap;font:13px ui-monospace,monospace}</style>
<h1>Confirm your order</h1><p>To protect your account we check that a real person is here. Scan the code with your phone.</p>
<div id="qr"></div><p><button id="go">Start the check</button></p><div id="out"></div>
<script>var ZABVERIFY_ACCESS_KEY = "{{publicKey}}";</script>
<script src="{{baseUrl.TrimEnd('/')}}/sdk/zabverify.js"></script>
<script>
document.getElementById('go').onclick = function () {
document.getElementById('out').textContent = 'waiting for your phone...';
ZabVerify.verifyFace({
container: '#qr',
onSuccess: function (r) {
// The browser can be faked: ask OUR server to confirm the token with the secret key.
fetch('/api/confirm', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ resultToken: r.resultToken }) })
.then(function (x) { return x.json(); }).then(function (j) { document.getElementById('out').textContent = JSON.stringify(j, null, 2); });
},
onFailed: function (e) { document.getElementById('out').textContent = 'Not verified: ' + e.code + (e.reason ? ' (' + e.reason + ')' : ''); }
});
};
</script></html>
""";
record ConfirmRequest(string? ResultToken);sdk/dotnet/examples/Console/Program.cs
// Full example (app side): the whole flow of an app with the ACCESS key, in a console.
// A WPF, MAUI or WinForms app does exactly the same and shows w.Session.QrPngBytes in an Image control.
//
// set ZABVERIFY_URL=https://auth.example.com
// set ZABVERIFY_PK=zapk_... (the access key; the SDK refuses to use a secret key here)
// set ZABVERIFY_APP=com.example.zabverify (sent as Origin: app://com.example.zabverify - add it to the key's allowed websites)
// set YOUR_BACKEND=http://localhost:5000 (optional: the AspNet example, which confirms the token with the secret key)
// dotnet run
using System.Net.Http.Json;
using ZabSys.Verify;
var url = Environment.GetEnvironmentVariable("ZABVERIFY_URL") ?? "";
var pk = Environment.GetEnvironmentVariable("ZABVERIFY_PK") ?? "";
var backend = Environment.GetEnvironmentVariable("YOUR_BACKEND");
using var client = new ZabVerifyClient(new ZabVerifyOptions { BaseUrl = url, Key = pk, AppId = Environment.GetEnvironmentVariable("ZABVERIFY_APP") ?? "com.example.zabverify" });
using var cts = new CancellationTokenSource();
Console.CancelKeyPress += (_, e) => { e.Cancel = true; cts.Cancel(); }; // Ctrl+C cancels the check and tells the server
await foreach (var e in client.StartVerification(new SessionOptions { Purpose = VerificationPurpose.Liveness }, cts.Token))
{
switch (e)
{
case VerificationEvent.Creating:
Console.WriteLine("Preparing...");
break;
case VerificationEvent.Waiting w:
Console.WriteLine($"Scan the QR with your phone, or open: {w.Session.QrUrl}");
await File.WriteAllBytesAsync("qr.png", w.Session.QrPngBytes); // in an app: show these bytes in an Image control
Console.WriteLine("(the QR code is saved as qr.png)");
break;
case VerificationEvent.Scanned:
Console.WriteLine("The phone opened the check. Follow the instructions there.");
break;
case VerificationEvent.Retry r:
Console.WriteLine($"Try again on the phone: {r.Reason}, {r.AttemptsLeft} tries left");
break;
case VerificationEvent.Success s:
Console.WriteLine("Verified on the phone. The result token is only a claim: your backend must confirm it.");
if (!string.IsNullOrEmpty(backend))
{
using var http = new HttpClient();
var reply = await http.PostAsJsonAsync(backend.TrimEnd('/') + "/api/confirm", new { resultToken = s.Result.ResultToken });
Console.WriteLine($"Your backend says ({(int)reply.StatusCode}): {await reply.Content.ReadAsStringAsync()}");
}
break;
case VerificationEvent.Failed f:
Console.WriteLine($"Not verified: {f.Error.Code}{(f.Error.Reason is null ? "" : " (" + f.Error.Reason + ")")}");
break;
}
}Before you go live
- Create an access key and a secret key in the console (Access keys). The secret key is shown once.
- Set the key's allowed websites (and, for an app,
app://your.app.id): an empty list accepts any caller, which is fine for testing and flagged in the console. - Use the service address we give you. It is served over HTTPS, which the camera needs.
- Confirm every result token on your server with the secret key before you trust it.
- Tell people what is stored (pictures are biometric data), and delete what you no longer need.Security and privacy.
NNode.js
Confirm results, read documents, manage PINs. Zero dependencies, typed. Server
- Requires
- Node 18+ (global
fetch). CommonJS with TypeScript definitions. - Use it for
- your backend: confirming results, reading documents, managing PINs (secret key,
zask_…)
Install
npm install @zabsys/verify-nodeQuick start
const { ZabVerify, ZabVerifyError } = require('@zabsys/verify-node');
const za = new ZabVerify({ baseUrl: 'https://auth.example.com', secretKey: process.env.ZABVERIFY_SECRET_KEY });
// Confirm what your browser or app sent you. Always do this before trusting a verification.
app.post('/api/confirm', async (req, res) => {
try {
const r = await za.verifyResult(req.body.resultToken); // rejects with code 'invalid_result' for a bad token
res.json({ verified: true, pin: r.pin, returningPerson: r.returningPin });
} catch (e) {
if (e instanceof ZabVerifyError) return res.status(e.code === 'invalid_result' ? 400 : 502).json({ verified: false, error: e.code });
throw e;
}
});
// Start a check from the server and wait for it
const s = await za.createSession({ purpose: 'liveness', userId: 'user-42' }); // show s.qrImage to the person
const done = await za.waitForResult(s); // long polls; throws when rejected / expired / cancelledThe secret key stays on your server. The constructor refuses an access key, and the API refuses a secret key that arrives with an Origin header.
API
| Member | What it does | Type |
|---|---|---|
new ZabVerify({ baseUrl, secretKey, timeoutMs?, fetch? }) | Refuses a zapk_ key. | class |
createSession({ purpose, userId, note, replace, identifier }) | Starts a check. purpose: liveness, verify, enroll, kyc. note: optional reference of your own (order 1234, 200 characters), returned in the session and the verified result, never shown to the person. | Promise<Session> |
getSession(id, { wait, rev }) | Reads a session; long polling with wait and rev. | Promise<SessionState> |
cancelSession(id) | Cancels; the QR stops working. | Promise<SessionState> |
waitForResult(session, { onUpdate, timeoutMs, signal }) | Long polls until over. | Promise<SessionState> |
verifyResult(resultToken) | Confirms a result token. | Promise<VerifiedResult> |
kyc.list / get / image / delete | Document verification records and scans. | group |
pins.get / lookup / link / unlink / delete | People and the document numbers linked to them. | group |
faces.deleteTemplate / deleteId | Privacy erasure. | group |
proxy({ authorize, userId, allowPurposes, createPerMinute }) | A request handler for YOUR backend (app.use('/zv', za.proxy({...}))): the Web SDK then runs against your own domain and the browser never sees the ZabVerify address or any key. Forwards only start, poll and cancel. See Keep your server address private. | (req, res) => Promise |
health() | Checks that the server is up. | Promise |
Options
| Option | Meaning |
|---|---|
secretKey | The zask_ key. Keep it in an environment variable or a secret store. |
timeoutMs | One request; long polls add their wait. |
fetch | Custom fetch (tests, proxies). |
Events and results
onUpdate(state) in waitForResult sees every change of the session.
Errors
ZabVerifyError with code (invalid_result, not_found, pin_not_found, rejected, expired, cancelled, timeout, network, config, http_<status>), status and details.
See the error reference for every code, what causes it and what to do.
Example app
A checkout page and a /api/confirm endpoint with no framework, using only the SDK and Node's http. The files below are the real ones from sdk/.
cd sdk/node
ZABVERIFY_URL=https://auth.example.com ZABVERIFY_PK=zapk_... ZABVERIFY_SK=zask_... node examples/server.mjs
# open http://localhost:8000sdk/node/examples/server.mjs
// Full example: a checkout page that asks the visitor for a human check and confirms the result on the server.
//
// ZABVERIFY_URL=https://auth.example.com ZABVERIFY_PK=zapk_... ZABVERIFY_SK=zask_... node examples/server.mjs -> http://localhost:8000
//
// The page loads the Web SDK from your ZabVerify server and shows a QR code; the person scans it with a phone; the browser gets a result token and
// POSTs it to /api/confirm; THIS server confirms it with the secret key and only then treats the person as verified. No framework needed.
import http from 'node:http';
import { createRequire } from 'node:module';
const { ZabVerify, ZabVerifyError } = createRequire(import.meta.url)('../index.js');
const { ZABVERIFY_URL: base = '', ZABVERIFY_PK: pk = '', ZABVERIFY_SK: sk = '', PORT: port = '8000' } = process.env;
const za = base && sk ? new ZabVerify({ baseUrl: base, secretKey: sk }) : null;
const page = `<!doctype html><html lang="en"><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
<title>Checkout - ZabVerify example</title>
<style>body{font:16px/1.5 system-ui,sans-serif;max-width:520px;margin:40px auto;padding:0 16px;color:#1a2433}
button{font:inherit;padding:10px 18px;border:0;border-radius:8px;background:#2557d6;color:#fff;cursor:pointer}
#out{margin-top:16px;padding:12px;border-radius:8px;background:#f3f5f9;white-space:pre-wrap;font:13px ui-monospace,monospace}</style>
<h1>Confirm your order</h1><p>To protect your account we check that a real person is here. Scan the code with your phone.</p>
<div id="qr"></div><p><button id="go">Start the check</button></p><div id="out"></div>
<script>var ZABVERIFY_ACCESS_KEY = ${JSON.stringify(pk)};</script>
<script src="${base.replace(/\/+$/, '')}/sdk/zabverify.js"></script>
<script>
document.getElementById('go').onclick = function () {
document.getElementById('out').textContent = 'waiting for your phone...';
ZabVerify.verifyFace({
container: '#qr',
onSuccess: function (r) {
// The browser can be faked: ask OUR server to confirm the token with the secret key.
fetch('/api/confirm', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ resultToken: r.resultToken }) })
.then(function (x) { return x.json(); }).then(function (j) { document.getElementById('out').textContent = JSON.stringify(j, null, 2); });
},
onFailed: function (e) { document.getElementById('out').textContent = 'Not verified: ' + e.code + (e.reason ? ' (' + e.reason + ')' : ''); }
});
};
</script></html>`;
const send = (res, status, body, type = 'application/json') => {
res.writeHead(status, { 'Content-Type': type + '; charset=utf-8' });
res.end(type === 'application/json' ? JSON.stringify(body) : body);
};
http.createServer(async (req, res) => {
try {
if (req.method === 'GET' && req.url === '/') return send(res, 200, page, 'text/html');
if (!za) return send(res, 503, { error: 'not_configured' });
if (req.method === 'GET' && req.url === '/api/session') { // server-side start: you draw the QR yourself (no browser SDK needed)
const s = await za.createSession({ userId: 'demo-user' });
return send(res, 200, { sessionId: s.sessionId, qrImage: s.qrImage, qrUrl: s.qrUrl, expiresAt: s.expiresAt });
}
if (req.method === 'POST' && req.url === '/api/confirm') {
let raw = '';
for await (const chunk of req) { raw += chunk; if (raw.length > 8192) return send(res, 413, { error: 'too_large' }); }
try {
const r = await za.verifyResult(JSON.parse(raw || '{}').resultToken);
// Only now is it safe to treat the person as verified.
return send(res, 200, { verified: true, purpose: r.purpose, pin: r.pin, returningPerson: r.returningPin, score: r.score });
} catch (e) {
if (e instanceof ZabVerifyError) return send(res, e.code === 'invalid_result' ? 400 : 502, { verified: false, error: e.code, message: e.message });
throw e;
}
}
send(res, 404, { error: 'not_found' });
} catch (e) {
send(res, 500, { error: 'server_error', message: String(e && e.message || e) });
}
}).listen(Number(port), () => console.log(`ZabVerify example on http://localhost:${port}`));Before you go live
- Create an access key and a secret key in the console (Access keys). The secret key is shown once.
- Set the key's allowed websites: an empty list accepts any caller, which is fine for testing and flagged in the console.
- Use the service address we give you. It is served over HTTPS, which the camera needs.
- Confirm every result token on your server with the secret key before you trust it.
- Tell people what is stored (pictures are biometric data), and delete what you no longer need.Security and privacy.
Python
Dataclasses, type hints, standard library only. Server
- Requires
- Python 3.8+. No dependencies.
- Use it for
- your backend: confirming results, reading documents, managing PINs (secret key,
zask_…)
Install
pip install ./sdk/python # from the repository
# or, once published:
pip install zabverifyQuick start
from zabverify import ZabVerify, ZabVerifyError
za = ZabVerify("https://auth.example.com", secret_key=os.environ["ZABVERIFY_SECRET_KEY"])
# Confirm what your browser or app sent you. Always do this before trusting a verification.
try:
result = za.verify_result(token) # raises ZabVerifyError(code="invalid_result") for a bad token
print(result.pin, result.returning_pin)
except ZabVerifyError as e:
print(e.code, e.status)
# Start a check from the server and wait for it
session = za.create_session(user_id="user-42") # show session.qr_image to the person
state = za.wait_for_result(session) # long polls; raises when rejected / expired / cancelledThe secret key stays on your server. The constructor refuses an access key.
API
| Member | What it does | Type |
|---|---|---|
ZabVerify(base_url, secret_key, timeout=30) | Refuses a zapk_ key. | class |
create_session(purpose, user_id, replace, identifier, note) | Starts a check. note: optional reference of your own (order 1234, 200 characters), returned in the session and the verified result, never shown to the person. | Session |
get_session(id, wait, rev) / cancel_session(id) | Read (long poll) or cancel a session. | SessionState |
wait_for_result(session, on_update, timeout) | Long polls until over. | SessionState |
verify_result(token) | Confirms a result token. | VerifiedResult |
kyc.list / get / image / delete | Document verification records and scans. | group |
pins.get / lookup / link / unlink / delete | People and the document numbers linked to them. | group |
faces.delete_template / delete_id | Privacy erasure. | group |
Options
| Option | Meaning |
|---|---|
secret_key | The zask_ key; keep it in an environment variable. |
timeout | Seconds for one request; long polls add their wait. |
Events and results
on_update(state) in wait_for_result sees every change of the session.
Errors
ZabVerifyError with .code (invalid_result, not_found, pin_not_found, rejected, expired, cancelled, timeout, network, config), .status, .reason.
See the error reference for every code, what causes it and what to do.
Example app
A checkout page and a /api/confirm endpoint using only the standard library's http.server. The files below are the real ones from sdk/.
cd sdk/python
ZABVERIFY_URL=https://auth.example.com ZABVERIFY_PK=zapk_... ZABVERIFY_SK=zask_... python examples/server.py
# open http://localhost:8000sdk/python/examples/server.py
"""Full example: a checkout page that asks the visitor for a human check and confirms the result on the server.
set ZABVERIFY_URL=https://auth.example.com
set ZABVERIFY_PK=zapk_... (public: goes to the page)
set ZABVERIFY_SK=zask_... (secret: stays in this process)
python examples/server.py -> http://localhost:8000
What happens: the page loads the Web SDK from your ZabVerify server and shows a QR code; the person scans it and follows the instructions on the
phone; the browser gets a result token and POSTs it to /api/confirm; THIS server confirms it with the secret key and only then "ships the order".
Standard library only, so it runs anywhere Python 3.8+ does.
"""
import json
import os
import sys
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
from zabverify import ZabVerify, ZabVerifyError # noqa: E402
BASE, PK, SK = os.environ.get("ZABVERIFY_URL", ""), os.environ.get("ZABVERIFY_PK", ""), os.environ.get("ZABVERIFY_SK", "")
PORT = int(os.environ.get("PORT", "8000"))
za = ZabVerify(BASE, SK) if BASE and SK else None
PAGE = """<!doctype html><html lang="en"><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
<title>Checkout - ZabVerify example</title>
<style>body{font:16px/1.5 system-ui,sans-serif;max-width:520px;margin:40px auto;padding:0 16px;color:#1a2433}
button{font:inherit;padding:10px 18px;border:0;border-radius:8px;background:#2557d6;color:#fff;cursor:pointer}
#out{margin-top:16px;padding:12px;border-radius:8px;background:#f3f5f9;white-space:pre-wrap;font:13px ui-monospace,monospace}</style>
<h1>Confirm your order</h1><p>To protect your account we check that a real person is here. Scan the code with your phone.</p>
<div id="qr"></div><p><button id="go">Start the check</button></p><div id="out"></div>
<script>var ZABVERIFY_ACCESS_KEY = "__PK__";</script>
<script src="__BASE__/sdk/zabverify.js"></script>
<script>
document.getElementById('go').onclick = function () {
document.getElementById('out').textContent = 'waiting for your phone...';
ZabVerify.verifyFace({
container: '#qr',
onSuccess: function (r) {
// The browser can be faked: ask OUR server to confirm the token with the secret key.
fetch('/api/confirm', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ resultToken: r.resultToken }) })
.then(function (x) { return x.json(); }).then(function (j) { document.getElementById('out').textContent = JSON.stringify(j, null, 2); });
},
onFailed: function (e) { document.getElementById('out').textContent = 'Not verified: ' + e.code + (e.reason ? ' (' + e.reason + ')' : ''); }
});
};
</script></html>"""
class Handler(BaseHTTPRequestHandler):
def _send(self, status, body, ctype="application/json"):
data = body if isinstance(body, bytes) else (json.dumps(body) if ctype == "application/json" else body).encode()
self.send_response(status)
self.send_header("Content-Type", ctype + "; charset=utf-8")
self.send_header("Content-Length", str(len(data)))
self.end_headers()
self.wfile.write(data)
def do_GET(self):
if self.path == "/":
return self._send(200, PAGE.replace("__PK__", PK).replace("__BASE__", BASE.rstrip("/")), "text/html")
if self.path == "/api/session": # server-side start: you draw the QR yourself (no browser SDK needed)
if not za:
return self._send(503, {"error": "not_configured"})
s = za.create_session(user_id="demo-user")
return self._send(200, {"sessionId": s.session_id, "qrImage": s.qr_image, "qrUrl": s.qr_url, "expiresAt": s.expires_at.isoformat() if s.expires_at else None})
self._send(404, {"error": "not_found"})
def do_POST(self):
if self.path != "/api/confirm":
return self._send(404, {"error": "not_found"})
if not za:
return self._send(503, {"error": "not_configured"})
n = int(self.headers.get("Content-Length") or 0)
try:
token = json.loads(self.rfile.read(n) or b"{}").get("resultToken", "")
r = za.verify_result(token)
except ZabVerifyError as e:
return self._send(400 if e.code == "invalid_result" else 502, {"verified": False, "error": e.code, "message": e.message})
except ValueError:
return self._send(400, {"verified": False, "error": "bad_json"})
# Only now is it safe to treat the person as verified.
self._send(200, {"verified": True, "purpose": r.purpose, "pin": r.pin, "returningPerson": r.returning_pin, "score": r.score})
if __name__ == "__main__":
if not za:
print("Set ZABVERIFY_URL, ZABVERIFY_PK and ZABVERIFY_SK first.")
print(f"ZabVerify example on http://localhost:{PORT}")
ThreadingHTTPServer(("", PORT), Handler).serve_forever()Before you go live
- Create an access key and a secret key in the console (Access keys). The secret key is shown once.
- Set the key's allowed websites: an empty list accepts any caller, which is fine for testing and flagged in the console.
- Use the service address we give you. It is served over HTTPS, which the camera needs.
- Confirm every result token on your server with the secret key before you trust it.
- Tell people what is stored (pictures are biometric data), and delete what you no longer need.Security and privacy.
PPHP
Typed, readonly classes. Uses curl when present and streams otherwise. Server
- Requires
- PHP 8.1+. No dependencies.
- Use it for
- your backend: confirming results, reading documents, managing PINs (secret key,
zask_…)
Install
composer require zabsys/verify
# from the repository:
composer config repositories.zabverify path ./sdk/php && composer require zabsys/verify:@devQuick start
use ZabSys\Verify\ZabVerify;
use ZabSys\Verify\ZabVerifyException;
$za = new ZabVerify('https://auth.example.com', getenv('ZABVERIFY_SECRET_KEY'));
// Confirm what your browser or app sent you. Always do this before trusting a verification.
try {
$r = $za->verifyResult($token); // throws code 'invalid_result' for a bad token
echo $r->pin, ' ', $r->returningPin ? 'returning' : 'new';
} catch (ZabVerifyException $e) {
echo $e->code(), ' ', $e->status;
}
// Start a check from the server and wait for it
$session = $za->createSession('liveness', 'user-42'); // show $session->qrImage to the person
$state = $za->waitForResult($session); // long polls; throws when rejected / expired / cancelledThe secret key stays on your server. The constructor refuses an access key.
API
| Member | What it does | Type |
|---|---|---|
new ZabVerify($baseUrl, $secretKey, $timeout = 30.0) | Refuses a zapk_ key. | class |
createSession($purpose, $userId, $replace, $identifier, $note) | Starts a check. $note: optional reference of your own (200 characters), never shown to the person. | Session |
getSession($id, $wait, $rev) / cancelSession($id) | Read (long poll) or cancel a session. | SessionState |
waitForResult($session, $onUpdate, $timeout) | Long polls until over. | SessionState |
verifyResult($token) | Confirms a result token. | VerifiedResult |
$za->kyc, $za->pins, $za->faces | Documents, people and privacy erasure (same calls as the other SDKs). | groups |
Options
| Option | Meaning |
|---|---|
$secretKey | The zask_ key; keep it out of the web root and out of version control. |
$timeout | Seconds for one request; long polls add their wait. |
Events and results
$onUpdate($state) in waitForResult sees every change of the session.
Errors
ZabVerifyException: code() (invalid_result, not_found, pin_not_found, rejected, expired, cancelled, timeout, network, config), $status, reason().
See the error reference for every code, what causes it and what to do.
Example app
A checkout page and a /api/confirm endpoint in one file, run with PHP's built-in server. The files below are the real ones from sdk/.
cd sdk/php
ZABVERIFY_URL=https://auth.example.com ZABVERIFY_PK=zapk_... ZABVERIFY_SK=zask_... php -S localhost:8000 examples/index.phpsdk/php/examples/index.php
<?php
/**
* Full example: a checkout page that asks the visitor for a human check and confirms the result on the server.
*
* ZABVERIFY_URL=https://auth.example.com ZABVERIFY_PK=zapk_... ZABVERIFY_SK=zask_... php -S localhost:8000 examples/index.php
*
* The page loads the Web SDK from your ZabVerify server and shows a QR code; the person scans it with a phone; the browser gets a result token and
* POSTs it to /api/confirm; THIS script confirms it with the secret key and only then treats the person as verified.
*/
declare(strict_types=1);
require __DIR__ . '/../src/ZabVerify.php';
use ZabSys\Verify\ZabVerify;
use ZabSys\Verify\ZabVerifyException;
$base = rtrim((string)getenv('ZABVERIFY_URL'), '/');
$pk = (string)getenv('ZABVERIFY_PK');
$sk = (string)getenv('ZABVERIFY_SK');
$path = parse_url($_SERVER['REQUEST_URI'] ?? '/', PHP_URL_PATH);
function reply(int $status, array $body): never
{
http_response_code($status);
header('Content-Type: application/json; charset=utf-8');
echo json_encode($body);
exit;
}
if ($path === '/api/confirm' && $_SERVER['REQUEST_METHOD'] === 'POST') {
if ($base === '' || $sk === '') reply(503, ['error' => 'not_configured']);
$token = (string)(json_decode(file_get_contents('php://input') ?: '{}', true)['resultToken'] ?? '');
try {
$r = (new ZabVerify($base, $sk))->verifyResult($token);
} catch (ZabVerifyException $e) {
reply($e->code() === 'invalid_result' ? 400 : 502, ['verified' => false, 'error' => $e->code(), 'message' => $e->getMessage()]);
}
// Only now is it safe to treat the person as verified.
reply(200, ['verified' => true, 'purpose' => $r->purpose, 'pin' => $r->pin, 'returningPerson' => $r->returningPin, 'score' => $r->score]);
}
if ($path === '/api/session') { // server-side start: you draw the QR yourself (no browser SDK needed)
if ($base === '' || $sk === '') reply(503, ['error' => 'not_configured']);
$s = (new ZabVerify($base, $sk))->createSession('liveness', 'demo-user');
reply(200, ['sessionId' => $s->sessionId, 'qrImage' => $s->qrImage, 'qrUrl' => $s->qrUrl, 'expiresAt' => $s->expiresAt?->format(DATE_ATOM)]);
}
if ($path !== '/') reply(404, ['error' => 'not_found']);
header('Content-Type: text/html; charset=utf-8');
$pkJs = json_encode($pk);
$baseHtml = htmlspecialchars($base, ENT_QUOTES);
?><!doctype html><html lang="en"><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
<title>Checkout - ZabVerify example</title>
<style>body{font:16px/1.5 system-ui,sans-serif;max-width:520px;margin:40px auto;padding:0 16px;color:#1a2433}
button{font:inherit;padding:10px 18px;border:0;border-radius:8px;background:#2557d6;color:#fff;cursor:pointer}
#out{margin-top:16px;padding:12px;border-radius:8px;background:#f3f5f9;white-space:pre-wrap;font:13px ui-monospace,monospace}</style>
<h1>Confirm your order</h1><p>To protect your account we check that a real person is here. Scan the code with your phone.</p>
<div id="qr"></div><p><button id="go">Start the check</button></p><div id="out"></div>
<script>var ZABVERIFY_ACCESS_KEY = <?= $pkJs ?>;</script>
<script src="<?= $baseHtml ?>/sdk/zabverify.js"></script>
<script>
document.getElementById('go').onclick = function () {
document.getElementById('out').textContent = 'waiting for your phone...';
ZabVerify.verifyFace({
container: '#qr',
onSuccess: function (r) {
// The browser can be faked: ask OUR server to confirm the token with the secret key.
fetch('/api/confirm', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ resultToken: r.resultToken }) })
.then(function (x) { return x.json(); }).then(function (j) { document.getElementById('out').textContent = JSON.stringify(j, null, 2); });
},
onFailed: function (e) { document.getElementById('out').textContent = 'Not verified: ' + e.code + (e.reason ? ' (' + e.reason + ')' : ''); }
});
};
</script></html>Before you go live
- Create an access key and a secret key in the console (Access keys). The secret key is shown once.
- Set the key's allowed websites: an empty list accepts any caller, which is fine for testing and flagged in the console.
- Use the service address we give you. It is served over HTTPS, which the camera needs.
- Confirm every result token on your server with the secret key before you trust it.
- Tell people what is stored (pictures are biometric data), and delete what you no longer need.Security and privacy.
GoGo
Context-aware, concurrency-safe, standard library only. Server
- Requires
- Go 1.21+. No dependencies.
- Use it for
- your backend: confirming results, reading documents, managing PINs (secret key,
zask_…)
Install
go get github.com/zabsys/zabverify-goQuick start
import zabverify "github.com/zabsys/zabverify-go"
za, err := zabverify.New("https://auth.example.com", os.Getenv("ZABVERIFY_SECRET_KEY"))
if err != nil { log.Fatal(err) }
// Confirm what your browser or app sent you. Always do this before trusting a verification.
res, err := za.VerifyResult(ctx, token)
if zabverify.IsCode(err, "invalid_result") { /* reject */ }
if err == nil { fmt.Println(res.PIN, res.ReturningPIN) }
// Start a check from the server and wait for it
s, _ := za.CreateSession(ctx, zabverify.SessionOptions{UserID: "user-42"}) // show s.QRImage to the person
st, err := za.WaitForResult(ctx, s.SessionID, nil) // long polls; an error when rejected / expired / cancelledThe secret key stays on your server. New refuses an access key.
API
| Member | What it does | Type |
|---|---|---|
zabverify.New(baseURL, secretKey) | Refuses a zapk_ key. | *Client, error |
CreateSession(ctx, SessionOptions) | Starts a check. SessionOptions.Note: optional reference of your own (200 characters), returned in the session and the verified result, never shown to the person. | *Session |
GetSession(ctx, id, wait, rev) / CancelSession(ctx, id) | Read (long poll) or cancel a session. | *SessionState |
WaitForResult(ctx, id, onUpdate) | Long polls until over; ctx cancellation stops it. | *SessionState |
VerifyResult(ctx, token) | Confirms a result token. | *VerifiedResult |
KYC, Pins, Faces | Documents, people and privacy erasure. | services |
zabverify.IsCode(err, code) | Is this a *zabverify.Error with that code? | bool |
Options
| Option | Meaning |
|---|---|
secretKey | The zask_ key; keep it in the environment or a secret manager. |
Client.HTTP | Replace the *http.Client (transport, proxy, tracing). |
Events and results
onUpdate(*SessionState) in WaitForResult sees every change of the session.
Errors
*zabverify.Error with Code (invalid_result, not_found, pin_not_found, rejected, expired, cancelled, timeout, network, config), Status, Reason.
See the error reference for every code, what causes it and what to do.
Example app
A checkout page and a /api/confirm handler with net/http only. The files below are the real ones from sdk/.
cd sdk/go
ZABVERIFY_URL=https://auth.example.com ZABVERIFY_PK=zapk_... ZABVERIFY_SK=zask_... go run ./examples/serversdk/go/examples/server/main.go
// Full example: a checkout page that asks the visitor for a human check and confirms the result on the server.
//
// ZABVERIFY_URL=https://auth.example.com ZABVERIFY_PK=zapk_... ZABVERIFY_SK=zask_... go run ./examples/server
//
// The page loads the Web SDK from your ZabVerify server and shows a QR code; the person scans it with a phone; the browser gets a result token
// and POSTs it to /api/confirm; THIS server confirms it with the secret key and only then treats the person as verified.
package main
import (
"encoding/json"
"fmt"
"html/template"
"log"
"net/http"
"os"
zabverify "github.com/zabsys/zabverify-go"
)
var page = template.Must(template.New("p").Parse(`<!doctype html><html lang="en"><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
<title>Checkout - ZabVerify example</title>
<style>body{font:16px/1.5 system-ui,sans-serif;max-width:520px;margin:40px auto;padding:0 16px;color:#1a2433}
button{font:inherit;padding:10px 18px;border:0;border-radius:8px;background:#2557d6;color:#fff;cursor:pointer}
#out{margin-top:16px;padding:12px;border-radius:8px;background:#f3f5f9;white-space:pre-wrap;font:13px ui-monospace,monospace}</style>
<h1>Confirm your order</h1><p>To protect your account we check that a real person is here. Scan the code with your phone.</p>
<div id="qr"></div><p><button id="go">Start the check</button></p><div id="out"></div>
<script>var ZABVERIFY_ACCESS_KEY = {{.PK}};</script>
<script src="{{.Base}}/sdk/zabverify.js"></script>
<script>
document.getElementById('go').onclick = function () {
document.getElementById('out').textContent = 'waiting for your phone...';
ZabVerify.verifyFace({
container: '#qr',
onSuccess: function (r) {
// The browser can be faked: ask OUR server to confirm the token with the secret key.
fetch('/api/confirm', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ resultToken: r.resultToken }) })
.then(function (x) { return x.json(); }).then(function (j) { document.getElementById('out').textContent = JSON.stringify(j, null, 2); });
},
onFailed: function (e) { document.getElementById('out').textContent = 'Not verified: ' + e.code + (e.reason ? ' (' + e.reason + ')' : ''); }
});
};
</script></html>`))
func main() {
base, pk, sk := os.Getenv("ZABVERIFY_URL"), os.Getenv("ZABVERIFY_PK"), os.Getenv("ZABVERIFY_SK")
za, err := zabverify.New(base, sk)
if err != nil {
log.Fatal("set ZABVERIFY_URL, ZABVERIFY_PK and ZABVERIFY_SK first: ", err)
}
reply := func(w http.ResponseWriter, status int, v any) {
w.Header().Set("Content-Type", "application/json; charset=utf-8")
w.WriteHeader(status)
_ = json.NewEncoder(w).Encode(v)
}
http.HandleFunc("GET /{$}", func(w http.ResponseWriter, r *http.Request) {
_ = page.Execute(w, map[string]any{"PK": pk, "Base": template.URL(base)})
})
// Server-side start: you draw the QR yourself (no browser SDK needed).
http.HandleFunc("GET /api/session", func(w http.ResponseWriter, r *http.Request) {
s, err := za.CreateSession(r.Context(), zabverify.SessionOptions{UserID: "demo-user"})
if err != nil {
reply(w, http.StatusBadGateway, map[string]any{"error": err.Error()})
return
}
reply(w, 200, map[string]any{"sessionId": s.SessionID, "qrImage": s.QRImage, "qrUrl": s.QRURL, "expiresAt": s.ExpiresAt})
})
http.HandleFunc("POST /api/confirm", func(w http.ResponseWriter, r *http.Request) {
var in struct {
ResultToken string `json:"resultToken"`
}
_ = json.NewDecoder(http.MaxBytesReader(w, r.Body, 8192)).Decode(&in)
res, err := za.VerifyResult(r.Context(), in.ResultToken)
if err != nil {
status := http.StatusBadGateway
if zabverify.IsCode(err, "invalid_result") {
status = http.StatusBadRequest
}
reply(w, status, map[string]any{"verified": false, "error": err.Error()})
return
}
// Only now is it safe to treat the person as verified.
reply(w, 200, map[string]any{"verified": true, "purpose": res.Purpose, "pin": res.PIN, "returningPerson": res.ReturningPIN, "score": res.Score})
})
port := os.Getenv("PORT")
if port == "" {
port = "8000"
}
fmt.Println("ZabVerify example on http://localhost:" + port)
log.Fatal(http.ListenAndServe(":"+port, nil))
}Before you go live
- Create an access key and a secret key in the console (Access keys). The secret key is shown once.
- Set the key's allowed websites: an empty list accepts any caller, which is fine for testing and flagged in the console.
- Use the service address we give you. It is served over HTTPS, which the camera needs.
- Confirm every result token on your server with the secret key before you trust it.
- Tell people what is stored (pictures are biometric data), and delete what you no longer need.Security and privacy.
JJava
java.net.http, no dependencies, a small JSON reader included. Server
- Requires
- Java 11+. No dependencies.
- Use it for
- your backend: confirming results, reading documents, managing PINs (secret key,
zask_…)
Install
javac -d out sdk/java/src/com/zabsys/verify/*.java YourApp.java
java -cp out YourAppQuick start
import com.zabsys.verify.ZabVerify;
import com.zabsys.verify.ZabVerifyException;
ZabVerify za = new ZabVerify("https://auth.example.com", System.getenv("ZABVERIFY_SECRET_KEY"));
// Confirm what your browser or app sent you. Always do this before trusting a verification.
try {
ZabVerify.VerifiedResult r = za.verifyResult(token); // throws code "invalid_result" for a bad token
System.out.println(r.pin + " " + r.returningPin);
} catch (ZabVerifyException e) {
System.out.println(e.getCode() + " " + e.getStatus());
}
// Start a check from the server and wait for it
ZabVerify.Session s = za.createSession(ZabVerify.SessionOptions.liveness("user-42")); // show s.qrImage to the person
ZabVerify.SessionState st = za.waitForResult(s.sessionId, null); // long polls; throws when rejected / expired / cancelledThe secret key stays on your server. The constructor refuses an access key.
API
| Member | What it does | Type |
|---|---|---|
new ZabVerify(baseUrl, secretKey) | Refuses a zapk_ key. | class |
createSession(SessionOptions) | Starts a check. SessionOptions.note: optional reference of your own (200 characters), never shown to the person. | Session |
getSession(id, wait, rev) / cancelSession(id) | Read (long poll) or cancel a session. | SessionState |
waitForResult(id, onUpdate, timeout) | Long polls until over. | SessionState |
verifyResult(token) | Confirms a result token. | VerifiedResult |
kyc, pins, faces | Documents, people and privacy erasure. | groups |
Options
| Option | Meaning |
|---|---|
secretKey | The zask_ key; keep it in the environment or a secret manager. |
Events and results
The Consumer<SessionState> in waitForResult sees every change of the session.
Errors
ZabVerifyException: getCode() (invalid_result, not_found, pin_not_found, rejected, expired, cancelled, timeout, network, config), getStatus(), getReason().
See the error reference for every code, what causes it and what to do.
Example app
A checkout page and a /api/confirm endpoint using only the JDK's built-in HTTP server. The files below are the real ones from sdk/.
cd sdk/java
javac -d out src/com/zabsys/verify/*.java examples/Example.java
ZABVERIFY_URL=https://auth.example.com ZABVERIFY_PK=zapk_... ZABVERIFY_SK=zask_... java -cp out Examplesdk/java/examples/Example.java
import com.sun.net.httpserver.HttpServer;
import com.zabsys.verify.ZabVerify;
import com.zabsys.verify.ZabVerifyException;
import java.io.IOException;
import java.io.OutputStream;
import java.net.InetSocketAddress;
import java.nio.charset.StandardCharsets;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Full example: a checkout page that asks the visitor for a human check and confirms the result on the server.
*
* <pre>
* javac -d out src/com/zabsys/verify/*.java examples/Example.java
* ZABVERIFY_URL=https://auth.example.com ZABVERIFY_PK=zapk_... ZABVERIFY_SK=zask_... java -cp out Example
* </pre>
*
* The page loads the Web SDK from your ZabVerify server and shows a QR code; the person scans it with a phone; the browser gets a result token and
* POSTs it to /api/confirm; THIS server confirms it with the secret key and only then treats the person as verified. JDK only (com.sun.net.httpserver).
*/
public class Example {
static final String BASE = System.getenv().getOrDefault("ZABVERIFY_URL", "").replaceAll("/+$", "");
static final String PK = System.getenv().getOrDefault("ZABVERIFY_PK", "");
static final String PAGE = "<!doctype html><html lang=\"en\"><meta charset=\"utf-8\"><meta name=\"viewport\" content=\"width=device-width,initial-scale=1\">"
+ "<title>Checkout - ZabVerify example</title><style>body{font:16px/1.5 system-ui,sans-serif;max-width:520px;margin:40px auto;padding:0 16px;color:#1a2433}"
+ "button{font:inherit;padding:10px 18px;border:0;border-radius:8px;background:#2557d6;color:#fff;cursor:pointer}"
+ "#out{margin-top:16px;padding:12px;border-radius:8px;background:#f3f5f9;white-space:pre-wrap;font:13px ui-monospace,monospace}</style>"
+ "<h1>Confirm your order</h1><p>To protect your account we check that a real person is here. Scan the code with your phone.</p>"
+ "<div id=\"qr\"></div><p><button id=\"go\">Start the check</button></p><div id=\"out\"></div>"
+ "<script>var ZABVERIFY_ACCESS_KEY = \"" + PK + "\";</script><script src=\"" + BASE + "/sdk/zabverify.js\"></script>"
+ "<script>document.getElementById('go').onclick = function () {"
+ " document.getElementById('out').textContent = 'waiting for your phone...';"
+ " ZabVerify.verifyFace({ container: '#qr', onSuccess: function (r) {"
+ " fetch('/api/confirm', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ resultToken: r.resultToken }) })"
+ " .then(function (x) { return x.json(); }).then(function (j) { document.getElementById('out').textContent = JSON.stringify(j, null, 2); }); },"
+ " onFailed: function (e) { document.getElementById('out').textContent = 'Not verified: ' + e.code + (e.reason ? ' (' + e.reason + ')' : ''); } }); };"
+ "</script></html>";
static void reply(com.sun.net.httpserver.HttpExchange x, int status, String type, String body) throws IOException {
byte[] b = body.getBytes(StandardCharsets.UTF_8);
x.getResponseHeaders().set("Content-Type", type + "; charset=utf-8");
x.sendResponseHeaders(status, b.length);
try (OutputStream o = x.getResponseBody()) { o.write(b); }
}
static String q(String s) { return "\"" + s.replace("\\", "\\\\").replace("\"", "\\\"") + "\""; }
public static void main(String[] args) throws IOException {
ZabVerify za = new ZabVerify(BASE, System.getenv().getOrDefault("ZABVERIFY_SK", ""));
HttpServer server = HttpServer.create(new InetSocketAddress(Integer.parseInt(System.getenv().getOrDefault("PORT", "8000"))), 0);
server.createContext("/", x -> {
if (x.getRequestURI().getPath().equals("/")) reply(x, 200, "text/html", PAGE); else reply(x, 404, "application/json", "{\"error\":\"not_found\"}");
});
// Server-side start: you draw the QR yourself (no browser SDK needed).
server.createContext("/api/session", x -> {
ZabVerify.Session s = za.createSession(ZabVerify.SessionOptions.liveness("demo-user"));
reply(x, 200, "application/json", "{\"sessionId\":" + q(s.sessionId) + ",\"qrImage\":" + q(s.qrImage) + ",\"qrUrl\":" + q(s.qrUrl) + "}");
});
server.createContext("/api/confirm", x -> {
String in = new String(x.getRequestBody().readNBytes(8192), StandardCharsets.UTF_8);
Matcher m = Pattern.compile("\"resultToken\"\\s*:\\s*\"([^\"]*)\"").matcher(in);
try {
ZabVerify.VerifiedResult r = za.verifyResult(m.find() ? m.group(1) : "");
// Only now is it safe to treat the person as verified.
reply(x, 200, "application/json", "{\"verified\":true,\"purpose\":" + q(String.valueOf(r.purpose)) + ",\"pin\":" + q(String.valueOf(r.pin)) + ",\"returningPerson\":" + r.returningPin + "}");
} catch (ZabVerifyException e) {
reply(x, e.getCode().equals("invalid_result") ? 400 : 502, "application/json", "{\"verified\":false,\"error\":" + q(e.getCode()) + ",\"message\":" + q(e.getMessage()) + "}");
}
});
server.start();
System.out.println("ZabVerify example on http://localhost:" + server.getAddress().getPort());
}
}Before you go live
- Create an access key and a secret key in the console (Access keys). The secret key is shown once.
- Set the key's allowed websites: an empty list accepts any caller, which is fine for testing and flagged in the console.
- Use the service address we give you. It is served over HTTPS, which the camera needs.
- Confirm every result token on your server with the secret key before you trust it.
- Tell people what is stored (pictures are biometric data), and delete what you no longer need.Security and privacy.
REST API
Every SDK is a thin client of this API. Use it directly from any language: plain HTTPS and JSON. Every endpoint below shows who may call it, the parameters, a request you can paste, the exact responses and the errors.
Before you start
| Topic | Rule |
|---|---|
| Base URL | https://YOUR-ZABVERIFY-HOST: the service address we give you. All endpoints are under /v1. |
| Keys | A secret key (zask_…) is for your server: Authorization: Bearer zask_…. An access key (zapk_…) is public and is for browsers and apps: X-Access-Key: zapk_…. A secret key sent from a browser (a request with an Origin header) is refused. Create both in the customer console, Access keys. |
| Format | Requests and responses are UTF-8 JSON (Content-Type: application/json), except the Document API that also accepts multipart/form-data. Times are ISO 8601 in UTC (2026-11-20T19:32:22Z). |
| Errors | Every error has the same shape: {"error": "code", "message": "human text"} with an HTTP status. Branch on error, never on the message. All codes: Errors. |
| Rate and limits | 429 rate_limited: too many requests per second for the key (wait Retry-After seconds). 429 quota_exceeded: the account's monthly limit is used up (renews on the 1st, UTC); retrying does not help. |
| CORS | The API never uses cookies. It answers with the caller's origin and the key decides access; an access key can be limited to a list of websites. |
| Security | Check the valid flag of /v1/face/results/verify on your server before you trust a person: the browser's result alone is never proof. |
All endpoints
| Endpoint | Key | What it does |
|---|---|---|
POST/v1/face/sessions | access or secret | Start a check, get the QR code |
GET/v1/face/sessions/{id} | poll token or secret | State of a check (long poll) |
POST/v1/face/sessions/{id}/cancel | poll token or secret | Cancel a check |
POST/v1/face/results/verify | secret | Confirm a result on your server |
GET/v1/fingerprint/users/{user_id} | secret | Is a fingerprint registered |
DELETE/v1/fingerprint/users/{user_id} | secret | Forget a user's fingerprint |
POST/v1/documents/extract | secret | Read a document from pictures |
GET/v1/documents/types | any key | Document ids that can be read |
GET/v1/kyc/records | secret | List document verifications |
GET/v1/kyc/records/{id} | secret | One verification with all data |
GET/v1/kyc/records/{id}/image/{side} | secret | A stored scan |
DELETE/v1/kyc/records/{id} | secret | Erase a verification |
GET/v1/pins/{pin} | secret | A person |
POST/v1/pins/lookup | secret | Who owns a document number |
POST/v1/pins/{pin}/identifiers | secret | Link a number to a person |
DELETE/v1/pins/{pin}/identifiers | secret | Unlink a number |
DELETE/v1/pins/{pin} | secret | Forget a person |
DELETE/v1/face/templates/{user_id} | secret | Erase a face template |
GET/healthz | none | Is the server up |
Checks (sessions)
A check is a session: you create it, show the QR code, the person scans it with their phone, and you watch the state until it is approved or rejected. The purposes are:
| purpose | What happens | Key | <code>user_id</code> |
|---|---|---|---|
liveness (default) | Human check: is a real person in front of the camera. No enrolment. With documents switched on for the key it becomes kyc. | access or secret | optional |
enroll | Register the person's face. | secret | required |
verify | Match the live face with the enrolled one. | access or secret | required |
kyc | Identity document, then the live face compared with the photo on it. | access or secret | optional |
fingerprint_enroll | The person registers a fingerprint (device key, WebAuthn). | secret | required |
fingerprint | The person confirms with the registered fingerprint. | access or secret | required |
POST/v1/face/sessions
Auth: access key (browser) or secret key (server)
Creates a check and returns the QR code to show. Enrolling, starting a check for a document number (identifier) and registering a fingerprint need the secret key.
| Name | In | Type | Required | Description |
|---|---|---|---|---|
purpose | body | string | no | One of the purposes above. Default liveness. |
user_id | body | string | no | Your id for the person (1–190 characters). Required for enroll, verify, fingerprint, fingerprint_enroll. |
note | body | string | no | Optional every time: a reference of your own for this check, for example order 1234 (200 characters at most). It is kept with the check and shown to you: in the secret-key answers (note), in the result you confirm and in the console. It is never shown to the person on the phone and never sent to the browser's poll view. |
replace | body | boolean | no | Overwrite an existing enrolment (enroll, fingerprint_enroll). |
identifier | body | object | no | {type, number, link}: start the check for a document number (secret key only). The result then says whether the number belongs to this face. |
curl -X POST https://YOUR-ZABVERIFY-HOST/v1/face/sessions \
-H "Authorization: Bearer zask_..." -H "Content-Type: application/json" \
-d '{"purpose":"liveness","user_id":"user-42","note":"order 1234"}'{
"session_id": "c00265109900c72387a46d197678501a",
"poll_token": "81d3ea15b06efa6bd722d61506e2fe47038b89ffa449f6af",
"purpose": "liveness",
"status": "pending",
"note": "order 1234",
"qr_url": "https://verify.example.com/v/Q8f2…",
"qr_image": "data:image/png;base64,iVBORw0KGgo…",
"expires_at": "2026-11-20T19:32:22Z",
"expires_in": 120,
"max_attempts": 3
}| HTTP | error | When |
|---|---|---|
| 400 | bad_purpose / bad_user_id / bad_note | Unknown purpose, a required user_id is missing, or the note is longer than 200 characters. |
| 401 | missing_key / invalid_key / key_disabled | No key, an unknown key, or a revoked or expired key. |
| 403 | service_disabled | Face, fingerprint or document verification is switched off for the account. |
| 403 | enroll_needs_secret_key / identifier_needs_secret_key | Enrolling, or starting a check for a number, was attempted with an access key. |
| 403 | origin_not_allowed | The website is not in the access key's allowed origins. |
| 409 | already_enrolled | The user already has a face or fingerprint: send replace: true. |
| 409 | face_disabled / nothing_to_verify | The key has the face check off and no document or fingerprint was configured for it. |
| 409 | fingerprint_unavailable_ip_address | Fingerprints need a host name over HTTPS, not an IP address. |
| 429 | rate_limited / quota_exceeded | Too fast, or the monthly limit is used up. |
GET/v1/face/sessions/{id}
Auth: X-Poll-Token (the token from creation, safe in the browser) or the secret key
The state of a check. Add wait to long-poll: the call returns at once when the revision is newer than rev, otherwise after wait seconds. The secret key also gets score, pin and identity; the browser never does.
| Name | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string | yes | The session_id. |
wait | query | integer | no | Seconds to wait for a change, 0–25 (default 0). |
rev | query | integer | no | The rev you last saw; the call returns when the session has a newer one. |
curl "https://YOUR-ZABVERIFY-HOST/v1/face/sessions/c00265109900c72387a46d197678501a?wait=20&rev=0" \
-H "X-Poll-Token: 81d3ea15b06efa6bd722d61506e2fe47038b89ffa449f6af"{
"session_id": "c002…",
"status": "pending",
"purpose": "liveness",
"rev": 0,
"attempts_left": 3,
"scanned": false,
"expires_at": "2026-11-20T19:32:22Z"
}{
"session_id": "c002…",
"status": "scanned",
"purpose": "liveness",
"reason": "liveness_failed",
"rev": 3,
"attempts_left": 2,
"scanned": true,
"expires_at": "2026-11-20T19:32:22Z"
}{
"session_id": "c002…",
"status": "approved",
"purpose": "liveness",
"rev": 5,
"attempts_left": 3,
"scanned": true,
"expires_at": "2026-11-20T19:32:22Z",
"result_token": "eyJzaWQiOiJjMDAy…"
}{
"session_id": "c002…",
"status": "approved",
"purpose": "kyc",
"rev": 5,
"attempts_left": 3,
"scanned": true,
"expires_at": "2026-11-20T19:32:22Z",
"user_id": "user-42",
"note": "order 1234",
"score": 0.97,
"pin": "PIN-7K3M9Q",
"returning_pin": false,
"identity": {
"type": "passport",
"last4": "6789",
"outcome": "match"
},
"result_token": "eyJzaWQiOiJjMDAy…"
}status is pending (nobody scanned), scanned (the phone is working; after a failed try reason says why), approved, rejected, expired or cancelled. reason values a browser can see: no_face, liveness_failed, spoof_suspected, no_match, kyc_failed. The browser is deliberately not told more.
| HTTP | error | When |
|---|---|---|
| 401 | missing_key | Neither a poll token nor a key was sent. |
| 404 | not_found | No such session, or it belongs to another account (ids cannot be probed). |
POST/v1/face/sessions/{id}/cancel
Auth: poll token or secret key
Cancels a check that is not finished; its QR code stops working. A finished check is returned unchanged.
curl -X POST https://YOUR-ZABVERIFY-HOST/v1/face/sessions/c00265109900c72387a46d197678501a/cancel \
-H "X-Poll-Token: 81d3ea15…"{
"session_id": "c002…",
"status": "cancelled",
"purpose": "liveness",
"rev": 2,
"attempts_left": 3,
"scanned": false,
"expires_at": "2026-11-20T19:32:22Z"
}| HTTP | error | When |
|---|---|---|
| 404 | not_found | No such session. |
POST/v1/face/results/verify
Auth: secret key
Confirms on your server that a result is genuine. Pass the result_token the browser received. Do this before you trust the person: the browser can be tampered with, the token cannot. A token is valid for 5 minutes.
| Name | In | Type | Required | Description |
|---|---|---|---|---|
result_token | body | string | yes | The token from the approved session. |
curl -X POST https://YOUR-ZABVERIFY-HOST/v1/face/results/verify \
-H "Authorization: Bearer zask_..." -H "Content-Type: application/json" \
-d '{"result_token":"eyJzaWQiOiJjMDAy…"}'{
"valid": true,
"session_id": "c002…",
"user_id": "user-42",
"note": "order 1234",
"purpose": "liveness",
"score": 1,
"verified_at": "2026-11-20T19:31:02Z",
"pin": "PIN-7K3M9Q",
"returning_pin": true
}{
"valid": true,
"session_id": "c002…",
"user_id": "",
"purpose": "kyc",
"score": 0.97,
"verified_at": "2026-11-20T19:31:02Z",
"pin": "PIN-7K3M9Q",
"returning_pin": false,
"identity": {
"type": "passport",
"last4": "6789",
"outcome": "match"
},
"kyc": {
"record_id": "a1b2c3d4e5f6a7b8c9d0e1f2",
"status": "verified",
"face_match": 0.97,
"flags": [],
"document_type": "us_passport",
"identifier_type": "passport",
"identifier_last4": "6789"
}
}| HTTP | error | When |
|---|---|---|
| 400 | invalid_result | The token is invalid, expired (5 minutes), already of another account, or the session is not approved. Reject the verification. |
| 403 | secret_key_required | Called with an access key. |
Fingerprint
A fingerprint check is a WebAuthn passkey: ZabVerify stores a public key, never a fingerprint. See Fingerprint. These calls tell your server whether a person has registered a device.
GET/v1/fingerprint/users/{user_id}
Auth: secret key
Is a fingerprint (device) registered for this user?
curl https://YOUR-ZABVERIFY-HOST/v1/fingerprint/users/user-42 -H "Authorization: Bearer zask_..."{
"user_id": "user-42",
"enrolled": true,
"devices": [
{
"registered_at": "2026-11-01T09:12:44Z",
"last_used": "2026-11-20T19:31:02Z"
}
]
}| HTTP | error | When |
|---|---|---|
| 403 | secret_key_required | Called with an access key. |
DELETE/v1/fingerprint/users/{user_id}
Auth: secret key
Forgets every registered device of the user (they register again at the next check).
curl -X DELETE https://YOUR-ZABVERIFY-HOST/v1/fingerprint/users/user-42 -H "Authorization: Bearer zask_..."{
"deleted": true,
"devices_deleted": 1
}Reading a document from pictures
Send a picture of a document and get its data back, with the same fields every time (a value that was not found is "", never missing). The full guide with all three ways to send a picture, every field and the security measures is on the Document API page.
POST/v1/documents/extract
Auth: secret key
Reads one document (a passport, a driving licence, a national ID card, a tax card). The pictures and the answer are not stored, but the call is listed in the console's request history. front (and back for two-sided documents) is a link, an upload or base64. JPEG or PNG, at most 8 MB each and 30 megapixels.
| Name | In | Type | Required | Description |
|---|---|---|---|---|
document_type | body or form | string | no | The document id, for example in_passport, us_passport, us_dl (a driving licence). Send this, or country with kind. |
country | body or form | string | no | Two-letter country code. Alone it means that country's passport. |
kind | body or form | string | no | passport, driving_licence, national_id or tax_id (with country). |
front | body or form | link, base64 or file | yes | The front (the photo page of a passport). |
back | body or form | link, base64 or file | no | The back, for two-sided documents. |
curl -X POST https://YOUR-ZABVERIFY-HOST/v1/documents/extract \
-H "Authorization: Bearer zask_..." \
-F document_type=in_passport -F front=@passport.jpg{
"schema": "zabverify.document.extract.v1",
"request_id": "9f2c41d07a3b55e1",
"status": "ok",
"document": {
"type": "in_passport",
"label": "India passport",
"country": "IN",
"kind": "passport",
"sides_read": [
"front"
]
},
"person": {
"full_name": "ANITA SHARMA",
"date_of_birth": "1992-03-14",
"sex": "FEMALE",
"…": "every field is always present"
},
"document_data": {
"number": "K1234567",
"expiry_date": "2029-06-01",
"…": "…"
},
"missing_fields": [],
"checks": {
"machine_readable_zone": "valid",
"expiry": "valid"
}
}| HTTP | error | When |
|---|---|---|
| 400 | bad_document_type / unknown_country / document_not_available / country_mismatch / kind_mismatch | The document cannot be worked out from document_type or country + kind. |
| 400 | front_required / bad_base64 / bad_image_url | No front picture, or a picture or link that cannot be understood. |
| 403 | needs_secret_key | Called with an access key. |
| 413 | image_too_large / image_dimensions | A picture is over 8 MB or 30 megapixels. |
| 415 | unsupported_image | Not a JPEG or PNG picture. |
| 422 | image_unreadable / image_too_small / image_url_unreachable | The picture is damaged or too small, or the link could not be downloaded. |
| 429 | rate_limited / quota_exceeded | Too fast, or the monthly Document API limit is used up. |
| 503 | document_engine_unavailable | This server has no document engine. |
GET/v1/documents/types
Auth: any key
Every document id that can be sent, optionally for one country.
| Name | In | Type | Required | Description |
|---|---|---|---|---|
country | query | string | no | A two-letter country code, for example IN. |
kind | query | string | no | passport, driving_licence, national_id or tax_id. |
curl "https://YOUR-ZABVERIFY-HOST/v1/documents/types?country=IN" -H "Authorization: Bearer zask_..."{
"total": 2,
"documents": [
{
"id": "in_passport",
"label": "India passport",
"country": "IN",
"country_name": "India",
"kind": "passport",
"sides": [
"front"
]
},
{
"id": "in_pan",
"label": "India PAN card",
"country": "IN",
"country_name": "India",
"kind": "tax_id",
"sides": [
"front"
]
}
]
}Document verifications (stored records)
When a person verifies a document in a check (purpose: kyc) ZabVerify keeps a record: what was read, the pictures and the verdict. These calls read and erase them.
GET/v1/kyc/records
Auth: secret key
The newest records (100 at most), optionally of one person.
| Name | In | Type | Required | Description |
|---|---|---|---|---|
pin | query | string | no | Only the records of this PIN. |
curl "https://YOUR-ZABVERIFY-HOST/v1/kyc/records?pin=PIN-7K3M9Q" -H "Authorization: Bearer zask_..."{
"records": [
{
"id": "a1b2c3d4e5f6a7b8c9d0e1f2",
"status": "verified",
"pin": "PIN-7K3M9Q",
"face_match": 0.97,
"flags": [],
"document_type": "us_passport",
"document_label": "United States passport",
"document_country": "US",
"identifier_type": "passport",
"identifier_last4": "6789",
"session_id": "c002…",
"created_at": "2026-11-20T19:31:02Z",
"updated_at": "2026-11-20T19:31:02Z"
}
]
}status: verified, review (a person should look), rejected or pending. flags name what needs attention (for example no_face_check: the check had the face step switched off).
| HTTP | error | When |
|---|---|---|
| 403 | secret_key_required / service_disabled | An access key was used, or document verification is off. |
GET/v1/kyc/records/{id}
Auth: secret key
One record with everything that was read: the fields per side, the live face attempts and extracted, the same fixed JSON for every document.
curl https://YOUR-ZABVERIFY-HOST/v1/kyc/records/a1b2c3d4e5f6a7b8c9d0e1f2 -H "Authorization: Bearer zask_..."{
"id": "a1b2c3d4e5f6a7b8c9d0e1f2",
"status": "verified",
"face_match": 0.97,
"flags": [],
"document_type": "us_passport",
"has_front_image": true,
"has_back_image": false,
"data": {
"front": {
"fields": {
"passport_number": "A01234567",
"name_en": "ALEX MORGAN"
}
},
"back": {
"fields": {}
}
},
"extracted": {
"schema": "zabverify.document.v1",
"person": {
"full_name": "ALEX MORGAN"
},
"document_data": {
"number": "A01234567"
}
}
}| HTTP | error | When |
|---|---|---|
| 404 | not_found | No such record in this account. |
GET/v1/kyc/records/{id}/image/{side}
Auth: secret key
A stored scan as image/jpeg. side is front, back or live1, live2 … (the live face pictures). Served with Cache-Control: no-store.
curl https://YOUR-ZABVERIFY-HOST/v1/kyc/records/a1b2…/image/front -H "Authorization: Bearer zask_..." -o front.jpg| HTTP | error | When |
|---|---|---|
| 404 | not_found | No such record or picture. |
DELETE/v1/kyc/records/{id}
Auth: secret key
Erases the record and its pictures.
curl -X DELETE https://YOUR-ZABVERIFY-HOST/v1/kyc/records/a1b2… -H "Authorization: Bearer zask_..."{
"deleted": true
}People (PINs)
Every person who passes a live check gets one permanent PIN (it is the same each time the same face comes back). You can link their document numbers to it. A number is stored only as a one-way hash plus its last 4 characters.
GET/v1/pins/{pin}
Auth: secret key
The person: how often verified, first and last seen and the linked numbers.
curl https://YOUR-ZABVERIFY-HOST/v1/pins/PIN-7K3M9Q -H "Authorization: Bearer zask_..."{
"pin": "PIN-7K3M9Q",
"created_at": "2026-10-02T08:00:00Z",
"last_seen": "2026-11-20T19:31:02Z",
"times_verified": 4,
"identifiers": [
{
"type": "passport",
"label": "Passport",
"last4": "6789",
"country": "US",
"linked_at": "2026-10-02T08:05:00Z",
"ref": "3f9a1c7d2b40"
}
]
}| HTTP | error | When |
|---|---|---|
| 404 | pin_not_found | No such PIN in this account. |
POST/v1/pins/lookup
Auth: secret key
Finds the person who owns a document number. Spaces and dashes in number are ignored.
| Name | In | Type | Required | Description |
|---|---|---|---|---|
type | body | string | yes | nid, passport, driving_license, other or a built document id. |
number | body | string | yes | The document number. |
country | body | string | no | Two-letter country code (passports of other countries). |
curl -X POST https://YOUR-ZABVERIFY-HOST/v1/pins/lookup -H "Authorization: Bearer zask_..." -H "Content-Type: application/json" \
-d '{"type":"passport","number":"A01234567"}'{
"pin": "PIN-7K3M9Q",
"created_at": "2026-10-02T08:00:00Z",
"last_seen": "2026-11-20T19:31:02Z",
"times_verified": 4,
"identifiers": [
{
"type": "passport",
"label": "Passport",
"last4": "6789",
"country": "US",
"linked_at": "2026-10-02T08:05:00Z",
"ref": "3f9a1c7d2b40"
}
]
}| HTTP | error | When |
|---|---|---|
| 404 | not_found | Nobody owns this number. |
POST/v1/pins/{pin}/identifiers
Auth: secret key
Links a document number to the person.
| Name | In | Type | Required | Description |
|---|---|---|---|---|
type | body | string | yes | As in lookup. |
number | body | string | yes | The document number. |
country | body | string | no | Two-letter country code. |
curl -X POST https://YOUR-ZABVERIFY-HOST/v1/pins/PIN-7K3M9Q/identifiers -H "Authorization: Bearer zask_..." -H "Content-Type: application/json" \
-d '{"type":"passport","number":"A01234567","country":"US"}'{
"pin": "PIN-7K3M9Q",
"identifier": {
"type": "passport",
"label": "Passport",
"last4": "4567",
"country": "US",
"linked_at": "2026-11-20T19:40:00Z",
"ref": "8c21aa90e4d1"
}
}| HTTP | error | When |
|---|---|---|
| 409 | identifier_in_use | The number already belongs to another PIN: treat it as a possible duplicate or fraud, do not relink. |
| 400 | bad_identifier_type / bad_identifier | Unknown type, or a number that is not 4–40 letters or digits. |
| 404 | pin_not_found | No such PIN. |
DELETE/v1/pins/{pin}/identifiers
Auth: secret key
Unlinks a number from the person.
| Name | In | Type | Required | Description |
|---|---|---|---|---|
type | body | string | yes | As in lookup. |
number | body | string | yes | The number to unlink. |
curl -X DELETE https://YOUR-ZABVERIFY-HOST/v1/pins/PIN-7K3M9Q/identifiers -H "Authorization: Bearer zask_..." -H "Content-Type: application/json" \
-d '{"type":"passport","number":"A01234567","country":"US"}'{
"deleted": true
}| HTTP | error | When |
|---|---|---|
| 404 | not_found | That number is not linked to this PIN. |
DELETE/v1/pins/{pin}
Auth: secret key
Forgets the person completely: the face data and every linked number. The same person gets a new PIN next time.
curl -X DELETE https://YOUR-ZABVERIFY-HOST/v1/pins/PIN-7K3M9Q -H "Authorization: Bearer zask_..."{
"deleted": true
}Privacy: erase data
DELETE/v1/face/templates/{user_id}
Auth: secret key
Erases the person's stored face template and the logged pictures of their checks (privacy requests).
curl -X DELETE https://YOUR-ZABVERIFY-HOST/v1/face/templates/user-42 -H "Authorization: Bearer zask_..."{
"deleted": true,
"logs_deleted": 3
}DELETE /v1/face/ids/{id} is the older name of DELETE /v1/pins/{pin} and still works.Checking a document number against the face
Start the check from your server with the number: POST /v1/face/sessions with {"purpose":"liveness","identifier":{"type":"passport","number":"…","link":false}}. When the person passes, the secret-key view of the session and /v1/face/results/verify return identity.outcome: match (the number already belongs to this face), mismatch (it belongs to a different face: treat it as fraud), linked or unknown. The browser never sees the outcome.
Health
GET/healthz
Auth: none
Answers while the server is up.
curl https://YOUR-ZABVERIFY-HOST/healthz{
"ok": true
}Document API
Send a picture of an identity document, get its data back as JSON. One request, no session, no phone, no QR code. The answer has the same fields every time.
How it works
Your server sends the picture of the document (an upload, base64 or a link) to POST /v1/documents/extract with the document type. ZabVerify reads it and answers with the person's data, the document data and what was checked. The picture is never stored and the answer is not kept on your behalf: only the console's request history (below) records that the call happened and how it ended. When you need the holder's live face compared with the photo on the document, a PIN, or a stored record, use a verification session instead (see Quick start).
Authorization: Bearer zask_…) and is refused from a browser or with an access key. Keep the key on your server and call this API from there.Send a document
| Name the document | How |
|---|---|
| By id | document_type: the id of the document, for example in_passport, us_passport, us_dl (list below). |
| By country and kind | country (two letters, IN) with kind: passport (the default when you send only country), driving_licence, national_id or tax_id. {"country":"US","kind":"driving_licence"} reads the same as {"document_type":"us_dl"}. The aliases licence, license, dl, nid, pan are accepted. |
| Both | Allowed; they must agree (country_mismatch / kind_mismatch otherwise). |
If a country has no reader for that kind yet, the answer is 400 document_not_available and its message lists what exists for the country. The answer's document.type always says which document was read.
front is required; back only for two-sided documents (a National ID card, a licence). A second picture sent for a one-sided document is ignored. Each picture can arrive in any of three ways:
| Way | How | Limit |
|---|---|---|
| Link | JSON "front": "https://…/passport.jpg" or {"url": "…"}; form field front_url. | Public http or https address, answered within 15 seconds. |
| Upload | multipart/form-data with the files front and back (the field image also means the front). | 8 MB per picture, 20 MB per request. |
| Base64 | JSON "front": {"base64": "…"}, or the plain string, or a data:image/jpeg;base64,… URL; form field front_base64. | 8 MB per picture (24 MB request). |
Pictures can be JPEG or PNG. Photograph the whole document flat, in good light, without glare. For a passport send the photo page with the two lines of <<< characters at the bottom.
curl -X POST https://YOUR-ZABVERIFY-HOST/v1/documents/extract \
-H "Authorization: Bearer zask_..." -H "Content-Type: application/json" \
-d '{"document_type":"in_passport","front":"https://files.example.com/passport.jpg"}'curl -X POST https://YOUR-ZABVERIFY-HOST/v1/documents/extract \
-H "Authorization: Bearer zask_..." \
-F document_type=us_passport -F front=@passport.jpgB64=$(base64 -w0 passport.jpg) # on macOS: base64 -i passport.jpg
curl -X POST https://YOUR-ZABVERIFY-HOST/v1/documents/extract \
-H "Authorization: Bearer zask_..." -H "Content-Type: application/json" \
-d "{\"document_type\":\"in_passport\",\"front\":{\"base64\":\"$B64\"}}"import base64, requests
r = requests.post(
"https://YOUR-ZABVERIFY-HOST/v1/documents/extract",
headers={"Authorization": "Bearer zask_..."},
json={"document_type": "in_passport",
"front": {"base64": base64.b64encode(open("passport.jpg", "rb").read()).decode()}},
timeout=120,
)
doc = r.json()
print(doc["status"], doc["person"]["full_name"], doc["document_data"]["number"]) # every key is always thereimport fs from "node:fs";
const form = new FormData();
form.append("document_type", "in_passport");
form.append("front", new Blob([fs.readFileSync("passport.jpg")], { type: "image/jpeg" }), "passport.jpg");
const res = await fetch("https://YOUR-ZABVERIFY-HOST/v1/documents/extract", {
method: "POST", headers: { Authorization: "Bearer zask_..." }, body: form,
});
const doc = await res.json();
console.log(doc.status, doc.person.full_name, doc.document_data.number);<?php
$ch = curl_init("https://YOUR-ZABVERIFY-HOST/v1/documents/extract");
curl_setopt_array($ch, [
CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 120,
CURLOPT_HTTPHEADER => ["Authorization: Bearer zask_..."],
CURLOPT_POSTFIELDS => ["document_type" => "in_passport", "front" => new CURLFile("passport.jpg", "image/jpeg")],
]);
$doc = json_decode(curl_exec($ch), true);
echo $doc["status"], " ", $doc["person"]["full_name"], " ", $doc["document_data"]["number"];10.x, 192.168.x …) or cloud metadata addresses are refused with image_url_unreachable. If the picture is private, upload it or send it as base64.The answer is always the same shape
Every field below is always present, for every document of every country. A value that was not found is an empty string "" and a list is []: never null, never a missing key. So your code can read doc.person.full_name or doc.document_data.expiry_date without any if key in … and cannot crash because one passport has no place of birth and another has. Use missing_fields and status to learn what was not found.
{
"schema": "zabverify.document.extract.v1",
"request_id": "9f2c41d07a3b55e1",
"status": "ok",
"document": {
"type": "in_passport",
"label": "India passport",
"country": "IN",
"country_name": "India",
"kind": "passport",
"sides_expected": [
"front"
],
"sides_read": [
"front"
]
},
"person": {
"full_name": "ANITA SHARMA",
"given_names": "ANITA",
"surname": "SHARMA",
"name_local": "",
"father_name": "",
"mother_name": "",
"spouse_name": "",
"relative_name": "",
"date_of_birth": "1992-03-14",
"year_of_birth": "",
"sex": "FEMALE",
"blood_group": "",
"nationality": "IND",
"place_of_birth": "PUNE",
"care_of": ""
},
"document_data": {
"number": "K1234567",
"issue_date": "2019-06-02",
"expiry_date": "2029-06-01",
"issuing_country": "IND",
"place_of_issue": "PUNE",
"issuing_authority": "",
"holder_type": "",
"personal_number": "",
"document_code": "P",
"file_number": "",
"categories": []
},
"address": {
"text": "",
"text_local": "",
"pin_code": ""
},
"missing_fields": [],
"checks": {
"machine_readable_zone": "valid",
"expiry": "valid",
"photo_found": true,
"code_read": false,
"issuer_verification": "not_performed"
},
"quality": {
"issues": []
},
"raw": {
"front": {
"passport_number": "K1234567",
"surname": "SHARMA"
},
"back": {},
"machine_readable_lines": [
"P<INDSHARMA<<ANITA<<<<<<<<<<<<<<<<<<<<<<<<<<<<",
"K1234567<4IND9203147F2906012<<<<<<<<<<<<<<<6"
],
"code": {}
}
}{
"schema": "zabverify.document.extract.v1",
"request_id": "5b81e0c2d94a7f30",
"status": "partial",
"document": {
"type": "in_passport",
"label": "India passport",
"country": "IN",
"country_name": "India",
"kind": "passport",
"sides_expected": [
"front"
],
"sides_read": [
"front"
]
},
"person": {
"full_name": "",
"given_names": "",
"surname": "",
"name_local": "",
"father_name": "",
"mother_name": "",
"spouse_name": "",
"relative_name": "",
"date_of_birth": "",
"year_of_birth": "",
"sex": "",
"blood_group": "",
"nationality": "",
"place_of_birth": "",
"care_of": ""
},
"document_data": {
"number": "M7654321",
"issue_date": "",
"expiry_date": "",
"issuing_country": "",
"place_of_issue": "",
"issuing_authority": "",
"holder_type": "",
"personal_number": "",
"document_code": "",
"file_number": "",
"categories": []
},
"address": {
"text": "",
"text_local": "",
"pin_code": ""
},
"missing_fields": [
"person.full_name",
"person.date_of_birth",
"person.sex",
"person.nationality",
"document.expiry_date",
"document.issuing_country"
],
"checks": {
"machine_readable_zone": "invalid",
"expiry": "unknown",
"photo_found": false,
"code_read": false,
"issuer_verification": "not_performed"
},
"quality": {
"issues": [
"blurry",
"mrz_unreadable"
]
},
"raw": {
"front": {},
"back": {},
"machine_readable_lines": [],
"code": {}
}
}Both answers have exactly the same keys. (The order of keys in the JSON is not guaranteed: read by name.)
status and missing_fields
| status | Meaning |
|---|---|
ok | Everything a document of this kind is expected to give was read (missing_fields is empty). |
partial | Something was read, something was not. missing_fields names the gaps; use the rest. |
unreadable | Nothing useful was read: ask for a clearer picture (see quality.issues). |
missing_fields lists the expected values that were empty, as person.<key> or document.<key>. What is expected depends on the kind of document: a passport is expected to give name, date of birth, sex, nationality, number, expiry date and issuing country; a driving licence name, date of birth, number and expiry date; a National ID name, date of birth and number; other cards name and number.
person
| Field | Content |
|---|---|
| full_name | The name as one string. For a passport without a printed full name it is given names + surname. |
| given_names, surname | The two parts of a passport name (from the machine readable lines). |
| name_local | The name in the country's own script (Hindi, for example), read when the language reader is installed. |
| father_name, mother_name, spouse_name, relative_name | As printed on the document. |
| date_of_birth | YYYY-MM-DD when the document gave a full date (passports always do), otherwise as printed. |
| year_of_birth | Only when the document prints just a year (for example some Aadhaar cards). |
| sex | MALE, FEMALE or the value as read. |
| blood_group, nationality, place_of_birth, care_of | As read. A passport's nationality is the three letter code (IND). |
document_data and address
| Field | Content |
|---|---|
| number | The document number: passport number, National ID, licence number, Aadhaar (masked), PAN ... |
| issue_date, expiry_date | YYYY-MM-DD for a passport, otherwise as read. |
| issuing_country, place_of_issue, issuing_authority | As read. issuing_country of a passport is the three letter code. |
| holder_type, personal_number, document_code, file_number | Only some documents have them; otherwise an empty string. |
| categories | A list (licence classes). [] when none. |
address has text, text_local and pin_code (documents that print an address, such as Aadhaar).
checks, quality and raw
| Field | Values |
|---|---|
checks.machine_readable_zone | valid (every check digit of a passport's two bottom lines holds), invalid, or not_applicable (not a passport). |
checks.expiry | valid, expired or unknown (no readable expiry date). |
checks.photo_found, checks.code_read | true/false: a holder photo was found on the front; a barcode or QR code was found and decoded. |
checks.issuer_verification | Always not_performed: see below. |
quality.issues | Picture problems the reader noticed (blurry, glare, too_dark, low_resolution, card_not_found, mrz_unreadable …). An empty list is good. |
raw | What each side gave under the reader's own names (front, back, code, machine_readable_lines). Its inner keys differ per document: use the fixed fields above in your code and raw for debugging. |
Driving licences
A driving licence is a document like any other: name it by country and kind (or by id) and send both sides. Its answer has the same fixed fields: document_data.number is the licence number, document_data.categories the licence classes (a list), document_data.expiry_date and issue_date. A licence is expected to give name, date of birth, number and expiry date; anything not found is listed in missing_fields.
curl -X POST https://YOUR-ZABVERIFY-HOST/v1/documents/extract \
-H "Authorization: Bearer zask_..." \
-F country=US -F kind=driving_licence -F front=@licence-front.jpg -F back=@licence-back.jpgAll licence documents the server can read, with their ids: GET /v1/documents/types?kind=driving_licence (add &country=IN for one country). Some countries have their own reader. The others use a general card reader that is guided by the printed labels, so show the result to the person for confirmation where it matters.
Which documents
Send the id as document_type. The list is long (every country's passport, plus national ID cards, driving licences and tax cards), so ask the server:
curl https://YOUR-ZABVERIFY-HOST/v1/documents/types?country=IN -H "Authorization: Bearer zask_..."{
"total": 5,
"documents": [
{"id": "in_passport", "label": "India passport", "country": "IN", "country_name": "India", "kind": "passport", "sides": ["front"]},
{"id": "in_pan", "label": "India PAN card", "country": "IN", "country_name": "India", "kind": "tax_id", "sides": ["front"]}
]
}Without ?country= the whole catalog is returned. A document that is listed can be read; how well depends on the engine and the picture (see below).
Errors
A document that could be opened but was hard to read is not an error: you get 200 with status: partial or unreadable and the empty fields. Errors are for requests that cannot be processed at all. They look like every other error of the API: {"error": "unsupported_image", "message": "…"}.
| HTTP | Code | Meaning |
|---|---|---|
| 400 | bad_document_type / unknown_country / document_not_available / country_mismatch / kind_mismatch | The document cannot be worked out from document_type or country + kind: unknown, not available for that country, or the two disagree. The message says what is available. |
| 400 | front_required / bad_image / bad_base64 / bad_image_url / bad_upload | No front picture, or a picture/link that cannot be understood. |
| 401 | missing_key / invalid_key / key_disabled | See Errors. |
| 403 | needs_secret_key | The call came with an access key. Use the secret key, from your server. |
| 403 | service_disabled | Document verification is switched off for the account. |
| 413 | image_too_large / too_large / image_dimensions | A picture is over 8 MB, the request is over 20 MB (24 MB as JSON), or the picture is over 30 megapixels or 12000 pixels on a side. |
| 422 | image_unreadable / image_too_small | The picture is damaged, or smaller than 64 x 64 pixels. |
| 415 | unsupported_image | Not a JPEG or PNG picture, whatever the file name or Content-Type says (PDF, HEIC, WebP, GIF, SVG and any other file must be converted to a photo first). |
| 422 | image_url_unreachable | The link could not be downloaded (not public, answered an error, too slow). |
| 429 | rate_limited | Too many documents with this key: wait a second and retry (Retry-After). |
| 502 | engine_error | The reader failed on this picture. Retry once; then use another picture. |
| 503 | document_engine_unavailable | This server has no document engine (the demo engine cannot read documents). |
Try it and see the history in the console
In the customer console (and for the administrator, in the customer's pages) open Document API. There you can:
- Try it: choose the country and the document, then add each picture as an upload, an image link or base64, and read it. It is the same call your server makes, it counts against the allowance and it shows the JSON you get, plus the matching
curlcommand. - See every request: a history of the calls from your servers (with the name of the access key) and from the console: when, which document, how each picture arrived, the HTTP status, Success / Partly read / Not readable / Failed, the error code and how long it took. Open a row to see the request in short and the answer that was returned.
- Allowance: how many reads are used this month and what the limit is.
| History keeps | History never keeps |
|---|---|
| Time, key name or console, document, picture method and size, a link's host and path, HTTP status, result, error code, duration, the caller's IP address, and the answer sealed with AES-GCM. | The pictures, the secret key, the Authorization header, and the query string of an image link (it can hold a signature). |
The history is kept 30 days by default and a customer can delete single rows. Because an answer contains the personal data read from a document, treat the history as personal data under your own privacy duties. Each customer sees only their own history; a request that was refused (wrong key, bad picture, over the limit) is listed too, so a customer can see why.
How uploads are kept safe
Every picture is treated as hostile until proven otherwise. Whatever the way it arrives (upload, base64 or link):
| Protection | What it means |
|---|---|
| Real pictures only | The first bytes decide, not the file name, the Content-Type header or the link's ending. Only JPEG and PNG pass; HTML, scripts, PHP, SVG, PDF, executables, archives, GIF and WebP are refused with 415. |
| Rewritten, not forwarded | The picture is decoded by this server and written again as a fresh JPEG. A script or other file glued on the end, text in comments, EXIF/XMP blocks and malformed data do not survive; the reader (engine) only ever receives a picture this server produced. The camera's rotation is applied during that step. |
| Size bombs refused early | A tiny file that claims to unpack to a gigantic picture is refused from its header (image_dimensions) before anything is allocated. At most 3 pictures are processed at the same moment. |
| Nothing on disk, nothing executed | Pictures are held in memory only for the request: never written to a file (not even a temporary one), never executed, never given a name from the request. |
| Links cannot reach your network | Only http/https on the ports 80, 443, 8080 and 8443, no user name in the address, no proxy. The address a link resolves to is checked on every connection and every redirect (3 at most): this machine, private networks, link-local and cloud metadata addresses, and IPv6 forms that hide them (NAT64, 6to4, Teredo) are refused. 8 MB and 15 seconds at most. |
| Returned text is inert | Text read from a card can be anything an attacker printed on it, for example <script>. Control characters, line breaks and invisible direction-override characters are removed and each value is cut at 500 characters. The JSON escapes < > & and is sent with nosniff. Still: treat every returned value as untrusted text and escape it when you show it in a page or put it in a query. |
| Secret key, limits, rate | Server-side secret key only, a monthly limit and a per-second rate per key, so the endpoint cannot be used to flood the engine. |
Privacy and honesty about accuracy
- Pictures are never stored. The data in the answer is yours; the console's request history keeps a sealed copy of the answer for a limited time (see above; it can be switched off). Your own server stores what it needs, under your own legal duties.
- Aadhaar numbers are masked in the answer (
XXXX XXXX 1234); the full number never leaves the reader. - This is reading, not verification. The data is what the reader saw on the picture. Nothing is checked with the government that issued the document, so a good forgery that prints correct data is read as correctly as a genuine document (
checks.issuer_verificationsaysnot_performed). A passport's number, date of birth and expiry date are protected by check digits (machine_readable_zone: valid); names and every printed field are not, and text recognition does misread. For decisions that matter, show the extracted values to the person and let them confirm, or use a verification session (it includes the confirm step and a live face comparison). - Test with your own documents before you rely on a field: how well it is read depends on the document and the picture.
Limits and capacity
Monthly limit. Each document read counts once against the account's Document API reads limit. When it is used up the API answers 429 quota_exceeded until the 1st of the next month (UTC). The administrator sets the limit per customer in the console (Customers, Settings, Verification limits) and a platform default for everyone who has none of their own; face, fingerprint and document verifications have separate limits, and the API request rate (per second, per key) is a separate setting. The customer sees the allowance on the Usage page.
Reading takes seconds on a CPU engine (a passport about 2 seconds, a two-sided card a few seconds more). A key may send about 5 documents per second; above that the API answers 429 with Retry-After. Set a client timeout of at least 120 seconds.
Errors
Every SDK maps these codes to its own error type (ZabVerifyError, ZabVerifyException, *zabverify.Error). Branch on code, never on the message text.
| Code | HTTP | Meaning | What to do |
|---|---|---|---|
invalid_result | 400 | The result token is invalid, expired (5 minutes) or belongs to another account. | Reject the verification. Never retry the same token. |
invalid_key | 401 | Unknown access key or secret key. | Check the key and the server address; keys are shown once at creation. |
missing_key | 401 | No key was sent. | Send X-Access-Key (browser/app) or Authorization: Bearer (server). |
key_disabled | 401 | The key is revoked or expired. | Create a new key in the console. |
customer_disabled | 403 | The account is disabled. | Contact the ZabVerify administrator. |
service_disabled | 403 | The service (human check or documents) is not enabled for the account. | Switch the service on for the customer in the console. |
origin_not_allowed | 403 | The caller's Origin is not in the key's allowed websites (apps: app://<id>). | Add the exact origin to the key, or leave the list empty while testing. |
secret_key_in_browser | 403 | A secret key arrived with an Origin header. | Use the access key in browsers and apps; the secret key only on servers. |
secret_key_required | 403 | A server-only call was made with an access key. | Make the call from your server with the secret key. |
enroll_needs_secret_key | 403 | Enrolment must be started from your server. | Create the session with the secret key and show it with attachFace. |
quota_exceeded | 429 | The account's monthly limit for this kind of check (face, fingerprint, document, Document API reads) is used up. It renews on the 1st (UTC). | Show a friendly message; ask the ZabVerify administrator for a higher limit. Retrying before the 1st does not help (unlike rate_limited). |
needs_secret_key | 403 | The Document API (/v1/documents/extract) was called with an access key. | Call it from your server with the secret key; see the Document API. |
unsupported_image / image_url_unreachable | 415 / 422 | A document picture is not JPEG, PNG or WebP, or a picture link could not be downloaded. | Convert the picture, or upload / send it as base64 instead of a link. |
no_instructions | 403 | No face-check instruction is enabled for the key. | Enable at least one in the console. |
not_found / pin_not_found | 404 | No such session, record, picture, PIN or number. | Check the id. pins.lookup uses this for "nobody owns this number". |
already_claimed | 409 | The QR was already opened on another phone. | Create a new session. |
identifier_in_use | 409 | A document number is already linked to another PIN. | Treat as a possible duplicate or fraud; do not relink. |
fingerprint_unavailable_ip_address | 409 | Passkeys cannot be bound to an IP address. | Contact support: the service address must be a host name over HTTPS (also fingerprint_unavailable_not_https). |
fingerprint_failed | reason | The device did not prove the fingerprint (wrong device, cancelled, or an invalid proof). | The person tries again until the allowed tries are used up. |
already_enrolled | 409 | That user already has a face enrolled. | Send replace: true to overwrite. |
rate_limited | 429 | Too many requests or sessions for the key. | Back off and retry (the SDKs do so for polling). |
engine_error | 503 | The face or document engine is unavailable. The attempt is not counted. | Retry shortly. |
rejected (session) | - | The check failed after the last attempt. reason: no_match, liveness_failed, no_face, kyc_failed. | Show the failure; offer a new check. |
expired / cancelled (session) | - | The QR expired (about 2 minutes) or the check was cancelled. | Start a new check. |
network (SDK) | - | The SDK could not reach the server (offline, wrong address, timeout). The message is always could not reach the verification service: it never contains the address, so it is safe to show. The technical original is kept separately (cause, InnerException or detail) for your logs. | Check connectivity and baseUrl; polling retries with a back-off. Never show the original to your users. |
config (SDK) | - | A missing or malformed key or base URL. | Fix the configuration. A secret key in an app or browser is reported as secret_key_in_app / secret_key_in_browser. |
An error body is {"error": "code", "message": "human readable"}. The message may change between versions; the code is stable.
Security and privacy
What the SDKs enforce, what you must do, and what is stored.
Keep the secret key secret
- Store it in an environment variable or a secret manager. Never in a web page, an app bundle, a repository or a log.
- Rotate it by creating a new key and revoking the old one in the console.
- Every server SDK refuses an access key; every client SDK refuses a secret key; the server refuses a secret key that arrives with an
Originheader.
Always confirm on the server
A result token shown in a browser or app proves nothing by itself: it can be copied or invented on the client. Grant access only after verifyResult succeeds on your server. Tokens are signed, expire after five minutes and are bound to your account.
Keep your server address private
A browser can only be told not to show an address, it cannot be stopped from using one: anything the page's code requests appears in the browser's developer tools. What you can control is where the address is never put in the first place.
| Where the address could leak | What ZabVerify does / what you do |
|---|---|
| Error messages (a network failure, a timeout) | Done for you in every SDK. The message of a network error is always could not reach the verification service: it never contains the host, the URL or a key, so you may show message to your users. The technical original is kept apart (cause in Node, Python, Go, Java, Kotlin and Flutter, InnerException in .NET, detail in PHP and Swift, not part of the message, JSON or toString) for your logs only. Never forward it to a browser. |
| The browser's network requests | Use the proxy below: the page talks only to your own domain. |
The script address (<script src="https://verify.example.com/sdk/zabverify.js">) | Copy /sdk/zabverify.js to your own site and load it from there. |
| The QR code and the 'open here' link | The phone has to open ZabVerify's page, so the link and the QR code contain the service address. Pass hideLink: true to the Web SDK to remove the clickable link from your page. |
| Calls from your server (Document API, results, PINs ...) | Never reach a browser at all. Keep the base URL and the secret key in environment variables on the server. |
| Your code and logs | Do not put the address in front-end code or in error pages you send to users; do not print error.cause / InnerException / detail to them. |
The proxy: the browser never sees ZabVerify or a key
The Node SDK has a ready-made request handler. The Web SDK then runs against your address. The proxy forwards three things only (start a check, poll it, cancel it), starts checks with the secret key on your server, and ignores any user id the browser sends.
const express = require('express');
const { ZabVerify } = require('@zabsys/verify-node'); // the Node server SDK
const za = new ZabVerify({ baseUrl: process.env.ZABVERIFY_URL, secretKey: process.env.ZABVERIFY_SECRET_KEY });
const app = express();
// The browser talks to /zv on YOUR domain. Nothing else is forwarded: start a check, poll it, cancel it.
app.use('/zv', za.proxy({
authorize: (req) => !!req.session?.user, // your own login (return false to refuse)
userId: (req) => req.session.user.id, // YOUR id for the person; the browser cannot choose it
createPerMinute: 20, // checks one client may start per minute
}));<script src="/js/zabverify.js"></script> <!-- a copy of the file, served from YOUR domain -->
<script>
ZabVerify.verifyFace({
accessKey: 'zapk_proxy', // any text that starts with zapk_: the proxy uses the secret key on your server
baseUrl: '/zv', // your own address
container: '#qr',
hideLink: true, // no 'open the check here' link (its address is the ZabVerify server's)
onSuccess: (r) => fetch('/api/confirm', { method: 'POST', body: JSON.stringify({ resultToken: r.resultToken }) }),
onFailed: (e) => showMessage(e.message), // safe to show: it never contains an address
});
</script>/zv can start checks on your account (and use up your monthly allowance). Use authorize with your own login, keep the rate limit, and allow only the purposes you need (allowPurposes, default only liveness; enrolling and document checks need your own server code). For other languages write the same three routes with the server SDK of your language: POST /v1/face/sessions with the secret key, and GET /v1/face/sessions/{id} / POST /v1/face/sessions/{id}/cancel with the browser's X-Poll-Token header.The result the page sends to your server (resultToken) is confirmed there with verifyResult, as always.
Allowed websites and apps
An access key can be limited to the websites (https://shop.example.com, https://*.example.com) and apps (app://com.example.app) that may use it. Browsers send their own Origin, which a page cannot change; an app sets it through the SDK, so it identifies the app but is not a secret. Treat the list as protection against other websites reusing your key, not as app authentication.
What is stored
| Data | How | Retention |
|---|---|---|
| Face template (only for enrolled users) | encrypted | until you erase it (faces.deleteTemplate) |
| Pictures of each attempt (one per instruction) | sealed with AES-GCM; visible only to your account and the platform administrator | until you delete them, or the service's retention period ends |
| Log lines of each attempt | database rows | as long as the service keeps them |
| Document numbers | keyed hash per customer and type, plus the last four characters | until the PIN is erased |
| Document scans and extracted data | sealed; shown in the console and via the API to the secret key | until the record is erased |
Face images and document scans are biometric or sensitive personal data in many countries (GDPR, BIPA and others). As the business asking people to verify, you are responsible for consent and notices. The phone page tells the person that pictures are kept and for how long. Delete the records you no longer need, and ask us how long they are kept.
Erasure
| To erase | Call |
|---|---|
| One user's face template and logged pictures | faces.deleteTemplate(userId) |
| A person: face data and every linked number | pins.delete(pin) |
| A document record | kyc.delete(id) |
Transport
The service uses HTTPS: the phone browser requires it for camera access, and keys travel in headers. Apps should pin or at least validate certificates the platform way; the Flutter SDK lets you replace the transport (ZabHttp) for pinning.
What ZabVerify does not prove
- That a document is genuine: it reads and cross-checks what is printed, and uses check digits and machine readable zones where the document has them. It does not query government databases.
Platform status
Which SDKs are tested against a real ZabVerify server, and which are in preview.
| SDK | Role | Status |
|---|---|---|
| Web (JavaScript) | App / browser | Tested |
| React | App / browser | Preview |
| Flutter and Dart | App / browser | Tested |
| Android (Kotlin) | App / browser | Preview |
| iOS (Swift) | App / browser | Preview |
| .NET (C#) | App / browserServer | Preview |
| Node.js | Server | Tested |
| Python | Server | Tested |
| PHP | Server | Tested |
| Go | Server | Tested |
| Java | Server | Tested |
Want ZabVerify for your app?
Tell us your platform and what you want to build, and we will set up your access.
