POST /api/otp/send
Send OTP
Send a WhatsApp or Gmail verification code and deduct dinar.
POST http://31.97.184.139:3016/api/otp/send
This is a normal REST JSON API. It works from PHP, Node.js, Python, Java, C#, Go, Ruby, Laravel, Django, Express, and any backend that can POST JSON.
Headers (required)
• Authorization: Bearer YOUR_API_KEY
• Content-Type: application/json
Body
• recipient: phone in E.164 for WhatsApp, or email for Gmail
• channel: "whatsapp" or "email"
• purpose: optional label, example "login"
WhatsApp (35 dinar)
WhatsApp Web must be connected first.
{"recipient":"+9647500000000","channel":"whatsapp","purpose":"login"}Success includes cost_iqd, balance_iqd, request_id, and delivered_via.
If WhatsApp Web is not connected: HTTP 409 and no charge.
Gmail (15 dinar)
{"recipient":"user@gmail.com","channel":"email","purpose":"login"}The 6-digit code is emailed. It is not returned in the JSON for Gmail.
PHP
$ch = curl_init("http://31.97.184.139:3016/api/otp/send");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOUR_API_KEY",
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode([
"recipient" => "user@gmail.com",
"channel" => "email",
"purpose" => "login",
]),
]);
$data = json_decode(curl_exec($ch), true);Node.js
const res = await fetch("http://31.97.184.139:3016/api/otp/send", {
method: "POST",
headers: {
Authorization: "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
recipient: "user@gmail.com",
channel: "email",
purpose: "login",
}),
});
const data = await res.json();Python
import requests
data = requests.post(
"http://31.97.184.139:3016/api/otp/send",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={"recipient": "user@gmail.com", "channel": "email", "purpose": "login"},
timeout=30,
).json()Use the language tabs below for Go, Java, C#, Ruby, and cURL.
Low balance
HTTP 402 if the wallet cannot cover 35 or 15 dinar.