Error Codes

HTTP status codes and VLens-specific error codes for debugging and error handling

View as Markdown

Every Vlens response uses the same envelope. Errors are signalled by the error_code field — not the HTTP status. A 200 OK response with error_code set is still an error.

1{
2 "data": null,
3 "error_code": 3011,
4 "error_message": "Card Not Detected",
5 "error_descriptions": null
6}
FieldDescription
error_codeNumeric error code. null on success.
error_messageHuman-readable description.
error_descriptionsAdditional structured details, when available.

Handling errors

Always check error_code before treating a response as successful:

1const res = await fetch(url, options);
2const body = await res.json();
3
4if (body.error_code !== null) {
5 throw new VlensError(body.error_code, body.error_message);
6}
7
8return body.data;

HTTP Error Codes

CodeMessageDescription
400Bad RequestThe request is invalid, usually due to missing required information, incorrect parameters, or a formatting error like invalid JSON. Ensure all required parameters are included and provide a valid base64-encoded image.
401UnauthorizedMake sure you are using the correct credentials and try again.
403ForbiddenGenerate and include a valid access token and try again.
415Unsupported Media TypePlease re-check your image format.
422Unprocessable EntityCheck the custom error code returned in the response, and refer to the VLens Error Codes table below for more information.
500Internal Server ErrorWell-formed request received, but an unexpected error occurred. Try again later.

VLens Error Codes

Document Validation (3xxx)

CodeMessageDescription
3001–3006Document Validation ErrorsEach code represents one of: Invalid ID Number (3001), Invalid BirthDate (3002), Invalid Govern (3003), Invalid ID_Key (3004), Invalid Gender (3005), Invalid ReleaseDate (3006). Ensure the document is properly aligned, well-lit, and focused.
3007–3009Wrong Date FormatVerify that all dates are in the right format. Each code represents a specific date: BirthDate (3007), ReleaseDate (3008), ExpiryDate (3009).
3010Document ExpiredEnsure the expiry date of the submitted document has not passed.
3011Card Not DetectedEnsure the document is visible in the image.
3013Invalid MRZEnsure the MRZ (Machine Readable Zone) is clear and fully visible.
3101ID Number MismatchEnsure the ID numbers on the front and back of the document match.
3102Name MismatchEnsure the name on the ID and car license documents match.
3104ID Number DuplicatedEnsure that you are logged in with the same user. The ID number is already registered for this tenant.
3106Application Cannot Be ProcessedThe application cannot be processed at this time due to internal validation rules. Please contact support for further assistance.

Bundle & Quota (4xxx)

CodeMessageDescription
4001Invalid Bundle KeyEnsure that your bundle key is entered correctly.
4002Insufficient QuotaYour bundle’s quota is depleted. Please recharge your bundle.
4003Exceeded Number of TrialsThe allowed number of trials has been exceeded. Try again later.
4004Unregistered ServiceEnsure the service is included in your bundle.
4005Disabled BundleContact the server admin to reactivate your bundle.
4006Not SubscribedSubscribe to a bundle to access the service.
4007Subscription ExpiredRenew your subscription to continue using the service.
4206Multiple Faces DetectedPlease make sure to have only one face in the image.
4207No Face DetectedMake sure a face is visible in the image.
4208Couldn’t Extract Facial FeaturesPlease make sure that there is a clear face in the image.
4209Face Not MatchingPlease recapture your face and ensure the same face feature from the NID is used.
4210Face is Not LivePlease recapture your face and ensure the capture is clear and live.

General & Document Errors (5xxx)

CodeMessageDescription
5000General ErrorSomething went wrong. Contact support.
5001Unsupported DocumentPlease enter a supported document type.
5002Maximum Image Size ExceededMake sure each provided image does not exceed the 3 MB limit.
5003Maximum Image Resolution ExceededMake sure each provided image does not exceed the 25 million pixel limit.
5004Transaction Not FoundCheck the Transaction ID/token sent in the request.
5005Spoofed DocumentPlease make sure you’re capturing a real, physical document.
5006Blurred ImagePlease recapture the image and make sure it is in focus.
5007Invalid ClassificationDocument is supported but the wrong endpoint was called.
5008Data MisassignedOne or more fields are undetectable from the image.
5009Cropped ImageID image is cropped. Please retake the photo and ensure all four edges of the ID are fully visible.

Identity & Contract Errors (6xxx)

CodeMessageDescription
6102Phone Number Already ExistsPhone number is already registered.
6103Email Already ExistsEmail address is already registered.
6104Phone Number Ownership Not VerifiedThe NTRA check returned false — the phone number is not registered with the same ID number.
6105OTP Code ExpiredOTP code has expired. Please request a new one.
6106OTP Code IncorrectOTP code is wrong. Please insert the correct code sent via SMS.
6107CSO Check Failed (Deprecated)CSO check could not be verified.
6109FRA Service UnavailableFRA service is unreachable. Please try again later.
6111Person Name MismatchFirst name on NID does not match CSO records. Please retake a clearer image or verify the NID.
6112Person Other Names MismatchRemaining names on NID do not match CSO records. Please retake a clearer image or verify the NID.
6113Factory Number MismatchFactory number on NID does not match CSO records. Please retake a clearer image or verify the NID.
6114Card Expiration Date MismatchExpiration date on NID does not match CSO records. Please retake a clearer image or verify the NID.
6116Phone Ownership Service ErrorNTRA service is currently unavailable. Please try again later.
6117Contract Already ExistsYou are attempting an operation that has already been completed for this contract.
6118Customer JWT RequiredUnable to find the authorization header. Please refresh or re-login.
6119Invalid JWT Token FormatError reading the authorization header. Please refresh or re-login.
6120Contract Authentication FailedFRA was unable to validate the customer’s access token from the identity provider while signing the contract.
6121Invalid Contract PDFThe PDF contract format is not valid. Please try again or contact your administrator.
6122Invalid NTRANTRA record is not valid at FRA end.
6123Invalid CSOCSO record is not valid at FRA end.
6124Invalid NTRA and CSOBoth NTRA and CSO records are not valid at FRA end.

Card & OCR Service Errors (7xxx)

CodeMessageDescription
7000Multiple Cards DetectedSeveral cards detected. Please take a clear image of a single card.
7001ID Front Card ErrorUnable to identify the ID front card image. Please retry with a clearer image.
7002ID Back Card ErrorUnable to identify the ID back card image. Please retry with a clearer image.
7003Car License Back Card ErrorUnable to identify the car license back image. Please retry with a clearer image.
7004Car License Front Card ErrorUnable to identify the car license front image. Please retry with a clearer image.
7005Driving License Card ErrorUnable to identify the driving license card. Please retry with a clearer image.
7006Passport Card ErrorUnable to identify the passport image. Please retry with a clearer image.
7008Face Match ErrorUnable to match the selfie image with the NID image. Please retry.
7009OCR Service UnreachableService is temporarily unavailable. Please try again.
7010Transliteration Service UnreachableTransliteration service is temporarily unavailable or turned off. Please try again.

Retry strategy

Error classStrategy
Auth (token expired)Refresh the token, then retry once
Validation / business errorsDo not retry — fix the request or surface to the user
Network errors / server errorsRetry with exponential backoff (e.g. 500 ms → 1 s → 2 s → 4 s, max 3 attempts)
1async function callVlensWithRetry(fn, maxAttempts = 3) {
2 let delay = 500;
3 for (let attempt = 1; attempt <= maxAttempts; attempt++) {
4 try {
5 return await fn();
6 } catch (err) {
7 // Only retry transient errors — never retry validation or auth failures
8 if (!isTransient(err) || attempt === maxAttempts) throw err;
9 await new Promise(r => setTimeout(r, delay));
10 delay = Math.min(delay * 2, 8000);
11 }
12 }
13}

Helpful Tips

API Debugging: Use the error messages to pinpoint and resolve issues quickly. Check both the HTTP status code and the error_code in the response body — the error_code is always the authoritative signal.

Image & Document Uploads: Ensure documents are clear, well-lit, and compress each image to under 500 KB before uploading for best performance. The hard API limits are 3 MB and 25 MP per image.

Subscription Management: Regularly monitor your bundle and subscription status to avoid interruptions in service (see error codes 4002–4007).


Validation errors

When request fields fail validation, the response may include structured field-level details in error_descriptions:

1{
2 "data": null,
3 "error_code": 400,
4 "error_message": "Validation failed",
5 "error_descriptions": [
6 { "field": "image", "message": "image is required" }
7 ]
8}

Iterate error_descriptions to surface field-level errors in your UI.


Getting help

If you encounter an error not listed here, contact support@vlenseg.com with:

  1. The endpoint URL and method
  2. The full request body (redact images and PII)
  3. The full response body including error_code and error_message
  4. Your tenant name and approximate UTC timestamp