Forgot password Devise gem API

Got the answer.

1) Create a custom action which recieves email as input

2) Add below code

@user = User.find_by_email("[email protected]")
if @user.present?
 @user.send_reset_password_instructions
 render :text => "updated"
else
     render :text => "no such email"
end

devise now supports it. Check the link bellow https://github.com/plataformatec/devise/wiki/API-Mode-Compatibility-Guide

Password Reset Request (post)

curl -X POST \
'http://{{protocol}}{{host}}:{{port}}/{{resource_plural}}/password' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-H 'Postman-Token: 406d7e49-7da5-460d-8cc2-1009da8fcb73' \
-H 'cache-control: no-cache' \
-d '{
  "user": {
      "email": "[email protected]"
  }
}'

Password Reset Confirm (patch)

  curl -X PATCH \
'http://{{protocol}}{{host}}:{{port}}/{{resource_plural}}/password' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-H 'Postman-Token: f68be2db-1b90-4443-be93-3f012ca4c7dc' \
-H 'cache-control: no-cache' \
-d '{
  "user": {
      "reset_password_token": "-96mB4zMSjL4t5N6ozGC",
      "password": "newpassword",
      "password_confirmation": "newpassword"
  }
}'