Bank Statement OCR API
The following document highlights the details of the Bank Statement OCR API.
API Description
Objective
The Bank Statement OCR API extracts accurate information from a user's bank statement document (in PDF format) using optical character recognition(OCR) and returns the extracted data in a JSON format.
| Input | Output |
|---|---|
| A PDF file of the user's bank statement document | The bank statement data extracted from the document in a JSON format. It can extract fields such as:
|
API URL
https://ind-engine.thomas.hyperverge.co/v1/bankStatementUpload
API Endpoint
bankStatementUpload
Overview
The API is RESTful and uses standard HTTP verbs and status codes. The responses are in JSON format, and you should upload all images and files as form-data through a POST request.
Method - POST
Authentication
You need a unique pair of application ID ( appId ) and application key ( appKey ) from HyperVerge to verify your identity for accessing the API.
Headers
| Header | Mandatory / Optional | Description | Input Format |
|---|---|---|---|
| content-type | Mandatory | This parameter defines the media type for the request payload | multipart/form-data |
| appId | Mandatory | The application identifier shared by HyperVerge. You can find the details in the dashboard's credentials tab | This should be a unique value |
| appKey | Mandatory | The application key shared by HyperVerge. You can find the details in the dashboard's credentials tab | This should be a unique value |
| transactionId | Mandatory | A unique identifier for tracking a user journey | This should be both unique and easily associated with the user's journey in your application(s) |
Inputs
The following table provides the details of the parameters required for the Bank Statement OCR API's request body:
| Parameter | Mandatory / Optional | Type | Description | Input Format | Default Value |
|---|---|---|---|---|---|
uploadPdf | Mandatory | file | The file containing the user's bank statement document | JPG, JPEG, PNG, or PDF format | Not Applicable |
pdfPassword | Optional | string | If the PDF is password protected, the password should be shared using this parameter | Not Applicable | Not Applicable |
Request
The following code snippet demonstrates a standard curl request for the Bank Statement OCR API:
curl --location --request POST 'https://ind-engine.thomas.hyperverge.co/v1/bankStatementUpload' \
--header 'Content-Type: multipart/form-data' \
--header 'appId: <Enter_the_HyperVerge_appId>' \
--header 'appKey: <Enter_the_HyperVerge_appKey>' \
--header 'transactionId: <Enter_the_HyperVerge_transactionID>' \
--form 'uploadPdf=@"<Path_to_PDF_File>"' \
--form 'pdfPassword="<PDF_File_Password>"'
Success Response
The following code snippet demonstrates a success response from the Bank Statement OCR API:
{
"status": "success",
"statusCode": 200,
"result": {
"bankName": "<Bank_Name>",
"statementId": "<Statement_Identifier>",
"entityId": "<Entity_Identifier>",
"accountNumber": "<Account_Number>",
"name": [
"<Account_Holder_Name>"
],
"address": "<User_Address>",
"ifsc": "<IFSC_Code>",
"micr": "<MICR_Code>",
"accountCategory": "<Account_Category>",
"fromDate": "<From_Date_in_YYYY-MM-DD_Format>",
"toDate": "<To_Date_in_YYYY-MM-DD_Format>",
"pageCount": "<Page_Count>",
"currencyCode": "<Currency_Code>",
"countryCode": "<Country_Code>"
},
"metaData": {
"requestId": "<Request_ID>",
"transactionId": "<Transaction_ID>"
}
}
Success Response Details
The following table outlines the details of the success response from the Bank Statement OCR API:
| Parameter | Type | Description |
|---|---|---|
status | string | The status of the request |
statusCode | integer | The HTTP status code returned for the request |
result | object | Object containing the extracted details from the bank statement |
result.bankName | string | The name of the bank extracted from the bank statement |
result.statementId | string | The unique identifier for the bank statement |
result.entityId | string | The unique identifier for the entity |
result.accountNumber | string | The account number extracted from the bank statement |
result.name | array | Array containing the account holder name or names |
result.name[] | string | The account holder name value |
result.address | string | The address of the account holder extracted from the bank statement |
result.ifsc | string | The IFSC code extracted from the bank statement |
result.micr | string | The MICR code extracted from the bank statement |
result.accountCategory | string | The category of the account extracted from the bank statement |
result.fromDate | string | The start date of the bank statement period |
result.toDate | string | The end date of the bank statement period |
result.pageCount | string | The total number of pages in the bank statement document |
result.currencyCode | string | The currency code of the bank statement |
result.countryCode | string | The country code of the bank statement |
metaData | object | Metadata object containing request tracking information |
metaData.requestId | string | Unique identifier for the API request |
metaData.transactionId | string | Unique identifier for tracking the user journey |
Error Responses
The following are some error responses from the Bank Statement OCR API:
- Missing Input
- Incorrect File Type
- Incorrect Password
- Document Not Detected
- Internal Server Error
{
"message": "Input Validation Error: requires property \"uploadPdf\"",
"statusCode": 400,
"status": "failure"
}
{
"message": "Invalid file type for: uploadPdf",
"statusCode": 400,
"status": "failure"
}
{
"message": "Password provided was incorrect",
"statusCode": 400,
"status": "failure"
}
{
"status": "failure",
"statusCode": 422,
"error": "Document Not Detected"
}
{
"status": "failure",
"statusCode": 500,
"message": "internal server error"
}
Error Response Details
A failure or error response contains a failure status with a relevant status code and error message.
The following table lists all error responses:
| Status Code | Error Message | Error Description | Error Resolution |
|---|---|---|---|
| 400 | Input Validation Error: requires property "uploadPdf" | The request does not contain the required "uploadPdf" property | Provide the uploadPdf parameter in the request |
| 400 | Invalid file type for: uploadPdf | The file type for "uploadPdf" is invalid | Ensure the file is in JPG, JPEG, PNG, or PDF format |
| 400 | Password provided was incorrect | The password in the request is incorrect | Provide the correct password for the password-protected PDF |
| 422 | Document Not Detected | The system was unable to detect a bank statement document in the provided file | Ensure the file contains a valid bank statement document |
| 500 | internal server error | There was an internal server error | Please check the request headers or contact the HyperVerge team for resolution |