Links

API Documentation

Bank Book Example (SCB)

test.png
post
https://api.iapp.co.th/book-bank-ocr/lineman/file
/
Bank Book OCR

Sample Requests

CURL
Python
Java - Unirest
C#
NodeJS - Request
Objective C
PHP
curl --location --request POST 'https://api.iapp.co.th/book-bank-ocr/lineman/file'
--header 'apikey: --- Your API Key ---'
--form 'file=@"/your/path/to/image.jpg"'
import requests
url = "https://api.iapp.co.th/book-bank-ocr/lineman/file"
payload={}
files=[ ('file',('image.jpg',open('/your/path/to/image.jpg','rb'),'image/jpeg')) ]
headers = { 'apikey': '--- Your API Key ---' }
response = requests.request("POST", url, headers=headers, data=payload, files=files)
print(response.text)
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.post("https://api.iapp.co.th/book-bank-ocr/lineman/file")
.header("apikey", "--- Your API Key ---")
.field("file", new File("/your/path/to/image.jpg"))
.asString();
var client = new RestClient("https://api.iapp.co.th/book-bank-ocr/lineman/file");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("apikey", "--- Your API Key ---");
request.AddFile("file", "/your/path/to/image.jpg");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
var request = require('request');
var fs = require('fs');
var options = {
'method': 'POST',
'url': 'https://api.iapp.co.th/book-bank-ocr/lineman/file',
'headers': {
'apikey': '--- Your API Key ---'
},
formData: {
'file': {
'value': fs.createReadStream('/your/path/to/image.jpg'),
'options': {
'filename': 'image.jpg',
'contentType': null
}
}
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.iapp.co.th/book-bank-ocr/lineman/file"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"apikey": @"--- Your API Key ---"
};
[request setAllHTTPHeaderFields:headers];
NSArray *parameters = @[
@{ @"name": @"file", @"fileName": @"/your/path/to/image.jpg" }
];
NSString *boundary = @"----WebKitFormBoundary7MA4YWxkTrZu0gW";
NSError *error;
NSMutableString *body = [NSMutableString string];
for (NSDictionary *param in parameters) {
[body appendFormat:@"--%@\r\n", boundary];
if (param[@"fileName"]) {
[body appendFormat:@"Content-Disposition:form-data; name=\"%@\"; filename=\"%@\"\r\n", param[@"name"], param[@"fileName"]];
[body appendFormat:@"Content-Type: %@\r\n\r\n", param[@"contentType"]];
[body appendFormat:@"%@", [NSString stringWithContentsOfFile:param[@"fileName"] encoding:NSUTF8StringEncoding error:&error]];
if (error) {
NSLog(@"%@", error);
}
} else {
[body appendFormat:@"Content-Disposition:form-data; name=\"%@\"\r\n\r\n", param[@"name"]];
[body appendFormat:@"%@", param[@"value"]];
}
}
[body appendFormat:@"\r\n--%@--\r\n", boundary];
NSData *postData = [body dataUsingEncoding:NSUTF8StringEncoding];
[request setHTTPBody:postData];
[request setHTTPMethod:@"POST"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
dispatch_semaphore_signal(sema);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api.iapp.co.th/book-bank-ocr/lineman/file');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'apikey' => '--- Your API Key ---'
));
$request->addUpload('file', '/your/path/to/image.jpg', 'image.jpg', '<Content-Type Header>');
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();

Parameters

Fields
Description
Bank Name
Name of the bank
Account Number
Account number on the bank book
Account Name
Account name on the bank book
Bank Branch
Name of the bank branch

Return Values

Fields
Type
Description
message
string
OCR successful / unsuccessful
status
int
API code
file-name-bookbank
string
Name of the input file
bank_name
string
Name of the bank
account_number
string
Account number on the bank book
account_name
string
Account name on the bank book
bank_branch
string
Name of the bank branch
signature
string
signature on the bank book
final-reason-codes
dict
Reason for detection failures
confidence
float
Average confidence of the OCR
inference
float
Time taken to process bank book

final-reason-codes (dict)

Fields
Type
Description
final_code
int
0 (manual check) or 1(pass)
message
string
pass or manual check
reason_codes
dict
reason codes f bank book fields and signature

reason_codes (dict)

Fields
Type
Description
reason_code_bookbank
int
0 or 1
reason_code_bookbank_signature
int
0 or 1
reason_codename_bookbank_signature
string
Reason if signature not found