Digital Identity

Verify users via national ID scanning and liveness detection
View as Markdown

Digital Identity (DI) verification confirms that your users are who they say they are. Vlens performs OCR on the Egyptian national ID (front + back), runs liveness detection using three face images, and optionally validates against NTRA and CSO authority databases.

This page covers the standard KYC path: ID capture and liveness after standard registration. For users with hasCDI: true, use the separate Consent-based Digital Identity (CDI) product — no steps on this page apply to them.


Concepts

Validation vs. verification

Not verified

The user has not yet completed ID scanning and liveness, or one of the steps failed. isDigitalIdentityVerified: false

Verified

All three capture steps passed, and any required authority checks (NTRA / CSO) also passed. isDigitalIdentityVerified: true

Whether NTRA and CSO checks are required depends on your tenant configuration. If both are disabled, a user is marked Verified as soon as all three capture steps pass.

Verification flow (standard registration)

After standard Register/StepCreate, the user has a token but isDigitalIdentityVerified is false until the three capture steps below complete. CDI users do not follow this path.

Both standard registration and login give you a user accessToken. The ID and liveness steps apply whenever the user is not yet verified.

You may submit id/front and id/back in any order, but both must complete before liveness.


Prerequisites (standard verification)

The user must complete standard registration before calling the verify/* endpoints below. Register/StepCreate returns a user access token — use it as Authorization: Bearer <token> for all verification calls.

CDI users are already verified at StepCreate and should not call verify/id/front, verify/id/back, or verify/liveness/multi.

See User Profile — Standard registration or the Quick Start for registration steps.


Step 1 — Scan ID front

transaction_id is optional. You may generate your own UUID and send it, or omit it and let the server generate one. Either way, the server always returns transaction_id in the response — save data.transaction_id and pass it to steps 2 and 3.

$curl -X POST https://api.vlenseg.com/api/DigitalIdentity/verify/id/front \
> -H "ApiKey: YOUR_API_KEY" \
> -H "Authorization: Bearer USER_TOKEN" \
> -H "Content-Type: application/json" \
> -d '{
> "transaction_id": "YOUR_UUID",
> "image": "BASE64_ID_FRONT_IMAGE",
> "getExtractedData": false
> }'

data.transaction_id is always returned by the server — save it and pass it to steps 2 and 3.

Fields extracted from the front:

FieldDescription
nameFull Arabic name
firstName / lastNameArabic name components
nameEnglishTransliterated full name
firstNameEnglish / lastNamesEnglishTransliterated name components
idNumberNational ID number
idKeyID key
dateOfBirthDate of birth
genderGender
govern / governEnglishGovernorate
address / addressEnglishFull address
address1 / address2Address line components
city / districtCity and district

Step 2 — Scan ID back

$curl -X POST https://api.vlenseg.com/api/DigitalIdentity/verify/id/back \
> -H "ApiKey: YOUR_API_KEY" \
> -H "Authorization: Bearer USER_TOKEN" \
> -H "Content-Type: application/json" \
> -d '{
> "image": "BASE64_ID_BACK_IMAGE",
> "transaction_id": "TRANSACTION_ID"
> }'

Additional fields from the back:

FieldDescription
maritalStatusMarital status
job / jobTitleOccupation
religionReligion
idExpiryID expiry date
releaseDateID issue date

Step 3 — Liveness detection

All three images must be captured within 0.5 seconds of each other. Identical images or images captured too far apart will fail the liveness check. Compress each image to under 500 KB for best performance.

$curl -X POST https://api.vlenseg.com/api/DigitalIdentity/verify/liveness/multi \
> -H "ApiKey: YOUR_API_KEY" \
> -H "Authorization: Bearer USER_TOKEN" \
> -H "Content-Type: application/json" \
> -d '{
> "transaction_id": "TRANSACTION_ID",
> "face_1": "BASE64_FACE_1",
> "face_2": "BASE64_FACE_2",
> "face_3": "BASE64_FACE_3"
> }'

Success response:

1{
2 "data": {
3 "isDigitalIdentityVerified": true,
4 "user": { "idNumber": "29901234567890" }
5 },
6 "services": {
7 "liveness": true,
8 "spoofing": { "fake": false },
9 "SRC": { "isValid": true },
10 "AML": { "AML_matched": false }
11 },
12 "error_code": null
13}

If your app captures the national ID before the user logs in (using API-key-only calls), you can link the completed transaction to the user after login instead of repeating the capture flow.

This is a native API pattern for mobile or custom integrations where your app calls /verify/* or /v1/ocr/* before the user has a token. It is not used with Iframe Integration (IdentityUserSession/*) or hosted web URLs (GenerateRegisterLink / GenerateLoginLink).

$curl -X POST https://api.vlenseg.com/api/DigitalIdentity/LinkUserWithExistingTransaction \
> -H "ApiKey: YOUR_API_KEY" \
> -H "Authorization: Bearer USER_TOKEN" \
> -H "Content-Type: application/json" \
> -d '{
> "transactionId": "EXISTING_TRANSACTION_ID",
> "getExtractedData": true
> }'

When to use this: The client performs OCR using only the ApiKey while the user is not yet authenticated. After login, call this endpoint to associate the completed verification with the user’s account — no re-capture needed.


Backend verification services

Each response includes a services object with results from the backend checks:

ServiceFieldWhat it checks
Spoofingservices.spoofing.fakeWhether the document is a photocopy or digital reproduction
Classificationservices.classification.doc_typeDocument type detection
Livenessservices.livenessWhether the face images passed liveness detection
AMLservices.AML.AML_matchedWhether the user is on an AML watchlist
SRCservices.SRC.isValidWhether the ID validates against the national registry

Delete user account

Authenticated users can permanently delete their VLens account through a three-step flow: initiate deletion, verify OTP, and submit a face match. This removes the user and their digital identity data from your tenant.

Deletion is only available when the user has no signed contracts. If the user has completed any e-contract signing, the API rejects the deletion request.

All steps require ApiKey and a user bearer token.

StepEndpointPurpose
1POST /api/DigitalIdentity/InitiateDeletionStart deletion and send OTP
2POST /api/DigitalIdentity/VerifyDeletionOtpValidate OTP (otpRequestId, otpCode)
3POST /api/DigitalIdentity/SubmitDeletionFaceMatchSubmit selfie for face match (if required)

Step 1 — Initiate deletion

No request body. Returns otpRequestId for the next steps.

$curl -X POST https://api.vlenseg.com/api/DigitalIdentity/InitiateDeletion \
> -H "ApiKey: YOUR_API_KEY" \
> -H "Authorization: Bearer USER_TOKEN" \
> -H "Content-Type: application/json"

Step 2 — Verify deletion OTP

$curl -X POST https://api.vlenseg.com/api/DigitalIdentity/VerifyDeletionOtp \
> -H "ApiKey: YOUR_API_KEY" \
> -H "Authorization: Bearer USER_TOKEN" \
> -H "Content-Type: application/json" \
> -d '{
> "otpRequestId": "OTP_REQUEST_ID",
> "otpCode": "123456"
> }'

If isUserDeleted is true, the account is deleted and no further steps are needed.

Step 3 — Submit face match

Required when OTP verification alone does not complete deletion. Submit a base64-encoded selfie matched against the identity on file.

$curl -X POST https://api.vlenseg.com/api/DigitalIdentity/SubmitDeletionFaceMatch \
> -H "ApiKey: YOUR_API_KEY" \
> -H "Authorization: Bearer USER_TOKEN" \
> -H "Content-Type: application/json" \
> -d '{
> "otpRequestId": "OTP_REQUEST_ID",
> "image": "BASE64_SELFIE"
> }'

Admin — list deletion audits

Admins can query deletion audit records for compliance and support.

$curl "https://api.vlenseg.com/api/DigitalIdentity/GetListOfUserDeletionAudits?MaxResultCount=10&SkipCount=0" \
> -H "ApiKey: YOUR_API_KEY" \
> -H "Authorization: Bearer ADMIN_TOKEN"

Cancel verified digital identity

Revoke a user’s verified digital identity status. After cancellation, isDigitalIdentityVerified returns false and the user must complete the verification flow again before signing e-contracts.

EndpointCallerAuth
POST /api/DigitalIdentity/CancelVerifiedDigitalIdentityUser (self)ApiKey + user bearer token
POST /api/DigitalIdentity/CancelVerifiedDigitalIdentityForAdminAdminApiKey + admin bearer token

User — cancel own verification

The authenticated user cancels their own verified digital identity. No request body is required.

$curl -X POST https://api.vlenseg.com/api/DigitalIdentity/CancelVerifiedDigitalIdentity \
> -H "ApiKey: YOUR_API_KEY" \
> -H "Authorization: Bearer USER_TOKEN" \
> -H "Content-Type: application/json"

Admin — cancel for any user

An admin cancels verified digital identity for a specific user by passing userId in the request body.

$curl -X POST https://api.vlenseg.com/api/DigitalIdentity/CancelVerifiedDigitalIdentityForAdmin \
> -H "ApiKey: YOUR_API_KEY" \
> -H "Authorization: Bearer ADMIN_TOKEN" \
> -H "Content-Type: application/json" \
> -d '{
> "userId": "USER_ID"
> }'

Cancelling verified digital identity is irreversible from the user’s perspective — they must re-verify before signing e-contracts. Use the admin endpoint only for support or compliance workflows.


Admin: retrieve identity data and images

Identity data (OCR fields)

EndpointScopeAuth
GET /api/DigitalIdentity/GetUserDigitalIdentityInfoLogged-in userUser token
GET /api/DigitalIdentity/GetUserDigitalIdentityData?emailOrPhoneNumber=...Any userAdmin token
$# Current user
$curl https://api.vlenseg.com/api/DigitalIdentity/GetUserDigitalIdentityInfo \
> -H "ApiKey: YOUR_API_KEY" \
> -H "Authorization: Bearer USER_TOKEN"
$
$# Admin lookup by email or phone
$curl "https://api.vlenseg.com/api/DigitalIdentity/GetUserDigitalIdentityData?emailOrPhoneNumber=%2B201234567890" \
> -H "ApiKey: YOUR_API_KEY" \
> -H "Authorization: Bearer ADMIN_TOKEN"

Returns idFront and idBack objects with OCR-extracted national ID fields.

To look up the raw transaction record by transaction_id, see OCR — Lookup transaction.

Verification images

Admins with the Requests permission can retrieve stored identity images for audit or support. Use GetUserDigitalIdentityImages or GetUserDigitalIdentityImagesV2, then download each file with GetStepImage or GetStepImageV2.

$# Step 1 — Get file names
$curl "https://api.vlenseg.com/api/DigitalIdentity/GetUserDigitalIdentityImages?emailOrPhoneNumber=%2B201234567890" \
> -H "ApiKey: YOUR_API_KEY" \
> -H "Authorization: Bearer ADMIN_TOKEN"
$
$# Step 2 — Download a specific image as base64
$curl "https://api.vlenseg.com/api/DigitalIdentity/GetStepImage?TransactionId=TX_ID&FileName=FILENAME" \
> -H "ApiKey: YOUR_API_KEY" \
> -H "Authorization: Bearer ADMIN_TOKEN"

The images response includes idFrontImage, idBackImage, livenessImage, and individual liveness face images (livenessFace01Image, livenessFace02Image, livenessFace03Image).