How to Re-set customer account password through Rest Api?

Which fields should we send in Api body to reset the password?

1 Answer 1


You can achieve below way:

Step 1: Send a reset token to customer mail by using below API. By default magento send a reset link password link in mail. For that customer will redirected to web view to reset password. Although little modification of email template we can send the reset token through mail as shwn below.

Api details:

url : http://example.com/rest/V1/customers/password    
Http method : PUT
Http header  : Content-Type application/json
Json Body : {"email":"[email protected]","template":"email_reset"} // email should be a valid email address as token will be sent there.

Email template modification[YourPackage/YourTheme/Magento_Customer/email/password_reset_confirmation.html]

    * Copyright © Magento, Inc. All rights reserved.
    * See COPYING.txt for license details.
    <!--@subject {{trans "Password Reset Confirmation for %name" name=$customer.name}} @-->
    <!--@vars {
    "var customer.name":"Customer Name",
    "var this.getUrl($store, 'customer/account/createPassword/', [_query:[id:$customer.id, token:$customer.rp_token]])":"Reset Password URL"
    } @-->
    {{template config_path="design/email/header_template"}}

    <p class="greeting" style="font-weight: bold;
    font-size: 25px;
    margin-bottom: 25px;
    margin-top: 5px;
    line-height: 28px;">{{trans "%name," name=$customer.name}}</p>
    <p>{{trans "There was recently a request to change the password for your account."}}</p>
    <p>{{trans "If you requested this change, your password reset token is:"}}</p>

    <table class="button" width="100%" border="0" cellspacing="0" cellpadding="0">
            <table class="inner-wrapper" border="0" cellspacing="0" cellpadding="0" align="center">
                    <td align="center">
                        {{trans "%token" token=$customer.rp_token}}

    <p>{{trans "If you did not make this request, you can ignore this email and your password will remain the same."}}</p>

    {{template config_path="design/email/footer_template"}}

Step2: By the use of reset token and with help below API:

Api details:

url : http://example.com/rest/V1/customers/resetPassword    
Http method : POST
Http header  : Content-Type application/json
Json Body : {"email":"[email protected]","resetToken":"token received in mail","newPassword":"new password"}

Hope this help you.

  • we should pass websiteid also in the body { "email": "[email protected]", "template": "email_reset", "websiteid": 1 } Sep 6, 2018 at 6:06
  • 1
    I think that only needed when scope of the customer is website. Sep 6, 2018 at 7:32
  • Hello, Also you can pass emty email in resetPassword API, magento will take based on token. May 23, 2019 at 11:53
  • No I think but not sure, as this is default magento api and will not work without email id but may customize with respect to token. May 23, 2019 at 12:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.