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

# Password Management

> Request password reset emails, reset passwords via OTP, and change current passwords.

# Password Management

Endpoints for managing, resetting, and updating user passwords.

***

## Forgot Password (Request Reset OTP)

Triggers a password-reset OTP to be dispatched to the provided email address.

### Endpoint

```http theme={null}
POST /api/v2/auth/forgot-password
```

### Request Body

| Field   | Type     | Required | Description           |
| :------ | :------- | :------- | :-------------------- |
| `email` | `string` | **Yes**  | Account email address |

```json theme={null}
{
  "email": "user@example.com"
}
```

### Response (200 OK)

```json theme={null}
{
  "success": true,
  "message": "Password reset code sent to your email"
}
```

***

## Reset Password (with OTP)

Sets a new password using the OTP received via email.

### Endpoint

```http theme={null}
POST /api/v2/auth/reset-password
```

### Request Body

| Field         | Type     | Required | Description               |
| :------------ | :------- | :------- | :------------------------ |
| `email`       | `string` | **Yes**  | Account email address     |
| `otpCode`     | `string` | **Yes**  | 6-digit OTP code received |
| `newPassword` | `string` | **Yes**  | New strong password       |

```json theme={null}
{
  "email": "user@example.com",
  "otpCode": "928371",
  "newPassword": "BrandNewPassword2026!"
}
```

### Response (200 OK)

```json theme={null}
{
  "success": true,
  "message": "Password reset successfully. Please log in with your new password."
}
```

***

## Change Password (Authenticated)

Allows logged-in users to update their password by confirming their old password.

### Endpoint

```http theme={null}
POST /api/v2/auth/change-password
```

### Headers

```http theme={null}
Authorization: Bearer <jwt_access_token>
```

### Request Body

| Field             | Type     | Required | Description          |
| :---------------- | :------- | :------- | :------------------- |
| `currentPassword` | `string` | **Yes**  | Existing password    |
| `newPassword`     | `string` | **Yes**  | New desired password |

```json theme={null}
{
  "currentPassword": "OldPassword123!",
  "newPassword": "NewStrongPassword2026!"
}
```

### Response (200 OK)

```json theme={null}
{
  "success": true,
  "message": "Password updated successfully"
}
```
