WhatsApp OTP API
Send verification codes through approved WhatsApp authentication templates for signups, logins, password resets, transaction approval, and other secure customer actions.
Why Use WhatsApp For OTPs
WhatsApp OTPs are useful when your customers already engage with your business on WhatsApp and you want verification to feel familiar, branded, and easy to complete.
| Use case | Customer experience |
|---|---|
| Account signup | Customer receives a code in WhatsApp and completes registration |
| Login verification | Customer confirms access without switching to email |
| Password reset | Customer receives a short-lived code in a trusted conversation |
| Transaction approval | Customer verifies a payment, order, or account change |
Template Requirements
WhatsApp OTPs use Meta-approved authentication templates. Fetch your approved templates with the
Templates endpoint, then send the selected template with the code in a single BUTTONS component. SMSLeopard
fills the template body from the same value.
Generate, store, expire, and validate OTPs in your own application. The WhatsApp API delivers the template message; your product should enforce security controls such as expiry and retry limits.
Endpoint
Example Request
cURL
curl -X POST "https://whatsapp.smsleopard.com/v1/whatsapp/send" \
-H "Authorization: Basic $(echo -n 'api_key:api_secret' | base64)" \
-H "Content-Type: application/json" \
-d '{
"destination": "254720000000",
"template_id": "AUTH_TEMPLATE_ID",
"phone_number_id": "WHATSAPP_PHONE_NUMBER_ID",
"component_list": {
"components": [
{
"component_type": "BUTTONS",
"fields": [
{ "name": "1", "value": "483921" }
]
}
]
}
}'