Skip to main content

Configuration Options

The SDK accepts a configuration object during initialization with the following options:

Core Settings

OptionTypeDefaultDescription
lensFlavorstringRequiredDetermines scanning experience type:
- 'document': Receipts & Invoices scanning
- 'long_document': Long Receipts scanning
- 'credit_card': Credit card scanning
- 'checks': Check scanning (front/back)
- 'upload': File upload only
- 'anydocs': AnyDocs
- 'caps': Bottle cap code capture
- 'code_strips': Printed code strip capture
- 'prescription_label': Prescription label video capture
containerstringundefinedHTML element ID where lens will mount. Creates full-screen overlay if not specified
enableFullScreenbooleanfalseEnable fullscreen mode for the camera view
debug_modebooleanfalseEnables debug logging to console
useDevApibooleanfalseRoute SDK API requests to lens-dev.veryfi.com instead of production (lens.veryfi.com). Affects partner validation, send-cropped, send-package, /api/document, and /api/blueprints
boxColorstring"rgba(84, 192, 139, 0.6)"Color for the document detection bounding box (CSS color value)

Document Processing

OptionTypeDefaultDescription
detectBlurbooleantrueEnable blur detection on captured images
testBlurDetectionbooleantrueEnable blur level calculation during crop (may slow capture)
enforceDocumentDetectionbooleanfalseForces document detection validation — prevents submission when no document detected (removes the "Submit Anyway" option from the modal)
enforceBlurDetectionbooleanfalseForces blur detection validation — prevents submission when image is blurry (removes the "Submit Anyway" option from the modal)
autoDocumentCapturebooleanfalseEnables automatic document capture when quality criteria are met (no manual capture button needed). Works with document and anydocs flavors

UI Elements

OptionTypeDefaultDescription
enableSubmitbooleantrueShows submit button after successful capture
torchButtonbooleantrueShow torch/flashlight toggle button (requires device support)
torchOnStartbooleantrueTurn torch on when the camera starts
switchCameraButtonbooleantrueShow switch camera (front/back) button
mirrorButtonbooleantrueShow mirror/flip video button
mirrorOnDesktopbooleantrueAutomatically mirror the video on desktop (front-facing webcam)
exitButtonbooleanfalseAdds button to close camera view
isBlurModalbooleantrueShows warning modal when blur is detected
isDocumentModalbooleantrueShows warning modal when no document is detected
capCircleRadiusnumber0.7Default circle radius for bottle cap overlay (requires lensFlavor: 'caps')
rectWidthnumber0.7Default width for code strip overlay (requires lensFlavor: 'code_strips')
rectHeightnumber0.08Default height for code strip overlay (requires lensFlavor: 'code_strips')

Detection Thresholds

OptionTypeDefaultDescription
blurThresholdnumber0.7Blur detection threshold (0–1). Higher values make blur detection stricter
lcdThresholdnumber0.5LCD detection threshold (0–1). Higher values make LCD detection stricter

LCD Detection (Fraud Prevention)

OptionTypeDefaultDescription
lcdDetectionForDocumentsbooleanfalseEnables LCD screen detection for receipts, invoices, and other document types
lcdDetectionForChecksbooleanfalseEnables LCD screen detection for check scanning
lcdDetectionForCardsbooleanfalseEnables LCD screen detection for credit card scanning
isLcdModalbooleantrueShows warning modal when an LCD screen is detected
enforceLcdDetectionbooleanfalseForces LCD detection validation — prevents submission when LCD is detected (removes the "Submit Anyway" option from the modal)

Front/Back Detection (Check Side Classification)

OptionTypeDefaultDescription
frontBackDetectionForChecksbooleanfalseEnables front/back side classification for checks. Detects if the user captured the wrong side and shows a warning modal to retake (requires lensFlavor: 'checks')

Local Field Extraction

On-device field detection runs on the crop preview before submit for receipt flavors. Uses Tesseract OCR plus a WASM classifier. Results are shown as labeled overlays on the preview and attached to the submit response as field_detection.

OptionTypeDefaultDescription
documentFieldsToDetectstring[][]Fields to detect on the crop preview: 'vendor', 'date', 'total'. Only applies to document and long_document flavors. Leave empty to disable
disableSubmitUntilFieldDetectionDonebooleanfalseKeep the submit button disabled until crop-preview field detection finishes. Only applies when documentFieldsToDetect is set
info

When documentFieldsToDetect is set, see the field_detection_* statuses above and field_detection on the onSuccess response. Configure options in Configuration.

Special Features

OptionTypeDefaultDescription
enableLongReceiptPreviewbooleanfalseShows preview during receipt stitching (requires lensFlavor: 'long_document')
packageModebooleanfalseWhen true, captured scans are bundled into a single zip uploaded to S3 at submit time; /api/document receives package_path instead of inline base64. See Decoupled Submission
customDataobject{}Custom key-value data object included in document submissions. Must be a plain object (not an array or null)

Use VeryfiLens.setCustomSubmitHandler(handler) to override the default submission flow (not an init option). See Decoupled Submission.

Fingerprint Settings

OptionTypeDefaultDescription
enforceFingerprintbooleanfalseRequires device fingerprint generation to succeed. Throws an error if fingerprint generation fails
disableFingerprintbooleanfalseDisables device fingerprint generation entirely. Sets UUID to 'not_generated' and removes stored fingerprint from localStorage

Check Processing

OptionTypeDefaultDescription
captureBackOfCheckbooleanfalseEnables back side capture for checks (requires lensFlavor: 'checks')
enforceBothSidesbooleanfalseRequires both sides of the check to be captured (requires lensFlavor: 'checks')
enforceAndSkipBothSidesbooleanfalseRequires both sides but automatically proceeds to back capture without prompting (requires lensFlavor: 'checks')
delayBetweenCapturesnumber0Delay in milliseconds between front and back capture (requires lensFlavor: 'checks')
checksEnableManualModebooleantrueEnable/disable manual capture mode for checks when aspect ratio falls outside acceptable limits (requires lensFlavor: 'checks')
checksManualModeTimeoutnumber3000Timeout in milliseconds before switching to manual mode (requires lensFlavor: 'checks')
checksMaxAspectRationumber2.61Maximum acceptable aspect ratio for check detection (requires lensFlavor: 'checks')
checksMinAspectRationumber2.61Minimum acceptable aspect ratio for check detection (requires lensFlavor: 'checks')
persistManualModeOnRetakebooleantruePersist manual mode when retaking front side or capturing back side (requires lensFlavor: 'checks')
forceLandscapeCheckPreviewbooleantrueForce horizontal/landscape orientation for check previews (requires lensFlavor: 'checks')

Crop Settings

OptionTypeDefaultDescription
cropMarginnumber0.0Margin around greenbox during cropping for all document types as percentage (0.0-1.0)
checksCropMarginnumber0.1Margin around greenbox during cropping for checks as percentage (0.0-1.0, requires lensFlavor: 'checks')
cropLayoutAspectRationumber0.0Custom aspect ratio for the manual mode crop layout guide overlay (0.0 = use default)

Crop Layout Overlay

OptionTypeDefaultDescription
cropLayoutBorderColorstring"#54C08B"Border color of the manual mode guide rectangle
cropLayoutStrokenumber2Border width in pixels of the manual mode guide rectangle
cropLayoutOverlayAlphanumber0.6Transparency of the manual mode guide overlay (0-1)
cropLayoutCornerRadiusnumber0Corner radius in pixels of the manual mode guide rectangle

Checks Manual Mode Crop Layout Position & Size

OptionTypeDefaultDescription
cropLayoutGuideTopPositionstring"40%"Vertical position of the crop guide (CSS value, e.g., "40%", "200px")
cropLayoutGuideLeftPositionstring"50%"Horizontal position of the crop guide (CSS value, e.g., "50%", "100px")
cropLayoutGuideWidthScalenumber0.90Width scale of guide relative to video width (0-1, where 0.90 = 90%)
cropLayoutGuideMaxHeightScalenumber0.70Maximum height scale of guide relative to video height (0-1, where 0.70 = 70%)

Checks Manual Mode Crop Layout Tip Text Styling

OptionTypeDefaultDescription
cropLayoutTipPositionstring"right"Position of tip text relative to guide. Options: "top", "bottom", "left", "right"
cropLayoutTipFontFamilystring"Arial, sans-serif"Font family for tip text
cropLayoutTipFontSizestring"16px"Font size for tip text (CSS value, e.g., "16px", "1rem")
cropLayoutTipFontWeightstring"bold"Font weight for tip text
cropLayoutTipColorstring"white"Color for tip text
cropLayoutTipTextShadowstring"0 1px 2px rgba(0,0,0,0.8)"Text shadow for tip text (CSS text-shadow value)
cropLayoutTipOffsetstring"35%"Offset distance of tip text from guide edge (CSS value)

AnyDocs

OptionTypeDefaultDescription
enableBlueprintsModalbooleanfalseShow blueprints selection modal on init. Fetches available blueprints from /api/blueprints. Ignored when selectedBlueprint is set (requires lensFlavor: 'anydocs')
selectedBlueprintstringnullPre-selected blueprint name. When set, skips the blueprints modal (requires lensFlavor: 'anydocs')
anydocMaxPagesnumbernullMaximum number of pages allowed. null means unlimited (requires lensFlavor: 'anydocs')
anydocAddPageTextstring'Add Page'Custom text for the add page button (requires lensFlavor: 'anydocs')
anydocSubmitTextstring'Submit'Custom text for the submit button (requires lensFlavor: 'anydocs')
anydocShowFlipMessagebooleanfalseShows a flip message after capturing a page (requires lensFlavor: 'anydocs')
anydocFlipMessageTextstring'Please flip the document and capture the other side'Custom message for the flip prompt (requires lensFlavor: 'anydocs' and anydocShowFlipMessage: true)
anydocFlipContinueTextstring'Continue'Custom text for the continue button in the flip prompt (requires lensFlavor: 'anydocs' and anydocShowFlipMessage: true)

Prescription Label

OptionTypeDefaultDescription
prescriptionLabelShowOverlaybooleantrueShows the bottle-shaped cutout overlay that guides the user where to position the pill bottle (requires lensFlavor: 'prescription_label')
prescriptionLabelWidthRationumber0.55Width of the bottle overlay (0–1 relative to viewport, requires lensFlavor: 'prescription_label')
prescriptionLabelHeightRationumber0.65Height of the bottle overlay (0–1 relative to viewport, requires lensFlavor: 'prescription_label')
prescriptionLabelTextstring'Position prescription label in outline'Instructional text shown to the user (requires lensFlavor: 'prescription_label')
prescriptionLabelShowSquareOverlaybooleanfalseShows a square/rectangular overlay guide instead of (or in addition to) the bottle outline (requires lensFlavor: 'prescription_label')
prescriptionLabelSquareWidthRationumber0.8Square overlay width (0–1 relative to viewport, requires lensFlavor: 'prescription_label' and prescriptionLabelShowSquareOverlay: true)
prescriptionLabelSquareHeightRationumber0.5Square overlay height (0–1 relative to viewport, requires lensFlavor: 'prescription_label' and prescriptionLabelShowSquareOverlay: true)
prescriptionLabelShowGuidebooleanfalseShow a semi-transparent guide explaining how to record the label. Auto-hides when recording starts and reappears on retake (requires lensFlavor: 'prescription_label')
prescriptionLabelGuideTextstring(see below)Guide text when the bottle outline overlay is active. Use \n for line breaks
prescriptionLabelSquareGuideTextstring(see below)Guide text when the square overlay is active. Use \n for line breaks
info

For prescription labels, selectedBlueprint defaults to 'prescription_medication_label' when no blueprint is provided.

Default prescriptionLabelGuideText: "Position the bottle within the outline.\n\nPress the capture button to start recording, slowly rotate the bottle to capture the entire label and press the capture button again to stop recording."

Default prescriptionLabelSquareGuideText: "Position the prescription label within the square.\n\nPress the capture button to start recording, press again to stop."

Text Customization

OptionTypeDefaultDescription
documentModalMessagestring'Oops, There appears to be no document on your image'Custom message for document detection modal
blurModalMessagestring'Oops, The image is too blurry to process'Custom message for blur detection modal
submitButtonTextstring'Submit Anyway'Custom text for submit button
retakeButtonTextstring'Retake a picture'Custom text for retake button
cropButtonTextstring'Crop'Custom text for crop button
resetButtonTextstring'Reset'Custom text for reset button
dropZoneTextstring'Click or drag and drop to upload an image'Custom text for upload drop zone (requires lensFlavor: 'upload')
lcdModalMessagestring'LCD screen detected. Please capture a printed document instead'Custom message for LCD detection modal
wrongSideFrontMessagestring'This looks like the back of the check. Please flip and capture the front side.'Custom message shown when back side is detected during front capture (requires frontBackDetectionForChecks: true)
wrongSideBackMessagestring'This looks like the front of the check. Please flip and capture the back side.'Custom message shown when front side is detected during back capture (requires frontBackDetectionForChecks: true)
checkEnforcedModalMessagestring'Please flip the check and capture the back side'Custom message when back check capture is required (requires lensFlavor: 'checks' and enforceBothSides: true)
checkOptionalModalMessagestring'Do you want to capture the back side of the check?'Custom message when back check capture is optional (requires lensFlavor: 'checks' and captureBackOfCheck: true)
checkContinueButtonTextstring'Continue'Custom text for check continue button (requires lensFlavor: 'checks' and enforceBothSides: true)
checkYesButtonTextstring'Yes'Custom text for check confirmation button (requires lensFlavor: 'checks')
checkNoButtonTextstring'No'Custom text for check rejection button (requires lensFlavor: 'checks')
bottleCapTextstring'Position bottle cap in circle'Default instruction text for bottle cap overlay
codeStripsTextstring'Position code strip in rectangle'Default instruction text for code strip overlay
cropLayoutTipMessagestring'Position check inside rectangle'Instructional text shown with the crop layout overlay in manual mode
OptionTypeDefaultDescription
onCloseRedirectUrlstringundefinedURL to redirect to when exit pressed
onClosefunctionundefinedCallback when camera view closes:
(isVisible: boolean) => void

Usage Examples

Document Scanning

await VeryfiLens.init("YOUR_CLIENT_ID", {
lensFlavor: "document",
torchButton: true,
exitButton: true,
isBlurModal: true,
isDocumentModal: true,
debug_mode: true,
documentModalMessage: "Please ensure a document is visible in the frame",
blurModalMessage: "Image is too blurry, please try again",
submitButtonText: "Process Document",
retakeButtonText: "Capture Again"
});

Check Scanning with Manual Mode

await VeryfiLens.init("YOUR_CLIENT_ID", {
lensFlavor: "checks",
captureBackOfCheck: true,
enforceBothSides: true,
checksEnableManualMode: true,
checksManualModeTimeout: 3000,
checksMaxAspectRatio: 2.7,
checksMinAspectRatio: 1.8,
checksCropMargin: 0.1,
persistManualModeOnRetake: true,
forceLandscapeCheckPreview: false,
// Checks manual mode crop layout overlay styling
cropLayoutBorderColor: "#54C08B",
cropLayoutStroke: 2,
cropLayoutOverlayAlpha: 0.6,
cropLayoutCornerRadius: 0,
// Checks manual mode crop layout positioning
cropLayoutGuideTopPosition: "40%",
cropLayoutGuideLeftPosition: "50%",
cropLayoutGuideWidthScale: 0.90,
cropLayoutGuideMaxHeightScale: 0.70,
// Checks manual mode crop layout tip text
cropLayoutTipMessage: "Align check within the guide",
cropLayoutTipPosition: "bottom",
cropLayoutTipFontSize: "18px",
cropLayoutTipColor: "white",
torchButton: true,
exitButton: true
});

Document Scanning with LCD Detection

await VeryfiLens.init("YOUR_CLIENT_ID", {
lensFlavor: "document",
torchButton: true,
exitButton: true,
lcdDetectionForDocuments: true,
isLcdModal: true,
enforceLcdDetection: false,
lcdThreshold: 0.4,
lcdModalMessage: "LCD screen detected. Please capture a printed document instead"
});

Check Scanning with LCD Detection

await VeryfiLens.init("YOUR_CLIENT_ID", {
lensFlavor: "checks",
captureBackOfCheck: true,
enforceBothSides: true,
torchButton: true,
exitButton: true,
lcdDetectionForChecks: true,
isLcdModal: true,
enforceLcdDetection: true,
lcdThreshold: 0.4
});

Check Scanning with Front/Back Detection

await VeryfiLens.init("YOUR_CLIENT_ID", {
lensFlavor: "checks",
captureBackOfCheck: true,
enforceBothSides: true,
torchButton: true,
exitButton: true,
frontBackDetectionForChecks: true,
wrongSideFrontMessage: "This looks like the back of the check. Please flip and capture the front side.",
wrongSideBackMessage: "This looks like the front of the check. Please flip and capture the back side."
});

AnyDocs

await VeryfiLens.init("YOUR_CLIENT_ID", {
lensFlavor: "anydocs",
torchButton: true,
exitButton: true,
isBlurModal: true,
isDocumentModal: true,
anydocMaxPages: 10,
anydocAddPageText: "Add Page",
anydocSubmitText: "Submit All",
anydocShowFlipMessage: true,
anydocFlipMessageText: "Please flip the document and capture the other side",
anydocFlipContinueText: "Continue"
});

Prescription Label

await VeryfiLens.init("YOUR_CLIENT_ID", {
lensFlavor: "prescription_label",
torchButton: true,
exitButton: true,
prescriptionLabelShowOverlay: true,
prescriptionLabelWidthRatio: 0.55,
prescriptionLabelHeightRatio: 0.65,
prescriptionLabelText: "Position prescription label in outline",
selectedBlueprint: "prescription_medication_label",
preferredVideoFormat: "video/mp4"
});

Automatic Document Capture

await VeryfiLens.init("YOUR_CLIENT_ID", {
lensFlavor: "document",
autoDocumentCapture: true,
torchButton: true,
exitButton: true,
isBlurModal: true,
isDocumentModal: true
});

Local Field Extraction

await VeryfiLens.init("YOUR_CLIENT_ID", {
lensFlavor: "document",
documentFieldsToDetect: ["vendor", "date", "total"],
disableSubmitUntilFieldDetectionDone: true,
torchButton: true,
exitButton: true
});

Custom Submit Handler

await VeryfiLens.init("YOUR_CLIENT_ID", {
lensFlavor: "document",
torchButton: true,
exitButton: true
});

VeryfiLens.setCustomSubmitHandler((image, packageInfo) => {
console.log("Custom handler received image:", image);
console.log("Package info (when packageMode: true):", packageInfo);
// Process image with your own API instead of Veryfi's
});

Custom Data with Submission

await VeryfiLens.init("YOUR_CLIENT_ID", {
lensFlavor: "document",
torchButton: true,
exitButton: true,
customData: {
userId: "user-123",
department: "accounting",
projectCode: "PRJ-456"
}
});

Dynamic Configuration

You can update configuration during runtime:

info

All settings except lensFlavor and container can be updated during runtime.

VeryfiLens.configureLens({
isBlurModal: false,
torchButton: false
});