-
Notifications
You must be signed in to change notification settings - Fork 1
ScanDoc AI Integration
avargic edited this page Mar 23, 2026
·
7 revisions
- Minimum supported android version – API level 21
- Tested up to (including) – API level 36
Create an instance of the ScanDocApi class with the ScanDocApiOptions
public ScanDocApiOptions(
final String scanDocApiBaseUrl,
final String userKey,
final String subClient,
final boolean acceptTermsAndConditions
)
- scanDocApiBaseUrl - backend base url
- userKey - API key required by backend
- subclient - ID that can be used to identify customers, defined by you
- acceptTermsAndConditions - must be set to true in order for network calls to work
Example:
private void initializeScanDocApi() {
scanDocApi = new ScanDocApi(
new ScanDocApiOptions(
SCANDOC_BASE_URL,
SCANDOC_USER_KEY,
SCANDOC_SUBCLIENT,
ACCEPT_SCANDOC_TERMS_AND_CONDITIONS
)
);
}Send the image for validation (optional)
public void validateScannedCard(
final Bitmap[] scannedCardImages,
final ValidationConfiguration validationConfiguration,
final ResultCallback<ValidationResponse> resultCallback
)
public void validateScannedCard(
final List<byte[]> scannedCardImages,
final ValidationConfiguration validationConfiguration,
final ResultCallback<ValidationResponse> resultCallback
)- scannedCardImages - array of bitmaps or byte arrays representing image
- validationConfiguration - validation options, see full docs
- resultCallback - actions to perform on success or error
Validation is not mandatory, but it is recommended. The extraction call can be configured to perform image validation prior to the extraction process. Image resizing and compression is handled by the SDK, you just need to pass in the captured image.
If the method succeeds, an instance of ValidationResponse is returned:
- transactionID - ID of the validation call
- uploadedAt - time of the request
- productName - ScanApp version
- errors - descriptions of errors that occurred
- warnings - descriptions of warnings that occurred
- status - response status code
- method - specifies which method was called
- infoCode - see list of possible validation info codes here
- keypoints - list of coordinates indicating document corners
- detectedBlurValue - values representing detected blurriness on the image
- validated - if image was successfully validated
- analysisTime - analysis duration in milliseconds
- index - returns index of best image, if multiple images were sent
- info - additional info
Example:
scanDocApi.validateScannedCard(
bitmaps,
new ValidationConfiguration(),
new ScanDocValidationCallback()
);Send the image for data extraction
public void extractDataFromScannedCard(
final Bitmap scannedCardImage,
final ResultCallback<ExtractionResponse> resultCallback
)
public void extractDataFromScannedCard(
final Bitmap scannedCardImage,
final ExtractionConfiguration extractionConfiguration,
final ResultCallback<ExtractionResponse> resultCallback
)
public void extractDataFromScannedCard(
final Bitmap scannedCardImage,
final ExtractionConfiguration extractionConfiguration,
final ResultCallback<ExtractionResponse> resultCallback
)
public void extractDataFromScannedCard(
final byte[] scannedCardImage,
final ResultCallback<ExtractionResponse> resultCallback
)- scannedCardImage - bitmap or byte array representing image
- ExtractionConfiguration - extraction options, see full docs
- resultCallback - actions to perform on success or error
Image resizing and compression is handled by the SDK, you just need to pass in the captured image.
If the method succeeds, an instance of ExtractionResponse is returned:
- transactionID — ID of the extraction call
- uploadedAt — Time of the request
- productName — ScanApp version
- errors — Description of errors that occurred
- warnings — Description of warnings that occurred
- status — Response status code
- method — Specifies which method was called
- infoCode — See list of possible extraction error codes here
- base64CreditCardImage — Returns cropped image that was processed by the server
- analysisTime — Analysis duration in milliseconds
- cardData — Extracted data
- osInfo — OS the request was sent from
- browserInfo — Browser the request was sent from
- deviceInfo — Device information
Example:
scanDocApi.extractDataFromScannedCard(
bitmap,
new ScanDocExtractionCallback()
);Start the camera and enable a timer that runs every 10ms:
- Capture a validation frame at
384x384 - Capture a full frame at the video's native resolution
- Send the validation frame to
/validation/along with the currentBlurValuesfield (a list of blur values from previous responses)
| InfoCode | Meaning | Action |
|---|---|---|
1009 |
Waiting for camera to focus | Continue validation. If the response contains DetectedBlurValue, add it to the local BlurValues list (keep the last 7–10 values). If it does not contain DetectedBlurValue, reset BlurValues to empty. |
1000 |
Validated | Immediately call /extraction/ with the corresponding full-resolution frame from the same moment. |
| Other | See Validation Info Codes | Optionally display an info message to the user on how to adjust/improve the card position, and continue validation. |
- The minimum recommended image resolution for extraction is 1280×720.
- Anti-blur procedure: https://scandoc.readme.io/reference/anti-blur-procedure-copy
- Official ScanDoc AI docs: https://scandoc.readme.io/reference/
- Example implementation available on Monri SDK GitHub