Water Bill OCR
Response Definition
HTTP Status
Code
Message
Description
200
-
-
OCR success.
206
partial_content
partial_content
Some page of request is invalid
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
413
too_large_request
Request size is too large; the input size must be less than 10 MB
Image base 64 might be too large to process please check the file size must not greater than 10 MB
500
1000
Internal server error
some error occurred in server side
Extract water bill information
POST
https://apis.aigen.online/aiscript/utility-waterbill/v2
Request Body
Name
Type
Description
image*
String
Base64 image encoded string
{'status': 'success',
'error': [],
'data': [{'acc_no': {'value': '79898938',
'bboxes': [[[442, 499], [699, 499], [699, 545], [442, 545]]],
'bboxes_norm': [[[0.2597, 0.1529],
[0.4107, 0.1529],
[0.4107, 0.167],
[0.2597, 0.167]]],
'confidence': 0.9982},
'billing_issue_date': {'value': '01/65',
'bboxes': [[[1492, 218], [1599, 218], [1599, 257], [1492, 257]]],
'bboxes_norm': [[[0.8766, 0.0668],
[0.9395, 0.0668],
[0.9395, 0.0787],
[0.8766, 0.0787]]],
'confidence': 0.9982},
'branch_id': {'value': '56-05',
'bboxes': [[[182, 505], [338, 505], [338, 545], [182, 545]]],
'bboxes_norm': [[[0.1069, 0.1547],
[0.1986, 0.1547],
[0.1986, 0.167],
[0.1069, 0.167]]],
'confidence': 0.9982},
'customer_name': {'value': 'นายธีระยุทธ แสงวุธ',
'bboxes': [[[76, 2598], [650, 2598], [650, 2699], [76, 2699]]],
'bboxes_norm': [[[0.0447, 0.796],
[0.3819, 0.796],
[0.3819, 0.8269],
[0.0447, 0.8269]]],
'confidence': 0.9698},
'deduction_price': {'value': '0.00',
'bboxes': [[[1067, 953], [1176, 953], [1176, 995], [1067, 995]]],
'bboxes_norm': [[[0.6269, 0.292],
[0.691, 0.292],
[0.691, 0.3048],
[0.6269, 0.3048]]],
'confidence': 0.9982},
'home_address': {'value': '89/54 หมู่ 10 มบ.อินดีบางใหญ่ (2) ถ.เทิดพระเกียรติ ตำบลบางแม่นาง อำเภอบางใหญ่ นนทบุรี',
'bboxes': [[[73, 2656], [1193, 2656], [1193, 2754], [73, 2754]],
[[246, 2738], [997, 2738], [997, 2816], [246, 2816]]],
'bboxes_norm': [[[0.0429, 0.8137],
[0.7009, 0.8137],
[0.7009, 0.8438],
[0.0429, 0.8438]],
[[0.1445, 0.8388], [0.5858, 0.8388], [0.5858, 0.8627], [0.1445, 0.8627]]],
'confidence': 0.9662},
'invoice_no': {'value': '005619-2',
'bboxes': [[[1072, 492], [1249, 492], [1249, 538], [1072, 538]]],
'bboxes_norm': [[[0.6298, 0.1507],
[0.7338, 0.1507],
[0.7338, 0.1648],
[0.6298, 0.1648]]],
'confidence': 0.9982},
'monthly_service_price': {'value': '25.00',
'bboxes': [[[1031, 1028], [1179, 1028], [1179, 1073], [1031, 1073]]],
'bboxes_norm': [[[0.6058, 0.315],
[0.6927, 0.315],
[0.6927, 0.3287],
[0.6058, 0.3287]]],
'confidence': 0.9981},
'overdue_number': {'value': '0',
'bboxes': [[[399, 1315], [641, 1315], [641, 1390], [399, 1390]]],
'bboxes_norm': [[[0.2344, 0.4029],
[0.3766, 0.4029],
[0.3766, 0.4259],
[0.2344, 0.4259]]],
'confidence': 0.9982},
'overdue_price': {'value': '0.00',
'bboxes': [[[1070, 1325], [1187, 1325], [1187, 1370], [1070, 1370]]],
'bboxes_norm': [[[0.6287, 0.4059],
[0.6974, 0.4059],
[0.6974, 0.4197],
[0.6287, 0.4197]]],
'confidence': 0.9982},
'payment_due_date': {'value': '09/0T/65',
'bboxes': [[[941, 1550], [1193, 1550], [1193, 1596], [941, 1596]]],
'bboxes_norm': [[[0.5529, 0.4749],
[0.7009, 0.4749],
[0.7009, 0.489],
[0.5529, 0.489]]],
'confidence': 0.9175},
'total_monthly_price': {'value': '211.86',
'bboxes': [[[1004, 1237], [1181, 1237], [1181, 1282], [1004, 1282]]],
'bboxes_norm': [[[0.5899, 0.379],
[0.6939, 0.379],
[0.6939, 0.3928],
[0.5899, 0.3928]]],
'confidence': 0.9981},
'total_price': {'value': '211.86',
'bboxes': [[[878, 1429], [1187, 1429], [1187, 1475], [878, 1475]]],
'bboxes_norm': [[[0.5159, 0.4378],
[0.6974, 0.4378],
[0.6974, 0.4519],
[0.5159, 0.4519]]],
'confidence': 0.9175},
'vat': {'value': '13.86',
'bboxes': [[[1041, 1181], [1181, 1181], [1181, 1224], [1041, 1224]]],
'bboxes_norm': [[[0.6116, 0.3618],
[0.6939, 0.3618],
[0.6939, 0.375],
[0.6116, 0.375]]],
'confidence': 0.9982},
'water_sp_price': {'value': '170.00',
'bboxes': [[[1002, 871], [1174, 871], [1174, 917], [1002, 917]]],
'bboxes_norm': [[[0.5887, 0.2669],
[0.6898, 0.2669],
[0.6898, 0.2809],
[0.5887, 0.2809]]],
'confidence': 0.9847}}]}
{'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',
'error': [{'object': 'error',
'code': 'partial_contents',
'message': 'Page 2 : can not recognised'}],
'data': [{'acc_no': {'value': '42503185',
'bboxes': [[[478, 570], [684, 570], [684, 612], [478, 612]]],
'bboxes_norm': [[[0.289, 0.2437],
[0.4135, 0.2437],
[0.4135, 0.2617],
[0.289, 0.2617]]],
'confidence': 0.9982},
'billing_issue_date': {'value': '01/64',
'bboxes': [[[1343, 304], [1438, 304], [1438, 343], [1343, 343]]],
'bboxes_norm': [[[0.812, 0.13],
[0.8694, 0.13],
[0.8694, 0.1466],
[0.812, 0.1466]]],
'confidence': 0.9982},
'branch_id': {'value': '04-03',
'bboxes': [[[277, 582], [401, 582], [401, 615], [277, 615]]],
'bboxes_norm': [[[0.1675, 0.2488],
[0.2424, 0.2488],
[0.2424, 0.2629],
[0.1675, 0.2629]]],
'confidence': 0.9982},
'customer_name': {},
'deduction_price': {'value': '0.00',
'bboxes': [[[974, 940], [1065, 940], [1065, 975], [974, 975]]],
'bboxes_norm': [[[0.5889, 0.4019],
[0.6439, 0.4019],
[0.6439, 0.4168],
[0.5889, 0.4168]]],
'confidence': 0.9982},
'home_address': {},
'invoice_no': {'value': '003790-3',
'bboxes': [[[987, 554], [1134, 554], [1134, 596], [987, 596]]],
'bboxes_norm': [[[0.5967, 0.2369],
[0.6856, 0.2369],
[0.6856, 0.2548],
[0.5967, 0.2548]]],
'confidence': 0.9982},
'monthly_service_price': {'value': '25.00',
'bboxes': [[[946, 1005], [1065, 1005], [1065, 1040], [946, 1040]]],
'bboxes_norm': [[[0.5719, 0.4297],
[0.6439, 0.4297],
[0.6439, 0.4446],
[0.5719, 0.4446]]],
'confidence': 0.9981},
'overdue_number': {'value': '1',
'bboxes': [[[458, 1242], [646, 1242], [646, 1298], [458, 1298]]],
'bboxes_norm': [[[0.2769, 0.531],
[0.3906, 0.531],
[0.3906, 0.5549],
[0.2769, 0.5549]]],
'confidence': 0.9982},
'overdue_price': {'value': '258.14',
'bboxes': [[[917, 1253], [1065, 1253], [1065, 1288], [917, 1288]]],
'bboxes_norm': [[[0.5544, 0.5357],
[0.6439, 0.5357],
[0.6439, 0.5507],
[0.5544, 0.5507]]],
'confidence': 0.9961},
'payment_due_date': {'value': '09/01/64',
'bboxes': [[[863, 1438], [1066, 1438], [1066, 1473], [863, 1473]]],
'bboxes_norm': [[[0.5218, 0.6148],
[0.6445, 0.6148],
[0.6445, 0.6298],
[0.5218, 0.6298]]],
'confidence': 0.9953},
'total_monthly_price': {'value': '230.37',
'bboxes': [[[919, 1181], [1063, 1181], [1063, 1216], [919, 1216]]],
'bboxes_norm': [[[0.5556, 0.5049],
[0.6427, 0.5049],
[0.6427, 0.5199],
[0.5556, 0.5199]]],
'confidence': 0.9982},
'total_price': {'value': '488.51',
'bboxes': [[[833, 1340], [1060, 1340], [1060, 1372], [833, 1372]]],
'bboxes_norm': [[[0.5036, 0.5729],
[0.6409, 0.5729],
[0.6409, 0.5866],
[0.5036, 0.5866]]],
'confidence': 0.9982},
'vat': {'value': '15.07',
'bboxes': [[[949, 1132], [1063, 1132], [1063, 1167], [949, 1167]]],
'bboxes_norm': [[[0.5738, 0.484],
[0.6427, 0.484],
[0.6427, 0.4989],
[0.5738, 0.4989]]],
'confidence': 0.9982},
'water_sp_price': {'value': '187.00',
'bboxes': [[[924, 874], [1066, 874], [1066, 914], [924, 914]]],
'bboxes_norm': [[[0.5586, 0.3737],
[0.6445, 0.3737],
[0.6445, 0.3908],
[0.5586, 0.3908]]],
'confidence': 0.9982}},
{'acc_no': {},
'billing_issue_date': {},
'branch_id': {},
'customer_name': {},
'deduction_price': {},
'home_address': {},
'invoice_no': {},
'monthly_service_price': {},
'overdue_number': {},
'overdue_price': {},
'payment_due_date': {},
'total_monthly_price': {},
'total_price': {},
'vat': {},
'water_sp_price': {}}]}
{'status': 'error',
'request_id': '7cccf9f2fe62118f8b755685f294cf6b',
'error': [{'object': 'error',
'code': 'bad_request',
'message': 'Fail to process table extraction'},
{'object': 'error', 'code': 'bad_request', 'message': 'success page is 0'}],
'data': []}
import requests
api = "https://apis.aigen.online/aiscript/utility-waterbill/v2"
headers = {"x-aigen-key": "<key>"}
data = {
"image": "base64_image"
}
res = requests.post(api, json=data, headers=headers)
print(res.json())
const axios = require("axios");
const api = "https://apis.aigen.online/aiscript/utility-waterbill/v2";
const headers = { "x-aigen-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/utility-waterbill/v2',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"image": "<base64_string>",
"option" : {}
}',
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/utility-waterbill/v2' \
--header 'X-AIGEN-KEY: <aigen-key>' \
--header 'Content-Type: application/json' \
--data '{
"image": "<base64_string>"
}'
Last updated