OCR API provides document image recognition and returns corresponding document information.
API Method
Base URL
- Indonesia:https://id.apitd.net/verification/kyc/ocr/v1
- Pakistan:https://pk.apitd.net/verification/kyc/ocr/v1
API
| URL | Request Methods | Content-Type | Output Format | Character Set |
|---|---|---|---|---|
| api-base-url?partner_code=xxx&partner_key=xxx | POST | application/json | JSON | UTF-8 |
Authentication
| Parameter | Type | Description | Required/Optional | Notes |
|---|---|---|---|---|
| partner_code | String | Partner Code | Required | Assigned by TD |
| partner_key | String | Partner Key | Required | Assigned by TD |
Request Parameter
| Parameter | Type | Description | Required/Optional | Notes |
|---|---|---|---|---|
| scene | String | Scene Type | required | enumeration: name_id name_phone_id name_bank_card name_id_bank_card name_id_phone_bank_card |
Response Parameter
| Parameter | Type | Description | Required/Optional | Notes |
|---|---|---|---|---|
| code | Integer | API status code | Required | |
| message | String | Status Information | Required | Specific error reasons will be provided when the API is abnormal |
| sequence_id | String | Unique response code | Required | A unique ID used to track each request |
| result | String | Result | Conditionally Required | Returned when code=200. Enumeration: 1. success 2. fail |
| card_info | JSONObject | ID card information | Conditionally Required | Returned when result is success |
| document_forgery_info | JSONObject | Document forgery detection | Conditional: Returns when result is success | Returned if specified in options |
ID Information (card_info)
-
KTP
Parameter Type Description nik String ID card name String Name birthday String Date of birth birthplace String Place of birth gender String Gender blood_type String Blood group address String Address rt_rw String RT/RW village String Village street String Street (District) religion String Religion marital_status String Marital status occupation String Career nationality String Country of Citizenship expiry_date String Validity period issue_date String Issue date issue_location String Issue location province String Province of residence city String City -
Pakistan NIC/CNIC(front and back side)
Parameter Type Description CNIC OR NIC card_side String The side of card: frontid_number String ID card number CNIC/NIC expiry_date String Expiry date of the card CNIC issue_date String Issue date of the card CNIC name String Name in English
Note: If English translation is required for this field of the NIC document, please contact business/operations to individually activate this enhanced configuration.CNIC name_urdu String Name in Urdu CNIC/NIC birthday String Date of birth CNIC/NIC gender String Gender CNIC/NIC father_name String Father's name
Note: If English translation is required for this field of the NIC document, please contact business/operations to individually activate this enhanced configuration.CNIC/NIC father_name_urdu String Father's name in Urdu CNIC/NIC identifier String Personal identifier NIC country_of_stay String Country of stay CNIC Parameter Type Description CNIC OR NIC card_side String The side of card: back id_number String ID card number CNIC/NIC current_address String Current address CNIC/NIC expiry_date String Expiry date of the card NIC family_number String Family number NIC permanent_address String Permanent address CNIC/NIC issue_date String Issue date of the card NIC current_address_en String Current address in English
Note: If required, please contact business/operations to individually activate this enhanced configuration.CNIC/NIC permanent_address_en String Permanent address in English
Note: If required, please contact business/operations to individually activate this enhanced configuration.CNIC/NIC
Document Forgery Detection (document_forgery_info)
| Parameter | Type | Description | Notes |
|---|---|---|---|
| result | String | Overall result of forgery detection | Enumeration: 1. pass: Passed, document is not forged 2. fail: Failed, document is forged |
| detail | Object | List of forgery detection details | If the result is "pass", this field is not returned; if the result is "fail", this field will list specific reasons, such as "black_white_print" (black and white print) and "screen_capture" (screen capture) |
API Status Code
| **Code ** | Message | Description |
|---|---|---|
| 200 | Success | Call Successfully |
| 301 | Service not purchased | No purchase of the servive |
| 302 | Traffic blocked | Traffic blocked |
| 303 | Traffic insufficient | Traffic insufficient |
| 304 | Service expired | Service expired |
| 305 | Daily maximum volume reached | Daily maximum volume reached |
| 12601 | Detection failed | Cannot recognize this image |
| 12602 | Document detected as having bad quality | The document has been detected but the quality is low. *Only applies to Indonesian OCR service |
| 11350 | Internal error | Internal error |
| 11301 | {parameter} empty | {parameter} empty |
| 11304 | The country partner located is not open | The country partner located is not open |
| 11340 | {parameter} error | {parameter} error |
Response Example
- Request:
{
"image": "/9j/4AAQSkZJRgABAQAAeAB4AAD/********XLiqqauzsw1J3sf/2Q==",
"country": "ID",
"options": "document_forgery"
}- Success (Indonesian):
{
"result": "success",
"code": 200,
"sequence_id": "1721890950247464I31676CAC******",
"message": "success",
"card_info": {
"birthday": "26-05-19**",
"address": "KP.C****",
"occupation": "WIRA****",
"gender": "LAKI-LAKI",
"city": "KABU****",
"expiry_date": "SE****",
"issue_location": "B****",
"religion": "IS****",
"nik": "327****60577****",
"marital_status": "KAWIN",
"birthplace": "BA****",
"nationality": "WN****",
"issue_date": "28-02-20**",
"province": "JAWA****",
"street": "MEGAMEND****",
"blood_type": "-",
"name": "M.TAUFAN****",
"village": "CIPAY****",
"rt_rw": "005/****"
},
"document_forgery_info":{
"result":"fail",
"detail":[
"black_white_print"
]
}
}- Success (Pakistani):
{
"result":"success",
"code":200,
"sequence_id":"1704275269816000X0A366B271******",
"message":"success",
"card_info":{
"birthday":"10/12/19**",
"identifier":"ش**تل",
"id_number":"3****-21*****-1",
"card_side":"front",
"country_of_stay":"",
"gender":"M",
"issue_date":"",
"father_name":"",
"expiry_date":"",
"name":"",
"father_name_urdu":"و*****شق",
"name_urdu":"نم*****د"
}
}- Failed:
{
"code": 11350,
"sequence_id": "69b57131b6fb********61ccba118b60",
"message": "Internal error"
}