The Official Account can obtain the follower’s OpenID where there has been a message interaction between the follower and the Official Account (a Weixin ID that has been encrypted. Every user will have a unique OpenID with respect to every Official Account. Different users will have different OpenIDs for different Official Accounts). The Official Account can use this API to obtain basic user information, including their alias, profile photo, gender, current city, language and following time in accordance with the OpenID.

Please note: if the developer needs unified user accounts across multiple Official Accounts, or between a Official Account and a mobile application, then they may only use the UnionID system to satisfy this requirement after binding their Official Account over at the Weixin Open Platform (open.weixin.qq.com).

Explanation of UnionID mechanism:

The developer can obtain basic user information through OpenID. It should be noted that: if a developer possesses multiple mobile applications, website applications, and Official Accounts, then they can use the UnionID from the user’s basic information to uniquely differentiate the user. This is because a user’s UnionID is unique, as long as the mobile applications, website applications or Official Accounts are under the same Weixin Open Platform Account. In other words, a user will have the same UnionID for different applications under the same Weixin Open Platform account.

Get basic user information (includes the UnionID system)

The developer can obtain basic user information through OpenID. Please use the https protocol.

API call request descriptions

http request format: GET https://api.weixin.qq.com/cgi-bin/user/info?access_token=ACCESS_TOKEN&openid=OPENID&lang=zh_CN

Parameter descriptions

Parameters Is it required? Description
access_token Yes Call interface credentials
openid Yes General user label: unique with respect to this Official Account
lang No Returns the country / region language version; zh_CN fro Simplified Chinese, zh_TW for Traditional Chinese, en for English

Return descriptions

Under normal circumstances, Weixin will return the following JSON data packets to the Official Account:

{
    "subscribe": 1, 
    "openid": "o6_bmjrPTlm6_2sgVt7hMZOPfL2M", 
    "nickname": "Band", 
    "sex": 1, 
    "language": "zh_CN", 
    "city": "Guangzhou", 
    "province": "Guangdong", 
    "country": "China", 


"headimgurl":  "http://thirdwx.qlogo.cn/mmopen/g3MonUZtNHkdmzicIlibx6iaFqAc56vxLSUfpb6n5WKSYVY0ChQKkiaJSgQ1dZuTOgvLLrhJbERQQ4



eMsv84eavHiaiceqxibJxCfHe/0",

  "subscribe_time": 1382694957,
   "unionid": " o6_bmasdasdsad6_2sgVt7hMZOPfL"
   "remark": "",


"groupid": 0,


"tagid_list":[128,2]

"subscribe_scene": "ADD_SCENE_QR_CODE",
"qr_scene": 98765,
 "qr_scene_str": ""

}

Parameter descriptions

Parameters Description
subscribe A label for when the user followed this Official Account. 0 represents that the user has not followed the Official Account, and no further information may be pulled.
openid User label: unique with respect to this Official Account
nickname User alias
sex Gender: 1 for male, 2 for female, and 0 for unknown
city The user’s city
country The user’s country
province The user’s province
language The user’s language: Simplified Chinese is zh_CN
headimgurl The user’s profile photo: the final value represents its square profile photo size (values of 0, 46, 64, 96, and 132 may be selected. 0 represents a 640*640 portrait), and the selection is empty where the user does not have a profile photo. When a user changes their profile photo, then the URL of the original profile photo will be voided.
subscribe_time User follow time: is a nonce. Should the user have followed the account multiple times, then it will be the most recent time
unionid This text box will only appear after the user has bound the Official Account to the Weixin Open Platform Account.
remark Notes from the Official Account operator on the user: the Official Account operator can add notes on fans from the Weixin Official Account Platform User Management interface
groupid The user’s current group ID (compatible with the old user group API)
tagid_list A list of ID tags that have been applied to the user
subscribe_scene Back to the channel source user followed; ADD_SCENE_SEARCH Search Official Account, ADD_SCENE_ACCOUNT_MIGRATION Migrate Official Account, ADD_SCENE_PROFILE_CARD Share Card, ADD_SCENE_QR_CODE Scan QR Code, ADD_SCENE_PROFILE_ Click the link in the graphic page, ADD_SCENE_PROFILE_ITEM Items on the top right corner of the graphic page, ADD_SCENE_PAID Follow after Paid, ADD_SCENE_OTHERS Others
qr_scene QR Code Scanning Scene (Self-defined by Developers)
qr_scene_str Description of QR Code Scanning Scene (Self-defined by Developers)

When errors occur, Weixin will return information including the error code. A JSON packet example is given below (this example is an invalid AppID error):

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

Batch-receive basic user information

The developer can receive basic user information through this API. Supports pulling a maximum of 100 messages at one time.

API call request descriptions

http request format: POST

https://api.weixin.qq.com/cgi-bin/user/info/batchget?access_token=ACCESS_TOKEN

POST data example

{
    "user_list": [
        {
            "openid": "otvxTs4dckWG7imySrJd6jSi0CWE", 
            "lang": "zh_CN"
        }, 
        {
            "openid": "otvxTs_JZ6SEiP0imdhpi50fuSZg", 
            "lang": "zh_CN"
        }
    ]
}

Parameter descriptions

Parameters Is it required? Description
openid Yes User label: unique with respect to this Official Account
lang No Country / region language version; zh_CN fro Simplified Chinese, zh_TW for Traditional Chinese, en for English. zh-CN is default

Return descriptions

Under normal circumstances, Weixin will return the JSON data packets described below to the Official Account (this example contains a once off pull of basic user information for two OpenID users. The first has already followed the account, and the second has not):

{
   "user_info_list": [
       {
           "subscribe": 1, 
           "openid": "otvxTs4dckWG7imySrJd6jSi0CWE", 
           "nickname": "iWithery", 
           "sex": 1, 
           "language": "zh_CN", 
           "city": "Jieyang", 
           "province": "Guangdong", 
           "country": "China", 
           "headimgurl": "http://thirdwx.qlogo.cn/mmopen/xbIQx1GRqdvyqkMMhEaGOX802l1CyqMJNgUzKP8MeAeHFicRDSnZH7FY4XB7p8XHXIf6uJA2SCunTPicGKezDC4saKISzRj3nz/0",
           "subscribe_time": 1434093047, 
           "unionid": "oR5GjjgEhCMJFyzaVZdrxZ2zRRF4", 
           "remark": "", 
           "groupid": 0,
           "tagid_list":[128,2]
           "subscribe_scene": "ADD_SCENE_QR_CODE",
    		   "qr_scene": 98765,
    		   "qr_scene_str": ""
      }, 
       {
           "subscribe": 0, 
           "openid": "otvxTs_JZ6SEiP0imdhpi50fuSZg", 
           "unionid": "oR5GjjjrbqBZbrnPwwmSxFukE41U", 
       }
   ]
}

Parameter descriptions

Parameters Description
subscribe A label for whether the user has subscribed to the Official Account: 0 represents that the user has not followed the Official Accounts and no other information will be pulled.
openid User label: unique with respect to this Official Account
nickname User alias
sex Gender: 1 for male, 2 for female, and 0 for unknown
city The user’s city
country The user’s country
province The user’s province
language The user’s language: Simplified Chinese is zh_CN
headimgurl The user’s profile photo: the final value represents its square profile photo size (values of 0, 46, 64, 96, and 132 may be selected. 0 represents a 640*640 portrait), and the selection is empty where the user does not have a profile photo. When a user changes their profile photo, then the URL of the original profile photo will be voided.
subscribe_time User follow time: is a nonce. Should the user have followed the account multiple times, then it will be the most recent time
unionid This text box will only appear after the user has bound the Official Account to the Weixin Open Platform Account.
remark Notes from the Official Account operator on the user: the Official Account operator can add notes on fans from the Weixin Official Account Platform User Management interface
groupid The user’s current group ID (currently compatible with the old user group API)
tagid_list A list of ID tags that have been applied to the user
subscribe_scene Back to the channel source user followed; ADD_SCENE_SEARCH Search Official Account, ADD_SCENE_ACCOUNT_MIGRATION Migrate Official Account, ADD_SCENE_PROFILE_CARD Share Card, ADD_SCENE_QR_CODE Scan QR Code, ADD_SCENE_PROFILE_ Click the link in the graphic page, ADD_SCENE_PROFILE_ITEM Items on the top right corner of the graphic page, ADD_SCENE_PAID Follow after Paid, ADD_SCENE_OTHERS Others
qr_scene QR Code Scanning Scene (Self-defined by Developers)
qr_scene_str Description of QR Code Scanning Scene (Self-defined by Developers)

When errors occur, Weixin will return information including the error code. A JSON packet example is given below (this example is an invalid AppID error):

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