> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hypersender.com/llms.txt
> Use this file to discover all available pages before exploring further.

# How to Send an OTP in Postman

> The Hypersender OTP API is a powerful API to send verification codes via WhatsApp and SMS. In this guide, we will show you how to send an OTP using Postman.

This guide walks you through sending and validating a one-time password with the Hypersender OTP API in Postman. Use the interactive walkthrough for the click-by-click flow, then rebuild the same requests with the written reference below.

The OTP API delivers codes over **WhatsApp** or **SMS**, depending on the identifier you pass as `chatId`.

[Send OTP via the API Using Postman](https://demo.arcade.software/PwO3GckpVUsixrQX4K8G?embed\&embed_mobile=tab\&embed_desktop=inline\&show_copy_link=true)

## What you need

* A [Hypersender account](https://app.hypersender.com/register) with an active instance.
* Your **API token** and **instance UUID** from the dashboard.
* [Postman](https://www.postman.com/downloads/) installed, or the [OTP Postman collection](https://docs.hypersender.com/v2/api-reference/otp/otp-collection.json) imported.
* A WhatsApp number connected to your instance, or an Android phone running the Hypersender SMS app for SMS delivery.

## Endpoints

| Step | Method | Endpoint |
| - | - | - |
| Send the code | `POST` | `/{instance}/request-code` |
| Verify the code | `POST` | `/{instance}/validate-code` |

**Base URL**

```text theme={null}
https://app.hypersender.com/api/otp/v2
```

**Auth header**

```http theme={null}
Authorization: Bearer YOUR_API_TOKEN
```

## 1. Request a code

`chatId` accepts a WhatsApp chat ID such as `20123456789@c.us`, or a phone number when you want the code delivered by SMS.

```json theme={null}
{
  "chatId": "20123456789@c.us",
  "length": 6,
  "useLetter": false,
  "useNumber": true,
  "name": "YourApp",
  "expires": 1800
}
```

`expires` is the code lifetime in seconds. `length`, `useLetter`, `useNumber`, and `allCapital` control how the code is generated.

## 2. Validate the code

Send the same `chatId` together with the code your user typed:

```json theme={null}
{
  "chatId": "20123456789@c.us",
  "code": "439713"
}
```

A successful response confirms the code is correct, unexpired, and unused. Each code validates once.

> [!TIP]
>
> Generate one code per user attempt instead of retrying in a loop — the endpoint is rate limited.

## Troubleshooting

> [accordion] 401 Unauthorized
>
> The `Authorization` header is missing or the token was rotated. Generate a new token in the dashboard and update the header.

> [accordion] 404 or unknown instance
>
> The instance UUID in the URL does not belong to your account. Copy it again from the dashboard.

> [accordion] The code never arrives
>
> For WhatsApp, confirm the number is connected and the `chatId` ends with `@c.us`. For SMS, confirm the Hypersender app is linked, online, and that you passed a phone number in international format.

> [accordion] Validation rejects a valid code
>
> The code expired — the default TTL is 1800 seconds — or it was already used. Request a fresh code for the next attempt.

## Next steps

> [card] [Request OTP Code](https://docs.hypersender.com/v2/api-reference/otp/otp-service/request-otp-code.md)
>
> Full parameter reference for the send step.

> [card] [Validate OTP Code](https://docs.hypersender.com/v2/api-reference/otp/otp-service/validate-otp-code.md)
>
> Full parameter reference for the verification step.

> [card] [Create your Hypersender account](https://app.hypersender.com/register)
>
> Get your API token and instance UUID, connect a number, and send your first OTP.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.