Skip to main content

Batch query user profiles

Retrieve profile information for multiple users, including basic info and extended attributes.

Request method

POST: https://Base URL/v4/user/profile/batch/get

Rate limit: 100 requests per second

Signature required: All server API requests require signature verification. See API request signature.

Request body

The request body is in application/json format and supports the following parameters:

ParameterTypeRequiredDescription
userIdsArrayYesUser IDs. Maximum 20 per request.

Request example

HTTP
POST /v4/user/profile/batch/get HTTP/1.1
Host: api.sg-light-api.com
App-Key: uwd1c0sxdlx2
Nonce: 14314
Timestamp: 1408710653491
Signature: xxxxxxxxxxxxxxxx
Content-Type: application/json

{
"userIds": [
"u1",
"u2"
]
}

Response

FieldTypeDescription
codeNumberStatus code. 0 indicates success.
resultObjectResponse data.
result.usersArrayList of user profile objects.

result.users fields:

FieldTypeDescription
users[i].userIdStringThe user ID.
users[i].versionNumberProfile version number.
users[i].userProfileJSON KVBasic user profile.
users[i].userExtProfileJSON KVExtended user profile.

userProfile fields:

KeyTypeLength/RangeDescription
uniqueIdStringMax 32 charactersApp-specific user ID
nameStringMax 32 charactersNickname
portraitUriStringMax 128 charactersAvatar URL
emailStringMax 128 charactersEmail address
birthdayStringMax 32 charactersBirthday
genderInt0 = unknown, 1 = male, 2 = femaleGender
locationStringMax 32 charactersLocation
roleInt0–100Role
levelInt0–100Level

Response example

HTTP
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{
"code": 0,
"result": {
"users": [
{
"userId": "u1",
"version": 12343433499942,
"userProfile": {"birthday":"20011221","level":2},
"userExtProfile": {"ext1":"testext"}
},
{
"userId": "u2",
"userProfile": {"gender":1,"level":5}
}
]
}
}