薪火科技首页

卡证识别ocr接口文档——薪火科技

支持类型: 银行卡、身份证、社保卡、护照、驾驶证、行驶证、户口本、名片、房产证、不动产证、营业执照、开户许可证、税务登记证、组织机构代码证、车辆合格证、车辆登记证、香港身份证、结婚证、离婚证等
卡证OCR识别在线演示网址


接口地址

http://api.xinhuokj.com:40072/ocr



HTTP头字段

Content-Type: application/json

HTTP正文体

{

"image": "/9j/4AAQSkZ......./9k=", //图片文件二进制数组经过base64编码后的字符串,目前支持jpg、tif、png、bmp等多种格式

"type": "8" , 

"token": "ef9c*************dbca", //请在用户中心获取token,网址:https://www.xinhuokj.com/user

}




可用postman工具调试,结果如下图所示:


返回字段描述

字段 说明
code 返回状态码。200:正常返回; 500:服务器内部错误
message 返回对应code的状态说明
result 图片结果信息
+ type 图片证件识别的类型
+ rotated_image_width 旋转后图片宽度
+ rotated_image_height 旋转后图片高度
+ image_angle 图片旋转角度(原图经过顺时针旋转该角度后获得正确方向图片)
+ item_list OCR识别结果
++ key 识别字段类型
++ value 识别字段结果
++ description 识别字段描述


type中返回的类型结果描述:

类型 说明 文档地址
bank_card 银行卡 银行卡地址
business_card 名片 名片地址
hongkong_idcard 香港身份证 香港身份证地址
id_card 身份证 身份证地址
social_security_cards 社保卡 社保卡地址
drive_license 驾驶证 驾驶证地址
vehicle_license 行驶证 行驶证地址
family_register 户口本 户口本地址
passport 护照 护照地址
marriage_certificate 结婚证 结婚证地址
divorce_certificate 离婚证 离婚证地址
house_property_owner_ship 房产证 房产证地址
real_estate 不动产证 不动产证地址
business_license 营业执照 营业执照地址
opening_license 开户许可证 开户许可证地址
tax_certificate 税务登记证 税务登记证地址
organization_certificate 组织机构代码证 组织机构代码证地址
vehicle_certificate 车辆合格证 车辆合格证地址
vehicle_registration 车辆登记证 车辆登记证地址


正常返回示例

{
    "cost_time": 770,
    "result": {
        "rotated_image_height": 306,
        "image_angle": 0,
        "type_description": "",
        "rotated_image_width": 476,
        "item_list": [
            {
                "value": "xxx",
                "position": [],
                "key": "name",
                "description": "姓名"
            },
            {
                "value": "女",
                "position": [],
                "key": "sex",
                "description": "性别"
            },
            {
                "value": "汉",
                "position": [],
                "key": "nationality",
                "description": "民族"
            },
            {
                "value": "1977年7月7日",
                "position": [],
                "key": "birth",
                "description": "出生日期"
            },
            {
                "value": "上海市普陀区小合路888号",
                "position": [],
                "key": "address",
                "description": "地址"
            },
            {
                "value": "310102197707077777",
                "position": [],
                "key": "id_number",
                "description": "身份证号"
            },
            {
                "value": "base64...",
                "position": [],
                "key": "id_number_image",
                "description": "身份证号码图像"
            },
            {
                "value": "base64...",
                "position": [],
                "key": "head_portrait",
                "description": "头像"
            },
            {
                "value": "base64...",
                "position": [],
                "key": "crop_image",
                "description": "切边图像"
            },
            {
                "value": "",
                "position": [],
                "key": "validate_date",
                "description": "有效期限"
            },
            {
                "value": "",
                "position": [],
                "key": "issue_authority",
                "description": "签发机构"
            }
        ],
        "type": "id_card"
    },
    "code": 200,
    "message": "success"
}


失败返回示例

{
    "code": 40101,
    "message": "App does not exist"
}

    


错误码

识别服务返回的code与message定义:

code message 含义
200 Success 请求成功
500 Server error 服务器内部错误
40001 Access server error 验证服务器错误,请再次请求, 如果持续出现此类错误,请联系技术支持团队
40002 Service temporarily unavailable 服务暂不可用,请再次请求, 如果持续出现此类错误,请联系技术支持团队
40003 Unsupported openapi method 调用的API不存在,请检查后重新尝试
40004 Open api request limit reached 集群超限额
40017 Open api daily request limit reached 每天请求量超限额
40018 Open api qps request limit reached QPS超限额
40019 Open api total request limit reached 请求总量超限额
40020 Open api daily testing limit reached. 今日测试次数已达上限
40100 Empty App key or app secret app_key 或 app_secret 为空
40101 App does not exist 实例不存在,请检查 app_key
40102 Invalid app secret 实例验证失败,请检查 app_secret
40103 Invalid App 实例已失效
40104 App has expired 实例已超过有效期
40105 Invalid IP source 无效的IP来源
40106 App does not match service 实例与service不匹配
40107 App has been overdrawn by 5% of the total count. Please use it after recharging. 实例额度已透支总额度的5%,请充值后使用
40110 App key or app secret invalid app_key 或 app_secret无效
40200 Internal error 服务器内部错误
40201 Not enough param 缺少必须的参数,请检查参数是否有遗漏
40202 Service not support 请求了不支持的服务,请检查调用的url
40300 Empty image 图片为空,请检查后重新尝试
40301 Image format error 上传的图片格式错误,现阶段我们支持的图片格式为:PNG、JPG、JPEG、BMP,请进行转码或更换图片
40302 Image size error 上传的图片大小错误
40303 File type unsupport 文件类型不支持
40400 Recognize error 识别错误,请再次请求
40401 Image recognize error 图像识别错误
40500 Classify failed 未能成功分类
40600 Missing request body 缺少 request body
50001 Time out 超时
90099 Unknown error 未知错误