Tawi50

Extract Tawi50 information from an image or pdf

Response Definition

http statuserror_codeerror_parametersdescription

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

NameTypeDescription

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"
    }
  ]
}
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())

Last updated