# Verify a practitioner's email OTP

Operation ID: `provider.verifyEmail`

Confirm the OTP emailed during provider.register and mark the Cognito account's email as verified.

## Public method

`verifyEmail`

Signature: `provider.verifyEmail(request)`

Return type: `Promise<{ verified: boolean }>`

## 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` | [`provider.VerifyEmailRequest`](../models/provider.VerifyEmailRequest.md) | No |  |  |  | Yes |  |

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

## Request example

```json
{
  "email": "provider.user@example.com",
  "otp": "123456",
  "tenant_id": "tenant-example-001"
}
```

## Success responses

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

## Success response examples

### 200

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

## Common errors

| Status | Shape | Content type | Description |
|---|---|---|---|
| `400` | [`provider.ErrorResponse`](../models/provider.ErrorResponse.md) | application/json | Required fields are missing, or the OTP is invalid/expired |
| `404` | [`provider.ErrorResponse`](../models/provider.ErrorResponse.md) | application/json | No account exists for the given email in this tenant |
| `500` | [`provider.ErrorResponse`](../models/provider.ErrorResponse.md) | application/json | Internal server error |

## Error examples

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

```json
{
  "error": "Invalid or expired OTP"
}
```

### 400 — Required fields are missing

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

### 404 — No Cognito user matches email in tenant

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

### 500 — The Cognito user lookup itself failed (sanitized example)

```json
{
  "error": "Lookup failed: Internal server error"
}
```

## NodeJS / TypeScript implementation

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

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

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

## cURL

```bash
curl -X POST \
  -H 'Content-Type: application/json' \
  -d '{"email":"provider.user@example.com","otp":"123456","tenant_id":"tenant-example-001"}' \
  'https://dev-api-provider.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.
