- Print
- DarkLight
- PDF
Update User
- Print
- DarkLight
- PDF
- To update the password for the user,
edit-other-user-password
permission is required. - This endpoint requires 2FA.
Changelog
Version | Description |
---|---|
0.48.0 | Renamed to users.update |
0.35.0 | Added |
The authenticated user ID.
The authenticated user token.
The desired method to get the 2FA code. It can be email
, totp
, or password
.
The user ID to update.
The object that includes the user information to update with the following parameters. Note: If you provide an empty object, the user details are returned.
The name of the user.
The password for the user.
The username for the user.
Whether the user is active, which determines if they can login or not.
The roles the user has been assigned.
Whether the user should join the default channels.
Whether the user should be required to change their password when they login.
Whether the user should get a welcome email.
Whether the user's email address should be verified.
Any custom fields the user should have on their account. To save custom fields, you must first define the custom fields in the admin panel (Administration > Settings > Accounts > Registration > Custom Fields). For details on how to configure this field, see Custom Fields. For information on how to view the custom fields, see the Get Users List endpoint.
OK
{
"user": {
"_id": "BsNr28znDkG8aeo7W",
"createdAt": "2016-09-13T14:57:56.037Z",
"services": {
"password": {
"bcrypt": "$2a$10$5I5nUzqNEs8jKhi7BFS55uFYRf5TE4ErSUH8HymMNAbpMAvsOcl2C"
}
},
"username": "uniqueusername",
"emails": [
{
"address": "[email protected]",
"verified": false
}
],
"type": "user",
"status": "offline",
"active": true,
"roles": [
"user"
],
"_updatedAt": "2016-09-13T14:57:56.175Z",
"name": "new name",
"customFields": {
"twitter": "userstwitter"
}
},
"success": true
}
Bad Request
{
"success": false,
"error": "Editing user is not allowed [error-action-not-allowed]",
"errorType": "error-action-not-allowed",
"details": {
"method": "insertOrUpdateUser",
"action": "Editing_user"
}
}
Unauthorized
{
"status": "error",
"message": "You must be logged in to do this."
}