# Identification of business licenses

Debugging Tools

Interface should be called on the server side, not in the front end (Weixin Mini Program, web pages, APP, etc.) directly called, specific reference interface call guide

Interface English name: bizlicenseOcr

This interface provides business license OCR recognition capabilities

# 1. How to call

# HTTPS calls

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

# Cloud Calls

  • Call method: ocr.businessLicense

  • The input and exit parameters are the same as the HTTPS call, which can be called in the cloud call documentation

# Third party invocation

  • This interface supports Third Party Platform generation business call.

  • The permission set to which this interface belongs is id: 117

  • When a service provider is authorized by one of the permissions set, it can call on behalf of the merchant by using authorizer_access_token , which can be viewed in the third-party call documentation.

# 2. Request parameters

# Query parametersQuery String parameters

Parameter NametypeRequired to fill inExampleIntroductions
access_tokenstringyesACCESS_TOCKENInterface invocation credentials, using access_token , authorizer_access_token
img_urlstringnoENCODE_URLTo detect the image url, pass this without passing the img parameter.

# Request BodyRequest Payload

Parameter NametypeRequired to fill inIntroductions
imgformdatayesForm-data in the media file identification, filename, filelength, content-type and other information, you do not need to pass this img_url.

# 3. Return Parameters

# Response Payload

Parameter NametypeIntroductions
errcodenumberError code
errmsgstringError message
reg_numstringRegistration Number
serialstringnumber
legal_representativestringName of the legal representative
enterprise_namestringBusiness Name
type_of_organizationstringForms of composition
addressstringBusiness premises / business residence
type_of_enterprisestringType of company
business_scopestringScope of business
registered_capitalstringRegistered capital
paid_in_capitalstringPaid in capital
valid_periodstringDuration of business
registered_datestringDate of registration / date of incorporation
cert_positionobjectLocation of business license
img_sizeobjectImage size

# Res.cert_positionObject Payload

Location of business license

Parameter NametypeIntroductions
posobjectLocation Information

# Res.img_sizeObject Payload

Image size

Parameter NametypeIntroductions
wnumberwidth
hnumberheight

# Res.cert_position.posObject Payload

Location Information

Parameter NametypeIntroductions
left_topobjectPosition in the upper left corner
right_topobjectPosition in the top right
right_bottomobjectPosition in the lower right
left_bottomobjectPosition in the lower left corner

# Res.cert_position.pos.left_topObject Payload

Position in the upper left corner

Parameter NametypeIntroductions
xnumberX-coordinate
ynumberY-coordinate

# Res.cert_position.pos.right_topObject Payload

Position in the top right

Parameter NametypeIntroductions
xnumberX-coordinate
ynumberY-coordinate

# Res.cert_position.pos.right_bottomObject Payload

Position in the lower right

Parameter NametypeIntroductions
xnumberX-coordinate
ynumberY-coordinate

# Res.cert_position.pos.left_bottomObject Payload

Position in the lower left corner

Parameter NametypeIntroductions
xnumberX-coordinate
ynumberY-coordinate

# 4. Note

  • Support for authenticated subscription number, Service Account, Weixin Mini Program, Service Account can be directly called, the number is limited to 100 times / day.If there is a higher amount of call demand, you can go to service platform for purchase.
  • Tips This interface is used as the background interface, which can be based on its own business carrying situation,When used together with Weixin Mini Program photography, album selection, etc., it can complete the collection, upload, identification, information return, etc. of ID card photos, for business scenarios that require the collection of photos or text information based on physical cards or certificates such as ID card or bank card.
  • Image caption, file size limit: less than 2 M
  • Return fields only those that exist in the current business license picture, and do not return fields if the corresponding fields do not exist

# 5. Code examples

# 5.1 Request to upload a file

Example Requests

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

Return an example

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

Example Requests

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

Return an example

{
    "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.3 Cloud function call example

Example Requests

cloud.openapi.ocr.businessLicense({
  img: {
    contentType: 'image/png',
    value: Buffer
  }
})

Return an example

{
    "errcode": 0,
    "errmsg": "ok",
    "reg_num": "123123",                                                     //注册号
    "serial": "123123",                                                      //编号
    "legalRepresentative": "张三",                                          //法定代表人姓名
    "enterprise_name": "XX饮食店",                                           //企业名称
    "typeOfOrganization": "个人经营",                                      //组成形式
    "address": "XX市XX区XX路XX号",                                           //经营场所/企业住所
    "typeOfEnterprise": "xxx",                                             //公司类型
    "businessScope": "中型餐馆(不含凉菜、不含裱花蛋糕,不含生食海产品)。",  //经营范围
    "registeredCapital": "200万",                                           //注册资本
    "paidInCapital": "200万",                                              //实收资本
    "validPeriod": "2019年1月1日",                                          //营业期限
    "registeredDate": "2018年1月1日",                                       //注册日期/成立日期
    "certPosition": {                                                       //营业执照位置
        "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
            }
        }
    },
    "imgSize": { //图片大小
        "w": 966,
        "h": 728
    }
}

# 6. Error code

The following is a list of error codes for this interface, other error codes can refer to General error codes

Error codeError DescriptionSolutions
-1system errorThe system is busy, so the developer is asked to try again in a few minutes.
40001invalid credential  access_token isinvalid or not latestAppSecret error while getting access_token, or access_token is invalid.Developers should check that AppSecret is correct, or that they are calling interfaces for the appropriate Official Account
101000invalid image url
101001certificate not found
101002decode image failedImage size over limit, resp_type = 0: 2MB, resp_type = 1: 10MB
101003not enough market quota

# 7. Scope of application

How this interface can be invoked under different account types:
Weixin Mini Program Official Account Service Account
Certification only Certification only
  • ✔: The account can call this interface
  • Authentication only: means that only authenticated accounts are allowed to be invoked by the enterprise entity, and accounts that are not authenticated or do not support authentication cannot be invoked.
  • Other account types that are not expressly stated may not be called on this interface without special instructions;