Bank Statement OCR
Extract Bank Statement information from an image or PDF.
Response Definition
HTTP Status | Code | Message | Description |
---|---|---|---|
200 | - | - | OCR success. |
400 | bad_request | Image too small | Image base 64 might be too small to process please check resolution of your image |
400 | bad_request | Fail to process table extraction | Fail to process table on document |
206 | partial_content | Partial_content | Some page of request is invalid |
Parameters
Body
Key | Type | Description |
---|---|---|
image | String | Base64 image encoded stringBase64 image encoded string |
option | Dict | Input Boolean for Optional return |
Option Key
Key | Type | Descript |
---|---|---|
return_statement_summary | Bool | Set True to return sum_withdraw, count_withdraw, sum_deposit, count_deposit |
return_datetime_iso | Bool | Set True to return additional key for date time iso format for date time data |
pdf_password | String | PDF password unlock |
Extract Bank Statement Information
POST https://apis.aigen.online/aiscript/bank-statement/v2
Request Body
Name | Type | Description |
---|---|---|
image* | Input base64 images encoded utf-8 |
- 200: OK Successful Response
- 400: Bad Request Image too small expect > 1000X1000 pixels
- 400: Bad Request Image too small
- 206: Partial Content
{
"status": "success",
"request_id": "150da2b0069699aedcb861a1afe4c585",
"error": [],
"data": [
{
"account_name": {},
"bank_name": {
"value": "ธนาคารกรุงศรีอยุธยา",
"confidence": 0.9894000291824341,
"bboxes": [
[
[65, 274],
[127, 274],
[127, 296],
[65, 296]
]
],
"bboxes_norm": [
[
[0.0398, 0.1172],
[0.0774, 0.1172],
[0.0774, 0.1266],
[0.0398, 0.1266]
]
]
},
"date_range": {},
"table_data": [
[
{
"column": "",
"value": "14/09/2022 20:49:07",
"bboxes": [
[
[59, 739],
[267, 739],
[267, 757],
[59, 757]
]
],
"bboxes_norm": [
[
[0.0357, 0.3159],
[0.1615, 0.3159],
[0.1615, 0.3236],
[0.0357, 0.3236]
]
],
"confidence": 0.9982
},
{
"column": "",
"value": "MOBILE",
"bboxes": [
[
[1119, 736],
[1195, 736],
[1195, 764],
[1119, 764]
]
],
"bboxes_norm": [
[
[0.677, 0.3147],
[0.7229, 0.3147],
[0.7229, 0.3266],
[0.677, 0.3266]
]
],
"confidence": 0.9462
}
],
[
{
"column": "",
"value": "16/09/2022 01:32:20",
"bboxes": [
[
[59, 783],
[267, 783],
[267, 806],
[59, 806]
]
],
"bboxes_norm": [
[
[0.0357, 0.3348],
[0.1615, 0.3348],
[0.1615, 0.3446],
[0.0357, 0.3446]
]
],
"confidence": 0.9763
},
{
"column": "",
"value": "OTHERS",
"bboxes": [
[
[1119, 781],
[1198, 781],
[1198, 811],
[1119, 811]
]
],
"bboxes_norm": [
[
[0.677, 0.3339],
[0.7247, 0.3339],
[0.7247, 0.3467],
[0.677, 0.3467]
]
],
"confidence": 0.9462
}
],
[
{
"column": "",
"value": "22/09/2022 13:52:24",
"bboxes": [
[
[59, 828],
[267, 828],
[267, 863],
[59, 863]
]
],
"bboxes_norm": [
[
[0.0357, 0.354],
[0.1615, 0.354],
[0.1615, 0.369],
[0.0357, 0.369]
]
],
"confidence": 0.9847
},
{
"column": "",
"value": "MOBILE",
"bboxes": [
[
[1119, 828],
[1195, 828],
[1195, 863],
[1119, 863]
]
],
"bboxes_norm": [
[
[0.677, 0.354],
[0.7229, 0.354],
[0.7229, 0.369],
[0.677, 0.369]
]
],
"confidence": 0.9462
}
],
[
{
"column": "",
"value": "23/09/2022 01:23:42",
"bboxes": [
[
[59, 874],
[267, 874],
[267, 909],
[59, 909]
]
],
"bboxes_norm": [
[
[0.0357, 0.3737],
[0.1615, 0.3737],
[0.1615, 0.3886],
[0.0357, 0.3886]
]
],
"confidence": 0.9953
},
{
"column": "",
"value": "OTHERS",
"bboxes": [
[
[1119, 874],
[1198, 874],
[1198, 909],
[1119, 909]
]
],
"bboxes_norm": [
[
[0.677, 0.3737],
[0.7247, 0.3737],
[0.7247, 0.3886],
[0.677, 0.3886]
]
],
"confidence": 0.9462
}
],
[
{
"column": "",
"value": "23/09/2022 18:21:29",
"bboxes": [
[
[59, 928],
[267, 928],
[267, 949],
[59, 949]
]
],
"bboxes_norm": [
[
[0.0357, 0.3968],
[0.1615, 0.3968],
[0.1615, 0.4057],
[0.0357, 0.4057]
]
],
"confidence": 0.9982
},
{
"column": "",
"value": "MOBILE",
"bboxes": [
[
[1119, 926],
[1195, 926],
[1195, 954],
[1119, 954]
]
],
"bboxes_norm": [
[
[0.677, 0.3959],
[0.7229, 0.3959],
[0.7229, 0.4079],
[0.677, 0.4079]
]
],
"confidence": 0.9462
}
]
]
}
]
}
{
"status": "400",
"message": "Image too small expect > 1000X1000 pixels",
"response_id": "1d5b4654930988180cc01862bcf3e3d2",
"error_list": [
{
"code": "2001",
"message": "Image too small expect > 1000X1000 pixels"
}
],
"result": null,
"additional_result": null
}
{
"status": "error",
"request_id": "733a9726da624c3e2c1cd2c516a8913b",
"error": [
{
"object": "error",
"code": "bad_request",
"message": "Image too small"
},
{
"object": "error",
"code": "bad_request",
"message": "success page is 0"
}
],
"data": []
}
{
"status": "error",
"request_id": "45154b795febe73e387f640d800192c6",
"error": [
{
"object": "error",
"code": "bad_request",
"message": "Fail to process table extraction"
},
{
"object": "error",
"code": "partial_content",
"message": "Partial content"
}
],
"data": [
{
"account_name": {},
"bank_name": {
"value": "ธนาคารกรุงศรีอยุธยา",
"confidence": 0.9894000291824341,
"bboxes": [
[
[65, 274],
[127, 274],
[127, 296],
[65, 296]
]
],
"bboxes_norm": [
[
[0.0398, 0.1172],
[0.0774, 0.1172],
[0.0774, 0.1266],
[0.0398, 0.1266]
]
]
},
"date_range": {},
"table_data": [
[
{
"column": "",
"value": "14/09/2022 20:49:07",
"bboxes": [
[
[59, 739],
[267, 739],
[267, 757],
[59, 757]
]
],
"bboxes_norm": [
[
[0.0357, 0.3159],
[0.1615, 0.3159],
[0.1615, 0.3236],
[0.0357, 0.3236]
]
],
"confidence": 0.9982
},
{
"column": "",
"value": "MOBILE",
"bboxes": [
[
[1119, 736],
[1195, 736],
[1195, 764],
[1119, 764]
]
],
"bboxes_norm": [
[
[0.677, 0.3147],
[0.7229, 0.3147],
[0.7229, 0.3266],
[0.677, 0.3266]
]
],
"confidence": 0.9462
}
],
[
{
"column": "",
"value": "16/09/2022 01:32:20",
"bboxes": [
[
[59, 783],
[267, 783],
[267, 806],
[59, 806]
]
],
"bboxes_norm": [
[
[0.0357, 0.3348],
[0.1615, 0.3348],
[0.1615, 0.3446],
[0.0357, 0.3446]
]
],
"confidence": 0.9763
},
{
"column": "",
"value": "OTHERS",
"bboxes": [
[
[1119, 781],
[1198, 781],
[1198, 811],
[1119, 811]
]
],
"bboxes_norm": [
[
[0.677, 0.3339],
[0.7247, 0.3339],
[0.7247, 0.3467],
[0.677, 0.3467]
]
],
"confidence": 0.9462
}
],
[
{
"column": "",
"value": "22/09/2022 13:52:24",
"bboxes": [
[
[59, 828],
[267, 828],
[267, 863],
[59, 863]
]
],
"bboxes_norm": [
[
[0.0357, 0.354],
[0.1615, 0.354],
[0.1615, 0.369],
[0.0357, 0.369]
]
],
"confidence": 0.9847
},
{
"column": "",
"value": "MOBILE",
"bboxes": [
[
[1119, 828],
[1195, 828],
[1195, 863],
[1119, 863]
]
],
"bboxes_norm": [
[
[0.677, 0.354],
[0.7229, 0.354],
[0.7229, 0.369],
[0.677, 0.369]
]
],
"confidence": 0.9462
}
],
[
{
"column": "",
"value": "23/09/2022 01:23:42",
"bboxes": [
[
[59, 874],
[267, 874],
[267, 909],
[59, 909]
]
],
"bboxes_norm": [
[
[0.0357, 0.3737],
[0.1615, 0.3737],
[0.1615, 0.3886],
[0.0357, 0.3886]
]
],
"confidence": 0.9953
},
{
"column": "",
"value": "OTHERS",
"bboxes": [
[
[1119, 874],
[1198, 874],
[1198, 909],
[1119, 909]
]
],
"bboxes_norm": [
[
[0.677, 0.3737],
[0.7247, 0.3737],
[0.7247, 0.3886],
[0.677, 0.3886]
]
],
"confidence": 0.9462
}
],
[
{
"column": "",
"value": "23/09/2022 18:21:29",
"bboxes": [
[
[59, 928],
[267, 928],
[267, 949],
[59, 949]
]
],
"bboxes_norm": [
[
[0.0357, 0.3968],
[0.1615, 0.3968],
[0.1615, 0.4057],
[0.0357, 0.4057]
]
],
"confidence": 0.9982
},
{
"column": "",
"value": "MOBILE",
"bboxes": [
[
[1119, 926],
[1195, 926],
[1195, 954],
[1119, 954]
]
],
"bboxes_norm": [
[
[0.677, 0.3959],
[0.7229, 0.3959],
[0.7229, 0.4079],
[0.677, 0.4079]
]
],
"confidence": 0.9462
}
]
]
},
{}
]
}
- Python
- Nodejs
- PHP
- CURL
import requests
api = "https://apis.aigen.online/aiscript/bank-statement/v2"
headers = {"x-aigen-key": "<key>"}
data = {"image": "<base64_string>"}
res = requests.post(api, json=data, headers=headers)
print(res.json())
const axios = require("axios");
const api = "https://apis.aigen.online/aiscript/bank-statement/v2";
const headers = {
"x-aigen-key": "<key>",
};
const data = { image: "<base64_string>" };
axios
.post(api, data, { headers: headers })
.then((res) => {
console.log(res.data);
})
.catch((err) => {
console.error(err.response.data);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://apis.aigen.online/aiscript/bank-statement/v2',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"image": "<base64_string>",
}',
CURLOPT_HTTPHEADER => array(
'X-AIGEN-KEY: <aigen-key>',
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
?>
curl --location 'https://apis.aigen.online/aiscript/bank-statement/v2' \
--header 'X-AIGEN-KEY: <aigen-key>' \
--header 'Content-Type: application/json' \
--data '{
"image": "<base64_string>",
}'