> For the complete documentation index, see [llms.txt](https://qbits-organization.gitbook.io/buildwise-doc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://qbits-organization.gitbook.io/buildwise-doc/authentication/otp-verification.md).

# OTP Verification

***

### Request Email OTP

Sends a 6-digit OTP code to the user's registered email address.

**Endpoint:** `POST /api/v1/auth/request-otp`

**Request Body:**

```json
{
  "email": "user@example.com"
}
```

**OTP Characteristics:**

* 6-digit numeric code
* 10-minute expiration
* Single-use validation
* Professional email template

**Response Codes:**

* `200` - OTP sent successfully
* `404` - Email address not found
* `400` - Email delivery failed

**Success Response:**

```json
{
  "success": true,
  "httpStatus": "OK",
  "message": "New OTP code sent successful",
  "action_time": "2025-05-27T14:11:37.143039",
  "data": "New OTP code set successful to user@example.com"
}
```

### Verify Email OTP

Validates the provided OTP code and activates the user account.

**Endpoint:** `POST /api/v1/auth/verify-otp`

**Request Body:**

```json
{
  "email": "user@example.com",
  "code": "123456"
}
```

**Verification Process:**

1. Validates email and OTP combination
2. Checks OTP expiration status
3. Activates user account (sets `isVerified = true`)
4. Generates JWT tokens for immediate authentication
5. Invalidates OTP to prevent reuse

**Response Codes:**

* `200` - OTP verified successfully, account activated
* `400` - OTP expired
* `403` - Invalid OTP or email combination
* `404` - User not found
