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

# Change Password

> Change the password for the authenticated account

## Endpoint

```
POST /api/v1/auth/change-password
```

**Base URL**: `http://localhost:3000/api/v1`

<Note>This endpoint requires **Bearer authentication**.</Note>

## Authentication

Include the access token in the Authorization header:

```bash theme={null}
Authorization: Bearer YOUR_ACCESS_TOKEN
```

This endpoint works for both:

* Job Seekers
* Companies

## Request Body

<ParamField body="currentPassword" type="string" required>
  The current password for the authenticated account.
</ParamField>

<ParamField body="newPassword" type="string" required>
  The new password to set. Minimum 6 characters.
</ParamField>

## Request Shape

```typescript theme={null}
interface ChangePasswordDto {
  currentPassword: string;
  newPassword: string;
}
```

## Example Request

```bash theme={null}
POST /api/v1/auth/change-password
Authorization: Bearer YOUR_ACCESS_TOKEN
Content-Type: application/json

{
  "currentPassword": "old-password-123",
  "newPassword": "new-password-456"
}
```

## Response

### Success Response (200 OK)

```json theme={null}
{
  "success": true,
  "data": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "email": "john.doe@example.com",
    "firstName": "John",
    "lastName": "Doe",
    "profileImageUrl": null,
    "isActive": true,
    "isVerified": true,
    "lastLoginAt": "2026-03-07T20:00:00.000Z",
    "createdAt": "2026-01-01T10:00:00.000Z",
    "updatedAt": "2026-03-07T21:00:00.000Z"
  },
  "message": "Password changed successfully",
  "meta": {
    "timestamp": "2026-04-23T20:00:00.000Z",
    "path": "/auth/change-password",
    "method": "POST"
  }
}
```

### Response Notes

<Info>
  **Current Implementation Detail**: The success payload depends on the account type and repository
  implementation. Treat the success status and message as the primary confirmation that the password
  was changed.
</Info>

## What Happens

<Steps>
  <Step title="Find User">
    The backend looks up the authenticated account in both job seeker and company tables.
  </Step>

  <Step title="Verify Current Password">
    The provided `currentPassword` is compared against the stored password hash.
  </Step>

  <Step title="Hash New Password">The new password is hashed before it is saved.</Step>

  <Step title="Update Password">
    The backend updates the password for the authenticated account.
  </Step>
</Steps>

## Error Responses

### 400 Bad Request - Validation Error

```json theme={null}
{
  "success": false,
  "error": {
    "message": [
      "currentPassword must be longer than or equal to 6 characters",
      "newPassword must be longer than or equal to 6 characters"
    ],
    "statusCode": 400,
    "timestamp": "2026-04-23T20:00:00.000Z",
    "path": "/auth/change-password",
    "method": "POST",
    "details": "Bad Request"
  }
}
```

### 401 Unauthorized - Not Authenticated

```json theme={null}
{
  "success": false,
  "error": {
    "message": "Unauthorized",
    "statusCode": 401,
    "timestamp": "2026-04-23T20:00:00.000Z",
    "path": "/auth/change-password",
    "method": "POST",
    "details": "Unauthorized"
  }
}
```

### 401 Unauthorized - Current Password Is Incorrect

```json theme={null}
{
  "success": false,
  "error": {
    "message": "Current password is incorrect",
    "statusCode": 401,
    "timestamp": "2026-04-23T20:00:00.000Z",
    "path": "/auth/change-password",
    "method": "POST",
    "details": "Unauthorized"
  }
}
```

### 404 Not Found - User Not Found

```json theme={null}
{
  "success": false,
  "error": {
    "message": "User not found",
    "statusCode": 404,
    "timestamp": "2026-04-23T20:00:00.000Z",
    "path": "/auth/change-password",
    "method": "POST",
    "details": "Not Found"
  }
}
```

### 500 Internal Server Error

```json theme={null}
{
  "success": false,
  "error": {
    "message": "Failed to update password",
    "statusCode": 500,
    "timestamp": "2026-04-23T20:00:00.000Z",
    "path": "/auth/change-password",
    "method": "POST",
    "details": "Internal Server Error"
  }
}
```

## Validation Rules

| Field           | Rules                |
| --------------- | -------------------- |
| currentPassword | Minimum 6 characters |
| newPassword     | Minimum 6 characters |

## Related Endpoints

* [Login](/api-reference/auth/login) - Sign in with the new password after changing it
* [Forgot Password](/api-reference/auth/forgot-password) - Use OTP-based recovery if the current password is unknown
* [Logout](/api-reference/auth/logout) - End the current session
