Developer Guide

Send SMS Verification

Send an SMS with verification code and a custom message for authentication purpose.

NOTE: You need to register for an API key before using this REST API. Please visit Micro Plan to sign up for an API key if you do not have one. In addition, you will also have to make sure you have enough SMS credits to send any verification SMS.

POST https://api.fraudlabspro.com/v1/verification/send

Request
Parameter Description
tel (required) The recipient mobile phone number in E164 format which is a plus followed by just numbers with no spaces or parentheses.

For example, +123456789

country_code (optional) ISO 3166 country code for the recipient mobile phone number. If parameter is supplied, then some basic telephone number validation is done.
key (required) FraudLabs Pro API key.
mesg (required) The message template for the SMS. Add <otp> as placeholder for the actual OTP to be generated. Max length is 140 characters.

For example,
Your OTP for the transaction is <otp>

format (optional) Returns the API response in json (default) or xml format.
Valid values: json | xml
The input parameter must be encoded the same way that the posted data from a WWW form is encoded. In other words, the percent-encoding.
Response
Parameter Description
tran_id Unique ID (20 characters) for this particular API call.
credits_remaining Number of remaining credits for sending SMS.
error Blank if there is no error otherwise it will contain one of the errors below:
  • FraudLabs Pro plan has expired.
  • Invalid phone number.
  • Message cannot be blank.
  • Message is too long.
  • API key not found.
  • Insufficient credits.
  • Invalid phone number.
  • Cannot send SMS to fixed line or VoIP lines.
  • Unknown error.
Sample Code
require_once 'lib/FraudLabsPro.php';

// Configures FraudLabs Pro API key
FraudLabsPro\Configuration::apiKey('YOUR_API_KEY');

// Send SMS Verification
FraudLabsPro\SMSVerification::sendsms([
	'tel'			=> '+15616288674',
	'mesg'			=> 'Hi, your OTP is <otp>.',
	'country_code'		=> 'US',
]);
import com.fraudlabspro.*;
import java.util.Hashtable;

public class FLP {

    public static void main(String[] args) {
        // Configures FraudLabs Pro API key
        FraudLabsPro.APIKEY = "YOUR_API_KEY";
        
        // Send SMS Verification API
        SMSVerification sms = new SMSVerification();

        // Sets SMS details for authentication purpose
        Hashtable data = new Hashtable<>();
        data.put("tel", "+15616288674");
        data.put("country_code", "US");
        data.put("mesg", "Hi, your OTP is .");

        String result = sms.sendSMS(data);
    }
}
Imports FraudLabsPro.FraudLabsPro
Public Class WebForm4
    Inherits System.Web.UI.Page
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        'Configure FraudLabs Pro API KEY
        FraudLabsProConfig.APIKey = "YOUR_API_KEY"

        'Send SMS Verification API
        Dim Send_SMS_Verification As New SMSVerification

        'Sets SMS details for authentication purpose
        Dim SMS_Details As New SMSVerificationPara
        SMS_Details.Tel = "+15616288674"
        SMS_Details.CountryCode = "US"
        SMS_Details.Message = "Hi, your OTP is <otp>."

        Dim result = Send_SMS_Verification.SendSMS(SMS_Details)
        Response.Write("TransactionID: " + result.TransactionID + "</br>")
        Response.Write("CreditsRemaining: " + result.CreditsRemaining + "</br>")
        Response.Write("Error: " + result.Error + "</br>")
    End Sub
End Class
using FraudLabsPro.FraudLabsPro;

public class WebForm4 : System.Web.UI.Page
{
    protected void Page_Load(object sender, System.EventArgs e)
    {
        // Configure FraudLabs Pro API KEY
        FraudLabsProConfig.APIKey = "YOUR_API_KEY";

        // Send SMS Verification API
        SMSVerification Send_SMS_Verification = new SMSVerification();

        // Sets SMS details for authentication purpose
        SMSVerificationPara SMS_Details = new SMSVerificationPara();
        SMS_Details.Tel = "+15616288674";
        SMS_Details.CountryCode = "US";
        SMS_Details.Message = "Hi, your OTP is <otp>.";

        var result = Send_SMS_Verification.SendSMS(SMS_Details);
        Response.Write("TransactionID: " + result.TransactionID + "</br>");
        Response.Write("CreditsRemaining: " + result.CreditsRemaining + "</br>");
        Response.Write("Error: " + result.Error + "</br>");
    }
}
 # Import SDK to use the function
from libs.smsverification import SMSVerification

 # Configure your API key
api_key = 'YOUR_API_KEY'

sms_verification_variables = {
	'key': api_key,
	'tel': '+15616288674',
	'country_code': 'US',
	'mesg': 'Your OTP for the transaction is <otp>.',
}
print(SMSVerification.send_sms(sms_verification_variables))
$ curl https://api.fraudlabspro.com/v1/verification/send -X POST \
	-d "key=Enter_License_Key" \
	-d "format=json" \
	-d "country_code=Enter_Country_Code" \
	-d "tel=Enter_Mobile_Phone_Number" \
	-d "mesg=Hi, your OTP is <otp>"
require 'fraudlabspro_ruby'

FraudlabsproRuby::Configuration.api_key = 'YOUR_API_KEY'

result = FraudlabsproRuby::Api::SMSVerification.sendSMS(
  tel: '+15616288674',
  mesg: 'Hi, your OTP is <otp>.',
  country_code: 'US'
)