1
2
3
# 1. Your backend mints a short-lived token for the browser (API key stays on your server) curl -X POST https://YOUR-FACEID-HOST/api/client-tokens \ -H "X-API-Key: $FACEID_API_KEY" \ -H "Content-Type: application/json" \ -d '{"scopes": ["liveness"], "ttlS": 600}' # → {"token": "fct_…", "expiresAt": …} pass the token to your page
<!-- 2. Drop the component into your page --> <script type="module" src="https://YOUR-FACEID-HOST/sdk/faceid.js"></script> <faceid-liveness token="fct_…" locale="ar"></faceid-liveness> <script> document.querySelector("faceid-liveness") .addEventListener("faceid-complete", (e) => { // send only the session id to your backend fetch("/my-backend/verify", { method: "POST", body: JSON.stringify({ sessionId: e.detail.sessionId }) }); }); </script>
# 3. Your backend reads the verdict — never trust the browser's copy import requests r = requests.get( f"https://YOUR-FACEID-HOST/api/liveness/sessions/{session_id}", headers={"X-API-Key": FACEID_API_KEY}, timeout=10) verdict = r.json() if verdict["status"] == "passed": approve_user() else: ask_to_retry(verdict["result"]["reasons"])
// Enrol once, then search or verify (Node.js 18+) const H = { "X-API-Key": process.env.FACEID_API_KEY }; const base = "https://YOUR-FACEID-HOST/api"; const person = await (await fetch(`${base}/persons`, { method: "POST", headers: { ...H, "Content-Type": "application/json" }, body: JSON.stringify({ name: "Customer 1042" }) })).json(); const form = new FormData(); form.append("image", new Blob([photoBytes]), "selfie.jpg"); await fetch(`${base}/persons/${person.id}/faces`, { method: "POST", headers: H, body: form }); // later: is this the same person? const v = await (await fetch(`${base}/persons/${person.id}/verify`, { method: "POST", headers: H, body: newSelfieForm })).json(); console.log(v.isMatch, v.similarity);
// Android (Kotlin): liveness, then the ID card front + back, then the chip val cfg = FaceId.Config(apiBase = "https://YOUR-HOST", token = tokenFromYourBackend, locale = "ar") val liveness = registerForActivityResult(FaceId.Liveness()) { r -> sessionId = r.sessionId } val idCard = registerForActivityResult(FaceId.Document()) { r -> sendToBackend(r.documentId) } val chip = registerForActivityResult(FaceId.Nfc()) { r -> check(r.integrity == true) } liveness.launch(cfg) idCard.launch(FaceId.DocumentRequest(cfg, "id_card", captureBack = true, livenessSessionId = sessionId)) chip.launch(FaceId.NfcRequest(can = "123456")) // the 6 digits printed on the card
POST /api/match | |
POST /api/detect | |
POST /api/persons | |
POST /api/persons/{id}/faces | |
POST /api/persons/{id}/verify | |
POST /api/search | |
POST /api/groups | |
POST /api/client-tokens | |
POST /api/liveness/sessions | |
GET /api/liveness/sessions/{id} | |
GET /api/audit |