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}}]}

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())

Last updated