Skip to main content
POST
/
auth
/
forgotpassword
Forgot password
curl --request POST \
  --url https://api.royalti.io/auth/forgotpassword \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "email": "[email protected]",
  "redirect_url": "<string>"
}
'
{
  "message": "Successful, Password reset code sent to users email",
  "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjA5NDExZGQ5LTQxNzYtNGRhMC1hZDA2LTk1MjdhNTIzZmE1ZSIsImVtYWlsIjoibW9sdW5vcmljaGllQGdtYWlsLmNvbSIsInJvbGUiOiJhcnRpc3QiLCJpYXQiOjE2Njk2OTM2MTEsImV4cCI6MTY2OTcxNTIxMX0.KmJDppTUIfaSy5SzwKcW8fjiJKY9dx9kYaX-0c4jcn8"
}
This endpoint requires authentication. Include your Bearer token in the Authorization header.

Description

/auth/forgotpassword Description:
The /auth/forgotpassword endpoint allows users to initiate the process of resetting their password by providing their email address. An optional redirect URL can also be provided to redirect users after initiating the password reset process.
Method:
POST
Request Payload:
ParameterTypeDescription
emailstringThe email address of the user.
redirect_url (Optional)stringThe URL to redirect the user to after initiating the password reset process.
Response Returns JWT token on success, should be used as bearer authorization token when calling /resetpassword
See examples below

Code Examples

const response = await fetch('https://api.royalti.io/auth/forgotpassword', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${token}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    "email": "sample-email",
    "redirect_url": "sample-redirect_url"
  })
});

const data = await response.json();
console.log(data);

Authorizations

Authorization
string
header
required

JWT Authorization header using the Bearer scheme. Format: "Bearer {token}"

Body

application/json
email
string<email>
required

The email address of the user

redirect_url
string

The URL to redirect the user to after initiating the password reset process

Response

Success

message
string
access_token
string