Send a numeric OTP to a customer over WhatsApp using one of your approved authentication templates.
Endpoint
POST https://xwialxkobwygraiddimj.supabase.co/functions/v1/public-api/v1/otp/send
Request body
Recipient’s phone number in E.164 format, e.g. +919876543210.
Number of digits in the generated code. Accepts 4–8.
How long the code stays valid.
Name of the approved authentication template to use. If omitted, Tanvik uses the most recently approved authentication-category template on your account — if you don’t have one yet, the request fails with no_default_otp_template.
Response
Unique identifier for this OTP request (a UUID) — pass this to the verify endpoint.
sent once accepted by WhatsApp.
ISO 8601 timestamp when the code stops being valid.
curl https://xwialxkobwygraiddimj.supabase.co/functions/v1/public-api/v1/otp/send \
-H "Authorization: Bearer tvk_live_xxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{ "to": "+919876543210", "length": 6, "expiry_seconds": 300 }'
const res = await fetch('https://xwialxkobwygraiddimj.supabase.co/functions/v1/public-api/v1/otp/send', {
method: 'POST',
headers: {
'Authorization': 'Bearer tvk_live_xxxxxxxxxxxxxxxx',
'Content-Type': 'application/json'
},
body: JSON.stringify({ to: '+919876543210', length: 6, expiry_seconds: 300 })
});
const data = await res.json();
import requests
res = requests.post(
"https://xwialxkobwygraiddimj.supabase.co/functions/v1/public-api/v1/otp/send",
headers={"Authorization": "Bearer tvk_live_xxxxxxxxxxxxxxxx"},
json={"to": "+919876543210", "length": 6, "expiry_seconds": 300}
)
{
"otp_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"status": "sent",
"expires_at": "2026-07-14T18:35:00Z"
}
OTP messages use WhatsApp authentication-category templates, which have separate approval and pricing from marketing/utility templates. See Create Templates.