OCR & Computer Vision

Standalone document extraction, face recognition, and biometric services
View as Markdown

The OCR API (/v1/ocr/) is a standalone computer vision service for document extraction, face matching, liveness detection, and compliance checks. It operates independently from the Digital Identity flow — you can use it without user registration.

National ID

Front and back extraction as separate calls

Passport

MRZ and biographical data extraction

Car License

Owner info (front) and vehicle specs (back), plus V2 combined model

Driving License

Egyptian driving license data extraction

Face Recognition

Face match (vs. ID photo), face compare, and liveness detection

General & Others

Auto-detect any document via /general, or submit unknowns via /others

License Plate

Egyptian vehicle plate text extraction

Commercial Registry

CR document data extraction

Transliteration

Arabic text to English transliteration


Base URL and authentication

The OCR API uses a different base path from the Digital Identity API:

https://api.vlenseg.com/v1/ocr/

Every request requires:

1ApiKey: YOUR_TENANT_API_KEY
2Authorization: Bearer YOUR_ACCESS_TOKEN
3Content-Type: application/json

Common request format

All OCR endpoints accept a JSON body with image as a base64-encoded string, plus optional transaction and control fields:

1{
2 "image": "BASE64_ENCODED_IMAGE",
3 "transaction_id": "optional-uuid-to-group-steps",
4 "client_transaction_id": "your-own-reference",
5 "country": "EGY",
6 "getExtractedData": true
7}
FieldRequiredDescription
imageYesBase64-encoded JPEG or PNG. Max 3 MB.
transaction_idNoGroup multiple steps into one transaction. Omit to start a new one.
client_transaction_idNoYour own reference ID.
countryNoDefaults to EGY.
getExtractedDataNoInclude full extracted fields in the response. Default false.

Common response format

1{
2 "services": {
3 "validations": { "validation_errors": [] },
4 "spoofing": { "fake": false },
5 "classification": { "doc_type": "national_id" },
6 "liveness": null,
7 "AML": null,
8 "SRC": null
9 },
10 "data": { ... },
11 "error_code": null,
12 "error_message": null
13}

data contains document-specific extracted fields. All step outputs include transaction_id, request_id, and client_transaction_id.

Save transaction_id from any step to chain subsequent calls or to look up the record later via the admin Transactions API.


Lookup transaction by ID (admin)

Retrieve the full record for any OCR or Digital Identity transaction. Pass the transaction_id returned by any OCR step (e.g. id/front, passport, liveness) or Digital Identity verify call (verify/id/front, verify/id/back, verify/liveness/multi).

Requires ApiKey and an admin bearer token.

$curl "https://api.vlenseg.com/api/Transactions/GetTransactionById?id=TRANSACTION_ID" \
> -H "ApiKey: YOUR_API_KEY" \
> -H "Authorization: Bearer ADMIN_TOKEN"

If the ID is invalid or expired, the API returns error code 5004 (Transaction Not Found). See Error codes.


National ID

Scan front

$curl -X POST https://api.vlenseg.com/v1/ocr/id/front \
> -H "ApiKey: YOUR_API_KEY" \
> -H "Authorization: Bearer TOKEN" \
> -H "Content-Type: application/json" \
> -d '{
> "image": "BASE64_ID_FRONT",
> "getExtractedData": true
> }'

Response data fields:

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
transaction_idUse in subsequent steps

Scan back

$curl -X POST https://api.vlenseg.com/v1/ocr/id/back \
> -H "ApiKey: YOUR_API_KEY" \
> -H "Authorization: Bearer TOKEN" \
> -H "Content-Type: application/json" \
> -d '{
> "image": "BASE64_ID_BACK",
> "transaction_id": "TX_FROM_FRONT"
> }'

Response data fields: maritalStatus, job, jobTitle, religion, husbandName, releaseDate, idExpiry, idNumber, gender


Passport

$curl -X POST https://api.vlenseg.com/v1/ocr/passport \
> -H "ApiKey: YOUR_API_KEY" \
> -H "Authorization: Bearer TOKEN" \
> -H "Content-Type: application/json" \
> -d '{
> "image": "BASE64_PASSPORT_IMAGE"
> }'

Response data fields:

FieldDescription
passport_noPassport number
nameFull name
nationalityNationality
country_codeIssuing country ISO code
genderGender
Date_of_BirthDate of birth
Date_of_ExpiryExpiry date
doc_TypeDocument type (e.g. P for passport)

Car license

License front (owner information)

$curl -X POST https://api.vlenseg.com/v1/ocr/car/license/front \
> -H "ApiKey: YOUR_API_KEY" \
> -H "Authorization: Bearer TOKEN" \
> -H "Content-Type: application/json" \
> -d '{"image": "BASE64_LICENSE_FRONT"}'

Response data fields: license_number, license_type, name, nationality, address, expiry, issuance, traffic_unit

License back (vehicle information)

$curl -X POST https://api.vlenseg.com/v1/ocr/car/license/back \
> -H "ApiKey: YOUR_API_KEY" \
> -H "Authorization: Bearer TOKEN" \
> -H "Content-Type: application/json" \
> -d '{"image": "BASE64_LICENSE_BACK"}'

Response data fields: model_year, type, sub_type, chasis, volume, motor, color, fuel, cylinder, examination_dt


Driving license

$curl -X POST https://api.vlenseg.com/v1/ocr/driving_license \
> -H "ApiKey: YOUR_API_KEY" \
> -H "Authorization: Bearer TOKEN" \
> -H "Content-Type: application/json" \
> -d '{"image": "BASE64_DRIVING_LICENSE"}'

Response data fields: nameArabic, nameEnglish, nationalID, nationalityArabic, nationalityEnglish, licenseType, job, address, expiryDate, issuanceDate, trafficUnit1, trafficUnit2


Face recognition

Face match (face vs. ID photo)

Match a face image against the ID front photo stored in a transaction. Requires completing the id/front step first for the same transaction_id.

$curl -X POST https://api.vlenseg.com/v1/ocr/face/match \
> -H "ApiKey: YOUR_API_KEY" \
> -H "Authorization: Bearer TOKEN" \
> -H "Content-Type: application/json" \
> -d '{
> "image": "BASE64_FACE_IMAGE",
> "transaction_id": "TX_WITH_ID_FRONT"
> }'

Response data fields:

FieldDescription
isMatchedWhether the face matches the ID photo
dissimilarityDistance score (lower = more similar)
thresholdMatch threshold used (default 2.4)
scoreMatch confidence score
detected_face_imageWhether a face was detected in the submitted image
detected_id_face_imageWhether a face was detected in the ID photo

Face compare (two faces)

Compare any two face images directly, without requiring an ID transaction.

$curl -X POST https://api.vlenseg.com/v1/ocr/face/compare \
> -H "ApiKey: YOUR_API_KEY" \
> -H "Authorization: Bearer TOKEN" \
> -H "Content-Type: application/json" \
> -d '{
> "face_image1": "BASE64_FACE_1",
> "face_image2": "BASE64_FACE_2",
> "liveness": "2"
> }'

Response data fields: same as Face Match — isMatched, dissimilarity, threshold, score

Liveness detection

Verify that a face image is from a live person, using three frames captured in quick succession.

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

All three images must be of the same person and captured within 0.5 seconds of each other. Compress each to under 500 KB.


License plate recognition

$curl -X POST https://api.vlenseg.com/v1/ocr/license_plate \
> -H "ApiKey: YOUR_API_KEY" \
> -H "Authorization: Bearer TOKEN" \
> -H "Content-Type: application/json" \
> -d '{"image": "BASE64_CAR_IMAGE"}'

Response data fields: result — the extracted plate text


Document classification

Identify the type of document in an image before processing it with a specific endpoint.

$curl -X POST https://api.vlenseg.com/v1/ocr/classification \
> -H "ApiKey: YOUR_API_KEY" \
> -H "Authorization: Bearer TOKEN" \
> -H "Content-Type: application/json" \
> -d '{"image": "BASE64_DOCUMENT"}'

Response services.classification.doc_type returns the detected type (e.g., national_id, passport, driving_license).


Liveness multi (standalone)

Run liveness detection using three face frames, without being tied to a Digital Identity user account. Same as /v1/ocr/liveness/multi.

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

All three face images must be of the same person and captured within 0.5 seconds of each other. Compress each to under 500 KB.

Response services.liveness returns true if the face images are live.


General document scan

Auto-detects the document type and extracts all available fields without specifying an endpoint upfront. Useful when the document type is unknown at call time.

$curl -X POST https://api.vlenseg.com/v1/ocr/general \
> -H "ApiKey: YOUR_API_KEY" \
> -H "Authorization: Bearer TOKEN" \
> -H "Content-Type: application/json" \
> -d '{
> "image": "BASE64_DOCUMENT",
> "getExtractedData": true
> }'

Response services.classification.doc_type indicates the detected type. data contains the extracted fields for that document type.


Car license V2

An updated model for car license scanning with improved accuracy. Accepts a single image and extracts both owner and vehicle data.

$curl -X POST https://api.vlenseg.com/v1/ocr/car/licenseV2 \
> -H "ApiKey: YOUR_API_KEY" \
> -H "Authorization: Bearer TOKEN" \
> -H "Content-Type: application/json" \
> -d '{"image": "BASE64_CAR_LICENSE"}'

Commercial registry (CR)

Extract data from an Egyptian commercial registry document.

$curl -X POST https://api.vlenseg.com/v1/ocr/cr \
> -H "ApiKey: YOUR_API_KEY" \
> -H "Authorization: Bearer TOKEN" \
> -H "Content-Type: application/json" \
> -d '{"image": "BASE64_CR_DOCUMENT"}'

Transliteration

Convert Arabic text to its English transliteration.

$curl -X POST https://api.vlenseg.com/v1/ocr/transliteration \
> -H "ApiKey: YOUR_API_KEY" \
> -H "Authorization: Bearer TOKEN" \
> -H "Content-Type: application/json" \
> -d '{"image": "BASE64_DOCUMENT"}'

Other documents

Extract data from document types not covered by the dedicated endpoints above.

$curl -X POST https://api.vlenseg.com/v1/ocr/others \
> -H "ApiKey: YOUR_API_KEY" \
> -H "Authorization: Bearer TOKEN" \
> -H "Content-Type: application/json" \
> -d '{"image": "BASE64_DOCUMENT"}'

AML validation

Check a name or ID number against criminal and AML records.

$curl -X POST https://api.vlenseg.com/v1/ocr/aml/validate \
> -H "ApiKey: YOUR_API_KEY" \
> -H "Authorization: Bearer TOKEN" \
> -H "Content-Type: application/json" \
> -d '{
> "idNumber": "29901234567890",
> "name": "Ahmed Mohamed"
> }'

File upload variants

Every endpoint has an equivalent /file variant that accepts multipart/form-data instead of base64. Replace the endpoint path with /file suffix and send the image as a form field:

$curl -X POST https://api.vlenseg.com/v1/ocr/passport/file \
> -H "ApiKey: YOUR_API_KEY" \
> -H "Authorization: Bearer TOKEN" \
> -F "file=@passport.jpg"

Available /file variants: id/front/file, id/back/file, car/license/front/file, car/license/back/file, car/licenseV2/file, passport/file, face/match/file, driving_license/file, license_plate/file, classification/file, others/file


OCR vs. Digital Identity verify

OCR API (/v1/ocr/)Digital Identity (/api/DigitalIdentity/verify/)
Requires user registrationNoYes
Links result to a user accountNoYes
Sets isDigitalIdentityVerifiedNoYes
Suitable for standalone extractionYesNo
Includes NTRA / CSO authority checksNoYes (configurable)

Use the OCR API when you need raw document extraction or biometric checks without tying the result to a Vlens user. Use the Digital Identity verify flow when you need the result to count toward a user’s verification status.