WeChat Open Platform

Official Accounts Documentation

Fetching User Profile

When a follower and an Official Account have corresponded through chat messaging, 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 a user's basic information via the OpenID, including nickname, profile photo, gender, city, language and time at which the user initially followed 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


Important Note: Which URL to send my HTTP requests

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
Response Format

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`](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 A unique user ID specific to a given Official Account. A non-follower visiting an Official Account's web pages can also generate a unique OpenID.
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:

  "errmsg":"invalid appid"

Refer to Return Codes.