📗✍️ Thai Bank Book OCR with Signature Detection
📗✍️ ระบบอ่านสมุดบัญชีธนาคารพร้อมตรวจจับลายเซ็น
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
-
Prerequisites
- An API key from iApp Technology
- Bank book images
- Supported formats: JPEG, JPG, PNG
- Maximum file size: 2MB
-
Quick Start
- Fast processing time
- High accuracy text recognition
- Support for multiple file formats
- Signature detection capability
-
Key Features
- Bank book information extraction
- Signature detection and verification
- Multiple bank support
- High accuracy recognition
-
Security & Compliance
- GDPR and PDPA compliant
- No data retention after processing
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
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
Key | Required | Description |
---|---|---|
apikey | Yes | Your API key for authentication. |
Body (Form-Data)
Key | Type | Required | Description |
---|---|---|---|
file | File | Yes | The file to be uploaded for OCR. Ensure the file path is specified correctly. |
Response Parameters
Main Response Object
Key | Type | Description |
---|---|---|
bank_book_results | Object | Contains the extracted data from the bank book. |
confidence | String | Confidence level of the OCR result, expressed as a percentage. |
inference_time(s) | String | Time taken to process the OCR request, in seconds. |
message | String | Status message of the request (e.g., "Success"). |
reason_codes | Object | Detailed reason codes for each extracted field. |
signature | String | Status of signature detection (e.g., "Detected"). |
status | Integer | HTTP status code of the response (e.g., 200 for success). |
Book Bank Result Object
Key | Type | Description |
---|---|---|
accountType | String | Type of bank account (e.g., "Savings" or "null" if unknown). |
account_name | String | Name of the account holder. |
account_number | String | Account number of the bank account. |
bank_branch | String | Name of the bank branch. |
bank_name | String | Full name of the bank, including the abbreviation and code. |
file_name_bookbank | String | File 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.
Field | Key | Type | Description |
---|---|---|---|
Account Type | accountType | Object | Code and message for account type. |
Account Name | account_name | Object | Code and message for account name. |
Account Number | account_number | Object | Code and message for account number. |
Bank Branch | bank_branch | Object | Code and message for bank branch. |
Bank Name | bank_name | Object | Code and message for bank name. |
File Name | file_name_bookbank | Object | Code and message for the file name. |
Signature | signature | Object | Code and message for signature detection. |
API Error Message
Reason Codes
Status Code | Status Message | Description |
---|---|---|
1 | pass | Confident about the content read |
0 | manual check | Not confident about the content read, pending manual check |
Signature Reason Codes
Status Code | Status Message |
---|---|
1 | no signature detected |
2 | shade/background |
3 | multiple pic detected |
4 | other (unspecified) |
Common API Error Messages
Status Code | Status Message | Description |
---|---|---|
404 | REQUESTED_URL_NOT_FOUND | API Route not found in request |
413 | FILE_IS_TOO_LARGE: (more than 2 MB) | The file size is too large |
416 | METHOD_NOT_ALLOWED | Method name (GET, POST) in the URL is incorrect. |
427 | LONG_TIME_TO_PROCESS | The server is processed for a long time. |
428 | LONG_TIME_TO_REQUEST | The client is waiting in the queue for a long time. |
461 | NO_FILE_ATTACHED | No file attached. |
462 | ATTACH_ONE_IMAGE_AT_A_TIME | Multiple 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 Name | IC Per Request | On-Premise |
---|---|---|
Book Bank OCR with Signature Detection | 1.25 IC/Request | Contact |