Verify OTP SMS in Java Bulk SMS API Documentation

Verify OTP SMS in Java

Verify One Time Password Token to the Recipient in Java.

Application API URL:


Import Verify OTP SMS API postman collection.

Postman Collection



Key Value Description
Login Credentials (Required Parameters)
Authenticate your API request using userId-password or apiKey. You should use either one to authenticate your login.
userId Your Registered Username The registered username parameter to be passed. You can use this if apiKey is not being used.
password Your password The password needs to be urlencoded if there are any special characters used in the password field. You can use this if apiKey is not being used.
apiKey Your unique apiKey apiKey needs to be sent as HTTP header when you are not using userId and password credentials. You can avail this from your user control panel and use instead of userId and password HTTP Request parameter. Please do not disclose this to anyone.
Required Parameters
mobile Mobile Number with Country Code Required. Enter your Customer's mobile number which needs to be verified.

Comments: Keep number in International format (with country code).
otp Sent OTP Code Required. Send the code to verify which was delivered to recipient.

Comments: Verify OTP Token of the recipient.
sendMethod verify

Required: This value required for verification of OTP code which was inputted by the recipient.

format plain|json|xml Value for response format.

System default is plain. If you need responses in JSON or XML then you have to give value as JSON or XML.

Save this Page on your Favorite Social Media

Sample Request Code


public class SMSGatewayCenter{

public static void main(String[] args)
//Your apikey key
String apiKey = "YourApiKey";
String userId = "YourUserName";
String password = "YourPassword";

//Send Method (generate|verify)
String sendMethod = "verify";

//Multiple mobiles numbers separated by comma
String mobile = "919999999999";

//Your message to terminate, URLEncode the content
String otp = "6789";

//response format
String format = "json";

//Prepare Url
URLConnection myURLConnection=null;
URL myURL=null;
BufferedReader reader=null;

//URL encode message
String urlencodedotp=URLEncoder.encode(otp);

//API End Point
String mainUrl="";

//API Paramters
StringBuilder sendSmsData= new StringBuilder(mainUrl);
//final string
mainUrl = sendSmsData.toString();
//prepare connection
myURL = new URL(mainUrl);
myURLConnection = myURL.openConnection();
reader= new BufferedReader(new InputStreamReader(myURLConnection.getInputStream()));
//reading response
String response;
while ((response = reader.readLine()) != null)
//print response

//finally close connection
catch (IOException e)

Response - Success

    "status": "success",
    "mobile": "91xxxxxxxxxx",
    "transactionId": "74c286ad-8a74-4dcd-a2dd-6c936a95037b",
    "statusCode": "900",
    "reason": "OTP has been Verified Successfully."
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <reason>OTP has been Verified Successfully.</reason>
status=success | mobile=91xxxxxxxxxx | reason=OTP has been Verified Successfully. |  transactionId=c30ec631-afcc-4810-ad01-372242df9c40 | errorCode=900

Response - Error

    "status": "error",
    "statusCode": "952",
    "reason": "OTP token is already verified."
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <reason>OTP token is already verified.</reason>
status=error | errorCode=952 | reason=OTP token is already verified.