Iframe Integration
The Identity User Session API lets you embed the complete Vlens verification and contracting UX inside your own application using an iframe or WebView — without exposing your ApiKey or admin credentials to the client.
Sessions are device-bound and user-bound. Each session is tied to a single device (via RSA public key) and expires after 30 minutes. A device is identified by its public key — store generated key pairs securely to avoid repeated mobile verification at each login.
How it works
- Your server calls Vlens with the user’s phone/email and session config
- The server passes
sessionStartingPathto the client app - The client loads the Vlens iframe at
<tenancy_name>-onboarding.vlenseg.com/<sessionStartingPath> - The user completes registration, KYC, and/or contract signing
- Your app receives completion events via
postMessage
Create Auth Session
A session that guides the user through whatever steps are needed based on their current state. Requires only ApiKey — no admin token.
Request fields
Response
sessionStartingPath is the path to append to your tenant’s base URL. If null, no session was created.
Create Invitation Session
A session with pre-filled data and an invitation notification (SMS or email) sent to the user. Requires admin bearer token + ApiKey.
Use this when you have already collected the customer’s information and want to minimize the steps they must complete.
smsProvider controls which SMS gateway sends the invitation. 0 = default from tenant settings.
Invitation links are short-lived (10 minutes) but the session itself lasts 30 minutes from when the user opens it. The link acts as a one-time OTP:
- Sent via SMS → no mobile verification required at login or registration
- Sent via email → no email verification required at registration
Change Phone Number Session
A session in which an existing user changes their registered phone number. It is loaded in the iframe the same way as the sessions above.
- Invitation —
POST /api/ChangePhoneNumberSession/CreateInvitationemails the user an invitation link. Requires an admin bearer token with the Change Phone Number Invitation permission, and the user’s email must be confirmed. Admins can also send it from the portal’s Users page. - Session —
POST /api/ChangePhoneNumberSession/CreateSessionreturns asessionStartingPathto load in the iframe, likeCreateAuthSession.UserPublicKeyis required. - The user confirms the new number with an SMS code (
SendOtp, thenVerifyOtp). - Users with a verified digital identity must also pass a face match against their stored biometric data (
ValidateFaceMatch). For other users, phone ownership is checked and the number is updated right after the OTP is verified. - The new number can’t be the same as the current number.
The invitation email has English and Arabic templates. To send the invitation from the portal, see Users & invitations.
Loading the iframe
Concatenate sessionStartingPath to your tenant’s base URL:
The allow="camera; microphone" attribute is required for liveness detection to work in the browser.
postMessage integration
The iframe communicates with the parent app via window.postMessage. This is required for device-bound signing — the parent app holds the private key.
Iframe → Parent (signing request):
Parent → Iframe (signing response):
Key storage
The private key must never leave the device. Store it using each platform’s secure enclave:
Security features
Every session request includes three layers of protection:
Session permissions reference
Prevent new request on rejection
Set sessionPermissions.preventNewRequestOnRejection: true when you create the session or the invitation. Inside the iframe:
- The user can’t start a new request for a contract type that was previously rejected for them.
- Rejected requests no longer count as signed contracts.
- If every allowed contract type is already signed or rejected, the session is treated as fulfilled.
The option is shown in the invitation and session details in the portal. To set it from the portal, see Users & invitations.
Web app (no-code access)
Users can access the Vlens web app directly at:
No developer configuration is required. The web app manages keys and sessions securely — each browser is treated as a separate device with its own key pair.
To restrict access to invited users only, enable Invitation Only in the portal under Feature Control → Main Feature.
When to use each flow
Session API endpoints
Your server creates the session with CreateAuthSession or CreateInvitation. The embedded iframe then calls the endpoints below (you do not call these directly from your backend in most integrations).
For the native API equivalents (outside the iframe), see Digital Identity and E-Contracting. To associate a pre-login OCR transaction with a user after native login, see Link an existing transaction — that flow does not apply inside an iframe session.

