Skip to main content

Handling Responses

The Web OCR SDK returns a Promise, which in case of success, will return an object with information about the collection of the selected document, or in case of error, will return a String with the error description. Below is an example of how to map each of these cases and get their results:

<script>
webOCR.initialize(document_type)
.then((ocr_key) => {
console.log(ocr_key)
})
.catch((error) => {
console.log(error)
})
</script>

Web OCR Return Description

AttributeTypeDescription
ocr_infoObjectSuccess object containing information regarding the capture of the selected document.
errorStringString with the error description (if it occurs)

Success Object Attributes

AttributeTypeDescription
ocr_keyStringIdentification key of the captured document images that can be used in any other QI Tech system service.
templateStringType of captured document

Error Types

ErrorDescription
Invalid Web Token! Please verify your Web Token.Web Token used is invalid. If you are certain that you are correctly using the Web Token provided by QI Tech, contact our support (suporte.caas@qitech.com.br) immediately.
Invalid Document Type! Please provide a valid document type.Document Type passed to the WebOCR.initialize() function is not valid. Check the allowed document types on the initialize function page.
User left Web OCR.The user returned from the Web OCR SDK before completing the document submission.