Comnexa OTP API reference
Call these URLs from your website or app backend. Create an API key first. OTP SMS does not need your own DLT header or template. A send needs enough INR wallet balance. Failed sends are refunded. The code is never returned by send.
1. Create a key on API Keys. Copy the full key the one time it is shown. The prefix alone will not work.
2. Keep wallet credit. Signup credit can pay OTP SMS. When the wallet cannot cover the price, the message is not sent.
3. Send from your server to https://comnexaapi.com/api/v1/otp/send. Use JSON or a form body. CORS is open for browser apps. Prefer a backend so the key is not in the page.
4. Check the code with POST /api/v1/otp/check using the same key, the mobile, and the digits the person typed. Codes last 10 minutes and work once.
OTP SMS: omit template_id. Promotional and transactional SMS still need a template id when that route asks for one.
Send OTP
Sends the OTP to an Indian mobile and charges the account wallet. Omit otp to let Comnexa generate a 6-digit code. The code is not returned. OTP SMS does not need your own DLT header or template_id.
Auth
Header Authorization: Bearer YOUR_KEY, or header x-api-key, or field authkey in the body or query.
Parameters
10-digit Indian mobile. +91 and 91 are accepted. phone is also accepted.
4 to 8 digits. Your app can generate this. Omit it to let Comnexa generate a 6-digit code.
sms, whatsapp, or voice. Default sms.
Leave empty for OTP SMS. Include an approved template id only when a promotional or transactional route asks for one.
Errors
Mobile or OTP is not valid, or the code does not match.
The API key is missing, wrong, or disabled. Use the full key shown once on API Keys.
The wallet cannot pay for this send. Recharge, then retry.
OTP SMS is turned off.
The message was not delivered. The wallet charge was refunded.
curl -X POST https://comnexaapi.com/api/v1/otp/send \
-H "Authorization: Bearer $COMNEXA_API_KEY" \
-H "Content-Type: application/json" \
-d '{"mobile":"9876543210","otp":"482913","channel":"sms"}'{
"id": "otp_ab12cd34ef56",
"mobile": "9876543210",
"status": "sent",
"amount_paise": 37
}{
"error": "Enter a 10-digit Indian mobile."
}