User Profile
Back

From WeChat Official Account Admin Platform
Jump to: navigation, search

When a follower and an official account have corresponded by message, the official account can receive the follower's OpenID. The OpenID is a unique encrypted WeChat ID for each user of an official account, and users can have separate OpenIDs corresponding to different official accounts. This API enables official accounts to obtain the user's basic information via the OpenID including nickname, profile photo, gender, city, language and the time that the user follows the official account.

Obtain User Basic Information

Developers can obtain users' basic information from OpenIDs using the HTTPS protocol.

Request Parameter

HTTP request method: GET 
https://api.wechat.com/cgi-bin/user/info?access_token=ACCESS_TOKEN&openid=OPENID&lang=en_US

Parameter Description

Parameter Required Description
access_token Yes The certificate for the calling API
openid Yes Unique user ID for the official account
lang Yes zh_CN: Simplified Chinese, zh_TW: Traditional Chinese, en: English

Return Description

An example of a successful JSON response is as follows:

{
    "subscribe": 1, 
    "openid": "o6_bmjrPTlm6_2sgVt7hMZOPfL2M", 
    "nickname": "Band", 
    "sex": 1, 
    "language": "zh_CN", 
    "city": "Guangzhou", 
    "province": "Guangdong", 
    "country": "China", 
    "headimgurl":    "http://wx.qlogo.cn/mmopen/g3MonUZtNHkdmzicIlibx6iaFqAc56vxLSUfpb6n5WKSYVY0ChQKkiaJSgQ1dZuTOgvLLrhJbERQQ4eMsv84eavHiaiceqxibJxCfHe/0", 
   "subscribe_time": 1382694957
}

Parameter Description

Parameter Description
subscribe Shows whether the user has followed the official account. 0: The user is not a follower, and you cannot obtain other information about this user.
openid Unique user ID for the official account
nickname User nickname
sex 1: Male; 2: Female; 0: Not Set
city City
country Country
province Province
language zh_CN: Simplified Chinese
headimgurl Profile photo URL. The last number in the URL shows the size of the square image, which can be 0 (640*640), 46, 64, 96 and 132. This parameter is null if the user hasn't set a profile photo
subscribe_time The timestamp when the user follows the official account or the last time if the user has followed several times

An example of an unsuccessful JSON response (caused by invalid AppID) is as follows:

{"errcode":40013,"errmsg":"invalid appid"}

Return Codes

Developer Guide
Custom-defined Menu
WeChat JS-SDK