Quick start
Send and verify your first OTP in five minutes.
SMS21 is the messaging layer for your applications: one API for one-time passwords, transactional SMS and WhatsApp. SMS21 routes each message to the best provider, fails over when one is down, enforces DLT rules, reports delivery and bills from a prepaid wallet — your applications never integrate an SMS or WhatsApp vendor directly.
1. Get a test key
- Create an account, then a company and a project in the dashboard.
- Under Developers → API keys, create a test key with the
otp:sendandotp:verifyscopes. It is shown once: store it in your secret manager or environment.
Test keys are safe to experiment with
Keys starting with
sms21_test_ use the sandbox: nothing is delivered or charged, and every OTP code is 123456. Only sms21_live_ keys send real messages.2. Send an OTP
Call SMS21 from your server. The response never contains the code.
curl -X POST https://sms21.in/v1/otp/send \
-H "X-API-Key: $SMS21_API_KEY" \
-H "Content-Type: application/json" \
-d '{"mobile":"919876543210","purpose":"login"}'{
"success": true,
"requestId": "otp_01k55q8y4m3d9v7x2c6b0n1r8t",
"status": "pending",
"channel": "sms",
"purpose": "login",
"expiresIn": 300,
"expiresAt": "2026-09-15T10:35:00.000Z",
"resendAfter": 30,
"messageId": "msg_01k55q8y4m3d9v7x2c6b0n1r8t"
}3. Verify the code
curl -X POST https://sms21.in/v1/otp/verify \
-H "X-API-Key: $SMS21_API_KEY" \
-H "Content-Type: application/json" \
-d '{"requestId":"otp_…","otp":"123456","mobile":"919876543210"}'4. Go live
- India: register your DLT entity, sender IDs and templates under DLT in the dashboard. Live SMS to India requires an approved template — see SMS & DLT.
- Fund the wallet, then create a live key with only the scopes the application needs.
- Restrict the key to your servers’ IP addresses.
- Add a webhook for delivery status instead of polling.
API reference
Every endpoint, field and error is described in the interactive API reference, generated from the OpenAPI 3.1 document — import it into Postman or a code generator.