Generate OTP SMS API
Generate OTP SMS API for SMSGatewayCenter APIs
Introduction to SMSGatewayCenter APIs
Welcome to SMSGatewayCenter’s API documentation hub! This guide helps you generate OTPs using our powerful Generate OTP API, part of our messaging suite including SMS API for bulk messaging, WhatsApp Business API for customer engagement, Voice Call API for automated alerts, and Two-Way SMS API for interactive communication. Our API supports POST and GET methods over HTTP, offering secure OTP generation for authentication. Ideal for developers in India, start integrating with our SMS gateway at unify.smsgateway.center/signup/!
Generate OTPs programmatically to enhance security for logins or transactions. This endpoint supports your bulk SMS campaigns with real-time delivery reports and Unicode, perfect for 2-factor authentication. Learn more about Integrated OTP SMS.
API Endpoint
https://unify.smsgateway.center/SMSApi/otp
Key | Value | Description |
---|---|---|
Login Credentials (Required) | ||
Authenticate your API request using userid-password or apiKey—choose one method. | ||
userid | Your Registered Username | Your registered username; use if apiKey isn’t provided. Signup for User ID |
password | Your Password | URL-encoded password (for special characters); use if apiKey isn’t provided. Signup for API Key |
Header (optional) Parameters | ||
apiKey | Your unique apiKey | apiKey needs to be sent as HTTP header when you are not using userid-password method. You can avail this from your user control panel and use instead of userid-password HTTP Request parameter. Please do not disclose this to anyone. |
Required Parameters | ||
mobile | Mobile value in integer | Enter the recipient mobile number |
sendMethod | generate | Enter as "generate". |
msgType | text|unicode | Message type |
msg | Your OTP message content | Example: Dear%20Milind,%20Your%20test%20SMS%20Account%20OTP%20Code%20is%20$otp$.%20Your%20OTP%20Code%20is%20valid%20for%205%20minutes%20only.%20SMSGatewayCenter |
medium | sms | Default is sms. |
codeType | num|aplha|alphanum | Define the OTP type. num will be numeric, alpha will be alphabetical and alphunum is mix of numeric and alphabets. |
codeExpiry | Expiry time in seconds | Default is 300. Set expiry time in seconds. |
codeLength | integer | Your OTP code length, such as 4 or 6. |
senderid | Approved Sender ID | Your approved sender id here |
output | plain|json|plain | Value for response format.System default is plain. If you need responses in json or plain then you have to give value as json or plain. |
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://unify.smsgateway.center/SMSApi/otp?userid=YourUsername&password=YourPassword&format=json&mobile=91777xxxxxxx&sendMethod=generate&msgType=text&msg=Dear%20Neha%2C%20Your%20test%20SMS%20Account%20OTP%20Code%20is%20%24otp%24.%20Your%20OTP%20Code%20is%20valid%20for%205%20minutes%20only.%20Your%20Brand&medium=sms&codeType=num&codeExpiry=300&codeLength=6&senderid=SENDER',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
{
"status": "success",
"mobile": "91777xxxxxxx",
"transactionId": "0",
"statusCode": "300",
"type": "new",
"reason": "OTP successfully generated.",
"createTime": "1700117933163",
"expiryTime": "1700118233163",
"retryAfter": "1700117993163"
}

Unlock Real-Time Messaging – Integrate Today!
Try Our API in a Sandbox Environment Before Going Live!
Join Thousands of Developers – Try Our API Now!
Get in touchSign upTestimonials
Why do Great Businesses Trust SMS Gateway Center?