OTP API Documentation
A simple REST API to send OTPs via SMS and check delivery status. One endpoint to send, one to check status. Works with any language or framework.
Authentication
All API requests require an API key in the X-API-Key header. Create API keys from your dashboard.
X-API-Key: sm_live_your_api_key_hereBase URL
https://api.startmessaging.comAPI Endpoints
POST
/otp/sendSend a one-time password to a phone number. Fields: phoneNumber (E.164 format), templateId (optional), and variables (Must contain "otp" — a 4-6 digit code you generate, plus optional custom placeholders like "appName").
GET
/messages/:idFetch the real-time delivery status of an OTP request. Statuses include initiated, queued, sent, delivered, and failed.
Send an OTP in One API Call
Works with every language. Just a single POST request.
curl -X POST https://api.startmessaging.com/otp/send \
-H "Content-Type: application/json" \
-H "X-API-Key: sm_live_your_api_key_here" \
-d '{
"phoneNumber": "+919876543210",
"templateId": "YOUR_TEMPLATE_ID",
"variables": {
"otp": "123456",
"appName": "YourApp"
}
}'Response Format
All responses follow a consistent JSON envelope:
{
"success": true,
"statusCode": 201,
"requestId": "req_abc123",
"timestamp": "2026-02-15T10:30:00.000Z",
"data": {
"otpRequestId": "uuid-of-otp-request",
"messageId": "uuid-of-message",
"status": "queued"
}
}API FAQ
Related Pages
Start Building with the OTP API
Get your API key and send your first OTP in under 5 minutes.