# Get basic user information in bulk
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: batchUserinfo
This interface is used for bulk retrieval of user basic information. A maximum of 100 pieces is supported at a time.
# 1. How to call
# HTTPS calls
POST https://api.weixin.qq.com/cgi-bin/user/info/batchget?access_token=ACCESS_TOKEN
# Cloud Calls
Call method: officialAccount.user.batchGetInfo
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 id to which the interface belongs is: 2,100
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 Name | type | Required to fill in | Introductions |
---|---|---|---|
access_token | string | yes | Interface invocation credentials, using access_token , authorizer_access_token |
# Request BodyRequest Payload
Parameter Name | type | Required to fill in | Introductions |
---|---|---|---|
user_list | objarray | yes | List of users |
# Body.user_list(Array)Object Payload
List of users
Parameter Name | type | Required to fill in | Example | Introductions |
---|---|---|---|---|
openid | string | yes | otvxTs4dckWG7imySrJd6jSi0CWE | The user's identity is unique to the current Official Account;Must be the openid of the user you care about |
lang | string | no | zh_CN | National and regional language version, zh_CN simplified, zh_TW traditional, en English, default to zh_CN |
# 3. Return Parameters
# Response Payload
Parameter Name | type | Introductions |
---|---|---|
user_info_list | objarray | List of users |
# Res.user_info_list(Array)Object Payload
List of users
Parameter Name | type | Introductions |
---|---|---|
subscribe | number | If the user subscribes to the Official Account ID, a value of 0 means that the user does not follow the Official Account message template and cannot pull the rest of the message. |
openid | string | User's ID, unique to the current Official Account |
nickname | string | User nickname |
sex | number | User's gender, when the value is 1 is male, when it is 2 is female, when its value is 0 is unknown |
language | string | User's language, simplified Chinese for zh_CN |
city | string | Cities populated by the average user's profile |
province | string | Provinces in which the user's profile was filled |
country | string | Countries, such as China for CN |
headimgurl | string | User avatar. The last value represents the square avatar size (there are 0, 46, 64, 96, 132 values optional, and 0 represents a 640 * 640 square avatar). This item is empty when the user does not have a avatar.If the user changes the avatar, the original avatar URL will become invalid. |
subscribe_time | number | Users pay attention to the time, which is a time stamp. If the user has followed it several times, then the last followed time is taken |
unionid | string | This field appears only after the user has bound Official Account to WeChat open platform account.See: Access to user personal information (UnionID mechanism) |
remark | string | Official Account The Official Account message template can be added by WeChat Official Account message. |
groupid | number | The user's group ID (temporarily compatible with the old user group interface) |
tagid_list | - | List of tag IDs the user has been hit with |
subscribe_scene | number | Return to the channel source of user concern, ADD_STORY_SEARCH Official Account search, ADD_STORY_ACCOUNT_MIGRATION Official Account, ADD_STORY_PROFILE_CARD business card sharing, ADD_STORY_QR_CODE scan two-dimensional code,ADD_SCENE_PROFILE_LINK: Click the name on the graphic page, ADD_SCENE_PROFILE_ITEM: Menu in the upper right corner of the graphic page, ADD_SCREEN_PAID: Follow after payment, ADD_SCENE_WECHAT_ADVERTISEMENT: WeChat Advertisement, ADD_SCENE_REPRINT: Others' reposts, ADD_SCENE_LIVESTREAM WeChat Channels live streaming,ADD_SCENE_CHANNELS WeChat Channels,ADD_SCENE_WXA Weixin Mini Program Attention, ADD_SCENE_OTHERS Other |
qr_scene | number | QR code scanning scene (developer customized) |
qr_scene_str | string | QR code scanning scene description (developer customized) |
# 4. Note
All openids must be users who have been followed
# 5. Code examples
# 5.1 Normal Requests
Example Requests
{
"user_list": [
{
"openid": "otvxTs4dckWG7imySrJd6jSi0CWE",
"lang": "zh_CN"
},
{
"openid": "otvxTs_JZ6SEiP0imdhpi50fuSZg",
"lang": "zh_CN"
}
]
}
Return an example
{
"user_info_list": [
{
"subscribe": 1,
"openid": "otvxTs4dckWG7imySrJd6jSi0CWE",
"language": "zh_CN",
"subscribe_time": 1434093047,
"unionid": "oR5GjjgEhCMJFyzaVZdrxZ2zRRF4",
"remark": "",
"groupid": 0,
"tagid_list": [
128,
2
],
"subscribe_scene": "ADD_SCENE_QR_CODE",
"qr_scene": 98765,
"qr_scene_str": ""
}
]
}
# 5.2 Error Request
Example Requests
{
"user_list": [
{
"openid": "otvxTs4dckWG7imySrJd6jSi0CWE",
"lang": "zh_CN"
},
{
"openid": "otvxTs_JZ6SEiP0imdhpi50fuSZg",
"lang": "zh_CN"
}
]
}
Return an example
{
"errcode":40013,
"errmsg":"invalid appid"
}
# 6. Error code
The following is a list of error codes for this interface, other error codes can refer to General error codes
Error code | Error Description | Solutions |
---|---|---|
-1 | system error | The system is busy, so the developer is asked to try again in a few minutes. |
40001 | invalid credential access_token isinvalid or not latest | AppSecret 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 |
40003 | invalid openid | User not interested or openid error |
40013 | invalid appid | Invalid AppID error |
40032 | invalid openid list size | Illegal openid list length |
# 7. Scope of application
Official Account | Service Account |
---|---|
Certification only | Certification only |
- 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;