Shipping Invoice OCR
API Documentation for Shipping Invoice OCR
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, cannot extract data from image |
206 | partial_content | Partial_content | Some page of request is invalid |
Extract Shipping Invoice Information
POST https://apis.aigen.online/aiscript/shipping-invoice/v2
Request Body
Name | Type | Description |
---|---|---|
image* | String | Base64 image encoded stringBase64 image encoded string |
- 200: OK Successful Response
- 400: Bad Request Bad Request
- 206: Partial Content Partial content
{
"status": "success",
"request_id": "",
"error": [],
"data": [
{
"total": {
"value": "1,605.00",
"bboxes": [
[
[1398, 1571],
[1565, 1571],
[1565, 1624],
[1398, 1624]
]
],
"bboxes_norm": [
[
[0.846, 0.672],
[0.947, 0.672],
[0.947, 0.695],
[0.846, 0.695]
]
],
"confidence": 0.9893
},
"branch_seller": {},
"seller_tax_id_no": {},
"buyer_address": {},
"item_name": {},
"seller_name": {
"value": "DHLGLOBALFORWARDING(THAILAND)LIMITED",
"bboxes": [
[
[92, 2029],
[641, 2029],
[641, 2071],
[92, 2071]
]
],
"bboxes_norm": [
[
[0.056, 0.868],
[0.388, 0.868],
[0.388, 0.886],
[0.056, 0.886]
]
],
"confidence": 0.9754
},
"invoice_no": {
"value": "W1032030",
"bboxes": [
[
[85, 191],
[748, 191],
[748, 266],
[85, 266]
]
],
"bboxes_norm": [
[
[0.052, 0.082],
[0.453, 0.082],
[0.453, 0.114],
[0.052, 0.114]
]
],
"confidence": 0.9928
},
"pod": {},
"baht": {
"value": "1,500.00",
"bboxes": [
[
[1424, 1222],
[1567, 1222],
[1567, 1274],
[1424, 1274]
]
],
"bboxes_norm": [
[
[0.862, 0.523],
[0.948, 0.523],
[0.948, 0.545],
[0.862, 0.545]
]
],
"confidence": 0.8537
},
"buyer_tax_id_no": {
"value": "0105556176239",
"bboxes": [
[
[1074, 465],
[1431, 465],
[1431, 505],
[1074, 505]
]
],
"bboxes_norm": [
[
[0.65, 0.199],
[0.866, 0.199],
[0.866, 0.216],
[0.65, 0.216]
]
],
"confidence": 0.9934
},
"customer_id": {
"value": "THTHP009/T0174",
"bboxes": [
[
[1092, 350],
[1462, 350],
[1462, 390],
[1092, 390]
]
],
"bboxes_norm": [
[
[0.661, 0.15],
[0.885, 0.15],
[0.885, 0.167],
[0.661, 0.167]
]
],
"confidence": 0.9797
},
"grand_total": {},
"pol": {
"value": "THLCH=LaemChabang,Thailand",
"bboxes": [
[
[92, 1007],
[456, 1007],
[456, 1073],
[92, 1073]
]
],
"bboxes_norm": [
[
[0.056, 0.431],
[0.276, 0.431],
[0.276, 0.459],
[0.056, 0.459]
]
],
"confidence": 0.9583
},
"due_date": {
"value": "17-Jun-23",
"bboxes": [
[
[1135, 502],
[1370, 502],
[1370, 542],
[1135, 542]
]
],
"bboxes_norm": [
[
[0.687, 0.215],
[0.829, 0.215],
[0.829, 0.232],
[0.687, 0.232]
]
],
"confidence": 0.9785
},
"sub_total": {
"value": "1,500.00",
"bboxes": [
[
[1429, 1496],
[1565, 1496],
[1565, 1536],
[1429, 1536]
]
],
"bboxes_norm": [
[
[0.865, 0.64],
[0.947, 0.64],
[0.947, 0.657],
[0.865, 0.657]
]
],
"confidence": 0.9961
},
"witholding_tax": {},
"other_3": {},
"vessel": {},
"seller_address": {},
"buyer_name": {},
"voy": {},
"vat": {
"value": "105.00",
"bboxes": [
[
[1459, 1531],
[1565, 1531],
[1565, 1571],
[1459, 1571]
]
],
"bboxes_norm": [
[
[0.883, 0.655],
[0.947, 0.655],
[0.947, 0.672],
[0.883, 0.672]
]
],
"confidence": 0.996
},
"biller_id": {},
"invoice_date": {
"value": "18-May-23",
"bboxes": [
[
[1090, 313],
[1376, 313],
[1376, 353],
[1090, 353]
]
],
"bboxes_norm": [
[
[0.66, 0.134],
[0.833, 0.134],
[0.833, 0.151],
[0.66, 0.151]
]
],
"confidence": 0.9859
},
"table_data": [
[
{
"column": "DESCRIPTION",
"value": "ro. Waybi77/BiTT of Lading ~ 1 shinment @ THB",
"bboxes": [
[
[92, 1222],
[1124, 1222],
[1124, 1257],
[92, 1257]
]
],
"bboxes_norm": [
[
[0.056, 0.523],
[0.68, 0.523],
[0.68, 0.538],
[0.056, 0.538]
]
],
"confidence": 0.8709
},
{
"column": "DESCRIPTION",
"value": "1500.00 Shipment/B/L SURRENDER FEE",
"bboxes": [
[
[92, 1257],
[1124, 1257],
[1124, 1292],
[92, 1292]
]
],
"bboxes_norm": [
[
[0.056, 0.538],
[0.68, 0.538],
[0.68, 0.553],
[0.056, 0.553]
]
],
"confidence": 0.9526
}
],
[
{
"column": "VAT IN THB",
"value": "7%",
"bboxes": [
[
[1124, 1222],
[1357, 1222],
[1357, 1257],
[1124, 1257]
]
],
"bboxes_norm": [
[
[0.68, 0.523],
[0.821, 0.523],
[0.821, 0.538],
[0.68, 0.538]
]
],
"confidence": 0.9953
}
],
[
{
"column": "CHARGES IN THB",
"value": "1.500.00",
"bboxes": [
[
[1357, 1222],
[1563, 1222],
[1563, 1257],
[1357, 1257]
]
],
"bboxes_norm": [
[
[0.821, 0.523],
[0.946, 0.523],
[0.946, 0.538],
[0.821, 0.538]
]
],
"confidence": 0.916
}
]
]
}
]
}
{
"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": [
{
"total": {
"value": "1,605.00",
"bboxes": [
[
[1398, 1571],
[1565, 1571],
[1565, 1624],
[1398, 1624]
]
],
"bboxes_norm": [
[
[0.846, 0.672],
[0.947, 0.672],
[0.947, 0.695],
[0.846, 0.695]
]
],
"confidence": 0.9893
},
"branch_seller": {},
"seller_tax_id_no": {},
"buyer_address": {},
"item_name": {},
"seller_name": {
"value": "DHLGLOBALFORWARDING(THAILAND)LIMITED",
"bboxes": [
[
[92, 2029],
[641, 2029],
[641, 2071],
[92, 2071]
]
],
"bboxes_norm": [
[
[0.056, 0.868],
[0.388, 0.868],
[0.388, 0.886],
[0.056, 0.886]
]
],
"confidence": 0.9754
},
"invoice_no": {
"value": "W1032030",
"bboxes": [
[
[85, 191],
[748, 191],
[748, 266],
[85, 266]
]
],
"bboxes_norm": [
[
[0.052, 0.082],
[0.453, 0.082],
[0.453, 0.114],
[0.052, 0.114]
]
],
"confidence": 0.9928
},
"pod": {},
"baht": {
"value": "1,500.00",
"bboxes": [
[
[1424, 1222],
[1567, 1222],
[1567, 1274],
[1424, 1274]
]
],
"bboxes_norm": [
[
[0.862, 0.523],
[0.948, 0.523],
[0.948, 0.545],
[0.862, 0.545]
]
],
"confidence": 0.8537
},
"buyer_tax_id_no": {
"value": "0105556176239",
"bboxes": [
[
[1074, 465],
[1431, 465],
[1431, 505],
[1074, 505]
]
],
"bboxes_norm": [
[
[0.65, 0.199],
[0.866, 0.199],
[0.866, 0.216],
[0.65, 0.216]
]
],
"confidence": 0.9934
},
"customer_id": {
"value": "THTHP009/T0174",
"bboxes": [
[
[1092, 350],
[1462, 350],
[1462, 390],
[1092, 390]
]
],
"bboxes_norm": [
[
[0.661, 0.15],
[0.885, 0.15],
[0.885, 0.167],
[0.661, 0.167]
]
],
"confidence": 0.9797
},
"grand_total": {},
"pol": {
"value": "THLCH=LaemChabang,Thailand",
"bboxes": [
[
[92, 1007],
[456, 1007],
[456, 1073],
[92, 1073]
]
],
"bboxes_norm": [
[
[0.056, 0.431],
[0.276, 0.431],
[0.276, 0.459],
[0.056, 0.459]
]
],
"confidence": 0.9583
},
"due_date": {
"value": "17-Jun-23",
"bboxes": [
[
[1135, 502],
[1370, 502],
[1370, 542],
[1135, 542]
]
],
"bboxes_norm": [
[
[0.687, 0.215],
[0.829, 0.215],
[0.829, 0.232],
[0.687, 0.232]
]
],
"confidence": 0.9785
},
"sub_total": {
"value": "1,500.00",
"bboxes": [
[
[1429, 1496],
[1565, 1496],
[1565, 1536],
[1429, 1536]
]
],
"bboxes_norm": [
[
[0.865, 0.64],
[0.947, 0.64],
[0.947, 0.657],
[0.865, 0.657]
]
],
"confidence": 0.9961
},
"witholding_tax": {},
"other_3": {},
"vessel": {},
"seller_address": {},
"buyer_name": {},
"voy": {},
"vat": {
"value": "105.00",
"bboxes": [
[
[1459, 1531],
[1565, 1531],
[1565, 1571],
[1459, 1571]
]
],
"bboxes_norm": [
[
[0.883, 0.655],
[0.947, 0.655],
[0.947, 0.672],
[0.883, 0.672]
]
],
"confidence": 0.996
},
"biller_id": {},
"invoice_date": {
"value": "18-May-23",
"bboxes": [
[
[1090, 313],
[1376, 313],
[1376, 353],
[1090, 353]
]
],
"bboxes_norm": [
[
[0.66, 0.134],
[0.833, 0.134],
[0.833, 0.151],
[0.66, 0.151]
]
],
"confidence": 0.9859
},
"table_data": [
[
{
"column": "DESCRIPTION",
"value": "ro. Waybi77/BiTT of Lading ~ 1 shinment @ THB",
"bboxes": [
[
[92, 1222],
[1124, 1222],
[1124, 1257],
[92, 1257]
]
],
"bboxes_norm": [
[
[0.056, 0.523],
[0.68, 0.523],
[0.68, 0.538],
[0.056, 0.538]
]
],
"confidence": 0.8709
},
{
"column": "DESCRIPTION",
"value": "1500.00 Shipment/B/L SURRENDER FEE",
"bboxes": [
[
[92, 1257],
[1124, 1257],
[1124, 1292],
[92, 1292]
]
],
"bboxes_norm": [
[
[0.056, 0.538],
[0.68, 0.538],
[0.68, 0.553],
[0.056, 0.553]
]
],
"confidence": 0.9526
}
],
[
{
"column": "VAT IN THB",
"value": "7%",
"bboxes": [
[
[1124, 1222],
[1357, 1222],
[1357, 1257],
[1124, 1257]
]
],
"bboxes_norm": [
[
[0.68, 0.523],
[0.821, 0.523],
[0.821, 0.538],
[0.68, 0.538]
]
],
"confidence": 0.9953
}
],
[
{
"column": "CHARGES IN THB",
"value": "1.500.00",
"bboxes": [
[
[1357, 1222],
[1563, 1222],
[1563, 1257],
[1357, 1257]
]
],
"bboxes_norm": [
[
[0.821, 0.523],
[0.946, 0.523],
[0.946, 0.538],
[0.821, 0.538]
]
],
"confidence": 0.916
}
]
]
},
{}
]
}
- Python
- Nodejs
- PHP
- CURL
import requests
api = "https://apis.aigen.online/aiscript/shipping-invoice/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/shipping-invoice/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/shipping-invoice/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/shipping-invoice/v2' \
--header 'X-AIGEN-KEY: <aigen-key>' \
--header 'Content-Type: application/json' \
--data '{
"image": "<base64_string>",
}'