For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Dashboard
HomeAPI Reference
HomeAPI Reference
  • Get started
    • Welcome
    • Quick Start
  • API basics
    • Authentication
    • Conventions
    • Errors
    • Webhooks
  • Products
    • Digital Identity
    • OCR & Computer Vision
    • E-Contracting
    • OAuth Registration
    • Iframe Integration
  • SDKs
    • Flutter SDK
  • Resources
    • Support
  • Changelog
    • Changelog
Dashboard
LogoLogo
On this page
  • Handling errors
  • Error categories
  • Authentication
  • Registration
  • Identity verification
  • Business request
  • Retry strategy
  • Validation errors
  • Getting help
API basics

Errors

Detect, handle, and recover from API errors
||View as Markdown|
Was this page helpful?
Edit this page
Previous

API Conventions

Next

Webhooks

Built with

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": 1050,
4 "error_message": "Image quality too low for OCR extraction",
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:

JavaScript
Python
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;

Error categories

Specific error codes are listed in error_code alongside a descriptive error_message. Errors fall into the following categories:

Authentication

CauseResolution
ApiKey header missing or invalidVerify the ApiKey is present and active in the dashboard
Authorization header missing on a protected endpointAdd Authorization: Bearer <token>
Access token expiredRefresh via /api/credentials/RefreshToken
Refresh token expired or revokedRe-authenticate via /api/credentials/Login
Token does not have permission for this endpointUse an admin token; check role assignments in the portal
Token belongs to a different tenantUse credentials for the correct tenant

Registration

CauseResolution
Phone or email already registeredCall /api/DigitalIdentity/CheckExistenceOfEmailOrPhone first
Invalid OTPRequest a new OTP after the user re-enters
OTP expired or request not foundRestart the OTP flow from StepVerifyPhone

Identity verification

CauseResolution
Image quality too low (blurry, dark, distant)Re-capture with better lighting and the ID filling most of the frame
Document detected as fakeRe-capture the physical ID — photocopies and screen captures fail spoofing
Liveness failedRe-capture three distinct frames within 0.5s — see Digital Identity
Identical face imagesCapture three distinct, sequential frames
Transaction not foundRestart from verify/id/front to obtain a new transaction
NTRA or CSO authority check failedThe ID could not be verified against national records — escalate via support

Business request

CauseResolution
User not eligibleInspect CheckEligibility and fix the specific failure (KYC, email, pending request)
Wrong request status for this operationConfirm requeststatus via GetBusinessRequestById matches what the endpoint expects
Location changed — liveness requiredCall StepReValidateLiveness before retrying StepRequestOtp
Invalid OTP (signing)Request a new OTP via StepRequestOtp
Required form field missingInspect the field list from GetBusinessRequestTypeTemplateFields

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. 500ms → 1s → 2s → 4s, 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}

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