# Complete a password reset

Operation ID: `fieldagent.confirmResetPassword`

Complete the ForgotPassword flow started by fieldagent.resetPassword, submitting the emailed confirmation code together with the new password.

## Public method

`confirmPassword`

Signature: `fieldAgent.confirmPassword(request)`

Return type: `Promise<ConfirmFieldAgentPasswordResponse>`

## Authentication

Classification: **PUBLIC**

## Prerequisites

None documented.

## HTTP

`POST /auth/confirm-reset-password`

## Path parameters

None.

## Query parameters

None.

## Body parameters

| Name | Type | Required | Format | Allowed values | Default | Nullable | Description |
|---|---|---:|---|---|---|---:|---|
| `body` | [`fieldagent.ConfirmResetPasswordRequest`](../models/fieldagent.ConfirmResetPasswordRequest.md) | No |  |  |  | Yes |  |

Request model: [`fieldagent.ConfirmResetPasswordRequest`](../models/fieldagent.ConfirmResetPasswordRequest.md)

## Request example

```json
{
  "confirmation_code": "123456",
  "email": "test.user@example.com",
  "new_password": "PasswordTest1234$",
  "tenant_id": "tenant-example-001"
}
```

## Success responses

| Status | Shape | Content type | Description |
|---|---|---|---|
| `200` | [`fieldagent.ConfirmResetPasswordResponse`](../models/fieldagent.ConfirmResetPasswordResponse.md) | application/json | Password reset |

## Success response examples

### 200

```json
{
  "message": "Password reset successful"
}
```

## Common errors

| Status | Shape | Content type | Description |
|---|---|---|---|
| `400` | [`fieldagent.ErrorResponse`](../models/fieldagent.ErrorResponse.md) | application/json | Required fields are missing, the new password is too short, or Cognito rejected the confirmation code |

## Error examples

### 400 — The confirmation code is incorrect or expired (sanitized example)

```json
{
  "error": "Invalid verification code provided, please try again."
}
```

### 400 — Required fields are missing

```json
{
  "error": "email, tenant_id, confirmation_code and new_password are required"
}
```

### 400 — New password does not meet the minimum length

```json
{
  "error": "password must be at least 8 characters"
}
```

## NodeJS / TypeScript implementation

```ts
import { HCSDK } from "@healthcloudai/hc-sdk";
import type { ConfirmFieldAgentPasswordRequest } from "@healthcloudai/hc-sdk";
```

```ts
const request = {
  "confirmation_code": "123456",
  "email": "test.user@example.com",
  "new_password": "PasswordTest1234$",
  "tenant_id": "tenant-example-001"
};

const result = await fieldAgent.confirmPassword(request);
```

## cURL

```bash
curl -X POST \
  -H 'Content-Type: application/json' \
  -d '{"confirmation_code":"123456","email":"test.user@example.com","new_password":"PasswordTest1234$","tenant_id":"tenant-example-001"}' \
  'https://dev-api-fieldagent.health.cloud/auth/confirm-reset-password'
```

## Notes

None.

## Prepared Test Console scenario

No canonical scenario is currently associated.

## Real response

No approved real integration response is currently published. Unapproved candidates are never rendered as examples.
