Send and check one-time codes for logins, sign-ups and payments with two API calls, over SMS, WhatsApp, voice or email, with automatic fallback between them.
curl -X POST https://api.sendexa.co/v1/otp/request \
-H "Authorization: Basic $SENDEXA_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"recipient": { "value": "0244123456" },
"sender": "MyBrand",
"channel": ["whatsapp", "sms"],
"code": { "length": 6, "type": "NUMERIC" },
"expiry": { "amount": 10, "duration": "minutes" }
}'From $0.05 per verification
Charged only on successful verification, plus the SMS or WhatsApp channel fee.
POST /v1/otp/request sends the code and POST /v1/otp/verify checks it. Sendexa generates, stores and expires the code, so you never keep OTPs in your own database.
Pass channels in order, such as ["whatsapp", "sms"]. If one can't be sent, the next is tried, so a missing WhatsApp account doesn't block a login.
One endpoint for every channel. Voice reads the code out for customers who can't receive SMS; email works for sign-ups without a phone.
The verification fee is charged only when a code is verified successfully. SMS and WhatsApp sends carry their normal per-message channel fee.
Set how many wrong attempts are allowed (1 to 10) and how long a code lives (1 to 1,440 minutes or hours). Requests are rate limited automatically.
Numeric, alphanumeric or letters only, 4 to 10 characters long, with your own message template and sender ID.
POST /v1/otp/request with the customer's number. Sendexa generates a code and sends it on the first channel that works.POST /v1/otp/verify with the number, the code and the OTP ID. You get back whether it matched.Full request options are in the Verify docs.
SMS reaches every phone, including feature phones and customers without data, and costs less per message in Ghana. WhatsApp shows your business name and works over Wi-Fi, but only for customers who use it. Listing ["whatsapp", "sms"] gives you both: WhatsApp first, SMS when it can't be used. We compare the two in WhatsApp OTP vs SMS OTP.
Verification starts from $0.05 per successful verification, plus the channel fee for SMS or WhatsApp sends (an SMS to Ghana is billed at the normal SMS rate). Voice and email have no separate channel fee. See the pricing page for current rates.
The verification fee is charged only when a code is verified successfully. The SMS or WhatsApp message itself is billed when it is sent.
If you pass a list of channels such as ["whatsapp", "sms"], Sendexa tries them in order until one send succeeds. WhatsApp needs an approved authentication template on your account.
You choose: between 1 and 1,440, in minutes or hours. Ten minutes is a common choice for logins and payments.
Yes. Call the resend endpoint, POST /v1/otp/resend/:id, with the OTP's ID.
SMS codes reach MTN, Telecel, AirtelTigo and Glo numbers. WhatsApp and email work for any customer who has those accounts.