# Verify a patient's email OTP

Operation ID: `patient.verifyEmail`

Confirm the one-time code emailed during `patient.register`, marking the Cognito user's email as verified. No authentication is required — the user is looked up by `email` within `tenant_id`.

## Public method

`verifyEmail`

Signature: `auth.verifyEmail(request)`

Return type: `Promise<VerifiedResponse>`

## Authentication

Classification: **PUBLIC**

## Prerequisites

None documented.

## HTTP

`POST /auth/verify-email`

## Path parameters

None.

## Query parameters

None.

## Body parameters

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

Request model: [`patient.VerifyEmailRequest`](../models/patient.VerifyEmailRequest.md)

## Request example

```json
{
  "email": "jordan.patient@yopmail.com",
  "otp": "123456",
  "tenant_id": "tenant-example-001"
}
```

## Success responses

| Status | Shape | Content type | Description |
|---|---|---|---|
| `200` | [`patient.VerifyEmailResponse`](../models/patient.VerifyEmailResponse.md) | application/json | Email verified |

## Success response examples

### 200

```json
{
  "verified": true
}
```

## Common errors

| Status | Shape | Content type | Description |
|---|---|---|---|
| `400` | [`patient.ErrorResponse`](../models/patient.ErrorResponse.md) | application/json | Bad request — missing fields, or the OTP is invalid/expired |
| `404` | [`patient.ErrorResponse`](../models/patient.ErrorResponse.md) | application/json | No user with this email exists in the given tenant |

## Error examples

### 400 — The OTP is invalid or expired

```json
{
  "error": "Invalid or expired verification code"
}
```

### 400 — Required fields are missing

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

### 404 — The email is not registered in this tenant

```json
{
  "error": "User with email 'user@example.com' not found in tenant 'tenant-example-001'"
}
```

## NodeJS / TypeScript implementation

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

```ts
const request = {
  "email": "jordan.patient@yopmail.com",
  "otp": "123456",
  "tenant_id": "tenant-example-001"
};

const result = await auth.verifyEmail(request);
```

## cURL

```bash
curl -X POST \
  -H 'Content-Type: application/json' \
  -d '{"email":"jordan.patient@yopmail.com","otp":"123456","tenant_id":"tenant-example-001"}' \
  'https://dev-api-patient.health.cloud/auth/verify-email'
```

## 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.
