Skip to main content
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

to
string
required
Recipient’s phone number in E.164 format, e.g. +919876543210.
length
integer
default:"6"
Number of digits in the generated code. Accepts 4–8.
expiry_seconds
integer
default:"300"
How long the code stays valid.
template
string
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

otp_id
string
Unique identifier for this OTP request (a UUID) — pass this to the verify endpoint.
status
string
sent once accepted by WhatsApp.
expires_at
string
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}
)
Response
{
  "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.