Browse Platform API
Platform API

Update a user

Copy

Use Update a user to change selected profile fields for an existing OpenIM user. In addition to userID, send only the fields that must change; omitted fields remain unchanged.

HTTP request

POST {API_ADDRESS}/user/update_user_info_ex

Request example

curl --request POST "${API_ADDRESS}/user/update_user_info_ex" \
  --header "Content-Type: application/json; charset=utf-8" \
  --header "operationID: ${OPERATION_ID}" \
  --header "token: ${ADMIN_TOKEN}" \
  --data-raw '{
  "userInfo": {
    "userID": "2",
    "nickname": "alantestuid3",
    "faceURL": "",
    "ex": "123",
    "globalRecvMsgOpt": 0
  }
}'
Keep administrator tokens on trusted backend services only. Client applications should use user tokens issued by your backend.

Request body

{
  "userInfo": {
    "userID": "2",
    "nickname": "alantestuid3",
    "faceURL": "",
    "ex": "123",
    "globalRecvMsgOpt": 0
  }
}
ParameterRequiredTypeDescription
userInfoYesobjectPartial user profile update. Omitted fields are not changed.
userInfo.userIDYesstringUser to update.
userInfo.nicknameNostringNew nickname. An explicit empty string clears the value.
userInfo.faceURLNostringNew avatar URL. An explicit empty string clears the value.
userInfo.exNostringNew business extension value. An explicit empty string clears the value.
userInfo.globalRecvMsgOptNointGlobal message receiving option. See GlobalRecvMsgOpt.
userInfo.addFriendPermission EnterpriseNointFriend request permission. See AddFriendPermission.

Response

OpenIM usually returns 200 OK when the request reaches the service. Use errCode in the JSON response to determine business success; errCode === 0 means the operation succeeded.

{
  "errCode": 0,
  "errMsg": "",
  "errDlt": ""
}

Response fields

FieldTypeDescription
errCodeintBusiness error code. 0 means success.
errMsgstringShort error message.
errDltstringDetailed error information for troubleshooting.

Error response

When a request fails, OpenIM returns the same error envelope. See Error codes for the full handling model.

{
  "errCode": 1004,
  "errMsg": "RecordNotFoundError",
  "errDlt": ": [1004]RecordNotFoundError"
}
ScenarioPossible causeRecommended action
Authentication failedtoken is missing, expired, or not an administrator token.Issue a new administrator token and keep it on the backend.
Traceability is weakoperationID is missing or reused across many requests.Generate a unique operationID for every request and log it with the response.
Validation failedThe request body has an invalid type, missing field, or unsupported enum value.Compare the payload with the request table and retry after correcting the fields.

Permissions and limits

  • Omitted optional fields remain unchanged; an explicitly supplied empty string clears a string field.
  • addFriendPermission is available in OpenIM Enterprise.