# Resend the email verification OTP

Operation ID: `patient.resendVerificationCode`

Issue a fresh email-verification OTP for an existing-but-unverified user. Throttled to one resend per 30 seconds per (tenant, user) at the service layer. No authentication is required — the user is looked up by `email` within `tenant_id`.

## Public method

`resendEmailVerification`

Signature: `auth.resendEmailVerification(request)`

Return type: `Promise<ResendEmailVerificationResponse>`

## Authentication

Classification: **PUBLIC**

## Prerequisites

None documented.

## HTTP

`POST /auth/resend-verification-code`

## Path parameters

None.

## Query parameters

None.

## Body parameters

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

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

## Request example

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

## Success responses

| Status | Shape | Content type | Description |
|---|---|---|---|
| `200` | [`patient.ResendVerificationCodeResponse`](../models/patient.ResendVerificationCodeResponse.md) | application/json | Verification code resent |

## Success response examples

### 200

```json
{
  "email_otp_sent": true
}
```

## Common errors

| Status | Shape | Content type | Description |
|---|---|---|---|
| `400` | [`patient.ErrorResponse`](../models/patient.ErrorResponse.md) | application/json | Bad request — missing fields, or the email is already verified |
| `404` | [`patient.ErrorResponse`](../models/patient.ErrorResponse.md) | application/json | No user with this email exists in the given tenant |
| `429` | [`patient.ErrorResponse`](../models/patient.ErrorResponse.md) | application/json | Cooldown active — a code was already sent within the last 30 seconds |

## Error examples

### 400 — The email is already verified

```json
{
  "error": "Email is already verified — no code to resend"
}
```

### 400 — Required fields are missing

```json
{
  "error": "email and tenant_id 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'"
}
```

### 429 — Resend requested before the cooldown elapsed

```json
{
  "error": "Please wait 30s before requesting a new code."
}
```

## NodeJS / TypeScript implementation

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

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

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

## cURL

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

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