# 营业执照识别

调试工具

接口应在服务器端调用,不可在前端(小程序、网页、APP等)直接调用,具体可参考接口调用指南

接口英文名:bizlicenseOcr

本接口用于识别营业执照

# 1. 调用方式

# HTTPS 调用

POST https://api.weixin.qq.com/cv/ocr/bizlicense?access_token=ACCESS_TOKEN&img_url=IMG_URL

# 云调用

  • 调用方法:ocr.businessLicense

  • 出入参和 HTTPS 调用相同,调用方式可查看 云调用 说明文档

# 第三方调用

  • 本接口支持第三方平台代商家调用。

  • 该接口所属的权限集 id 为:117

  • 服务商获得其中之一权限集授权后,可通过使用 authorizer_access_token 代商家进行调用,具体可查看 第三方调用 说明文档。

# 2. 请求参数

# 查询参数 Query String parameters

参数名类型必填示例说明
access_tokenstringACCESS_TOCKEN接口调用凭证,可使用 access_tokenauthorizer_access_token
img_urlstringENCODE_URL要检测的图片 url,传这个则不用传 img 参数。

# 请求体 Request Payload

参数名类型必填说明
imgformdataform-data 中媒体文件标识,有filename、filelength、content-type等信息,传这个则不用传 img_url。

# 3. 返回参数

# 返回体 Response Payload

参数名类型说明
errcodenumber错误码
errmsgstring错误信息
reg_numstring注册号
serialstring编号
legal_representativestring法定代表人姓名
enterprise_namestring企业名称
type_of_organizationstring组成形式
addressstring经营场所/企业住所
type_of_enterprisestring公司类型
business_scopestring经营范围
registered_capitalstring注册资本
paid_in_capitalstring实收资本
valid_periodstring营业期限
registered_datestring注册日期/成立日期
cert_positionobject营业执照位置
img_sizeobject图片大小

# Res.cert_position Object Payload

营业执照位置

参数名类型说明
posobject位置信息

# Res.img_size Object Payload

图片大小

参数名类型说明
wnumber宽度
hnumber高度

# Res.cert_position.pos Object Payload

位置信息

参数名类型说明
left_topobject左上角位置
right_topobject右上角位置
right_bottomobject右下角位置
left_bottomobject左下角位置

# Res.cert_position.pos.left_top Object Payload

左上角位置

参数名类型说明
xnumberx坐标
ynumbery坐标

# Res.cert_position.pos.right_top Object Payload

右上角位置

参数名类型说明
xnumberx坐标
ynumbery坐标

# Res.cert_position.pos.right_bottom Object Payload

右下角位置

参数名类型说明
xnumberx坐标
ynumbery坐标

# Res.cert_position.pos.left_bottom Object Payload

左下角位置

参数名类型说明
xnumberx坐标
ynumbery坐标

# 4. 注意事项

本接口无特殊注意事项

# 5. 代码示例

# 5.1 上传文件请求

请求示例

curl -F 'img=@test.jpg' "https://api.weixin.qq.com/cv/ocr/bizlicense?access_token=ACCESS_TOCKEN" 

返回示例

{
    "errcode": 0, 
    "errmsg": "ok", 
    "reg_num": "123123",//注册号
    "serial": "123123",//编号
    "legal_representative": "张三", //法定代表人姓名
    "enterprise_name": "XX饮食店", //企业名称
    "type_of_organization": "个人经营", //组成形式
    "address": "XX市XX区XX路XX号", //经营场所/企业住所
    "type_of_enterprise": "xxx", //公司类型
    "business_scope": "中型餐馆(不含凉菜、不含裱花蛋糕,不含生食海产品)。", //经营范围
    "registered_capital": "200万", //注册资本
    "paid_in_capital": "200万", //实收资本
    "valid_period": "2019年1月1日", //营业期限
    "registered_date": "2018年1月1日", //注册日期/成立日期
    "cert_position": { //营业执照位置
        "pos": {
            "left_top": {
                "x": 155, 
                "y": 191
            }, 
            "right_top": {
                "x": 725, 
                "y": 157
            }, 
            "right_bottom": {
                "x": 743, 
                "y": 512
            }, 
            "left_bottom": {
                "x": 164, 
                "y": 525
            }
        }
    }, 
    "img_size": { //图片大小
        "w": 966, 
        "h": 728
    }
}

# 5.2 上传链接请求

请求示例

curl "https://api.weixin.qq.com/cv/ocr/bizlicense?img_url=ENCODE_URL&access_token=ACCESS_TOCKEN"

返回示例

{
    "errcode": 0, 
    "errmsg": "ok", 
    "reg_num": "123123",//注册号
    "serial": "123123",//编号
    "legal_representative": "张三", //法定代表人姓名
    "enterprise_name": "XX饮食店", //企业名称
    "type_of_organization": "个人经营", //组成形式
    "address": "XX市XX区XX路XX号", //经营场所/企业住所
    "type_of_enterprise": "xxx", //公司类型
    "business_scope": "中型餐馆(不含凉菜、不含裱花蛋糕,不含生食海产品)。", //经营范围
    "registered_capital": "200万", //注册资本
    "paid_in_capital": "200万", //实收资本
    "valid_period": "2019年1月1日", //营业期限
    "registered_date": "2018年1月1日", //注册日期/成立日期
    "cert_position": { //营业执照位置
        "pos": {
            "left_top": {
                "x": 155, 
                "y": 191
            }, 
            "right_top": {
                "x": 725, 
                "y": 157
            }, 
            "right_bottom": {
                "x": 743, 
                "y": 512
            }, 
            "left_bottom": {
                "x": 164, 
                "y": 525
            }
        }
    }, 
    "img_size": { //图片大小
        "w": 966, 
        "h": 728
    }
}

# 6. 错误码

以下是本接口的错误码列表,其他错误码可参考 通用错误码

错误码错误描述解决方案
-1system error系统繁忙,此时请开发者稍候再试
40001invalid credential  access_token isinvalid or not latest获取 access_token 时 AppSecret 错误,或者 access_token 无效。请开发者认真比对 AppSecret 的正确性,或查看是否正在为恰当的公众号调用接口
101000invalid image url
101001certificate not found
101002decode image failed图片大小超过限制,resp_type = 0: 2MB,resp_type = 1: 10MB
101003not enough market quota

# 7. 适用范围

本接口在不同账号类型下的可调用情况:
小程序公众号服务号
仅认证 仅认证
  • ✔:该账号可调用此接口
  • 仅认证:表示仅允许企业主体已认证账号调用,未认证或不支持认证的账号无法调用
  • 其他未明确声明的账号类型,如无特殊说明,均不可调用此接口;