Update a user
You can update information about a user using this API. In addition to changing a user's nickname or profile image, you can issue a new access token for the user. The new access token replaces the previous one as the necessary token for authentication.
You can also deactivate or reactivate a user using this API request. If the leave_all_when_deactivated
is set to true
, a user leaves all joined group channels and becomes deactivated.
Note: Issuing session tokens through the
/users/{user_id}
endpoint is now deprecated and it's replaced with/users/{user_id}/token
endpoint for greater efficiency. For those who are currently using the old endpoint, you can start issuing tokens using the new endpoint.
HTTP request
Parameters
The following table shows a parameter that this action supports.
Required
Parameter name | Type | Description |
---|---|---|
user_id | string | Specifies the unique ID of the user. |
Request body
The following table lists the properties of an HTTP request that this action supports.
Optional
Property name | Type | Description |
---|---|---|
nickname | string | Specifies the user's nickname. The length is limited to 80 characters. |
profile_url | string | Specifies the URL of the user's profile image. If left empty, no profile image is set for the user. The length is limited to 2,048 characters. |
profile_file | file | Uploads the file of the user's profile image. Acceptable image file types are limited to |
issue_access_token | boolean | Determines whether to revoke the existing access token and create a new one for the user. If |
is_active | boolean | Determines whether to activate or deactivate the user within the Sendbird application. |
last_seen_at | long | Specifies the time the user went offline in Unix milliseconds format to indicate when the user was last connected to the Sendbird server. |
discovery_keys[] | array of strings | Specifies an array of unique keys of the user, which is provided to Sendbird server when searching for friends. The unique key acts as an identifier for users' friends to find each other. The server uses discovery keys to identify and match the user with other users. |
preferred_languages[] | array of strings | Specifies an array of one or more language codes to translate notification messages to preferred languages. Up to four languages can be set for the user. If messages are sent in one of the preferred languages, notification messages won't be translated. If messages are sent in a language other than the preferred languages, notification messages will be translated into the first language in the array. Messages translated into other preferred languages will be provided in the |
leave_all_when_deactivated | boolean | Determines whether the user leaves all joined group channels upon deactivation. This property should be specified in conjunction with the |
| boolean | (Deprecated) Determines whether to add a new session token for the user. If |
| long | (Deprecated) Specifies the time for the issued session token to expire in Unix milliseconds format. The length should be 13. If not specified and the |
Note: If you want to upload a profile picture by passing an image file, refer to Multipart requests.
Responses
If successful, this action returns an updated user resource in the response body.
Error
In the case of an error, an error object like below is returned. See the error codes section for more details.