Authentication
API keys, bearer tokens, and the dual-auth model
Every Vlens API request requires two credentials:
Token types
Admin token
Used for service-to-service calls and management operations. Obtained by calling /api/credentials/Login with your admin credentials.
Response:
Lifetime: 24 hours. Use the refreshToken to get a new access token before it expires.
User token
Returned by the registration and login flows. Used for all user-scoped operations (identity verification, business request creation, contract signing).
User tokens are returned in the data.accessToken field of /api/DigitalIdentity/Register and other user-facing endpoints.
User token via OAuth (Google / Microsoft)
Users can authenticate using an existing Google or Microsoft account. The OAuth token from the provider is verified by Vlens, and the resulting oAuthTokenVerificationRequestId is passed to /Register to skip the email verification step.
OAuth provider setup is configured in the Vlens portal. See the Google Cloud Platform Console and Azure AD B2C documentation for creating OAuth client credentials.
API-key-only (public endpoints)
Some endpoints require only the ApiKey header and no bearer token. These are public registration endpoints:
POST /api/DigitalIdentity/CheckExistenceOfEmailOrPhonePOST /api/DigitalIdentity/Register/StepVerifyPhonePOST /api/DigitalIdentity/Register/StepVerifyEmailPOST /api/DigitalIdentity/Register/StepVerifyOAuthTokenPOST /api/DigitalIdentity/VerifyOAuthTokenPOST /api/DigitalIdentity/RegisterPOST /api/DigitalIdentity/Register/StepCreatePOST /api/DigitalIdentity/GenerateRegisterLinkPOST /api/DigitalIdentity/GenerateLoginLinkPOST /api/DigitalIdentity/RefreshTokenPOST /api/DigitalIdentity/ForgetPassword/SendEmailOtpPOST /api/DigitalIdentity/ForgetPassword/SendEmailOtpV2POST /api/DigitalIdentity/ForgetPasswordByPhone/SendPhoneOtpPOST /api/IdentityUserSession/CreateAuthSession
Refreshing tokens
Admin token
Use the refresh token from /api/credentials/Login to get a new admin access token without re-authenticating. Refresh tokens expire after 7 days.
User token
User refresh and logout flows are documented in User Profile.
Rotate refresh tokens server-side and never expose them in client-side code or mobile apps.
Request headers
A complete request with both credentials looks like this:
Multi-tenant context
Vlens is multi-tenant. Your ApiKey is scoped to your tenant — you cannot access another tenant’s data. Admin tokens issued by /api/credentials/Login are also tenant-scoped.
When using the admin login endpoint, pass your TenancyName in both the request body (tenancyName field) and as a header.
Security best practices
- Store
ApiKeyand admin credentials server-side only — never in client-side code or mobile apps. - For mobile apps, use one of the native SDKs (Android, iOS, Flutter, React Native) — they handle token management securely without exposing the API key in the app bundle.
- For web / frontend integrations, use the Iframe Integration flow, which lets the server issue session tokens instead of exposing the API key.
- Rotate your
ApiKeyfrom the dashboard if you suspect it has been compromised. - User tokens can be stored client-side (they are scoped to a single user with limited permissions).

