User Profile
Login, token refresh, and account management — email, phone, and password
This page covers all user-facing account management flows: login (with OTP), token refresh, email and phone updates, password change, and password reset.
Registration paths
Vlens has two separate registration flows. Choose one per user based on CheckExistenceOfEmailOrPhone:
Do not combine steps from both flows (for example, do not call verify/id/front after a CDI StepCreate).
Standard registration flow
Phone OTP → optional email OTP → StepCreate → then ID scan and liveness on the Digital Identity page. Login only repeats the phone OTP step afterward.
This diagram is the standard path only. If CheckExistenceOfEmailOrPhone returns hasCDI: true, stop here and follow Consent-based Digital Identity (CDI) instead — no verify/* steps afterward.
After standard registration, login does not repeat the ID or liveness steps. The user only enters phone + password and validates the SMS OTP.
Login
Login calls the same endpoint twice — first to trigger the OTP SMS, then to validate it and receive tokens.
Step 1 — Submit credentials (triggers SMS OTP)
Save data.phoneNumberOtpRequestId from the response.
Step 2 — Validate OTP and receive tokens
Response:
smsProviders values: 0 = default, 1 = Infobip, 2 = Vodafone, 3 = Cequens, 4 = Victory Link, 5 = BroadNet, 6 = Ezagel, 7 = Orange.
Hosted registration and login links
When you do not want to build a registration or login UI, generate a signed Vlens web URL server-side and redirect the user to it. This is a browser redirect flow — not the same as Iframe Integration and not related to linking a pre-login transaction.
Both accept optional phoneNumber, email, latitude, longitude, imei, and returnUrl. The response data field is the URL to open in a browser.
Refresh token
User token
Admin token
Both return data.accessToken and data.refreshToken.
Log out
Invalidate the current user session. Requires ApiKey and a user bearer token.
Update email
Step 1 — Request email OTP
Save data.emailOtpRequestId from the response.
Step 2 — Validate OTP
Verify email (post-registration)
If email verification was skipped during registration (skipEmail: true), the user can verify later.
Step 1 — Request email OTP
Save data.emailOtpRequestId.
Step 2 — Validate OTP
Update phone number
Changing a phone number requires liveness re-validation before the OTP is sent.
To let a user change their number through an invitation link or an embedded session instead, see Change Phone Number Session.
Step 1 — Send OTP to new number
Save data.phoneNumberOtpRequestId.
Step 2 — Re-validate liveness (if required)
If the response indicates liveness re-validation is needed:
Save the new data.phoneNumberOtpRequestId from this response.
Step 3 — Validate OTP
By default the phone number is updated as soon as the OTP validates. To defer the actual change — for example, so an admin can review it first — send "deferCommit": true in this request. The response then returns data.isCommitPending: true instead of updating the number immediately, and you need step 4 below.
Step 4 — Commit the change (admin, only if deferred)
Only needed when step 3 was called with deferCommit: true. Requires an authorized admin access token.
Use the same phoneNumberOtpRequestId from step 3. VLens re-validates the OTP request and the user’s Digital Identity before applying the new phone number.
Change password
Changing the current password sends an OTP to the registered email to confirm the change.
Step 1 — Request password change
Save data.emailOtpRequestId.
Step 2 — Validate OTP and confirm change
Reset password
V2 variants (SendEmailOtpV2, ValidateEmailOtpV2, ValidatePhoneOtpV2, ResetV2) follow the same steps with updated validation rules.
Via email + phone (4 steps)
Step 1 — Send OTP to email
Save data.emailOtpRequestId.
Step 2 — Validate email OTP (triggers phone OTP)
Save data.phoneNumberOtpRequestId.
Step 3 — Validate phone OTP
Save data.userId and data.passwordResetCode.
Step 4 — Set new password
Via phone only (3 steps)
Step 1 — Send OTP to phone
Save data.phoneNumberOtpRequestId.
Step 2 — Validate phone OTP
Save data.userId and data.passwordResetCode.
Step 3 — Set new password

