Book Bank OCR
This API is utilized to extract information from the book bank document.
POST https://api.aigen.online/aiscript/bookbank/v2
Request Body Parameters
| key | Type | Description |
|---|---|---|
| image* | String | Input base64 image encoded utf-8 |
Response Keys
| key | Type | Description |
|---|---|---|
| status | String | The summary status. |
| error | List[dict] | The list of errors which occurred during extracting information in each image or page. |
| data | List[dict] | The response dictionary in each individual request page or imageta |
List of Bank
| Bank name | Value |
|---|---|
| Siam Commercial Bank PCL | SCB |
| Bank of Ayudhya Public Company Limited | KRUNGSRI BANK |
| Bangkok Bank Public Company Limited | BANGKOK BANK |
| Thai Military Bank Public Company Limited | TMB |
| Kasikorn bank PCL | KASIKORN BANK |
| Land and Houses Bank Public Company Limited | LH BANK |
| Bank for Agriculture and Agricultural Cooperatives | BAAC |
| Krungthai Bank Public Company Limited | KTB |
| Government Housing Bank | GH BANK |
| TMBThanachart Bank | TTB |
| CIMB Thai Bank Public Company Limited | CIMB |
| TISCO FINANCIAL GROUP PUBLIC COMPANY LIMITED | TISCO |
| Islamic Bank of Thailand | ISLAMICBANK |
| BANK OF CHINA | BANK OF CHINA |
| CITI BANK | CITI BANK |
| united overseas bank | UOB |
Response Data Keys
| Key | Field schema | Description |
|---|---|---|
| bank_name | Object information V2 | Bank Name |
| branch | Object information V2 | Branch Name |
| account_no | Object information V2 | Account Number |
| account_name | Object information V2 | Account Name |
| account_type | Object information V2 | Account Type |
| account_name_title | Object information V2 | Account Title |
| account_name_name | Object information V2 | Account Name |
| account_name_surname | Object information V2 | Account Surname |
Field schema
Object information V2
| value | str | The string value of a considering field. |
| bboxes | List[List[List[int]]] | This list of ocr bounding boxes in considering documents. |
| bboxes_norm | List[List[List[float]]] | The list of ocr bounding boxes in normalized scale [0,1] |
| confidence | float | The ocr confidence level. |
Response code
| HTTP status | Code | Message | Description |
|---|---|---|---|
| 200 | - | - | Document information extraction successfully. |
| 206 | partial_content | Partial_content | The api was unable to retrieve information on some image or page content. In case request images or pages greater than one. |
| 400 | bad_request | Bad Request | Not a valid base64 image request (must be .jpg, .jpeg, .png, .pdf) or invalid size, request schema. The api can not retrieve information on any image. |
| 413 | request_entity_too_large | Request entity too large | The requested image size is larger than the specified image size. |
| 500 | internal_server_error | Internal server error | some errors occurred inside the server. |
- 200: OK Successful response
- 206: Partial Content Partial Content
- 400: Bad Request Bad Request
- 413: Request entity too large
{
"status": "success",
"request_id": "cab78ada-3d63-4007-b223-83c24721c91d",
"error": [],
"data": [
{
"bank_name": {},
"branch": {
"value": "สาขาเยาวราช",
"confidence": 0.7237,
"bboxes": [],
"bboxes_norm": []
},
"account_no": {
"value": "123456789",
"confidence": 0.9815,
"bboxes": [],
"bboxes_norm": []
},
"account_name": {
"value": "ไอเจ็น จำกัด",
"confidence": 0.9546,
"bboxes": [],
"bboxes_norm": []
},
"account_type": {},
"table": [],
"account_name_title": {
"value": "นาย",
"confidence": 0.9546,
"bboxes": [],
"bboxes_norm": []
},
"account_name_name": {
"value": "สมชาย",
"confidence": 0.9546,
"bboxes": [],
"bboxes_norm": []
},
"account_name_surname": {
"value": "ใจดี",
"confidence": 0.9546,
"bboxes": [],
"bboxes_norm": []
}
}
],
"response_id": "cead48b4-68a5-40bf-8e54-2c033cb2e1aa"
}
{
"error": [
{
"object": "error",
"code": "partial_content",
"message": "Partial content"
},
{
"object": "error",
"code": 400,
"message": "Cannot detect bookbank on Image."
}
],
"data": [
{
"bank_name": {
"value": "KTB",
"confidence": 0.7428,
"bboxes": [
[
[351, 1481],
[791, 1481],
[791, 1598],
[351, 1598]
]
],
"bboxes_norm": [
[
[0.2123, 0.6332],
[0.4785, 0.6332],
[0.4785, 0.6832],
[0.2123, 0.6832]
]
]
},
"branch": {
"value": "สาขาสีลม",
"confidence": 0.876,
"bboxes": [
[
[213, 971],
[554, 971],
[554, 1036],
[213, 1036]
]
],
"bboxes_norm": [
[
[0.1289, 0.4151],
[0.3351, 0.4151],
[0.3351, 0.4429],
[0.1289, 0.4429]
]
]
},
"account_no": {
"value": "987654321",
"confidence": 0.8707,
"bboxes": [
[
[1128, 855],
[1503, 855],
[1503, 899],
[1128, 899]
]
],
"bboxes_norm": [
[
[0.6824, 0.3655],
[0.9093, 0.3655],
[0.9093, 0.3844],
[0.6824, 0.3844]
]
]
},
"account_name": {
"value": "บัญชีออมทรัพย์ ไอเจ็น จำกัด",
"confidence": 0.8718,
"bboxes": [
[
[473, 1184],
[1252, 1184],
[1252, 1268],
[473, 1268]
]
],
"bboxes_norm": [
[
[0.2861, 0.5062],
[0.7574, 0.5062],
[0.7574, 0.5421],
[0.2861, 0.5421]
]
]
},
"account_type": {},
"table": [],
"account_name_title": {
"value": "บัญชีออมทรัพย์ ด.ช.",
"confidence": 0.8718,
"bboxes": [
[
[473, 1184],
[1252, 1184],
[1252, 1268],
[473, 1268]
]
],
"bboxes_norm": [
[
[0.2861, 0.5062],
[0.7574, 0.5062],
[0.7574, 0.5421],
[0.2861, 0.5421]
]
]
},
"account_name_name": {
"value": "สมชาย",
"confidence": 0.8718,
"bboxes": [
[
[473, 1184],
[1252, 1184],
[1252, 1268],
[473, 1268]
]
],
"bboxes_norm": [
[
[0.2861, 0.5062],
[0.7574, 0.5062],
[0.7574, 0.5421],
[0.2861, 0.5421]
]
]
},
"account_name_surname": {
"value": "ใจดี",
"confidence": 0.8718,
"bboxes": [
[
[473, 1184],
[1252, 1184],
[1252, 1268],
[473, 1268]
]
],
"bboxes_norm": [
[
[0.2861, 0.5062],
[0.7574, 0.5062],
[0.7574, 0.5421],
[0.2861, 0.5421]
]
]
}
},
{}
],
"status": "error"
}
{
"error": [
{ "object": "error", "code": "bad_request", "message": "Bad Request" },
{
"object": "error",
"code": 400,
"message": "Cannot detect bookbank on Image."
}
],
"status": "error",
"data": {
"bank_name": {},
"branch": {},
"account_no": {},
"account_name": {},
"account_name_title": {},
"account_name_name": {},
"account_name_surname": {},
"table": [],
"account_type": {}
}
}
[
{
"status": "error",
"error": [
{
"object": "error",
"code": "request_entity_too_large",
"message": "The request size exceeds the limit (10240 KB)"
}
],
"data": []
}
]
- Python
- Nodejs
- PHP
- CURL
import requests
api = "https://api.aigen.online/aiscript/bookbank/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://api.aigen.online/aiscript/bookbank/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://api.aigen.online/aiscript/bookbank/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://api.aigen.online/aiscript/bookbank/v2' \
--header 'X-AIGEN-KEY: <aigen-key>' \
--header 'Content-Type: application/json' \
--data '{
"image": "<base64_string>",
}'