Request OTP code
curl --request POST \
--url https://app.hypersender.com/api/otp/v2/{instance}/request-code \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"chatId": "[email protected]",
"length": 6,
"useLetter": false,
"useNumber": true,
"allCapital": false,
"name": "hypersender",
"expires": 1800
}
'import requests
url = "https://app.hypersender.com/api/otp/v2/{instance}/request-code"
payload = {
"chatId": "[email protected]",
"length": 6,
"useLetter": False,
"useNumber": True,
"allCapital": False,
"name": "hypersender",
"expires": 1800
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
chatId: '[email protected]',
length: 6,
useLetter: false,
useNumber: true,
allCapital: false,
name: 'hypersender',
expires: 1800
})
};
fetch('https://app.hypersender.com/api/otp/v2/{instance}/request-code', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.hypersender.com/api/otp/v2/{instance}/request-code",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'chatId' => '[email protected]',
'length' => 6,
'useLetter' => false,
'useNumber' => true,
'allCapital' => false,
'name' => 'hypersender',
'expires' => 1800
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.hypersender.com/api/otp/v2/{instance}/request-code"
payload := strings.NewReader("{\n \"chatId\": \"[email protected]\",\n \"length\": 6,\n \"useLetter\": false,\n \"useNumber\": true,\n \"allCapital\": false,\n \"name\": \"hypersender\",\n \"expires\": 1800\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.hypersender.com/api/otp/v2/{instance}/request-code")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"chatId\": \"[email protected]\",\n \"length\": 6,\n \"useLetter\": false,\n \"useNumber\": true,\n \"allCapital\": false,\n \"name\": \"hypersender\",\n \"expires\": 1800\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.hypersender.com/api/otp/v2/{instance}/request-code")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"chatId\": \"[email protected]\",\n \"length\": 6,\n \"useLetter\": false,\n \"useNumber\": true,\n \"allCapital\": false,\n \"name\": \"hypersender\",\n \"expires\": 1800\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "OTP code generated and message queued successfully",
"data": {
"uuid": "a0b5df6a-b491-4190-80a5-38d85a2a4836",
"chat_id": "[email protected]",
"code": "439713",
"status": "pending",
"otp_type": "code",
"expires_at": "2025-12-29T18:09:38+00:00",
"created_at": "2025-12-29T17:39:38+00:00"
}
}Request OTP Code
Generate an OTP code and queue the message to the provided chatId for secure authentication.
POST
/
{instance}
/
request-code
Request OTP code
curl --request POST \
--url https://app.hypersender.com/api/otp/v2/{instance}/request-code \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"chatId": "[email protected]",
"length": 6,
"useLetter": false,
"useNumber": true,
"allCapital": false,
"name": "hypersender",
"expires": 1800
}
'import requests
url = "https://app.hypersender.com/api/otp/v2/{instance}/request-code"
payload = {
"chatId": "[email protected]",
"length": 6,
"useLetter": False,
"useNumber": True,
"allCapital": False,
"name": "hypersender",
"expires": 1800
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
chatId: '[email protected]',
length: 6,
useLetter: false,
useNumber: true,
allCapital: false,
name: 'hypersender',
expires: 1800
})
};
fetch('https://app.hypersender.com/api/otp/v2/{instance}/request-code', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.hypersender.com/api/otp/v2/{instance}/request-code",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'chatId' => '[email protected]',
'length' => 6,
'useLetter' => false,
'useNumber' => true,
'allCapital' => false,
'name' => 'hypersender',
'expires' => 1800
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.hypersender.com/api/otp/v2/{instance}/request-code"
payload := strings.NewReader("{\n \"chatId\": \"[email protected]\",\n \"length\": 6,\n \"useLetter\": false,\n \"useNumber\": true,\n \"allCapital\": false,\n \"name\": \"hypersender\",\n \"expires\": 1800\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.hypersender.com/api/otp/v2/{instance}/request-code")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"chatId\": \"[email protected]\",\n \"length\": 6,\n \"useLetter\": false,\n \"useNumber\": true,\n \"allCapital\": false,\n \"name\": \"hypersender\",\n \"expires\": 1800\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.hypersender.com/api/otp/v2/{instance}/request-code")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"chatId\": \"[email protected]\",\n \"length\": 6,\n \"useLetter\": false,\n \"useNumber\": true,\n \"allCapital\": false,\n \"name\": \"hypersender\",\n \"expires\": 1800\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "OTP code generated and message queued successfully",
"data": {
"uuid": "a0b5df6a-b491-4190-80a5-38d85a2a4836",
"chat_id": "[email protected]",
"code": "439713",
"status": "pending",
"otp_type": "code",
"expires_at": "2025-12-29T18:09:38+00:00",
"created_at": "2025-12-29T17:39:38+00:00"
}
}Overview
Generate a one-time password (OTP) code and automatically send it to a WhatsApp user. This endpoint is perfect for implementing two-factor authentication, phone verification, or secure login systems.How It Works
- Send a request with the recipient’s
chatIdand OTP configuration - The system generates a random code based on your specifications
- The code is stored with an expiration time
- A message containing the code is queued to be sent to the user
- You receive the code details to verify later
Quick Demo
Learn how to send an OTP code using Postman: Demo Link
Parameters
chatId (required)
The WhatsApp chat ID of the recipient (e.g.,[email protected])
length
The length of the OTP code. Default is6 characters.
useLetter
Include letters in the code generation. Default isfalse.
useNumber
Include numbers in the code generation. Default istrue.
allCapital
Make all letters uppercase whenuseLetter is true. Default is false.
name
The name to display in the message template (e.g., your app or service name).expires
Time-to-live (TTL) in seconds before the code expires. Default is1800 seconds (30 minutes).
Showcase Example Message

Response
The response includes:uuid: Unique identifier for this OTP requestchat_id: The recipient’s chat IDcode: The generated OTP code (store this securely if needed)status: Current status (pending,sent,validated, orexpired)otp_type: Type of OTP (alwayscodefor this endpoint)expires_at: ISO 8601 timestamp when the code expirescreated_at: ISO 8601 timestamp when the code was created
View All of your OTP Requests

Usage Example
use Illuminate\Support\Facades\Http;
$response = Http::withToken('YOUR_API_TOKEN')
->post('https://app.hypersender.com/api/otp/v2/{instance}/request-code', [
'chatId' => '[email protected]',
'length' => 6,
'useLetter' => false,
'useNumber' => true,
'name' => 'YourAppName',
'expires' => 1800,
]);
$result = $response->json();
$otpData = $result['data'] ?? null;
// Example: log or store uuid and status
info('OTP uuid: ' . ($otpData['uuid'] ?? ''));
Next Steps
After generating the code:- The user will receive the OTP via WhatsApp
- User enters the code in your application
- Use the Validate OTP Code endpoint to verify the code
- Check the
uuidto track the verification status
Set an appropriate
expires time based on your security requirements. Shorter expiration times (5-10 minutes) provide better security but may frustrate users if they need more time to complete the verification.Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Hypersender instance UUID
Body
application/json