# wx.getUserInfo(Object object)

Gets user information in batch without user authorization. This API is only available in the open data domain.

# Parameters

# Object object

Attribute Type Default Required Description
openIdList Array.<string> [] No The array of openIds of users whose information needs to be obtained. To get the current user's information, set an element in the array as 'selfOpenId'.
lang string en No The language of the displayed user information
success function No The callback function for a successful API call
fail function No Callback function for failed API call
complete function No Callback function used when API call completed (always executed whether call succeeds or fails)

Valid values of object.lang

Value Description Minimum Version
en English
zh_CN Simplified Chinese
zh_TW Traditional Chinese

# object.success callback function

# Parameters
# Object res
Property Type Description
data Array.<Object> The user information list

res.data is composed as follows

Property Type Description
avatarUrl string The URL of the user's profile photo
city string The user's city
country string The user's country
gender number The user's gender
language string The language used to display the country, province, and city
nickName string The alias of the user
openId string The openid of the user
province string The user's province

# Sample Code

Get the information on the current user and several other users.


wx.getUserInfo({
  openIdList: ['selfOpenId', 'ownAP0b9qt6AzvYOSWOX8VX8KMq0', 'ownAP0QJHIN2w3X60EUsj2Vah5Ig', 'ownAP0f8ANWUCcloXN1oZPfxtz0g'],
  lang: 'zh_CN',
  success: (res) => {
    console.log('success', res.data)
  },
  fail: (res) => {
    reject(res)
  }
})