Skip to main content

Update a user password

Log in to add to favourites

A user can update their password with a call that includes a new password and the user's current password in a parameter defined in UserUpdatePasswordOptions.
A member of the System Administrators group can update the password without the need to provide the existing password.

updatePassword(options: UserUpdatePasswordOptions): Promise<void>

Remarks

If the existing password is wrong then an exception with a 409 Conflict status is thrown.
If the new password does not meet the password policy then an exception with a 422 Unprocessable Entity status is thrown.

Example for a non-admin user

JavaScript
let options = {    
    "userId": "4b262379-5bbe-421e-a429-f6e2ab5a849b",
    "existing": "m4rl451ng3r",
    "new": "pr0j3ctM4yh3m"
};

client.security.users.updatePassword(options)
    .then( result => {
        console.log('API call was successful');
    })
    .catch(error => {
        console.log('API call error: ', error);        
    });

Example for a System Adminstrators user

JavaScript
let options = {    
    "userId": "4b262379-5bbe-421e-a429-f6e2ab5a849b",    
    "new": "pr0j3ctM4yh3m"
};

client.security.users.updatePassword(options)
    .then( result => {
        console.log('API call was successful');
    })
    .catch(error => {
        console.log('API call error: ', error);        
    });

Still need help?

If you still need help after reading this article, don't hesitate to reach out to the Contensis community on Slack or raise a support ticket to get help from our team.
New support request