API Reference
中文

OCR API V2.0

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 Parameter

ParameterTypeDescriptionRequired/OptionalNotes
imageStringID card imageRequiredBase64 encoded image character stream of JPG, JPEG, PNG, the image cannot exceed 2M
countryStringCountryRequiredTwo-digit country code (uppercase). Compliant with ISO 3166 standard, such as Mexico: MX
sceneStringScene TypeRequiredEnumeration:
  • name_id
  • name_phone_id
  • name_bank_card
  • name_id_bank_card
  • name_id_phone_bank_card | | options | String | Additional feature output | Optional | Enumeration:
  • images: to output document image, portraits, signature etc.
  • image_quality: to output image quality related parameters
  • document_forgery: Returns forgery detection parameters

Support multiple selections, separated by commas, for example: images, image_quality, document_forgery |

OCR Image Specifications and Requirements

Requirement CategorySpecific Guidelines and Requirements
Document Placement- Ensure the document is centered in the image, with all four edges clearly visible and not obscured or cropped.
  • Maintain the original aspect ratio of the document to avoid distortion.
  • Avoid using non-authentic online samples (such as images found on the internet), blurry photographs, incomplete document edges, or severely distorted images. | | Image Quality | - Capture the image in an environment with adequate and even lighting, avoiding direct strong light or shadows.
  • Use a single, preferably light-colored background without complex patterns or textures.
  • Ensure the test image is clear, without blurriness or overexposure issues. | | Image Specifications | - The file size of the image should ideally be between 100KB and 500KB to ensure fast upload speeds and efficient processing, while avoiding excessive compression that could degrade recognition quality. |

Examples of Acceptable Pictures:

Acceptable Pictures

Examples of Non-acceptable Pictures:

Non-acceptable Pictures

Response Parameter

ParameterTypeDescriptionNotes
codeIntegerAPI status code
messageStringStatus informationWhen the API is in an abnormal state, the specific abnormal reasons are returned
sequence_idStringUnique response codeTo track the unique identification of each request
resultStringVerification resultEnumeration:
  • success: if document type can be recognized, document is not expired, MRZ (if applicable) is valid and the format of text fields is valid
  • error: if any one of the above document type, expiry, MRZ and text fields check fails
  • not performed: checks are not performed | | status_info | Object | Verification details | Details of above result including verification details of document type, expiry, MRZ and text fields | | document_type_info | Object | Document type information | Default parameter | | card_info | Object | ID card information | OCR results for the identification document | | image_info | Object | Image information | Returned when related input parameter is selected | | image_quality_info | Object | Image quality information | Returned when related input parameter is selected | | document_forgery_info | Object | Document forgery detection | Returned when related input parameter is selected |

Data Objects

StatusInfo
ParameterTypeDescriptionNotes
doc_typeIntegerCheck whether the document type can be correctly identifiedRefer to the CheckResult data dictionary
expiryIntegerCheck whether the document has expiredRefer to the CheckResult data dictionary
mrzIntegerCheck whether the MRZ (Machine Readable Zone) is correctly recognizedRefer to the CheckResult data dictionary
textIntegerCheck whether the text format of the fields on the document meets the requirementsRefer to the CheckResult data dictionary

Example:

{
    "doc_type": 1,
    "expiry": 0,
    "mrz": 1,
    "text": 1
}
DocumentTypeInfo
ParameterTypeDescriptionNotes
document_nameStringDetailed document name
document_descriptionStringDocument typeIdentity Card, Passport, Driving License etc

Example:

{
    "document_name": "Philippines - ePassport (2016)",
    "document_description": "Passport"
}

API Status Code

CodeMessageDescription
200SuccessCall Successfully
301Service not purchasedNo purchase of the service
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": "GB",
    "scene": "Ocr",
    "options": "images,image_quality,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"
        ]
    }
}