OCR API提供证件图片识别并返回相应的证件信息。
API 方式
Base URL
- 印尼节点:https://id.apitd.net/verification/kyc/ocr/v1
- 巴基斯坦节点:https://pk.apitd.net/verification/kyc/ocr/v1
API
URL | 请求方式 | Content-Type | 输出格式 | 字符集 |
---|---|---|---|---|
api-base-url?partner_code=xxx&partner_key=xxx | POST | application/json | JSON | UTF-8 |
认证参数
字段 | 类型 | 含义 | 建议 | 备注 |
---|---|---|---|---|
partner_code | String | 合作方标识 | 必须 | 由 TD 分配 |
partner_key | String | 合作方密钥 | 必须 | 由 TD 分配 |
请求参数
字段 | 类型 | 含义 | 建议 | 备注 |
---|---|---|---|---|
image | String | 证件照片 | 必须 | JPG、JPEG、PNG的base64编码图⽚字符流,图⽚不能超过3M |
country | String | 国家 | 必须 | 国家,必填. 两位国家码,符合 ISO 3166 标准。目前支持:印尼(ID) , 巴基斯坦(PK) |
options | String | 其他额外返回值 | 可选 | 填入"en",巴基斯坦身份证以下字段将返回Urdu语的英文翻译结果: 1. NIC证件的name、father_name字段 2. NIC/CNIC证件的current_address_en、permanent_address_en字段 *备注:如果需要,请联系商务/运营单独开通该增强型配置。 |
响应参数
字段 | 类型 | 含义 | 建议 | 备注 |
---|---|---|---|---|
code | Integer | API 状态码 | 必须 | |
message | String | 状态信息 | 必须 | 在 API 异常状态下会输出具体的异常原因 |
sequence_id | String | 响应唯一码 | 必须 | 用于跟踪每次请求记录的唯一标识 |
result | String | 结果 | 条件必须:接口成功,code为200时才返回 | 枚举值: 成功:success 失败:fail |
card_info | JSONObject | 身份证信息 | 条件必须:result 为success 时则返回 |
支持证件类型
-
印尼KTP
字段 字段类型 描述 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 -
巴基斯坦身份证(正面/反面)
字段 类型 描述 CNIC OR NIC card_side String The side of card: front
id_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
备注:如果NIC证件该字段需要英语翻译,请联系商务/运营单独开通该增强型配置。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 in English
备注:如果NIC证件该字段需要英语翻译,请联系商务/运营单独开通该增强型配置。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 字段 类型 描述 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 English translation of current address
备注:如果需要,请联系商务/运营单独开通该增强型配置。CNIC/NIC permanent_address_en String English translation of current address
备注:如果需要,请联系商务/运营单独开通该增强型配置。CNIC/NIC
API 状态码
Code | Message | 描述 |
---|---|---|
200 | Success | 调⽤成功 |
301 | Service not purchased | 未购买此服务 |
302 | Traffic blocked | 流量已被禁用 |
303 | Traffic insufficient | 流量不足 |
304 | Service expired | 服务已过期 |
305 | Daily maximum volume reached | 日流量已封顶 |
12601 | Detection failed | 没有识别到证件 |
12602 | Document detected as having bad quality | 识别到证件,但证件质量差 *只针对印尼OCR服务才有的错误码 |
11350 | Internal error | 系统错误 |
11301 | {parameter} empty | {参数}为空 |
11304 | The country partner located is not open | 国家不支持 |
11340 | {parameter} error | {参数}错误 |
响应示例
-
入参示例:
{ "image": "/9j/4AAQSkZJRgABAQAAeAB4AAD/********XLiqqauzsw1J3sf/2Q==", "country": "PK" }
-
业务请求成功
{
"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":"نم*****د"
}
}
- 业务不请求成功
-
{ "code": 11350, "sequence_id": "69b57131b6fb********61ccba118b60", "message": "Internal error" }