> ## 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 Generate a WhatsApp OTP Link in Postman

> Generate a WhatsApp OTP magic link for passwordless authentication. In this guide, we will show you how to create an OTP link using Postman.

Generate a WhatsApp OTP link with the Hypersender API in Postman. The walkthrough below shows the request; use the [Generate WhatsApp OTP Link reference](https://docs.hypersender.com/v2/api-reference/otp/otp-service/generate-a-whatsapp-otp-link.md) for the response shape, implementation flow, and security notes.

This endpoint is **WhatsApp only** — it returns a `whatsapp_link` that opens WhatsApp with a pre-filled verification message.

[Generate a WhatsApp OTP Link with Hypersender API](https://demo.arcade.software/PdNJvHRkkBIpPaHPxQdT?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.
* Public HTTPS callback URLs on your server if you want to confirm the result server-to-server.

## Request

**`POST`** `https://app.hypersender.com/api/otp/v2/{instance}/generate-link`

```http theme={null}
Authorization: Bearer YOUR_API_TOKEN
Content-Type: application/json
```

```json theme={null}
{
  "chatId": "20123456789@c.us",
  "expires": 1800,
  "name": "YourApp",
  "message": {
    "prompt": "Give me link to login at YourApp",
    "success": "Here is your login link: {link}",
    "failed": "Login failed, please try again later.",
    "expired": "The link has been expired, please try another one."
  },
  "callback": {
    "success": "https://yourdomain.com/callback/success",
    "failed": "https://yourdomain.com/callback/failed"
  }
}
```

Use the recipient’s WhatsApp chat ID for `chatId`. Set the lifetime in seconds with `expires`. The API schema does not specify a default. The `message` object customizes the verification messages. The callback URLs are optional; the API reference does not specify callback payload fields or a signing scheme.

## What happens next

1. In Postman, check for `success: true`. Copy `data.whatsapp_link` from the response and note `data.expires_at`. The request starts in the `pending` state.
2. Open the link on a test device and send the prefilled WhatsApp message. In production, your backend can associate the pending request with the intended user and your app can present the link to that user.
3. If you configured callbacks, check which endpoint received the result. Test success, failure, and expiry before using the flow for sign-in.

| Result | What to verify in your application |
| - | - |
| Success | After verifying the callback according to the contract for your account, match it to the pending sign-in attempt and complete that attempt once. |
| Failure | Keep the user signed out and let them request a fresh link when appropriate. |
| Expired | Keep the user signed out and offer a fresh link. Check the WhatsApp expiry message and enforce the recorded expiry in your app even if no callback arrives. |

The public API specification does not define a callback payload or signature. Confirm how to authenticate callbacks for your account before using one to authorize sign-in.

## Troubleshooting

> [accordion] 401 Unauthorized
>
> Check the `Authorization` header, and regenerate the token in the dashboard if it was rotated.

> [accordion] The link expires before users click it
>
> Increase `expires` in the request body. For an expired attempt, generate a fresh link. Use `message.expired` to tell the user what to do next.

> [accordion] No callback received
>
> Check that your HTTPS endpoint is publicly reachable and inspect your own server logs for the test request.

## Next steps

> [card] [Generate OTP Link reference](https://docs.hypersender.com/v2/api-reference/otp/otp-service/generate-a-whatsapp-otp-link.md)
>
> Full parameter reference for this endpoint.

> [card] [OTP API overview](https://docs.hypersender.com/v2/api-reference/otp/otp-api-introduction.md)
>
> See how the code and link flows fit together.

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

> [card] [Full API integration guide](https://docs.hypersender.com/v2/api-reference/otp/otp-service/generate-a-whatsapp-otp-link.md)
>
> Review the response, server example, and error handling.

> [card] [Use Laravel](https://docs.hypersender.com/v2/packages-and-sdks/laravel/otp/generate-whatsapp-otp-link-with-laravel.md)
>
> Generate an OTP link with the Laravel SDK.


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