Skip to main content

Set user profile

Set a user's profile information, including basic info (userProfile) and extended attributes (userExtProfile). Basic info covers common fields like name, gender, email, and birthday. Extended attributes are customizable additional fields.

Request method

POST: https://Base URL/v4/user/profile/set

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
userIdStringYesThe user ID.
userProfileJSON KVNoBasic user profile as a JSON object. At least one of userProfile or userExtProfile must be provided.
userExtProfileJSON KVNoExtended user profile as a JSON object. Keys must be alphanumeric, case-sensitive, max 32 characters, and prefixed with ext_. Values must be strings, max 256 characters. Up to 20 key-value pairs by default. You must first add User custom attributes in the console.

userProfile fields:

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

Request example

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

{
"userId": "u1",
"userProfile": {
"name": "Nick"
},
"userExtProfile": {
"extProfile": "testpro1"
}
}

Response

FieldTypeDescription
codeNumberStatus code. 0 indicates success.
profileKeyStringIf code is not 0, returns the specific key that failed.

Response example

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

{
"code": 0
}