OCR API

OCR API provides document image recognition and returns corresponding document information.

API Method

Base URL

API

URLRequest MethodsContent-TypeOutput FormatCharacter Set
api-base-url?partner_code=xxx&partner_key=xxxPOSTapplication/jsonJSONUTF-8
Authentication
ParameterTypeDescriptionRequired/OptionalNotes
partner_codeStringPartner CodeRequiredAssigned by TD
partner_keyStringPartner KeyRequiredAssigned by TD

Request

ParameterTypeDescriptionRequired/OptionalNotes
imageStringID card imageRequiredID photo,base64 photo of JPG,JPEG,PNG format, the image size limits to 3M
countryStringCountryRequired2-letter country code according to ISO 3166.
Only support: Indonesia(ID), Pakistan(PK)
optionsStringAdditional feature outputOptionalInput "en" in this field, and the following fields of the Pakistan Identity Card will return the English translation results of Urdu language:
1. 'name' and 'fathername' fields of NIC documents
2. 'currentaddress_en' and 'permanent_address_en' fields of NIC/CNIC documents
*Note: If required, please contact business/operations for individual activation of this enhanced configuration.

Response Parameter

ParameterTypeDescriptionRequired/OptionalNote
codeIntegerAPI status codeRequired
messageStringStatus InformationRequiredSpecific error reasons will be provided when the API is abnormal
sequence_idStringUnique response codeRequiredA unique ID used to track each request
resultStringResultConditionally RequiredReturned when code=200.
Enumeration:
1. success
2. fail
card_infoJSONObjectID card informationConditionally RequiredReturned when result is success

Supported ID types

  • KTP
    ParameterTypeDescription
    nikStringID card
    nameStringName
    birthdayStringDate of birth
    birthplaceStringPlace of birth
    genderStringGender
    blood_typeStringBlood group
    addressStringAddress
    rt_rwStringRT/RW
    villageStringVillage
    streetStringStreet (District)
    religionStringReligion
    marital_statusStringMarital status
    occupationStringCareer
    nationalityStringCountry of Citizenship
    expiry_dateStringValidity period
    issue_dateStringIssue date
    issue_locationStringIssue location
    provinceStringProvince of residence
  • Pakistan NIC/CNIC(front and back side)

    ParameterTypeDescriptionCNIC OR NIC
    card_sideStringThe side of card: front
    id_numberStringID card numberCNIC/NIC
    expiry_dateStringExpiry date of the cardCNIC
    issue_dateStringIssue date of the cardCNIC
    nameStringName 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_urduStringName in UrduCNIC/NIC
    birthdayStringDate of birthCNIC/NIC
    genderStringGenderCNIC/NIC
    father_nameStringFather'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_urduStringFather's name in UrduCNIC/NIC
    identifierStringPersonal identifierNIC
    country_of_stayStringCountry of stayCNIC
    ParameterTypeDescriptionCNIC OR NIC
    card_sideStringThe side of card: back
    id_numberStringID card numberCNIC/NIC
    current_addressStringCurrent addressCNIC/NIC
    expiry_dateStringExpiry date of the cardNIC
    family_numberStringFamily numberNIC
    permanent_addressStringPermanent addressCNIC/NIC
    issue_dateStringIssue date of the cardNIC
    current_address_enStringCurrent address in English
    Note: If required, please contact business/operations to individually activate this enhanced configuration.
    CNIC/NIC
    permanent_address_enStringPermanent address in English
    Note: If required, please contact business/operations to individually activate this enhanced configuration.
    CNIC/NIC

API Status Code

Code MessageDescription
200SuccessCall Successfully
301Service not purchasedNo purchase of the servive
302Traffic blockedTraffic blocked
303Traffic insufficientTraffic insufficient
304Service expiredService expired
305Daily maximum volume reachedDaily maximum volume reached
12601Detection failedCannot recognize this image
12602Document detected as having bad qualityThe document has been detected but the quality is low.
*Only applies to Indonesian OCR service
11350Internal errorInternal error
11301{parameter} empty{parameter} empty
11304The country partner located is not openThe country partner located is not open
11340{parameter} error{parameter} error

Response Example

  • Request

    {
      "image": "/9j/4AAQSkZJRgABAQAAeAB4AAD/********XLiqqauzsw1J3sf/2Q==",
      "country": "PK"
    }
    
  • Success

{
   "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"
}