POST /api/otp/verify
Verify OTP
Confirm the code the user typed. This call is free.
POST http://31.97.184.139:3016/api/otp/verify
Verify does not charge dinar. Same REST JSON call from PHP, Node.js, Python, or any HTTP client.
Body
• recipient: same phone or email used in send
• otp: the 6-digit code
• request_id: optional, from the send response
PHP
$ch = curl_init("http://31.97.184.139:3016/api/otp/verify");
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",
"otp" => "123456",
"request_id" => 1,
]),
]);
$data = json_decode(curl_exec($ch), true);Node.js
const res = await fetch("http://31.97.184.139:3016/api/otp/verify", {
method: "POST",
headers: {
Authorization: "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
recipient: "user@gmail.com",
otp: "123456",
request_id: 1,
}),
});
const data = await res.json();Python
import requests
data = requests.post(
"http://31.97.184.139:3016/api/otp/verify",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={"recipient": "user@gmail.com", "otp": "123456", "request_id": 1},
timeout=30,
).json()Expected results
• 200: OTP verified
• 400: invalid or expired
• 404: no pending OTP for that recipient