{"id":2580,"date":"2024-12-31T20:23:00","date_gmt":"2024-12-31T20:23:00","guid":{"rendered":"https:\/\/meetanshi.com\/blog\/magento-2-api-reset-customer-password\/"},"modified":"2025-04-24T09:40:59","modified_gmt":"2025-04-24T04:10:59","slug":"magento-2-api-reset-customer-password","status":"publish","type":"post","link":"https:\/\/meetanshi.com\/blog\/magento-2-api-reset-customer-password\/","title":{"rendered":"Magento 2 API &#8211; Reset Customer Password"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Hello, Magento peeps!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I am here back with another blog post on Magento 2 API. My last post was about getting customer tokens in Magento 2 using API, which is required for the customer login. If you haven\u2019t checked it, read it now at&nbsp;<a href=\"https:\/\/meetanshi.com\/blog\/magento-2-api-get-customer-token\/\" target=\"_blank\" rel=\"noreferrer noopener\">Magento 2 API \u2013 Get Customer Token<\/a>. This blog post will show you how to reset customer password using Magento 2 API.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In a survey by&nbsp;<a href=\"https:\/\/blog.hypr.com\/hypr-password-study-findings\" target=\"_blank\" rel=\"noreferrer noopener\">HYPR<\/a>, 78% of the respondents revealed that they had to reset the password they forgot in 90 days. Therefore, it becomes vital to provide password reset functionality to the customers if you are developing a mobile shopping app based on Magento 2 or creating a new storefront. Magento 2 includes default API endpoints that provide customers with such functionality to reset their passwords. We recommend&nbsp;<a href=\"https:\/\/meetanshi.com\/free-tools\">setting up a strong password<\/a>&nbsp;each time.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this blog post, I will guide you through the Magento 2 API to request a password reset token email and use that token to reset the customer password.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Let\u2019s begin with the&nbsp;<em><strong>Magento 2 API to Reset Customer Password<\/strong><\/em>!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to Reset Customer Password Using REST API in Magento 2?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The client needs a password reset token to set a new password in Magento 2 using REST API. The client needs to pass the customer email id through a PUT method in Magento 2 API to request the password reset token. The request will generate a password reset token in Magento 2, which will be sent to the customers\u2019 email that can be later used to set a new password.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 1:&nbsp;Request Customer Password Reset Token Using Magento 2 API<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Provided below is the complete structure of the Magento 2 API request to get the customer password reset token:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Method:&nbsp;<\/strong>PUT<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>URL:&nbsp;<\/strong><em>store_url\/rest\/V1\/customers\/password<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Body:<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">{\n  \"email\": \"meetanshi.tester@gmail.com\",\n  \"template\": \"email_reset\"\n}<\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2022\/06\/Send-Customer-Password-Reset-Token-Request-in-Magento-2-API-1-700x312.png\" alt=\"Reset Customer ID Password using Magento 2 Rest API\" class=\"wp-image-50611\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">If a customer with the provided email id is registered, Magento 2 will return a&nbsp;<strong>\u2018true\u2019<\/strong>&nbsp;response and send a customer password reset link containing the reset token to the same email address.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 2: Use Customer Password Reset Token to Set New Password Using Magento 2 API<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The next step is to utilize the password reset token to set a new password using Magento 2 API request. Generally, the password reset token is present in the URL of the password reset link received on the customer\u2019s email. The client must pass the customer\u2019s email address, password reset token, and a new password through a POST request to the&nbsp;<em>customers\/resetPassword&nbsp;<\/em>endpoint. Here\u2019s the complete structure of the Magento 2 API request to reset the customer password:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Method:&nbsp;<\/strong>POST<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>URL:&nbsp;<\/strong><em>store_url\/rest\/V1\/customers\/resetPassword<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Body:<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">{\n  \"email\": \"meetanshi.tester@gmail.com\",\n  \"resetToken\": \"0:3:DufpYnLrA+Kw5jmJUd6171AQSU2jgO+1AOp4AiIeibTHq5jgve+7ZBDvI62ihr1tDeBxYSmvtNILoeIk\",\n  \"newPassword\":\"test@123\"\n}<\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2022\/06\/Reset-Customer-ID-Password-using-Magento-2-Rest-API-1-700x313.png\" alt=\"Send Customer Password Reset Token Request in Magento 2 API\" class=\"wp-image-50615\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Response:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Magento 2 will reset the customer password as requested on the successful validation of the password reset token. An error message will be displayed in case of a mismatch of the password.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">That\u2019s it!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This is how you can use Magento 2 REST API to reset customer password.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Developers can harness the features and functionalities of Magento 2 by using the REST APIs in third-party developments such as new storefronts or mobile apps. Magento 2 API Rest Customer Password is useful to add the \u2018forgot password\u2019 feature by using the APIs. I hope this guide will help you with the customer password reset API in Magento 2 and add value to your Magento knowledge.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In case you still have any doubts or queries using the customer password reset API in Magento 2, feel free to comment. I\u2019d be happy to help you.  <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Also, do not forget to share this Magento 2 API guide with your developer friends via social media.  <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Thanks for reading!  <\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-8f761849 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<div class=\"wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button btn-orange\"><a class=\"wp-block-button__link wp-element-button\" href=\"https:\/\/meetanshi.com\/blog\/magento-2-api-generate-customer-token-using-customer-id\/\">Magento 2 API \u2013 Generate Customer Token<\/a><\/div>\n<\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<div class=\"wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button btn-orange\"><a class=\"wp-block-button__link wp-element-button\" href=\"https:\/\/meetanshi.com\/blog\/magento-2-api-create-cart-add-products-to-cart\/\">Magento 2 API \u2013 Create Cart &amp; Add Products to Cart<\/a><\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Hello, Magento peeps! I am here back with another blog post on Magento 2 API. My last post was about getting customer tokens in Magento&#8230;<\/p>\n","protected":false},"author":13,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[34],"tags":[],"class_list":["post-2580","post","type-post","status-publish","format-standard","hentry","category-magento"],"acf":[],"_links":{"self":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/2580","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/comments?post=2580"}],"version-history":[{"count":3,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/2580\/revisions"}],"predecessor-version":[{"id":12891,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/2580\/revisions\/12891"}],"wp:attachment":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/media?parent=2580"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/categories?post=2580"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/tags?post=2580"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}