# Menu Identification

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: menuOcr

This interface is used to identify paper menus

# 1. How to call

# HTTPS calls

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

# Cloud Calls

  • This interface does not support cloud calls

# 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
imgformdatanoPicture file, file size limit: less than 2 M

# 3. Return Parameters

# Response Payload

Parameter NametypeIntroductions
errcodenumberError code
errmsgstringError message
contentobjectIdentifying information

# Res.contentObject Payload

Identifying information

Parameter NametypeIntroductions
menu_itemsobjarrayList of Menu Content

# Res.content.menu_items(Array)Object Payload

List of Menu Content

Parameter NametypeIntroductions
namestringMenu Name
pricenumberPrice

# 4. Note

The interface is not yet connected to the service platform and does not support paid purchases at this time.

# 5. Code examples

# 5.1 Request to upload a file

Example Requests

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

Return an example

{
    "errcode": 0, 
    "errmsg": "ok", 
    "content": "{\"menu_items\": [{\"name\": \"酱鸭\", \"price\": 48.0}, {\"name\": \"龙虾\", \"price\": 80.0}, {\"name\": \"芝麻鸭块\", \"price\": 48.0}, {\"name\": \"皮皮虾\", \"price\": 70.0}, {\"name\": \"特色辣鸭脚\", \"price\": 46.0}, {\"name\": \"花甲\", \"price\": 30.0}, {\"name\": \"小鸭翅\", \"price\": 46.0}, {\"name\": \"鸭肠\", \"price\": 40.0}, {\"name\": \"微辣大鸭脚\", \"price\": 43.0}, {\"name\": \"八宝\", \"price\": 10.0}, {\"name\": \"大鸭翅\", \"price\": 43.0}, {\"name\": \"千叶豆腐\", \"price\": 10.0}, {\"name\": \"鸭脖\", \"price\": 35.0}, {\"name\": \"毛豆\", \"price\": 15.0}, {\"name\": \"鸭锁骨\", \"price\": 35.0}, {\"name\": \"螺丝\", \"price\": 15.0}, {\"name\": \"特色蟹脚\", \"price\": 55.0}, {\"name\": \"藕片\", \"price\": 15.0}, {\"name\": \"鱿鱼须\", \"price\": 70.0}, {\"name\": \"腐竹\", \"price\": 15.0}, {\"name\": \"鸭下巴\", \"price\": 70.0}, {\"name\": \"鸭头\", \"price\": 5.0}, {\"name\": \"无骨鸭脚\", \"price\": 70.0}, {\"name\": \"辣椒酱\", \"price\": 10.0}, {\"name\": \"鸭舌\", \"price\": 138.0}, {\"name\": \"花生米\", \"price\": 5.0}, {\"name\": \"鸭胗\", \"price\": 55.0}, {\"name\": \"萝卜干\", \"price\": 12.0}, {\"name\": \"牛肉串\", \"price\": 65.0}, {\"name\": \"盐菜\", \"price\": 12.0}]}"
}

Example Requests

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

Return an example

{
    "errcode": 0, 
    "errmsg": "ok", 
    "content": "{\"menu_items\": [{\"name\": \"酱鸭\", \"price\": 48.0}, {\"name\": \"龙虾\", \"price\": 80.0}, {\"name\": \"芝麻鸭块\", \"price\": 48.0}, {\"name\": \"皮皮虾\", \"price\": 70.0}, {\"name\": \"特色辣鸭脚\", \"price\": 46.0}, {\"name\": \"花甲\", \"price\": 30.0}, {\"name\": \"小鸭翅\", \"price\": 46.0}, {\"name\": \"鸭肠\", \"price\": 40.0}, {\"name\": \"微辣大鸭脚\", \"price\": 43.0}, {\"name\": \"八宝\", \"price\": 10.0}, {\"name\": \"大鸭翅\", \"price\": 43.0}, {\"name\": \"千叶豆腐\", \"price\": 10.0}, {\"name\": \"鸭脖\", \"price\": 35.0}, {\"name\": \"毛豆\", \"price\": 15.0}, {\"name\": \"鸭锁骨\", \"price\": 35.0}, {\"name\": \"螺丝\", \"price\": 15.0}, {\"name\": \"特色蟹脚\", \"price\": 55.0}, {\"name\": \"藕片\", \"price\": 15.0}, {\"name\": \"鱿鱼须\", \"price\": 70.0}, {\"name\": \"腐竹\", \"price\": 15.0}, {\"name\": \"鸭下巴\", \"price\": 70.0}, {\"name\": \"鸭头\", \"price\": 5.0}, {\"name\": \"无骨鸭脚\", \"price\": 70.0}, {\"name\": \"辣椒酱\", \"price\": 10.0}, {\"name\": \"鸭舌\", \"price\": 138.0}, {\"name\": \"花生米\", \"price\": 5.0}, {\"name\": \"鸭胗\", \"price\": 55.0}, {\"name\": \"萝卜干\", \"price\": 12.0}, {\"name\": \"牛肉串\", \"price\": 65.0}, {\"name\": \"盐菜\", \"price\": 12.0}]}"
}

# 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.
101000invalid image url
101001certificate not found
101002decode image failedImage size over limit, resp_type = 0: 2MB, resp_type = 1: 10MB

# 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;