OTP SMS for secure sign-up, login and payments
Send one-time passwords to your users' phones the moment they need them — through the SageSMS transactional API, any hour of the day.
How OTP SMS verification works
A one-time password (OTP) is a short code — usually 4 to 6 digits — that proves a user has the phone number they claim. Your application generates the code, stores it with an expiry time, and sends it to the user by SMS. The user types it back in, and your system checks it matches before allowing the sign-up, login, password reset or payment.
SageSMS delivers the SMS part of that flow. Your backend calls the transactional API with the user's number and a message such as “Your verification code is 482913. It expires in 5 minutes.” Because OTPs go through the transactional route, they are not restricted to promotional hours and can be sent 24/7.
Banks and financial institutions in Sri Lanka already rely on SageSMS for OTP verification and transaction alerts, where speed and reliability matter most.
Why use SageSMS for OTP
- Transactional route — available 24/7
- Your brand name as the Sender ID
- Simple HTTP API, JSON responses
- Every OTP logged in your message history
- Prepaid credits that never expire
- From LKR 0.60 per SMS, no monthly fee, credits never expire
OTP delivery you can build on
SageSMS handles delivery; your application stays in control of generating and checking codes.
Sign-up & login verification
Confirm new accounts and add a second factor to logins by sending a code to the user's mobile number.
Payment & transaction approval
Ask users to confirm high-value actions — payments, withdrawals, profile changes — with a one-time code.
Branded sender
Codes arrive from your approved Transactional Sender ID, which helps users recognise genuine messages and avoid phishing.
One API call per OTP
Send each code with a single POST request to the transactional endpoint — no SDK or special library required.
Audit trail
Every OTP SMS appears in your delivery reports and history, helping your support team resolve “I didn't get the code” queries.
Balance monitoring
Use the balance endpoint to alert your team before credits run low, so verification never stops working.
Adding OTP SMS to your app
- 01
Generate a code
Create a random numeric code on your server and store it with a short expiry (for example 5 minutes).
- 02
Send it via SageSMS
POST the user's number and message to the transactional SMS API.
- 03
User enters the code
Show an input in your app or website for the code they received.
- 04
Verify and expire
Check the code matches and hasn't expired, then delete it so it can't be reused.
OTP security checklist
SageSMS sends the message; these practices on your side keep OTP verification secure.
| Practice | Why it matters |
|---|---|
| Use 6 random digits | Harder to guess than 4 digits, still easy to type. |
| Expire codes in 5–10 minutes | Limits the window for a stolen or forwarded code. |
| Limit attempts and resends | Stops brute-force guessing and SMS cost abuse. |
| Never put the code in a URL | URLs get logged and shared; keep codes in the message body only. |
| Say who it is from | “Your YourBrand code is…” helps users spot fake messages. |
OTP SMS questions
Can OTP SMS be sent at night?
Yes. OTPs are transactional messages, so they can be sent at any time. Only promotional SMS is limited to daytime hours (8:00 AM–8:00 PM Sri Lanka time).
Does SageSMS generate the OTP code for me?
No — your application generates and verifies the code, and SageSMS delivers it by SMS. This keeps your verification logic and secrets in your own system.
What Sender ID do I need for OTP SMS?
You need an approved Transactional Sender ID — usually your brand or app name, up to 11 characters. The transactional API only accepts Transactional Sender IDs.
How much does an OTP SMS cost?
LKR 0.60 to 0.90 per SMS page depending on your plan. OTPs are transactional, so no promotional levy applies, and a typical OTP message fits in a single page.
Explore more SageSMS services
Add OTP verification to your product
Get your API key and Transactional Sender ID, and start sending one-time passwords to your users.