Web integration
Integrate face liveness verification into a web app or backend using the iLive REST API.
Integrate face liveness verification into your web application or backend service using the iLive API. All inference runs on iLive's servers — your app just creates a session, sends the user to verify, and reads back the result.
Architecture overview
Two integration modes
| Mode | Best for | How it works |
|---|---|---|
| Managed session (server-to-server) | KYC flows, onboarding, identity verification | Your backend creates a session, gets a URL, redirects the user to it. User completes verification. iLive redirects back and calls your webhook. |
| Direct session (client-side) | Standalone apps, demos, testing | Your frontend creates the session directly via the API. No server-side integration needed. |
Quick start: managed session (recommended)
Step 1: Create a session (your backend)
From your server, create a managed session:
Response:
Step 2: Redirect the user to the verification URL
Send the user to session_url. They'll see the iLive verification UI.
Step 3: User completes verification
The user sees:
- Welcome screen with instructions
- Camera access request
- Face guide overlay (position face in oval)
- Liveness challenges (blink, turn head, smile)
- "Analyzing..." spinner
- Result screen (pass / fail / retry)
After completion, iLive:
- Redirects the user to your
redirect_urlwith the session ID as a query parameter - Calls your
webhook_url(if provided) with the result
Step 4: Fetch the result (your backend)
After the user is redirected back, fetch the verification result:
Response:
Step 5: Download the ICAO photo
If the verdict is pass, download the passport-quality photo:
Returns a 480×600 JPEG (ICAO-compliant passport photo dimensions).
Integration examples
Full backend examples for creating a session and retrieving the result:
Webhook handler
When you provide a webhook_url, iLive POSTs the result when the session
completes:
Quick start: direct session (client-side only)
For demos or standalone apps, skip the managed session flow:
API reference
POST /api/v1/managed-session
Create a server-managed verification session.
Headers: Authorization: Bearer <API_KEY>
Request:
Response:
POST /api/v1/session
Create a direct session (no API key required).
Request:
Response:
GET /api/v1/session/{id}/result?token=TOKEN
Get the verification result.
Response:
verdict | Meaning |
|---|---|
"pass" | User is a live person. Confidence ≥ 70%. |
"fail" | Liveness check failed. Possible spoof or deepfake. |
"retry" | Inconclusive. Confidence between 45–70%. User should try again. |
GET /api/v1/session/{id}/photo?token=TOKEN
Download the ICAO passport photo (480×600 JPEG). Only available when
the verdict is pass.
Returns: image/jpeg, or 202 Accepted (still processing).
Passive mode
For a frictionless experience, create a session in passive mode — the user just faces the camera for three seconds with no challenges:
The verification flow is otherwise identical — redirect the user to the session URL. They'll see a brief camera check with no challenges. The verdict webhook uses the same format.
Passive mode uses the same anti-spoof, deepfake, face-consistency, and motion analysis as active mode. The only difference is no interactive challenges, making it faster and lower-friction.
| Feature | Active mode | Passive mode |
|---|---|---|
| User interaction | 3–6 challenges (blink, turn, etc.) | Just hold still for 3 seconds |
| Verification layers | 5 (including challenges) | 4 (no challenges) |
| Best for | High-security, regulatory compliance | Low-friction onboarding, repeat verification |
| Default | Yes | Set mode: "passive" |
Face comparison
Compare two faces server-side:
Compare against a verified liveness session:
Security considerations
Always use HTTPS in production. Set a managed-session API key to prevent
unauthorized session creation, and ensure redirect_url and
webhook_url are HTTPS URLs under your control.
- Always use HTTPS in production.
- Set an API key on your managed-session endpoint to prevent unauthorized session creation.
- Validate
redirect_url— the API rejects internal / private IPs to prevent SSRF. - Webhook URLs must be HTTPS — HTTP webhook URLs are rejected.
- Session tokens are single-use — each session gets a unique token for result retrieval.
- Enable rate limiting in production to prevent abuse.
- Enable CAPTCHA for public-facing deployments.
WebSocket protocol
For real-time frame processing (used by the built-in frontend):
Client sends: JPEG frame bytes (binary message, max 1.5 MB)
Server sends: JSON messages:
Troubleshooting
502 Bad Gateway: Backend hasn't started yet. Retry in a few seconds.
Camera not working: Browsers require HTTPS (or localhost) for camera
access. Serving over plain HTTP will block the camera prompt.
"Session not found" on result fetch: The session may have expired. The default TTL for managed sessions is 30 minutes.
Low confidence scores: Check lighting conditions. Verification performs best with even, front-facing illumination.