Shipping Label OCR
API Documentation for Shipping Label OCR
Response Definition
HTTP Status | Code | Message | Description |
---|---|---|---|
200 | - | - | OCR success. |
206 | partial_content | Partial_content | Some page request is invalid |
400 | bad_request | Can not detect label | Cannot detect Parcel Label in an image |
413 | 413 | The request base64 size is too large | Image is too large |
422 | 422 | Invalid base64 request or Image size is not supported | Invalid base64 request or Image size is not supported |
Extract Shipping Label Information
POST https://apis.aigen.online/aiscript/shipping-label/v2
Request Body
Name | Type | Description |
---|---|---|
image* | String | Base64 image encoded stringBase64 image encoded string |
- 200: OK Successful Response
- 206: Partial Content Partial content
- 400: Bad Request Bad Request
- 413: Error
- 422: Error
{
"status": "success",
"request_id": "",
"error": [],
"data": [
{
"reciever_name": {
"value": "คุณ สุสิ สิสุ",
"bboxes": [
[
[457, 1290],
[1837, 1290],
[1837, 1498],
[457, 1498]
]
],
"bboxes_norm": [
[
[0.1052, 0.3899],
[0.4228, 0.3899],
[0.4228, 0.453],
[0.1052, 0.453]
]
],
"confidence": 0.9083
},
"reciever_address": {
"value": "อาคารสุสิเลขที 111 ม.11 บ.ปอเหลือง",
"bboxes": [
[
[785, 1550],
[2711, 1550],
[2711, 1714],
[785, 1714]
]
],
"bboxes_norm": [
[
[0.1808, 0.4687],
[0.624, 0.4687],
[0.624, 0.5181],
[0.1808, 0.5181]
]
],
"confidence": 0.9783
},
"reciever_phone_number": {
"value": "0111111111",
"bboxes": [
[
[1929, 1305],
[2823, 1305],
[2823, 1485],
[1929, 1485]
]
],
"bboxes_norm": [
[
[0.444, 0.3946],
[0.6496, 0.3946],
[0.6496, 0.4488],
[0.444, 0.4488]
]
],
"confidence": 0.9803
}
}
]
}
{
"status": "error",
"request_id": "",
"error": [
{
"object": "error",
"code": "partial_content",
"message": "Partial content"
}
],
"data": [
{
"reciever_name": {
"value": "คุณ สุสิ สิสุ",
"bboxes": [
[
[457, 1290],
[1837, 1290],
[1837, 1498],
[457, 1498]
]
],
"bboxes_norm": [
[
[0.1052, 0.3899],
[0.4228, 0.3899],
[0.4228, 0.453],
[0.1052, 0.453]
]
],
"confidence": 0.9083
},
"reciever_address": {
"value": "อาคารสุสิเลขที 111 ม.11 บ.ปอเหลือง",
"bboxes": [
[
[785, 1550],
[2711, 1550],
[2711, 1714],
[785, 1714]
]
],
"bboxes_norm": [
[
[0.1808, 0.4687],
[0.624, 0.4687],
[0.624, 0.5181],
[0.1808, 0.5181]
]
],
"confidence": 0.9783
},
"reciever_phone_number": {
"value": "0111111111",
"bboxes": [
[
[1929, 1305],
[2823, 1305],
[2823, 1485],
[1929, 1485]
]
],
"bboxes_norm": [
[
[0.444, 0.3946],
[0.6496, 0.3946],
[0.6496, 0.4488],
[0.444, 0.4488]
]
],
"confidence": 0.9803
}
},
{}
]
}
{
"status": "error",
"request_id": "",
"error": [
{
"object": "error",
"code": "400",
"message": "Cannot detect Parcel Label in an image"
}
],
"data": [{}]
}
{
"status": "error",
"request_id": "",
"error": [
{
"object": "error",
"code": 413,
"message": "The request base64 size is too large"
}
],
"data": []
}
{
"status": "error",
"request_id": "",
"error": [
{
"object": "error",
"code": "422",
"message": "Invalid base64 request or Image size is not supported"
}
],
"data": []
}
- Python
- Nodejs
- PHP
- CURL
import requests
api = "https://apis.aigen.online/aiscript/shipping-label/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-label/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-label/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-label/v2' \
--header 'X-AIGEN-KEY: <aigen-key>' \
--header 'Content-Type: application/json' \
--data '{
"image": "<base64_string>",
}'