Loading ZabSys Cloud…

New Business software, email, SMS and AI built for growing companies, with support by a real team

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.

Servers secret key

These confirm results, read document records, manage PINs and erase data. They use the secret key (zask_…).

The whole flow in one picture

Your page or appZabVerify serverThe person's phoneYour server SDK/v1/face/sessions camera + voicesecret key 1 create a sessionsession_id, poll_token, QR image 2 long poll (waits for changes) 3 the person scans the QR: claiminstructions, photos (one per step) 4 scanned / retry / approved the QR turns green or red 5 the page sends the result token to YOUR server 6 POST /v1/face/results/verify (secret key)valid: true - now it is safe to trust the person

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

Verify real people, in any app.
PieceWhat it is
11 SDKsWeb, React, Flutter, Android, iOS, .NET, Node.js, Python, PHP, Go, Java.
11 example appsEach SDK ships a complete example that you can run in a minute.
REST APIEvery SDK is a thin client of the same HTTP API, documented in the API reference.
Smoke testsSeveral SDKs are tested against a real ZabVerify server; platform status says exactly which.

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.

99.9% uptime

A hosted service, run and watched by ZabSys.

Encrypted storage

Pictures, document data and face templates are stored encrypted.

Your records stay yours

Read them and delete them with your secret key or in your console.

What we store, and how it is protected

What is stored and how it is protected
DataHow it is protectedHow long it is kept
Pictures of each attemptEncrypted with AES-256-GCMUntil you delete them, or the service's retention period ends
Document photos and the data read from themEncrypted with AES-256-GCMUntil you delete the record
Face templates of registered usersEncrypted with AES-256-GCMUntil you erase them
Document numbersStored as a keyed hash; only the last four characters are shownUntil the person's record is erased
Document API answersEncrypted. The pictures sent to the Document API are not stored30 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.

Terminal
curl https://YOUR-ZABVERIFY-HOST/v1/kyc/records \
  -H "Authorization: Bearer zask_..."
REST calls for stored records
CallWhat it does
GET /v1/kyc/recordsList 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.

199 countries and territories

Listed below by region.

199 passports

Read from the machine readable lines, with their check digits.

613 other documents

National ID cards, driving licences, residence permits and more.

Asia 50Europe 46Africa 54North America 23South America 12Oceania 14

Asia

Supported documents in Asia
CountryPassport IDOther documents
Afghanistan AFaf_passportTazkira (national ID) Driving licence
Armenia AMam_passportResidence card ID card Driving licence
Azerbaijan AZaz_passportTemporary residence card ID card Driving licence
Bahrain BHbh_passportResidence permit CPR smart card Driving licence
Bangladesh BDbd_passportWork permit / residence visa National ID card Driving licence
Bhutan BTbt_passportWork permit Citizenship ID card (CID) Driving licence
Brunei BNbn_passportResidence pass Identity card (IC) Driving licence
Cambodia KHkh_passportWork permit / extended visa Cambodian identity card Driving licence
China CNcn_passportForeigner permanent residence ID card Mainland travel permit (Hong Kong, Macao, Taiwan residents) Resident Identity Card Driving licence
Georgia GEge_passportResidence permit card ID card Driving licence
Hong Kong HKhk_passportVisa / entry permit HKID card (Hong Kong identity card) Driving licence
India INin_passportAadhaar card Driving licence PAN card Voter ID card (EPIC)
Indonesia IDid_passportKITAS / KITAP (residence permit) KTP (e-KTP identity card) SIM (driving licence)
Iran IRir_passportAmayesh card (foreign nationals) National card (Kart-e Melli) Driving licence
Iraq IQiq_passportCivil status ID Residence permit Unified national ID card Driving licence
Israel ILil_passportResidence permit (A/5 visa) Teudat Zehut (ID card) Driving licence
Japan JPjp_passportResidence card (zairyu card) Special permanent resident certificate My Number card Driving licence
Jordan JOjo_passportResidence permit National ID card Driving licence
Kazakhstan KZkz_passportResidence permit (VNZh) Identity card Driving licence
Kuwait KWkw_passportResidency (Article 18 / 20) Civil ID Driving licence
Kyrgyzstan KGkg_passportResidence permit ID card Driving licence
Laos LAla_passportWork permit Lao ID card Driving licence
Lebanon LBlb_passportResidence permit Lebanese ID card Driving licence
Macau MOmo_passportNon-resident worker card Macao resident identity card (BIR) Driving licence
Malaysia MYmy_passportMyPR (permanent resident card) i-Kad (foreign worker card) Employment pass / residence pass MyKad Driving licence
Maldives MVmv_passportWork permit National ID card Driving licence
Mongolia MNmn_passportForeigner residence card Mongolian ID card Driving licence
Myanmar MMmm_passportCitizenship Scrutiny Card Foreigner registration card National Registration Card (NRC) Driving licence
Nepal NPnp_passportCitizenship certificate National ID card Driving licence Voter ID card
North Korea KPkp_passportCitizen ID card
Oman OMom_passportResidence card Resident / civil ID card Driving licence
Pakistan PKpk_passportNICOP (overseas Pakistani card) POR card (Proof of Registration) CNIC (computerised national ID) Driving licence
Palestine PSps_passportPalestinian ID card Driving licence
Philippines PHph_passportUMID card PRC professional ID Postal ID ACR I-Card (alien registration) PhilSys National ID Driver's licence Voter's ID
Qatar QAqa_passportResidence permit Qatar ID (QID) Driving licence
Saudi Arabia SAsa_passportIqama (resident ID) National ID card Driving licence
Singapore SGsg_passportFIN card (Employment Pass / S Pass / Dependant's Pass) Permanent resident re-entry permit NRIC (identity card) Driving licence
South Korea KRkr_passportAlien registration card / residence card Resident registration card (mobile ID) Driving licence
Sri Lanka LKlk_passportResidence visa National Identity Card (NIC) Driving licence
Syria SYsy_passportResidence permit Civil ID card Driving licence
Taiwan TWtw_passportAlien Resident Certificate (ARC) National ID card Driving licence
Tajikistan TJtj_passportResidence permit Internal passport / ID card Driving licence
Thailand THth_passportPink ID card (foreign residents) Work permit Thai national ID card Driving licence
Timor-Leste TLtl_passportResidence card Bilhete de Identidade (ID card) Driving licence Voter card
Turkey TRtr_passportResidence permit (ikamet) T.C. Kimlik Karti (identity card) Driving licence
Turkmenistan TMtm_passportResidence permit Internal passport / ID card Driving licence
United Arab Emirates AEae_passportResidence visa Emirates ID Driving licence
Uzbekistan UZuz_passportResidence permit ID card (biometric) Driving licence
Vietnam VNvn_passportTemporary residence card Citizen identity card (CCCD) Driving licence
Yemen YEye_passportNational ID card Driving licence

Europe

Supported documents in Europe
CountryPassport IDOther documents
Albania ALal_passportResidence permit National ID card Driving licence
Andorra ADad_passportResidence permit National ID card Driving licence
Austria ATat_passportAufenthaltstitel Personalausweis Fuhrerschein
Belarus BYby_passportResidence permit National ID card Driving licence
Belgium BEbe_passportResidence card for foreigners (A-F card) eID (identiteitskaart) Driving licence
Bosnia and Herzegovina BAba_passportResidence permit National ID card Driving licence
Bulgaria BGbg_passportResidence permit National ID card Driving licence
Croatia HRhr_passportResidence permit National ID card Driving licence
Cyprus CYcy_passportResidence permit National ID card Driving licence
Czechia CZcz_passportResidence permit Obcansky prukaz Ridicsky prukaz
Denmark DKdk_passportResidence card Driving licence
Estonia EEee_passportResidence permit National ID card Driving licence
Finland FIfi_passportResidence permit card Identity card Driving licence
France FRfr_passportTitre de sejour Carte nationale d'identite Permis de conduire
Germany DEde_passportAufenthaltstitel (eAT) Personalausweis Fuhrerschein
Greece GRgr_passportResidence permit Police identity card Driving licence
Hungary HUhu_passportResidence permit Szemelyi igazolvany Driving licence
Iceland ISis_passportResidence permit National ID card Driving licence
Ireland IEie_passportIRP card (Irish Residence Permit) Passport card Public Services Card Garda age card Driving licence
Italy ITit_passportPermesso di soggiorno Carta d'identita elettronica (CIE) Patente di guida
Kosovo XKxk_passportResidence permit National ID card Driving licence
Latvia LVlv_passportResidence permit National ID card Driving licence
Liechtenstein LIli_passportResidence permit National ID card Driving licence
Lithuania LTlt_passportResidence permit National ID card Driving licence
Luxembourg LUlu_passportResidence permit Identity card Driving licence
Malta MTmt_passportResidence permit National ID card Driving licence
Moldova MDmd_passportResidence permit National ID card Driving licence
Monaco MCmc_passportResidence permit National ID card Driving licence
Montenegro MEme_passportResidence permit National ID card Driving licence
Netherlands NLnl_passportVerblijfsvergunning Identiteitskaart Rijbewijs
North Macedonia MKmk_passportResidence permit National ID card Driving licence
Norway NOno_passportResidence card National ID card Driving licence
Poland PLpl_passportKarta pobytu Dowod osobisty Prawo jazdy
Portugal PTpt_passportAutorizacao de residencia Cartao de Cidadao Carta de conducao
Romania ROro_passportResidence permit Carte de identitate Driving licence
Russia RUru_passportResidence permit (VNZh) Internal passport Driving licence
San Marino SMsm_passportResidence permit National ID card Driving licence
Serbia RSrs_passportResidence permit National ID card Driving licence
Slovakia SKsk_passportResidence permit National ID card Driving licence
Slovenia SIsi_passportResidence permit National ID card Driving licence
Spain ESes_passportTIE (foreigner identity card) DNI Permiso de conducir
Sweden SEse_passportResidence permit card National ID card Driving licence
Switzerland CHch_passportForeign national ID (permit B / C / L) Identity card Driving licence
Ukraine UAua_passportTemporary residence permit ID card / internal passport Driving licence
United Kingdom GBgb_passportBiometric residence permit / eVisa PASS proof-of-age card Photocard driving licence
Vatican City VAva_passportResidence permit National ID card Driving licence

Africa

Supported documents in Africa
CountryPassport IDOther documents
Algeria DZdz_passportResidence card Biometric national ID card Driving licence
Angola AOao_passportResidence permit National ID card Driving licence
Benin BJbj_passportResidence permit National ID card Driving licence
Botswana BWbw_passportResidence permit National ID card Driving licence
Burkina Faso BFbf_passportResidence permit National ID card Driving licence
Burundi BIbi_passportResidence permit National ID card Driving licence
Cabo Verde CVcv_passportResidence permit National ID card Driving licence
Cameroon CMcm_passportResidence permit National ID card Driving licence
Central African Republic CFcf_passportResidence permit National ID card Driving licence
Chad TDtd_passportResidence permit National ID card Driving licence
Comoros KMkm_passportResidence permit National ID card Driving licence
Cote d'Ivoire CIci_passportResidence permit National ID card Driving licence
Djibouti DJdj_passportResidence permit National ID card Driving licence
DR Congo CDcd_passportResidence permit National ID card Driving licence
Egypt EGeg_passportResidence permit National ID card Driving licence
Equatorial Guinea GQgq_passportResidence permit National ID card Driving licence
Eritrea ERer_passportResidence permit National ID card Driving licence
Eswatini SZsz_passportResidence permit National ID card Driving licence
Ethiopia ETet_passportResidence permit Fayda national ID / Kebele ID Driving licence
Gabon GAga_passportResidence permit National ID card Driving licence
Gambia GMgm_passportResidence permit National ID card Driving licence
Ghana GHgh_passportResidence permit Ghana Card Driving licence Voter ID card
Guinea GNgn_passportResidence permit National ID card Driving licence
Guinea-Bissau GWgw_passportResidence permit National ID card Driving licence
Kenya KEke_passportAlien card National ID card Driving licence
Lesotho LSls_passportResidence permit National ID card Driving licence
Liberia LRlr_passportResidence permit National ID card Driving licence
Libya LYly_passportResidence permit National ID card Driving licence
Madagascar MGmg_passportResidence permit National ID card Driving licence
Malawi MWmw_passportResidence permit National ID card Driving licence
Mali MLml_passportResidence permit National ID card Driving licence
Mauritania MRmr_passportResidence permit National ID card Driving licence
Mauritius MUmu_passportResidence permit National ID card Driving licence
Morocco MAma_passportCarte de sejour CNIE Driving licence
Mozambique MZmz_passportResidence permit National ID card Driving licence
Namibia NAna_passportResidence permit National ID card Driving licence
Niger NEne_passportResidence permit National ID card Driving licence
Nigeria NGng_passportECOWAS residence card National ID (NIN) card Driving licence Permanent Voter's Card (PVC)
Republic of the Congo CGcg_passportResidence permit National ID card Driving licence
Rwanda RWrw_passportResidence permit National ID card Driving licence
Sao Tome and Principe STst_passportResidence permit National ID card Driving licence
Senegal SNsn_passportResidence permit National ID card Driving licence
Seychelles SCsc_passportResidence permit National ID card Driving licence
Sierra Leone SLsl_passportResidence permit National ID card Driving licence
Somalia SOso_passportResidence permit National ID card Driving licence
South Africa ZAza_passportPermanent residence permit Smart ID card Driving licence
South Sudan SSss_passportResidence permit National ID card Driving licence
Sudan SDsd_passportResidence permit National ID card Driving licence
Tanzania TZtz_passportResidence permit NIDA national ID Driving licence
Togo TGtg_passportResidence permit National ID card Driving licence
Tunisia TNtn_passportCarte de sejour CIN (national identity card) Driving licence
Uganda UGug_passportResidence permit National ID (NIN) card Driving licence
Zambia ZMzm_passportResidence permit National ID card Driving licence
Zimbabwe ZWzw_passportResidence permit National ID card Driving licence

North America

Supported documents in North America
CountryPassport IDOther documents
Antigua and Barbuda AGag_passportResidence permit National ID card Driving licence
Bahamas BSbs_passportResidence permit National ID card Driving licence
Barbados BBbb_passportResidence permit National ID card Driving licence
Belize BZbz_passportResidence permit National ID card Driving licence
Canada CAca_passportPermanent resident card Provincial photo ID card Provincial driver's licence
Costa Rica CRcr_passportResidence permit National ID card Driving licence
Cuba CUcu_passportResidence permit National ID card Driving licence
Dominica DMdm_passportResidence permit National ID card Driving licence
Dominican Republic DOdo_passportResidence permit National ID card Driving licence
El Salvador SVsv_passportResidence permit National ID card Driving licence
Grenada GDgd_passportResidence permit National ID card Driving licence
Guatemala GTgt_passportResidence permit National ID card Driving licence
Haiti HTht_passportResidence permit National ID card Driving licence
Honduras HNhn_passportResidence permit National ID card Driving licence
Jamaica JMjm_passportResidence permit National ID card Driving licence
Mexico MXmx_passportTarjeta de residente Licencia de conducir INE credencial para votar
Nicaragua NIni_passportResidence permit National ID card Driving licence
Panama PApa_passportResidence permit National ID card Driving licence
Saint Kitts and Nevis KNkn_passportResidence permit National ID card Driving licence
Saint Lucia LClc_passportResidence permit National ID card Driving licence
Saint Vincent and the Grenadines VCvc_passportResidence permit National ID card Driving licence
Trinidad and Tobago TTtt_passportResidence permit National ID card Driving licence
United States USus_passportState identification card Permanent resident card (Green card) Employment authorization card (EAD) U.S. passport card State driver's licence

South America

Supported documents in South America
CountryPassport IDOther documents
Argentina ARar_passportDNI for foreigners DNI Licencia de conducir
Bolivia BObo_passportResidence permit National ID card Driving licence
Brazil BRbr_passportCRNM (migrant registration) Registro Geral (RG / CIN) CNH
Chile CLcl_passportCedula for foreigners Cedula de identidad Licencia de conducir
Colombia COco_passportCedula de extranjeria PPT (temporary protection permit) Cedula de ciudadania Licencia de conduccion
Ecuador ECec_passportCedula for foreigners Cedula de identidad Licencia de conducir
Guyana GYgy_passportResidence permit National ID card Driving licence
Paraguay PYpy_passportResidence permit National ID card Driving licence
Peru PEpe_passportCarne de extranjeria DNI Licencia de conducir
Suriname SRsr_passportResidence permit National ID card Driving licence
Uruguay UYuy_passportResidence card Cedula de identidad Libreta de conducir
Venezuela VEve_passportCedula de identidad Licencia de conducir

Oceania

Supported documents in Oceania
CountryPassport IDOther documents
Australia AUau_passportState photo card Visa (VEVO) / ImmiCard State driver's licence
Fiji FJfj_passportResidence permit National ID card Driving licence
Kiribati KIki_passportResidence permit National ID card Driving licence
Marshall Islands MHmh_passportResidence permit National ID card Driving licence
Micronesia FMfm_passportResidence permit National ID card Driving licence
Nauru NRnr_passportResidence permit National ID card Driving licence
New Zealand NZnz_passport18+ card (Kiwi Access) Resident visa Driver licence
Palau PWpw_passportResidence permit National ID card Driving licence
Papua New Guinea PGpg_passportResidence permit National ID card Driving licence
Samoa WSws_passportResidence permit National ID card Driving licence
Solomon Islands SBsb_passportResidence permit National ID card Driving licence
Tonga TOto_passportResidence permit National ID card Driving licence
Tuvalu TVtv_passportResidence permit National ID card Driving licence
Vanuatu VUvu_passportResidence 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

  1. Sign in to your ZabVerify customer console (your service address, /console/).
  2. Open Access keys and create a key. You get a pair: the access key zapk_… (public) and the secret key zask_… (shown once).
  3. Put the websites that will show the QR in allowed websites, for example https://shop.example.com. For an app add app://com.example.app. An empty list accepts any caller (fine for testing).
  4. 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.

HTML
<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>
JSX
<ZabVerifyProvider accessKey="zapk_..." baseUrl="https://auth.example.com">
  <ZabVerifyView onSuccess={(r) => confirmOnMyServer(r.resultToken)} />
</ZabVerifyProvider>
Dart
ZabVerifyView(
  client: ZabVerifyClient(baseUrl: 'https://auth.example.com', accessKey: 'zapk_...', appId: 'com.example.app'),
  onSuccess: (r) => confirmOnMyServer(r.resultToken),
)
Kotlin
za.verify().collect { e ->
  if (e is VerificationEvent.Success) confirmOnMyServer(e.result.resultToken)
}
Swift
ZabVerifyView(client: za) { result in confirmOnMyServer(result.resultToken) } onFailed: { _ in }
C#
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:

JavaScript
const r = await za.verifyResult(req.body.resultToken);   // throws 'invalid_result' if it is not real
if (r.valid) grantAccess(r.pin);
Python
r = za.verify_result(token)      # raises ZabVerifyError('invalid_result') if it is not real
grant_access(r.pin)
PHP
$r = $za->verifyResult($token);   // throws 'invalid_result' if it is not real
grantAccess($r->pin);
Go
res, err := za.VerifyResult(ctx, token)
if err != nil { /* invalid_result: reject */ }
grantAccess(res.PIN)
Java
ZabVerify.VerifiedResult r = za.verifyResult(token);   // throws 'invalid_result' if it is not real
grantAccess(r.pin);
C#
var r = await za.VerifyResultAsync(body.ResultToken);   // throws 'invalid_result' if it is not real
GrantAccess(r.Pin);
Terminal
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

Quick start
I want to...Do this
Check documents tooStart 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 laterEnrol from your server (purpose: 'enroll' with the secret key), then use verify. See purposes.
Link a document number to a personpins.link(pin, 'nid', number) and pins.lookup('nid', number). See PINs.
Erase a person's datafaces.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

Your page or appZabVerify serverThe person's phoneYour server SDK/v1/face/sessions camera + voicesecret key 1 create a sessionsession_id, poll_token, QR image 2 long poll (waits for changes) 3 the person scans the QR: claiminstructions, photos (one per step) 4 scanned / retry / approved the QR turns green or red 5 the page sends the result token to YOUR server 6 POST /v1/face/results/verify (secret key)valid: true - now it is safe to trust the person
  1. Create. Your page, app or server creates a session. ZabVerify answers with session_id, a poll_token, the verification link (qr_url) and the same link drawn as a QR code (a PNG data URL).
  2. 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.
  3. 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.
  4. 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.
  5. Result. The status becomes approved with a result_token, or rejected, expired or cancelled.

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

How ZabVerify works
Access keySecret key
Looks likezapk_…zask_…
Goes inyour web page or appyour server only
Sent asX-Access-Key headerAuthorization: Bearer header
Canstart human and document checks, poll and cancel its own sessionseverything: confirm results, enrol, read documents, manage PINs, erase data
Locked tothe key's allowed websites (Origin)never usable with an Origin header

Purposes

How ZabVerify works
PurposeWhat the phone doesWho may start it
liveness (default)A human check: a real, live person, no enrolment, nothing compared with anyone.access or secret key
kycPhotographs 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
enrollStores the person's face under your user_id.secret key only
verifyA 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

  1. Register once from your server: create a session with purpose: fingerprint_enroll and the user's id, and show its QR (attachFace). The person scans it and touches the sensor. Needs the secret key.
  2. 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.
  3. 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

JavaScript
ZabVerify.verifyFingerprint({ userId: 'user-42', container: '#qr', onSuccess: (r) => confirmOnMyServer(r.resultToken) });
JavaScript
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');              // erase
Terminal
curl -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

Tested. Checked against a real server: the QR, the phone claim, retries, rejection, expiry, cancellation, the allowed websites rule and the refusal of a secret key. TypeScript definitions are included.
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

HTML
<div id="qr"></div>
<script>var ZABVERIFY_ACCESS_KEY = "zapk_...";</script>
<script src="https://YOUR-ZABVERIFY-HOST/sdk/zabverify.js"></script>
Terminal
npm install @zabsys/verify-web

Quick start

JavaScript
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

Web (JavaScript)
MemberWhat it doesType
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.promiseResolves 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

Web (JavaScript)
OptionMeaning
containerCSS selector or element. Omit it for headless use.
userIdYour own id for the person (required for verifyIdentity).
noteOptional 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.
sizeQR size in px, default 220.
textOverride texts: waiting, scanned, success, failed, expired, tryAgain ...
retryButtonfalse hides the Try again button.
hideLinktrue 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 / onStatusCallbacks. 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/.

Run it
cd sdk/web
ZABVERIFY_URL=https://auth.example.com ZABVERIFY_PK=zapk_... ZABVERIFY_SK=zask_... node examples/server.mjs
# open http://localhost:8000
sdk/web/examples/index.html
sdk/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
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

  1. Create an access key and a secret key in the console (Access keys). The secret key is shown once.
  2. 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.
  3. Use the service address we give you. It is served over HTTPS, which the camera needs.
  4. Confirm every result token on your server with the secret key before you trust it.
  5. 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

Preview. Built on the tested Web SDK. Try the components in your project.
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

Terminal
npm install @zabsys/verify-react @zabsys/verify-web

Quick start

JSX
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

React
MemberWhat it doesType
<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

React
OptionMeaning
purpose'liveness' (default), 'kyc' or 'verify'.
userIdYour own id for the person.
noteOptional 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.
autoStartStart when the component mounts.
textsOverride any string (also the way to translate the widget).
onSuccess / onFailed / onScanned / onRetryCallbacks.

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/.

Run it
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.mjs
sdk/react/examples/vite-app/src/main.jsx
sdk/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
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
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
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

  1. Create an access key and a secret key in the console (Access keys). The secret key is shown once.
  2. 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.
  3. Use the service address we give you. It is served over HTTPS, which the camera needs.
  4. Confirm every result token on your server with the secret key before you trust it.
  5. 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

Tested. Checked against a real server and with widget tests.
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

YAML
dependencies:
  zabverify:
    path: ../path/to/sdk/flutter   # or your package source
Terminal
flutter pub add zabverify --path ../path/to/sdk/flutter

Quick start

Dart
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

Flutter and Dart
MemberWhat it doesType
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.eventsStream of events; a late listener first receives what already happened.Stream<VerificationEvent>
verification.resultCompletes 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
ZabHttpReplace the HTTP transport (proxies, pinning, tests).interface

Options

Flutter and Dart
OptionMeaning
purposeVerificationPurpose.liveness (default), kyc or verify.
appId / originHow an app identifies itself (see the note below).
textsZabVerifyTexts(...) overrides every string, which is also how you translate it.
onOpenLinkShows 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/.

Run it
cd sdk/flutter/example
flutter create .      # once: adds the android/ios/web folders
flutter run
sdk/flutter/example/lib/main.dart
sdk/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
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: true

Before you go live

  1. Create an access key and a secret key in the console (Access keys). The secret key is shown once.
  2. 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.
  3. Use the service address we give you. It is served over HTTPS, which the camera needs.
  4. Confirm every result token on your server with the secret key before you trust it.
  5. 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

Preview. It follows the same behaviour as the Dart SDK, tested against a real server.
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

Kotlin
// settings.gradle.kts
include(":zabverify")
project(":zabverify").projectDir = file("path/to/sdk/android/zabverify")

// app/build.gradle.kts
dependencies { implementation(project(":zabverify")) }

Quick start

Kotlin
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 server

Preview. Build the sample in your project first, and tell us what you see.

API

Android (Kotlin)
MemberWhat it doesType
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

Android (Kotlin)
OptionMeaning
PurposeLIVENESS (default), KYC, VERIFY.
appIdYour 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/.

Run it
cd sdk/android
./gradlew :sample:installDebug      # (create the Gradle wrapper first: gradle wrapper)
# emulator: your computer is http://10.0.2.2
sdk/android/sample/src/main/java/com/zabsys/verify/sample/MainActivity.kt
sdk/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
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

  1. Create an access key and a secret key in the console (Access keys). The secret key is shown once.
  2. 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.
  3. Use the service address we give you. It is served over HTTPS, which the camera needs.
  4. Confirm every result token on your server with the secret key before you trust it.
  5. 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

Preview. It follows the same behaviour as the Dart SDK, tested against a real server.
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

Swift
.package(path: "../path/to/sdk/ios")
// target dependency:
.product(name: "ZabVerify", package: "ios")
File > Add Package Dependencies > Add Local... > choose the sdk/ios folder

Quick start

Swift
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

iOS (Swift)
MemberWhat it doesType
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.qrImageDataThe QR as PNG Data.Data

Options

iOS (Swift)
OptionMeaning
Purpose.liveness (default), .kyc, .verify.
appIdYour bundle identifier; becomes the Origin the key must allow.
TextsEvery 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/.

Run it
# 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
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
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

  1. Create an access key and a secret key in the console (Access keys). The secret key is shown once.
  2. 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.
  3. Use the service address we give you. It is served over HTTPS, which the camera needs.
  4. Confirm every result token on your server with the secret key before you trust it.
  5. 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

Preview. It follows the same behaviour as the Node, Python, PHP, Go, Java and Dart SDKs, tested against a real server.
Requires
.NET 6 or 8. System.Text.Json and HttpClient; Microsoft.Extensions.Http for the DI helper.
Use it for
your backend (secret key) and your apps (access key)

Install

Terminal
dotnet add reference path/to/sdk/dotnet/src/ZabSys.Verify/ZabSys.Verify.csproj
# or, once published:
dotnet add package ZabSys.Verify

Quick start

C#
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

.NET (C#)
MemberWhat it doesType
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 / CancelSessionAsyncRead 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 / FacesServer 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

.NET (C#)
OptionMeaning
BaseUrl / KeyServer address and key.
AppId / OriginApps: sent as Origin: app://<AppId>.
TimeoutOne 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/.

Run it
cd sdk/dotnet/examples/AspNet
set ZABVERIFY__BASEURL=https://auth.example.com
set ZABVERIFY__PUBLICKEY=zapk_...
set ZABVERIFY__SECRETKEY=zask_...
dotnet run
sdk/dotnet/examples/AspNet/Program.cs
sdk/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
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

  1. Create an access key and a secret key in the console (Access keys). The secret key is shown once.
  2. 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.
  3. Use the service address we give you. It is served over HTTPS, which the camera needs.
  4. Confirm every result token on your server with the secret key before you trust it.
  5. Tell people what is stored (pictures are biometric data), and delete what you no longer need.Security and privacy.

Node.js

Confirm results, read documents, manage PINs. Zero dependencies, typed. Server

Tested. Checked against a real server: session create, read, long poll, cancel, the error mapping, a list, an erase, a wrong key and an unreachable 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

Terminal
npm install @zabsys/verify-node

Quick start

JavaScript
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 / cancelled

The 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

Node.js
MemberWhat it doesType
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 / deleteDocument verification records and scans.group
pins.get / lookup / link / unlink / deletePeople and the document numbers linked to them.group
faces.deleteTemplate / deleteIdPrivacy 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

Node.js
OptionMeaning
secretKeyThe zask_ key. Keep it in an environment variable or a secret store.
timeoutMsOne request; long polls add their wait.
fetchCustom 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/.

Run it
cd sdk/node
ZABVERIFY_URL=https://auth.example.com ZABVERIFY_PK=zapk_... ZABVERIFY_SK=zask_... node examples/server.mjs
# open http://localhost:8000
sdk/node/examples/server.mjs
sdk/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

  1. Create an access key and a secret key in the console (Access keys). The secret key is shown once.
  2. Set the key's allowed websites: an empty list accepts any caller, which is fine for testing and flagged in the console.
  3. Use the service address we give you. It is served over HTTPS, which the camera needs.
  4. Confirm every result token on your server with the secret key before you trust it.
  5. 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

Tested. Checked against a real server: session create, read, long poll, cancel, the error mapping, a list, an erase, a wrong key and an unreachable server.
Requires
Python 3.8+. No dependencies.
Use it for
your backend: confirming results, reading documents, managing PINs (secret key, zask_…)

Install

Terminal
pip install ./sdk/python        # from the repository
# or, once published:
pip install zabverify

Quick start

Python
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 / cancelled

The secret key stays on your server. The constructor refuses an access key.

API

Python
MemberWhat it doesType
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 / deleteDocument verification records and scans.group
pins.get / lookup / link / unlink / deletePeople and the document numbers linked to them.group
faces.delete_template / delete_idPrivacy erasure.group

Options

Python
OptionMeaning
secret_keyThe zask_ key; keep it in an environment variable.
timeoutSeconds 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/.

Run it
cd sdk/python
ZABVERIFY_URL=https://auth.example.com ZABVERIFY_PK=zapk_... ZABVERIFY_SK=zask_... python examples/server.py
# open http://localhost:8000
sdk/python/examples/server.py
sdk/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

  1. Create an access key and a secret key in the console (Access keys). The secret key is shown once.
  2. Set the key's allowed websites: an empty list accepts any caller, which is fine for testing and flagged in the console.
  3. Use the service address we give you. It is served over HTTPS, which the camera needs.
  4. Confirm every result token on your server with the secret key before you trust it.
  5. Tell people what is stored (pictures are biometric data), and delete what you no longer need.Security and privacy.

PHP

Typed, readonly classes. Uses curl when present and streams otherwise. Server

Tested. Checked against a real server: session create, read, long poll, cancel, the error mapping, a list, an erase, a wrong key and an unreachable server.
Requires
PHP 8.1+. No dependencies.
Use it for
your backend: confirming results, reading documents, managing PINs (secret key, zask_…)

Install

Terminal
composer require zabsys/verify
# from the repository:
composer config repositories.zabverify path ./sdk/php && composer require zabsys/verify:@dev

Quick start

PHP
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 / cancelled

The secret key stays on your server. The constructor refuses an access key.

API

PHP
MemberWhat it doesType
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->facesDocuments, people and privacy erasure (same calls as the other SDKs).groups

Options

PHP
OptionMeaning
$secretKeyThe zask_ key; keep it out of the web root and out of version control.
$timeoutSeconds 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/.

Run it
cd sdk/php
ZABVERIFY_URL=https://auth.example.com ZABVERIFY_PK=zapk_... ZABVERIFY_SK=zask_... php -S localhost:8000 examples/index.php
sdk/php/examples/index.php
sdk/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

  1. Create an access key and a secret key in the console (Access keys). The secret key is shown once.
  2. Set the key's allowed websites: an empty list accepts any caller, which is fine for testing and flagged in the console.
  3. Use the service address we give you. It is served over HTTPS, which the camera needs.
  4. Confirm every result token on your server with the secret key before you trust it.
  5. Tell people what is stored (pictures are biometric data), and delete what you no longer need.Security and privacy.

Go

Context-aware, concurrency-safe, standard library only. Server

Tested. Checked against a real server: session create, read, long poll, cancel, the error mapping, a list, an erase, a wrong key and an unreachable server.
Requires
Go 1.21+. No dependencies.
Use it for
your backend: confirming results, reading documents, managing PINs (secret key, zask_…)

Install

Terminal
go get github.com/zabsys/zabverify-go

Quick start

Go
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 / cancelled

The secret key stays on your server. New refuses an access key.

API

Go
MemberWhat it doesType
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, FacesDocuments, people and privacy erasure.services
zabverify.IsCode(err, code)Is this a *zabverify.Error with that code?bool

Options

Go
OptionMeaning
secretKeyThe zask_ key; keep it in the environment or a secret manager.
Client.HTTPReplace 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/.

Run it
cd sdk/go
ZABVERIFY_URL=https://auth.example.com ZABVERIFY_PK=zapk_... ZABVERIFY_SK=zask_... go run ./examples/server
sdk/go/examples/server/main.go
sdk/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

  1. Create an access key and a secret key in the console (Access keys). The secret key is shown once.
  2. Set the key's allowed websites: an empty list accepts any caller, which is fine for testing and flagged in the console.
  3. Use the service address we give you. It is served over HTTPS, which the camera needs.
  4. Confirm every result token on your server with the secret key before you trust it.
  5. Tell people what is stored (pictures are biometric data), and delete what you no longer need.Security and privacy.

Java

java.net.http, no dependencies, a small JSON reader included. Server

Tested. Checked against a real server: session create, read, long poll, cancel, the error mapping, a list, an erase, a wrong key and an unreachable server.
Requires
Java 11+. No dependencies.
Use it for
your backend: confirming results, reading documents, managing PINs (secret key, zask_…)

Install

Terminal
javac -d out sdk/java/src/com/zabsys/verify/*.java YourApp.java
java -cp out YourApp

Quick start

Java
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 / cancelled

The secret key stays on your server. The constructor refuses an access key.

API

Java
MemberWhat it doesType
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, facesDocuments, people and privacy erasure.groups

Options

Java
OptionMeaning
secretKeyThe 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/.

Run it
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 Example
sdk/java/examples/Example.java
sdk/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

  1. Create an access key and a secret key in the console (Access keys). The secret key is shown once.
  2. Set the key's allowed websites: an empty list accepts any caller, which is fine for testing and flagged in the console.
  3. Use the service address we give you. It is served over HTTPS, which the camera needs.
  4. Confirm every result token on your server with the secret key before you trust it.
  5. 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

REST API
TopicRule
Base URLhttps://YOUR-ZABVERIFY-HOST: the service address we give you. All endpoints are under /v1.
KeysA 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.
FormatRequests 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).
ErrorsEvery 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 limits429 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.
CORSThe 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.
SecurityCheck 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

REST API
EndpointKeyWhat it does
POST/v1/face/sessionsaccess or secretStart a check, get the QR code
GET/v1/face/sessions/{id}poll token or secretState of a check (long poll)
POST/v1/face/sessions/{id}/cancelpoll token or secretCancel a check
POST/v1/face/results/verifysecretConfirm a result on your server
GET/v1/fingerprint/users/{user_id}secretIs a fingerprint registered
DELETE/v1/fingerprint/users/{user_id}secretForget a user's fingerprint
POST/v1/documents/extractsecretRead a document from pictures
GET/v1/documents/typesany keyDocument ids that can be read
GET/v1/kyc/recordssecretList document verifications
GET/v1/kyc/records/{id}secretOne verification with all data
GET/v1/kyc/records/{id}/image/{side}secretA stored scan
DELETE/v1/kyc/records/{id}secretErase a verification
GET/v1/pins/{pin}secretA person
POST/v1/pins/lookupsecretWho owns a document number
POST/v1/pins/{pin}/identifierssecretLink a number to a person
DELETE/v1/pins/{pin}/identifierssecretUnlink a number
DELETE/v1/pins/{pin}secretForget a person
DELETE/v1/face/templates/{user_id}secretErase a face template
GET/healthznoneIs 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:

REST API
purposeWhat happensKey<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 secretoptional
enrollRegister the person's face.secretrequired
verifyMatch the live face with the enrolled one.access or secretrequired
kycIdentity document, then the live face compared with the photo on it.access or secretoptional
fingerprint_enrollThe person registers a fingerprint (device key, WebAuthn).secretrequired
fingerprintThe person confirms with the registered fingerprint.access or secretrequired

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.

REST API
NameInTypeRequiredDescription
purposebodystringnoOne of the purposes above. Default liveness.
user_idbodystringnoYour id for the person (1–190 characters). Required for enroll, verify, fingerprint, fingerprint_enroll.
notebodystringnoOptional 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.
replacebodybooleannoOverwrite an existing enrolment (enroll, fingerprint_enroll).
identifierbodyobjectno{type, number, link}: start the check for a document number (secret key only). The result then says whether the number belongs to this face.
Terminal
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"}'
Response 201 Created
{
  "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
}
REST API
HTTPerrorWhen
400bad_purpose / bad_user_id / bad_noteUnknown purpose, a required user_id is missing, or the note is longer than 200 characters.
401missing_key / invalid_key / key_disabledNo key, an unknown key, or a revoked or expired key.
403service_disabledFace, fingerprint or document verification is switched off for the account.
403enroll_needs_secret_key / identifier_needs_secret_keyEnrolling, or starting a check for a number, was attempted with an access key.
403origin_not_allowedThe website is not in the access key's allowed origins.
409already_enrolledThe user already has a face or fingerprint: send replace: true.
409face_disabled / nothing_to_verifyThe key has the face check off and no document or fingerprint was configured for it.
409fingerprint_unavailable_ip_addressFingerprints need a host name over HTTPS, not an IP address.
429rate_limited / quota_exceededToo 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.

REST API
NameInTypeRequiredDescription
idpathstringyesThe session_id.
waitqueryintegernoSeconds to wait for a change, 0–25 (default 0).
revqueryintegernoThe rev you last saw; the call returns when the session has a newer one.
Terminal
curl "https://YOUR-ZABVERIFY-HOST/v1/face/sessions/c00265109900c72387a46d197678501a?wait=20&rev=0" \
  -H "X-Poll-Token: 81d3ea15b06efa6bd722d61506e2fe47038b89ffa449f6af"
JSON
{
  "session_id": "c002…",
  "status": "pending",
  "purpose": "liveness",
  "rev": 0,
  "attempts_left": 3,
  "scanned": false,
  "expires_at": "2026-11-20T19:32:22Z"
}
JSON
{
  "session_id": "c002…",
  "status": "scanned",
  "purpose": "liveness",
  "reason": "liveness_failed",
  "rev": 3,
  "attempts_left": 2,
  "scanned": true,
  "expires_at": "2026-11-20T19:32:22Z"
}
JSON
{
  "session_id": "c002…",
  "status": "approved",
  "purpose": "liveness",
  "rev": 5,
  "attempts_left": 3,
  "scanned": true,
  "expires_at": "2026-11-20T19:32:22Z",
  "result_token": "eyJzaWQiOiJjMDAy…"
}
JSON
{
  "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.

REST API
HTTPerrorWhen
401missing_keyNeither a poll token nor a key was sent.
404not_foundNo 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.

Terminal
curl -X POST https://YOUR-ZABVERIFY-HOST/v1/face/sessions/c00265109900c72387a46d197678501a/cancel \
  -H "X-Poll-Token: 81d3ea15…"
Response 200
{
  "session_id": "c002…",
  "status": "cancelled",
  "purpose": "liveness",
  "rev": 2,
  "attempts_left": 3,
  "scanned": false,
  "expires_at": "2026-11-20T19:32:22Z"
}
REST API
HTTPerrorWhen
404not_foundNo 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.

REST API
NameInTypeRequiredDescription
result_tokenbodystringyesThe token from the approved session.
Terminal
curl -X POST https://YOUR-ZABVERIFY-HOST/v1/face/results/verify \
  -H "Authorization: Bearer zask_..." -H "Content-Type: application/json" \
  -d '{"result_token":"eyJzaWQiOiJjMDAy…"}'
JSON
{
  "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
}
JSON
{
  "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"
  }
}
REST API
HTTPerrorWhen
400invalid_resultThe token is invalid, expired (5 minutes), already of another account, or the session is not approved. Reject the verification.
403secret_key_requiredCalled 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?

Terminal
curl https://YOUR-ZABVERIFY-HOST/v1/fingerprint/users/user-42 -H "Authorization: Bearer zask_..."
Response 200
{
  "user_id": "user-42",
  "enrolled": true,
  "devices": [
    {
      "registered_at": "2026-11-01T09:12:44Z",
      "last_used": "2026-11-20T19:31:02Z"
    }
  ]
}
REST API
HTTPerrorWhen
403secret_key_requiredCalled 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).

Terminal
curl -X DELETE https://YOUR-ZABVERIFY-HOST/v1/fingerprint/users/user-42 -H "Authorization: Bearer zask_..."
Response 200
{
  "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.

REST API
NameInTypeRequiredDescription
document_typebody or formstringnoThe document id, for example in_passport, us_passport, us_dl (a driving licence). Send this, or country with kind.
countrybody or formstringnoTwo-letter country code. Alone it means that country's passport.
kindbody or formstringnopassport, driving_licence, national_id or tax_id (with country).
frontbody or formlink, base64 or fileyesThe front (the photo page of a passport).
backbody or formlink, base64 or filenoThe back, for two-sided documents.
Terminal
curl -X POST https://YOUR-ZABVERIFY-HOST/v1/documents/extract \
  -H "Authorization: Bearer zask_..." \
  -F document_type=in_passport -F front=@passport.jpg
Response 200
{
  "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"
  }
}
REST API
HTTPerrorWhen
400bad_document_type / unknown_country / document_not_available / country_mismatch / kind_mismatchThe document cannot be worked out from document_type or country + kind.
400front_required / bad_base64 / bad_image_urlNo front picture, or a picture or link that cannot be understood.
403needs_secret_keyCalled with an access key.
413image_too_large / image_dimensionsA picture is over 8 MB or 30 megapixels.
415unsupported_imageNot a JPEG or PNG picture.
422image_unreadable / image_too_small / image_url_unreachableThe picture is damaged or too small, or the link could not be downloaded.
429rate_limited / quota_exceededToo fast, or the monthly Document API limit is used up.
503document_engine_unavailableThis server has no document engine.

GET/v1/documents/types

Auth: any key

Every document id that can be sent, optionally for one country.

REST API
NameInTypeRequiredDescription
countryquerystringnoA two-letter country code, for example IN.
kindquerystringnopassport, driving_licence, national_id or tax_id.
Terminal
curl "https://YOUR-ZABVERIFY-HOST/v1/documents/types?country=IN" -H "Authorization: Bearer zask_..."
Response 200
{
  "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.

REST API
NameInTypeRequiredDescription
pinquerystringnoOnly the records of this PIN.
Terminal
curl "https://YOUR-ZABVERIFY-HOST/v1/kyc/records?pin=PIN-7K3M9Q" -H "Authorization: Bearer zask_..."
Response 200
{
  "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).

REST API
HTTPerrorWhen
403secret_key_required / service_disabledAn 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.

Terminal
curl https://YOUR-ZABVERIFY-HOST/v1/kyc/records/a1b2c3d4e5f6a7b8c9d0e1f2 -H "Authorization: Bearer zask_..."
Response 200
{
  "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"
    }
  }
}
REST API
HTTPerrorWhen
404not_foundNo 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.

Terminal
curl https://YOUR-ZABVERIFY-HOST/v1/kyc/records/a1b2…/image/front -H "Authorization: Bearer zask_..." -o front.jpg
REST API
HTTPerrorWhen
404not_foundNo such record or picture.

DELETE/v1/kyc/records/{id}

Auth: secret key

Erases the record and its pictures.

Terminal
curl -X DELETE https://YOUR-ZABVERIFY-HOST/v1/kyc/records/a1b2… -H "Authorization: Bearer zask_..."
Response 200
{
  "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.

Terminal
curl https://YOUR-ZABVERIFY-HOST/v1/pins/PIN-7K3M9Q -H "Authorization: Bearer zask_..."
Response 200
{
  "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"
    }
  ]
}
REST API
HTTPerrorWhen
404pin_not_foundNo 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.

REST API
NameInTypeRequiredDescription
typebodystringyesnid, passport, driving_license, other or a built document id.
numberbodystringyesThe document number.
countrybodystringnoTwo-letter country code (passports of other countries).
Terminal
curl -X POST https://YOUR-ZABVERIFY-HOST/v1/pins/lookup -H "Authorization: Bearer zask_..." -H "Content-Type: application/json" \
  -d '{"type":"passport","number":"A01234567"}'
Response 200
{
  "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"
    }
  ]
}
REST API
HTTPerrorWhen
404not_foundNobody owns this number.

POST/v1/pins/{pin}/identifiers

Auth: secret key

Links a document number to the person.

REST API
NameInTypeRequiredDescription
typebodystringyesAs in lookup.
numberbodystringyesThe document number.
countrybodystringnoTwo-letter country code.
Terminal
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"}'
Response 201
{
  "pin": "PIN-7K3M9Q",
  "identifier": {
    "type": "passport",
    "label": "Passport",
    "last4": "4567",
    "country": "US",
    "linked_at": "2026-11-20T19:40:00Z",
    "ref": "8c21aa90e4d1"
  }
}
REST API
HTTPerrorWhen
409identifier_in_useThe number already belongs to another PIN: treat it as a possible duplicate or fraud, do not relink.
400bad_identifier_type / bad_identifierUnknown type, or a number that is not 4–40 letters or digits.
404pin_not_foundNo such PIN.

DELETE/v1/pins/{pin}/identifiers

Auth: secret key

Unlinks a number from the person.

REST API
NameInTypeRequiredDescription
typebodystringyesAs in lookup.
numberbodystringyesThe number to unlink.
Terminal
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"}'
Response 200
{
  "deleted": true
}
REST API
HTTPerrorWhen
404not_foundThat 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.

Terminal
curl -X DELETE https://YOUR-ZABVERIFY-HOST/v1/pins/PIN-7K3M9Q -H "Authorization: Bearer zask_..."
Response 200
{
  "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).

Terminal
curl -X DELETE https://YOUR-ZABVERIFY-HOST/v1/face/templates/user-42 -H "Authorization: Bearer zask_..."
Response 200
{
  "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.

Terminal
curl https://YOUR-ZABVERIFY-HOST/healthz
Response 200
{
  "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).

Server side only. The call needs the secret key (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

Document API
Name the documentHow
By iddocument_type: the id of the document, for example in_passport, us_passport, us_dl (list below).
By country and kindcountry (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.
BothAllowed; 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:

Document API
WayHowLimit
LinkJSON "front": "https://…/passport.jpg" or {"url": "…"}; form field front_url.Public http or https address, answered within 15 seconds.
Uploadmultipart/form-data with the files front and back (the field image also means the front).8 MB per picture, 20 MB per request.
Base64JSON "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.

Terminal
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"}'
Terminal
curl -X POST https://YOUR-ZABVERIFY-HOST/v1/documents/extract \
  -H "Authorization: Bearer zask_..." \
  -F document_type=us_passport -F front=@passport.jpg
Terminal
B64=$(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\"}}"
Python
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 there
JavaScript
import 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
<?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"];
Links are fetched by ZabVerify, from the internet. To protect your own network a link must be a public address: addresses on this server, on a private network (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.

JSON
{
  "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": {}
  }
}
JSON
{
  "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

Document API
statusMeaning
okEverything a document of this kind is expected to give was read (missing_fields is empty).
partialSomething was read, something was not. missing_fields names the gaps; use the rest.
unreadableNothing 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

Document API
FieldContent
full_nameThe name as one string. For a passport without a printed full name it is given names + surname.
given_names, surnameThe two parts of a passport name (from the machine readable lines).
name_localThe name in the country's own script (Hindi, for example), read when the language reader is installed.
father_name, mother_name, spouse_name, relative_nameAs printed on the document.
date_of_birthYYYY-MM-DD when the document gave a full date (passports always do), otherwise as printed.
year_of_birthOnly when the document prints just a year (for example some Aadhaar cards).
sexMALE, FEMALE or the value as read.
blood_group, nationality, place_of_birth, care_ofAs read. A passport's nationality is the three letter code (IND).

document_data and address

Document API
FieldContent
numberThe document number: passport number, National ID, licence number, Aadhaar (masked), PAN ...
issue_date, expiry_dateYYYY-MM-DD for a passport, otherwise as read.
issuing_country, place_of_issue, issuing_authorityAs read. issuing_country of a passport is the three letter code.
holder_type, personal_number, document_code, file_numberOnly some documents have them; otherwise an empty string.
categoriesA 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

Document API
FieldValues
checks.machine_readable_zonevalid (every check digit of a passport's two bottom lines holds), invalid, or not_applicable (not a passport).
checks.expiryvalid, expired or unknown (no readable expiry date).
checks.photo_found, checks.code_readtrue/false: a holder photo was found on the front; a barcode or QR code was found and decoded.
checks.issuer_verificationAlways not_performed: see below.
quality.issuesPicture problems the reader noticed (blurry, glare, too_dark, low_resolution, card_not_found, mrz_unreadable …). An empty list is good.
rawWhat 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.

Terminal
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.jpg

All 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:

Terminal
curl https://YOUR-ZABVERIFY-HOST/v1/documents/types?country=IN -H "Authorization: Bearer zask_..."
JSON
{
  "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": "…"}.

Document API
HTTPCodeMeaning
400bad_document_type / unknown_country / document_not_available / country_mismatch / kind_mismatchThe 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.
400front_required / bad_image / bad_base64 / bad_image_url / bad_uploadNo front picture, or a picture/link that cannot be understood.
401missing_key / invalid_key / key_disabledSee Errors.
403needs_secret_keyThe call came with an access key. Use the secret key, from your server.
403service_disabledDocument verification is switched off for the account.
413image_too_large / too_large / image_dimensionsA 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.
422image_unreadable / image_too_smallThe picture is damaged, or smaller than 64 x 64 pixels.
415unsupported_imageNot 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).
422image_url_unreachableThe link could not be downloaded (not public, answered an error, too slow).
429rate_limitedToo many documents with this key: wait a second and retry (Retry-After).
502engine_errorThe reader failed on this picture. Retry once; then use another picture.
503document_engine_unavailableThis 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 curl command.
  • 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.
Document API
History keepsHistory 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):

Document API
ProtectionWhat it means
Real pictures onlyThe 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 forwardedThe 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 earlyA 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 executedPictures 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 networkOnly 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 inertText 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, rateServer-side secret key only, a monthly limit and a per-second rate per key, so the endpoint cannot be used to flood the engine.
This is not an antivirus. Pictures are never stored or opened by anything but the decoder, but if you keep the original files yourself, scan them as you would any upload.

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_verification says not_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.

Errors
CodeHTTPMeaningWhat to do
invalid_result400The result token is invalid, expired (5 minutes) or belongs to another account.Reject the verification. Never retry the same token.
invalid_key401Unknown access key or secret key.Check the key and the server address; keys are shown once at creation.
missing_key401No key was sent.Send X-Access-Key (browser/app) or Authorization: Bearer (server).
key_disabled401The key is revoked or expired.Create a new key in the console.
customer_disabled403The account is disabled.Contact the ZabVerify administrator.
service_disabled403The service (human check or documents) is not enabled for the account.Switch the service on for the customer in the console.
origin_not_allowed403The 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_browser403A secret key arrived with an Origin header.Use the access key in browsers and apps; the secret key only on servers.
secret_key_required403A server-only call was made with an access key.Make the call from your server with the secret key.
enroll_needs_secret_key403Enrolment must be started from your server.Create the session with the secret key and show it with attachFace.
quota_exceeded429The 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_key403The 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_unreachable415 / 422A 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_instructions403No face-check instruction is enabled for the key.Enable at least one in the console.
not_found / pin_not_found404No such session, record, picture, PIN or number.Check the id. pins.lookup uses this for "nobody owns this number".
already_claimed409The QR was already opened on another phone.Create a new session.
identifier_in_use409A document number is already linked to another PIN.Treat as a possible duplicate or fraud; do not relink.
fingerprint_unavailable_ip_address409Passkeys 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_failedreasonThe 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_enrolled409That user already has a face enrolled.Send replace: true to overwrite.
rate_limited429Too many requests or sessions for the key.Back off and retry (the SDKs do so for polling).
engine_error503The 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

  1. Store it in an environment variable or a secret manager. Never in a web page, an app bundle, a repository or a log.
  2. Rotate it by creating a new key and revoking the old one in the console.
  3. Every server SDK refuses an access key; every client SDK refuses a secret key; the server refuses a secret key that arrives with an Origin header.

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.

Security and privacy
Where the address could leakWhat 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 requestsUse 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' linkThe 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 logsDo 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.

JavaScript
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
}));
HTML
<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>
Protect the proxy like any other endpoint of yours. Whoever can reach /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

Security and privacy
DataHowRetention
Face template (only for enrolled users)encrypteduntil you erase it (faces.deleteTemplate)
Pictures of each attempt (one per instruction)sealed with AES-GCM; visible only to your account and the platform administratoruntil you delete them, or the service's retention period ends
Log lines of each attemptdatabase rowsas long as the service keeps them
Document numberskeyed hash per customer and type, plus the last four charactersuntil the PIN is erased
Document scans and extracted datasealed; shown in the console and via the API to the secret keyuntil 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

Security and privacy
To eraseCall
One user's face template and logged picturesfaces.deleteTemplate(userId)
A person: face data and every linked numberpins.delete(pin)
A document recordkyc.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.

Platform status
SDKRoleStatus
Web (JavaScript)App / browserTested
ReactApp / browserPreview
Flutter and DartApp / browserTested
Android (Kotlin)App / browserPreview
iOS (Swift)App / browserPreview
.NET (C#)App / browserServerPreview
Node.jsServerTested
PythonServerTested
PHPServerTested
GoServerTested
JavaServerTested

Want ZabVerify for your app?

Tell us your platform and what you want to build, and we will set up your access.