Skip to main content

📗✍️ Thai Bank Book OCR with Signature Detection

📗✍️ ระบบอ่านสมุดบัญชีธนาคารพร้อมตรวจจับลายเซ็น

Version Status

Welcome to Bank Book OCR with Signature Detection API, an AI product developed by iApp Technology Co., Ltd. Our API is designed to extract information from bank books and detect signatures with high accuracy and speed.

Getting Started

  1. Prerequisites

    • An API key from iApp Technology
    • Bank book images
    • Supported formats: JPEG, JPG, PNG
    • Maximum file size: 2MB
  2. Quick Start

    • Fast processing time
    • High accuracy text recognition
    • Support for multiple file formats
    • Signature detection capability
  3. Key Features

    • Bank book information extraction
    • Signature detection and verification
    • Multiple bank support
    • High accuracy recognition
  4. Security & Compliance

    • GDPR and PDPA compliant
    • No data retention after processing
How to get API Key?

Please visit iApp AI Portal to view your existing API key or request a new one.

Features and Capabilities

Core Features

The Bank Book OCR API provides robust capabilities to extract and recognize key information from bank book images. Below is an overview of its features:

Core Capabilities

  • Bank Name Recognition: Extracts the full name of the bank, including abbreviation and code.
  • Account Number Recognition: Detects and accurately extracts the bank account number.
  • Account Name Recognition: Retrieves the name of the account holder.
  • Bank Branch Recognition: Identifies the branch name associated with the bank account.
  • Signature Detection: Recognizes the presence of a signature on the document.
  • Confidence Scoring: Provides a confidence level percentage for each recognized field.

Supported Banks

The API supports multiple popular banks in Thailand:

  • SCB (Siam Commercial Bank)
  • Bangkok Bank
  • Krungthai Bank
  • Kasikorn Bank
  • Krungsri Bank (Bank of Ayudhya)
  • TMB Bank

Example

Request:

Image Preview Bank Book with Signature OCR Example

curl --location 'https://api.iapp.co.th/book-bank-ocr/file' \
--header 'apikey: {{YOUR API KEY}}' \
--form 'file=@"{YOUR UPLOADED FILE}"'

Response:

{
"bank_book_results": {
"accountType": "null",
"account_name": "XXXXX XXXXXXXคุณ",
"account_number": "90XXXXXX61",
"bank_branch": "มหาวิทยาลัยธรรมศาสตร์ ท่าพระจันทร์",
"bank_name": "กรุงเทพ (BBL)",
"file_name_bookbank": "1376070230-image3-o"
},
"confidence": "64.43",
"inference_time(s)": "0.478",
"message": "Success",
"reason_codes": {
"accountType": { "code": 1, "message": "Success" },
"account_name": { "code": 1, "message": "Success" },
"account_number": { "code": 1, "message": "Success" },
"bank_branch": { "code": 1, "message": "Success" },
"bank_name": { "code": 1, "message": "Success" },
"file_name_bookbank": { "code": 1, "message": "Success" },
"signature": { "code": 1, "message": "Success" }
},
"signature": "Detected",
"status": 200
}

API Reference

Endpoint

POST https://api.iapp.co.th/book-bank-ocr/file

Request Parameters

Headers

KeyRequiredDescription
apikeyYesYour API key for authentication.

Body (Form-Data)

KeyTypeRequiredDescription
fileFileYesThe file to be uploaded for OCR. Ensure the file path is specified correctly.

Response Parameters

Main Response Object

KeyTypeDescription
bank_book_resultsObjectContains the extracted data from the bank book.
confidenceStringConfidence level of the OCR result, expressed as a percentage.
inference_time(s)StringTime taken to process the OCR request, in seconds.
messageStringStatus message of the request (e.g., "Success").
reason_codesObjectDetailed reason codes for each extracted field.
signatureStringStatus of signature detection (e.g., "Detected").
statusIntegerHTTP status code of the response (e.g., 200 for success).

Book Bank Result Object

KeyTypeDescription
accountTypeStringType of bank account (e.g., "Savings" or "null" if unknown).
account_nameStringName of the account holder.
account_numberStringAccount number of the bank account.
bank_branchStringName of the bank branch.
bank_nameStringFull name of the bank, including the abbreviation and code.
file_name_bookbankStringFile name of the uploaded bank book.

Reason Codes Object

Each field in the bank_book_results object has an associated reason code indicating success or failure.

FieldKeyTypeDescription
Account TypeaccountTypeObjectCode and message for account type.
Account Nameaccount_nameObjectCode and message for account name.
Account Numberaccount_numberObjectCode and message for account number.
Bank Branchbank_branchObjectCode and message for bank branch.
Bank Namebank_nameObjectCode and message for bank name.
File Namefile_name_bookbankObjectCode and message for the file name.
SignaturesignatureObjectCode and message for signature detection.

API Error Message

Reason Codes

Status CodeStatus MessageDescription
1passConfident about the content read
0manual checkNot confident about the content read, pending manual check

Signature Reason Codes

Status CodeStatus Message
1no signature detected
2shade/background
3multiple pic detected
4other (unspecified)

Common API Error Messages

Status CodeStatus MessageDescription
404REQUESTED_URL_NOT_FOUNDAPI Route not found in request
413FILE_IS_TOO_LARGE: (more than 2 MB)The file size is too large
416METHOD_NOT_ALLOWEDMethod name (GET, POST) in the URL is incorrect.
427LONG_TIME_TO_PROCESSThe server is processed for a long time.
428LONG_TIME_TO_REQUESTThe client is waiting in the queue for a long time.
461NO_FILE_ATTACHEDNo file attached.
462ATTACH_ONE_IMAGE_AT_A_TIMEMultiple input images
560

SERVER_IS_BUSY:

(Please try again in a few seconds.)

Server is working on many requests.

Code Example

Python

import requests

url = "https://api.iapp.co.th/book-bank-ocr/file"

payload = {}
files=[
('file',('{YOUR UPLOADED FILE}',open('{YOUR UPLOADED FILE}','rb'),'image/jpeg'))
]
headers = {
'apikey': '{{YOUR API KEY}}'
}

response = requests.request("POST", url, headers=headers, data=payload, files=files)

print(response.text)

JavaScript

const axios = require("axios")
const FormData = require("form-data")
const fs = require("fs")
let data = new FormData()
data.append("file", fs.createReadStream("{YOUR UPLOADED FILE}"))

let config = {
method: "post",
maxBodyLength: Infinity,
url: "https://api.iapp.co.th/book-bank-ocr/file",
headers: {
apikey: "{{YOUR API KEY}}",
...data.getHeaders(),
},
data: data,
}

axios
.request(config)
.then((response) => {
console.log(JSON.stringify(response.data))
})
.catch((error) => {
console.log(error)
})

PHP

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.iapp.co.th/book-bank-ocr/file',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => array('file'=> new CURLFILE('{YOUR UPLOADED FILE}')),
CURLOPT_HTTPHEADER => array(
'apikey: {{YOUR API KEY}}'
),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

Swift

let parameters = [
[
"key": "file",
"src": "{YOUR UPLOADED FILE}",
"type": "file"
]] as [[String: Any]]

let boundary = "Boundary-\(UUID().uuidString)"
var body = Data()
var error: Error? = nil
for param in parameters {
if param["disabled"] != nil { continue }
let paramName = param["key"]!
body += Data("--\(boundary)\r\n".utf8)
body += Data("Content-Disposition:form-data; name=\"\(paramName)\"".utf8)
if param["contentType"] != nil {
body += Data("\r\nContent-Type: \(param["contentType"] as! String)".utf8)
}
let paramType = param["type"] as! String
if paramType == "text" {
let paramValue = param["value"] as! String
body += Data("\r\n\r\n\(paramValue)\r\n".utf8)
} else {
let paramSrc = param["src"] as! String
let fileURL = URL(fileURLWithPath: paramSrc)
if let fileContent = try? Data(contentsOf: fileURL) {
body += Data("; filename=\"\(paramSrc)\"\r\n".utf8)
body += Data("Content-Type: \"content-type header\"\r\n".utf8)
body += Data("\r\n".utf8)
body += fileContent
body += Data("\r\n".utf8)
}
}
}
body += Data("--\(boundary)--\r\n".utf8);
let postData = body


var request = URLRequest(url: URL(string: "https://api.iapp.co.th/book-bank-ocr/file")!,timeoutInterval: Double.infinity)
request.addValue("{{YOUR API KEY}}", forHTTPHeaderField: "apikey")
request.addValue("multipart/form-data; boundary=\(boundary)", forHTTPHeaderField: "Content-Type")

request.httpMethod = "POST"
request.httpBody = postData

let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
}

task.resume()

Kotlin

val client = OkHttpClient()
val mediaType = "text/plain".toMediaType()
val body = MultipartBody.Builder().setType(MultipartBody.FORM)
.addFormDataPart("file","{YOUR UPLOADED FILE}",
File("{YOUR UPLOADED FILE}").asRequestBody("application/octet-stream".toMediaType()))
.build()
val request = Request.Builder()
.url("https://api.iapp.co.th/book-bank-ocr/file")
.post(body)
.addHeader("apikey", "{{YOUR API KEY}}")
.build()
val response = client.newCall(request).execute()

Java

OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM)
.addFormDataPart("file","{YOUR UPLOADED FILE}",
RequestBody.create(MediaType.parse("application/octet-stream"),
new File("{YOUR UPLOADED FILE}")))
.build();
Request request = new Request.Builder()
.url("https://api.iapp.co.th/book-bank-ocr/file")
.method("POST", body)
.addHeader("apikey", "{{YOUR API KEY}}")
.build();
Response response = client.newCall(request).execute();

Dart

var headers = {
'apikey': '{{YOUR API KEY}}'
};
var request = http.MultipartRequest('POST', Uri.parse('https://api.iapp.co.th/book-bank-ocr/file'));
request.files.add(await http.MultipartFile.fromPath('file', '{YOUR UPLOADED FILE}'));
request.headers.addAll(headers);

http.StreamedResponse response = await request.send();

if (response.statusCode == 200) {
print(await response.stream.bytesToString());
}
else {
print(response.reasonPhrase);
}

History

Version 1.2

Expected to be released by the end of May

  • Increase accuracy
  • Bank branch recognition
  • Account name recognition

Version 1.1

Released on 20th April 2022

Overall Accuracy = 78%

  • Increased accuracy:
  • Account number recognition by 8% (old version: 88.84%, new version: 96.82%)
  • Bank name recognition by 4% (old version: 94.87%, new version: 99.5%)

Version 1.0

Released on 24th March 2022
Overall Accuracy = 74.85%

  • First initial version
  • Supported Banks: SCB, Bangkok Bank, Krungthai Bank, Kasikorn bank, krungsri bank(Bank of Ayudhya), TMB Bank
  • Supported fields: Bank name, Account number, Account name, Bank branch

Pricing

AI API Service NameIC Per RequestOn-Premise
Book Bank OCR with Signature Detection1.25 IC/RequestContact