> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sublay.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Request password reset

> Send a password reset email to a user

## Overview

`useRequestPasswordReset` returns a function that sends a password reset email to the specified address. The server always responds with a generic success message regardless of whether the address is registered, to prevent user enumeration.

## Usage Example

```tsx React theme={null}
import { useRequestPasswordReset } from "@sublay/react-js";

function ForgotPasswordForm() {
  const requestPasswordReset = useRequestPasswordReset();

  const handleSubmit = async (e: React.FormEvent<HTMLFormElement>) => {
    e.preventDefault();
    const form = e.currentTarget;
    try {
      const result = await requestPasswordReset({
        email: form.email.value,
      });
      alert(result.message);
    } catch (err) {
      console.error(err);
    }
  };

  return (
    <form onSubmit={handleSubmit}>
      <input name="email" type="email" placeholder="Email" />
      <button type="submit">Send Reset Link</button>
    </form>
  );
}
```

```tsx React Native theme={null}
import { useRequestPasswordReset } from "@sublay/react-native";

function ForgotPasswordButton({ email }: { email: string }) {
  const requestPasswordReset = useRequestPasswordReset();

  return (
    <Button
      title="Send Reset Link"
      onPress={() => requestPasswordReset({ email })}
    />
  );
}
```

## Parameters

The returned function accepts:

**email** `string` *required*

The email address to send the reset link to.

## Returns

The hook returns an async function. That function resolves to:

**success** `boolean`

Always `true` when the request completes without a server error.

**message** `string`

A generic success message. The same message is returned whether or not the
email address is registered.

> [!NOTE]
>
> The reset link in the email expires after 1 hour. The link points to a
> server-hosted page that collects the new password and calls the
> Reset Password endpoint.

## See Also

* [Request Password Reset API reference](https://docs.sublay.io/v7/api-reference/auth/request-password-reset.md)
* [Reset Password API reference](https://docs.sublay.io/v7/api-reference/auth/reset-password.md)
* [Built-in Auth guide](https://docs.sublay.io/v7/sdk/authentication/built-in.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.