General Invoice OCR

Extract General Invoice Information

Response Definition

HTTP StatusCodeMessageDescription

200

-

-

OCR success.

206

partial_content

Partial content

Some page of request is invalid

400

bad_request

Bad request

The API cannot recognize the request with an unspecified cause.

Parameters

Body

KeyTypeDescription

image

String

Base64 image encoded stringBase64 image encoded string

Extract General Invoice Information

POST https://apis.aigen.online/aiscript/general-invoice/v2

Request Body

NameTypeDescription

image*

String

Input base64 images encoded utf-8

request_id

String

(Optional) Request id manually assigned by a user

{
     {
          "status": "success",
          "request_id": "4799c6e2-1433-422a-b3cb-69156fef1ac7",
          "error": [],
          "data": [
               {
                    "shipping_from_address": {},
                    "type_doc": {
                         "value": "ใบสั่งซื้อ",
                         "datetime_iso": "Invalid Datetime",
                         "bboxes": [
                              [
                                   [
                                        673,
                                        229
                                   ],
                                   [
                                        745,
                                        229
                                   ],
                                   [
                                        745,
                                        254
                                   ],
                                   [
                                        673,
                                        254
                                   ]
                              ]
                         ],
                         "bboxes_norm": [
                              [
                                   [
                                        0.4069,
                                        0.0979
                                   ],
                                   [
                                        0.4504,
                                        0.0979
                                   ],
                                   [
                                        0.4504,
                                        0.1086
                                   ],
                                   [
                                        0.4069,
                                        0.1086
                                   ]
                              ]
                         ],
                         "confidence": 0.9889107698097206
                    },
                    "seller_address": {
                         "value": "1 64/14 ซ.สุขุมวิท 75 ถ.สุขุวิท แขวงพระโขนงเหนือ กรุงเทพมหานคร",
                         "datetime_iso": "Invalid Datetime",
                         "bboxes": [
                              [
                                   [
                                        155,
                                        322
                                   ],
                                   [
                                        831,
                                        322
                                   ],
                                   [
                                        831,
                                        371
                                   ],
                                   [
                                        155,
                                        371
                                   ]
                              ]
                         ],
                         "bboxes_norm": [
                              [
                                   [
                                        0.0937,
                                        0.1377
                                   ],
                                   [
                                        0.5024,
                                        0.1377
                                   ],
                                   [
                                        0.5024,
                                        0.1586
                                   ],
                                   [
                                        0.0937,
                                        0.1586
                                   ]
                              ]
                         ],
                         "table_data": [
                              [
                                   {
                                        "column": "table_item_number",
                                        "value": "1",
                                        "datetime_iso": "Invalid Datetime",
                                        "bboxes": [
                                             [
                                                  [
                                                       147,
                                                       577
                                                  ],
                                                  [
                                                       158,
                                                       577
                                                  ],
                                                  [
                                                       158,
                                                       588
                                                  ],
                                                  [
                                                       147,
                                                       588
                                                  ]
                                             ]
                                        ],
                                        "bboxes_norm": [
                                             [
                                                  [
                                                       0.0889,
                                                       0.2467
                                                  ],
                                                  [
                                                       0.0955,
                                                       0.2467
                                                  ],
                                                  [
                                                       0.0955,
                                                       0.2514
                                                  ],
                                                  [
                                                       0.0889,
                                                       0.2514
                                                  ]
                                             ]
                                        ],
                                        "confidence": 0.9984912923157658
                                   },
                                   {
                                        "column": "table_item_code",
                                        "value": "CON-800138",
                                        "datetime_iso": "Invalid Datetime",
                                        "bboxes": [
                                             [
                                                  [
                                                       231,
                                                       570
                                                  ],
                                                  [
                                                       348,
                                                       570
                                                  ],
                                                  [
                                                       348,
                                                       591
                                                  ],
                                                  [
                                                       231,
                                                       591
                                                  ]
                                             ]
                                        ],
                                        "bboxes_norm": [
                                             [
                                                  [
                                                       0.1397,
                                                       0.2437
                                                  ],
                                                  [
                                                       0.2104,
                                                       0.2437
                                                  ],
                                                  [
                                                       0.2104,
                                                       0.2527
                                                  ],
                                                  [
                                                       0.1397,
                                                       0.2527
                                                  ]
                                             ]
                                        ],
                                        "confidence": 0.9859116532963199
                                   }
                              ]
                         ]
                    }
               }
          ]
     }
import requests

api = "https://apis.aigen.online/aiscript/general-invoice/v2"
headers = {"x-aigen-key": "<key>"}
data = {"image": "<base64_string>"}

res = requests.post(api, json=data, headers=headers)
print(res.json())

Last updated