Resend a WhatsApp code through the API: when, and what it costs
The reference for the resend address of ArabyBot's OTP API: the single field, the response, what every resend costs, and the refusals.
On this page 7
The short answer
With a POST request to the resend address carrying the same request id. A fresh code is sent for the existing request under the same rate limits as send, and the response returns the new validity. Every resend is a new billed WhatsApp message, so make the «resend» button appear after a delay.
Also asked as: «اعادة ارسال كود التحقق واتساب» · «الكود موصلش على الواتساب» · «resend whatsapp otp code api»
The address and authentication
POST https://app.arabybot.com/wa_otp_api/resend
Send the OTP app's public key in the header X-Public-Key: ab_otp_…. You create the app in the OTP section of the dashboard, which gives you the public key and a secret shown once. If you switched request signing on for the app, add the header X-Signature: sha256=…, an HMAC-SHA256 of the raw request body keyed with the app secret.
The fields
request_id(required) The request id returned by the first send.
An example request
cURL
curl -X POST https://app.arabybot.com/wa_otp_api/resend \
-H "X-Public-Key: ab_otp_YOUR_PUBLIC_KEY" \
-H "Content-Type: application/json" \
-d '{ "request_id": "3f6c2a9e-41b7-4c0d-9a51-7e2b8d4f1c60" }' PHP
$ch = curl_init('https://app.arabybot.com/wa_otp_api/resend');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ['X-Public-Key: ab_otp_YOUR_PUBLIC_KEY', 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
'request_id' => '3f6c2a9e-41b7-4c0d-9a51-7e2b8d4f1c60',
]),
]);
$answer = json_decode(curl_exec($ch), true);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
curl_close($ch); Python
import requests
r = requests.post(
'https://app.arabybot.com/wa_otp_api/resend',
headers={
"X-Public-Key": "ab_otp_YOUR_PUBLIC_KEY",
},
json={
"request_id": "3f6c2a9e-41b7-4c0d-9a51-7e2b8d4f1c60",
},
timeout=30,
)
print(r.status_code, r.json()) Node.js
// Node.js 18+
const r = await fetch('https://app.arabybot.com/wa_otp_api/resend', {
method: 'POST',
headers: {"X-Public-Key": "ab_otp_YOUR_PUBLIC_KEY", "Content-Type": "application/json"},
body: JSON.stringify({
"request_id": "3f6c2a9e-41b7-4c0d-9a51-7e2b8d4f1c60"
}),
});
console.log(r.status, await r.json());
The response
200
{ "success": true, "request_id": "3f6c2a9e-41b7-4c0d-9a51-7e2b8d4f1c60",
"expires_in": 300, "expires_at": "2026-11-16 18:14:10" } - The response has the same shape as the send response.
The refusals
Every refusal comes back as JSON with "success": false, an error_code and a message, plus retry_after in seconds when the cause is a rate limit:
- 404
not_found: No request with this id. - 422
missing_request_id: The request id is missing. - 429: A rate limit; wait
retry_afterseconds. - 401
missing_key / invalid_key: The public key is missing or wrong. - 401
missing_signature / bad_signature: The app requires request signing and the signature is missing or does not match.
The limits
Every code is a paid WhatsApp message at Meta's authentication rate for the recipient's country. For protection there are limits on requests per phone number and per app, per minute and per day; passing them returns status 429 with retry_after in seconds.
The OTP API guide · All APIs for developers
Frequently asked questions
Is a resend free?
No. Every resend is a new WhatsApp message at Meta's authentication rate. That is why it has the same rate limits as send.
When do I show the «resend» button to the user?
After a delay, not at once. And if the request returns status 429, show the user the time in retry_after before they try again.
Read next
Try the agent before you pay anything
The agent that will answer your customers is the one answering you now: ask it from the chat button here or on WhatsApp. Your account is free with no credit card, and the free trial on your own number or page is activated after you contact our team on customer-service WhatsApp.