Tawi50
Extract Tawi50 information from an image or pdf
Response Definition
http status | error_code | error_parameters | description |
---|---|---|---|
200 | - | - | OCR successful |
206 | no_field_detect | error <object> | Can’t detect any field of witholding |
400 | no_field_detect | error <object> | Can’t detect any field of witholding |
422 | - | - | Invalid input |
Extract information from an image or pdf
POST
https://apis.aigen.online/aiscript/tawi-50/v2
Request Body
Name | Type | Description |
---|---|---|
image* | String | Input list of base64 image encoded utf-8 |
{
"status": "200",
"request_id": "string",
"error": [
{
"code": "string",
"message": "string"
}
],
"data": [
{
"tax_payer_id_number": {
"value": "บ้าน",
"bboxes": [
[
[
358,
346
],
[
1055,
346
],
[
1055,
396
],
[
358,
396
]
],
[
[
373,
286
],
[
533,
286
],
[
533,
340
],
[
373,
340
]
]
],
"bboxes_norm": [
[
[
0.5,
0.4
],
[
0.75,
0.4
],
[
0.75,
0.6
],
[
0.5,
0.6
]
],
[
[
0.5,
0.4
],
[
0.75,
0.4
],
[
0.75,
0.6
],
[
0.5,
0.6
]
]
],
"confidence": 0.9803633930835318
},
"date_witholding_tax": {
"value": "บ้าน",
"bboxes": [
[
[
358,
346
],
[
1055,
346
],
[
1055,
396
],
[
358,
396
]
],
[
[
373,
286
],
[
533,
286
],
[
533,
340
],
[
373,
340
]
]
],
"bboxes_norm": [
[
[
0.5,
0.4
],
[
0.75,
0.4
],
[
0.75,
0.6
],
[
0.5,
0.6
]
],
[
[
0.5,
0.4
],
[
0.75,
0.4
],
[
0.75,
0.6
],
[
0.5,
0.6
]
]
],
"confidence": 0.9803633930835318
},
"tax_witholder": {
"value": "บ้าน",
"bboxes": [
[
[
358,
346
],
[
1055,
346
],
[
1055,
396
],
[
358,
396
]
],
[
[
373,
286
],
[
533,
286
],
[
533,
340
],
[
373,
340
]
]
],
"bboxes_norm": [
[
[
0.5,
0.4
],
[
0.75,
0.4
],
[
0.75,
0.6
],
[
0.5,
0.6
]
],
[
[
0.5,
0.4
],
[
0.75,
0.4
],
[
0.75,
0.6
],
[
0.5,
0.6
]
]
],
"confidence": 0.9803633930835318
},
"less_income_tax": {
"value": "บ้าน",
"bboxes": [
[
[
358,
346
],
[
1055,
346
],
[
1055,
396
],
[
358,
396
]
],
[
[
373,
286
],
[
533,
286
],
[
533,
340
],
[
373,
340
]
]
],
"bboxes_norm": [
[
[
0.5,
0.4
],
[
0.75,
0.4
],
[
0.75,
0.6
],
[
0.5,
0.6
]
],
[
[
0.5,
0.4
],
[
0.75,
0.4
],
[
0.75,
0.6
],
[
0.5,
0.6
]
]
],
"confidence": 0.9803633930835318
},
"type_withold_tax": {
"value": "บ้าน",
"bboxes": [
[
[
358,
346
],
[
1055,
346
],
[
1055,
396
],
[
358,
396
]
],
[
[
373,
286
],
[
533,
286
],
[
533,
340
],
[
373,
340
]
]
],
"bboxes_norm": [
[
[
0.5,
0.4
],
[
0.75,
0.4
],
[
0.75,
0.6
],
[
0.5,
0.6
]
],
[
[
0.5,
0.4
],
[
0.75,
0.4
],
[
0.75,
0.6
],
[
0.5,
0.6
]
]
],
"confidence": 0.9803633930835318
},
"tax_witholder_id_number": {
"value": "บ้าน",
"bboxes": [
[
[
358,
346
],
[
1055,
346
],
[
1055,
396
],
[
358,
396
]
],
[
[
373,
286
],
[
533,
286
],
[
533,
340
],
[
373,
340
]
]
],
"bboxes_norm": [
[
[
0.5,
0.4
],
[
0.75,
0.4
],
[
0.75,
0.6
],
[
0.5,
0.6
]
],
[
[
0.5,
0.4
],
[
0.75,
0.4
],
[
0.75,
0.6
],
[
0.5,
0.6
]
]
],
"confidence": 0.9803633930835318
},
"tax_amount": {
"value": "บ้าน",
"bboxes": [
[
[
358,
346
],
[
1055,
346
],
[
1055,
396
],
[
358,
396
]
],
[
[
373,
286
],
[
533,
286
],
[
533,
340
],
[
373,
340
]
]
],
"bboxes_norm": [
[
[
0.5,
0.4
],
[
0.75,
0.4
],
[
0.75,
0.6
],
[
0.5,
0.6
]
],
[
[
0.5,
0.4
],
[
0.75,
0.4
],
[
0.75,
0.6
],
[
0.5,
0.6
]
]
],
"confidence": 0.9803633930835318
},
"tax_payer": {
"value": "บ้าน",
"bboxes": [
[
[
358,
346
],
[
1055,
346
],
[
1055,
396
],
[
358,
396
]
],
[
[
373,
286
],
[
533,
286
],
[
533,
340
],
[
373,
340
]
]
],
"bboxes_norm": [
[
[
0.5,
0.4
],
[
0.75,
0.4
],
[
0.75,
0.6
],
[
0.5,
0.6
]
],
[
[
0.5,
0.4
],
[
0.75,
0.4
],
[
0.75,
0.6
],
[
0.5,
0.6
]
]
],
"confidence": 0.9803633930835318
},
"form_type": {
"value": "บ้าน",
"bboxes": [
[
[
358,
346
],
[
1055,
346
],
[
1055,
396
],
[
358,
396
]
],
[
[
373,
286
],
[
533,
286
],
[
533,
340
],
[
373,
340
]
]
],
"bboxes_norm": [
[
[
0.5,
0.4
],
[
0.75,
0.4
],
[
0.75,
0.6
],
[
0.5,
0.6
]
],
[
[
0.5,
0.4
],
[
0.75,
0.4
],
[
0.75,
0.6
],
[
0.5,
0.6
]
]
],
"confidence": 0.9803633930835318
}
},
{
"data": "string"
}
]
}
{
"status": "error",
"request_id": "Unique id of the response",
"error": "{'code':'no_field_detect', 'message':'Can’t detect any field of witholding_tax_document on this document'}",
"data": [
{
"tax_payer_id_number": {
"value": "บ้าน",
"bboxes": [
[
[
358,
346
],
[
1055,
346
],
[
1055,
396
],
[
358,
396
]
],
[
[
373,
286
],
[
533,
286
],
[
533,
340
],
[
373,
340
]
]
],
"bboxes_norm": [
[
[
0.5,
0.4
],
[
0.75,
0.4
],
[
0.75,
0.6
],
[
0.5,
0.6
]
],
[
[
0.5,
0.4
],
[
0.75,
0.4
],
[
0.75,
0.6
],
[
0.5,
0.6
]
]
],
"confidence": 0.9803633930835318
},
"date_witholding_tax": {
"value": "บ้าน",
"bboxes": [
[
[
358,
346
],
[
1055,
346
],
[
1055,
396
],
[
358,
396
]
],
[
[
373,
286
],
[
533,
286
],
[
533,
340
],
[
373,
340
]
]
],
"bboxes_norm": [
[
[
0.5,
0.4
],
[
0.75,
0.4
],
[
0.75,
0.6
],
[
0.5,
0.6
]
],
[
[
0.5,
0.4
],
[
0.75,
0.4
],
[
0.75,
0.6
],
[
0.5,
0.6
]
]
],
"confidence": 0.9803633930835318
},
"tax_witholder": {
"value": "บ้าน",
"bboxes": [
[
[
358,
346
],
[
1055,
346
],
[
1055,
396
],
[
358,
396
]
],
[
[
373,
286
],
[
533,
286
],
[
533,
340
],
[
373,
340
]
]
],
"bboxes_norm": [
[
[
0.5,
0.4
],
[
0.75,
0.4
],
[
0.75,
0.6
],
[
0.5,
0.6
]
],
[
[
0.5,
0.4
],
[
0.75,
0.4
],
[
0.75,
0.6
],
[
0.5,
0.6
]
]
],
"confidence": 0.9803633930835318
},
"less_income_tax": {
"value": "บ้าน",
"bboxes": [
[
[
358,
346
],
[
1055,
346
],
[
1055,
396
],
[
358,
396
]
],
[
[
373,
286
],
[
533,
286
],
[
533,
340
],
[
373,
340
]
]
],
"bboxes_norm": [
[
[
0.5,
0.4
],
[
0.75,
0.4
],
[
0.75,
0.6
],
[
0.5,
0.6
]
],
[
[
0.5,
0.4
],
[
0.75,
0.4
],
[
0.75,
0.6
],
[
0.5,
0.6
]
]
],
"confidence": 0.9803633930835318
},
"type_withold_tax": {
"value": "บ้าน",
"bboxes": [
[
[
358,
346
],
[
1055,
346
],
[
1055,
396
],
[
358,
396
]
],
[
[
373,
286
],
[
533,
286
],
[
533,
340
],
[
373,
340
]
]
],
"bboxes_norm": [
[
[
0.5,
0.4
],
[
0.75,
0.4
],
[
0.75,
0.6
],
[
0.5,
0.6
]
],
[
[
0.5,
0.4
],
[
0.75,
0.4
],
[
0.75,
0.6
],
[
0.5,
0.6
]
]
],
"confidence": 0.9803633930835318
},
"tax_witholder_id_number": {
"value": "บ้าน",
"bboxes": [
[
[
358,
346
],
[
1055,
346
],
[
1055,
396
],
[
358,
396
]
],
[
[
373,
286
],
[
533,
286
],
[
533,
340
],
[
373,
340
]
]
],
"bboxes_norm": [
[
[
0.5,
0.4
],
[
0.75,
0.4
],
[
0.75,
0.6
],
[
0.5,
0.6
]
],
[
[
0.5,
0.4
],
[
0.75,
0.4
],
[
0.75,
0.6
],
[
0.5,
0.6
]
]
],
"confidence": 0.9803633930835318
},
"tax_amount": {
"value": "บ้าน",
"bboxes": [
[
[
358,
346
],
[
1055,
346
],
[
1055,
396
],
[
358,
396
]
],
[
[
373,
286
],
[
533,
286
],
[
533,
340
],
[
373,
340
]
]
],
"bboxes_norm": [
[
[
0.5,
0.4
],
[
0.75,
0.4
],
[
0.75,
0.6
],
[
0.5,
0.6
]
],
[
[
0.5,
0.4
],
[
0.75,
0.4
],
[
0.75,
0.6
],
[
0.5,
0.6
]
]
],
"confidence": 0.9803633930835318
},
"tax_payer": {
"value": "บ้าน",
"bboxes": [
[
[
358,
346
],
[
1055,
346
],
[
1055,
396
],
[
358,
396
]
],
[
[
373,
286
],
[
533,
286
],
[
533,
340
],
[
373,
340
]
]
],
"bboxes_norm": [
[
[
0.5,
0.4
],
[
0.75,
0.4
],
[
0.75,
0.6
],
[
0.5,
0.6
]
],
[
[
0.5,
0.4
],
[
0.75,
0.4
],
[
0.75,
0.6
],
[
0.5,
0.6
]
]
],
"confidence": 0.9803633930835318
},
"form_type": {
"value": "บ้าน",
"bboxes": [
[
[
358,
346
],
[
1055,
346
],
[
1055,
396
],
[
358,
396
]
],
[
[
373,
286
],
[
533,
286
],
[
533,
340
],
[
373,
340
]
]
],
"bboxes_norm": [
[
[
0.5,
0.4
],
[
0.75,
0.4
],
[
0.75,
0.6
],
[
0.5,
0.6
]
],
[
[
0.5,
0.4
],
[
0.75,
0.4
],
[
0.75,
0.6
],
[
0.5,
0.6
]
]
],
"confidence": 0.9803633930835318
}
},
{
"data": "string"
}
]
}
{
"status": "error",
"request_id": "Unique id of the response",
"error": "{'code':'no_field_detect', 'message':'Can’t detect any field of witholding_tax_document on this document'}",
"data": "Unknown Type: null"
}
{
"detail": [
{
"loc": [
"string"
],
"msg": "string",
"type": "string"
}
]
}
import requests
api = "https://apis.aigen.online/aiscript/tawi-50/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/tawi-50/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/tawi-50/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 '' \
--header 'X-AIGEN-KEY: <aigen-key>' \
--header 'Content-Type: application/json' \
--data '{
"image": "<base64_string>",
}'
Last updated