Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.
Manage User Passwords
The associated session must have permission to access the given user password information. If the session does not have proper permissions, an HTTP error 403 response is returned from these methods.
These methods are available for both users and self-service users. For managing self-service user passwords, use SelfServiceUser instead of User in the REST API URL.
Here is an example of retrieving the current password expiration status for a user:
Example usage for getting current password expiration status
1curl https://MyDomainName.my.salesforce.com/services/data/v67.0/sobjects/User/005D0000001KyEIIA0/password -H "Authorization: Bearer token"Example request body for getting current password expiration status
None required
JSON example response body for getting current password expiration status
1{
2 "isExpired" : false
3}XML example response body for getting current password expiration status
1<Password>
2 <isExpired>false</isExpired>
3</Password>Example error response if session has insufficient privileges
1{
2 "message" : "You do not have permission to view this record.",
3 "errorCode" : "INSUFFICIENT_ACCESS"
4}Here is an example of changing the password for a given user:
Example usage for changing a user password
1curl https://MyDomainName.my.salesforce.com/services/data/v67.0/sobjects/User/005D0000001KyEIIA0/password -H "Authorization: Bearer token" -H "Content-Type: application/json" -d @newpwd.json -X POSTContents for file newpwd.json
1{
2 "NewPassword" : "myNewPassword1234"
3}Example response for changing a user password
No response body on successful password change, HTTP status code 204 returned.
Example error response if new password does not meet organization password requirements
1{
2 "message" : "Your password must have a mix of letters and numbers.",
3 "errorCode" : "INVALID_NEW_PASSWORD"
4}And finally, here is an example of resetting a user password:
Example usage for resetting a user password
1curl https://MyDomainName.my.salesforce.com/services/data/v67.0/sobjects/User/005D0000001KyEIIA0/password -H "Authorization: Bearer token" -X DELETEExample request body for resetting a user password
None required
JSON example response body for resetting a user password
1{
2 "NewPassword" : "2sv0xHAuM"
3}XML example response body for resetting a user password
1<Result>
2 <NewPassword>2sv0xHAuM</NewPassword>
3</Result>