### Developer Guide

### Send SMS Verification

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

Before sending SMS verification, kindly check whether you have enough SMS credits or not. A 24 hours cooldown required if the SMS failed to deliver 10 times in a day. An API key is needed before using this REST API, thus sign up for an API key if you do not have one.

SIGN UP NOW

### Request

POST

https://api.fraudlabspro.com/v2/verification/send

| Parameter | Type | Description |
| --- | --- | --- |
| tel | string | (required) The recipient mobile phone number in E164 format which is a plus followed by just numbers with no spaces or parentheses. For example, \+12015550123 |
| country\_code | string | (optional) ISO 3166 country code for the recipient mobile phone number. If parameter is supplied, then some basic telephone number validation is done. |
| key | string | (required) FraudLabs Pro API key. |
| mesg | string | (required) The message template for the SMS. Add &lt;otp&gt; as placeholder for the actual OTP to be generated. Max length is 140 characters. For example, Your OTP for the transaction is &lt;otp&gt; |
| otp\_timeout | integer | (optional) Timeout feature for OTP value in seconds. Default is 3600 seconds(1 hour). Min timeout is 15 seconds whereas max timeout is 86400 seconds(24 hours). |
| format | string | (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 | Type | Description |
| --- | --- | --- |
| tran\_id | string | Unique ID (20 characters) for this particular API call. |
| credits\_remaining | string | Number of remaining credits for sending SMS. |

### Sandbox

| Test Mobile Phone Number | Result |
| --- | --- |
| \+11 | You can enter this bogus phone number to simulate a success SMS sending (No credit will be deducted). For the OTP value, you can enter 123456 to successfully complete the SMS verification. |
| \+11234 | Error message of Invalid phone number will be returned. |

### Sample Codes

### 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'

=&gt;

'\+123456789'

,

'mesg'

=&gt;

'Hi, your OTP is &lt;otp&gt;.'

,

'country\_code'

=&gt;

'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

&lt;

&gt;

(

)

;

data

.

put

(

"tel"

,

"\+123456789"

)

;

data

.

put

(

"country\_code"

,

"US"

)

;

data

.

put

(

"mesg"

,

"Hi, your OTP is &lt;otp&gt;."

)

;

String

result

=

sms

.

sendSMS

(

data

)

;

\}

\}

Imports

FraudLabsPro

.

FraudLabsPro

Imports

Newtonsoft

.

Json

Module

Program

Sub

Main

(

)

'Configure FraudLabs Pro API KEY

FraudLabsProConfig

.

APIKey

=

"YOUR\_API\_KEY"

'Send SMS Verification API

Dim

SendSMS

As

New

SMSVerification

'Sets SMS details for authentication purpose

Dim

SMSPara

As

New

SMSVerificationPara

With

\{

.

Tel

=

"\+123456789"

,

.

CountryCode

=

"US"

,

.

Message

=

"Hi, your OTP is &lt;otp&gt;."

\}

Dim

result

=

SendSMS

.

SendSMS

(

SMSPara

)

Console

.

WriteLine

(

"tran\_id: "

&amp;

result

(

"tran\_id"

)

.

ToString

)

Console

.

WriteLine

(

"credits\_remaining: "

&amp;

result

(

"credits\_remaining"

)

.

ToString

)

End

Sub

End

Module

using

FraudLabsPro

.

FraudLabsPro

;

using

System

.

Collections

;

using

Newtonsoft

.

Json

;

using

Newtonsoft

.

Json

.

Linq

;

// Configure FraudLabs Pro API KEY

FraudLabsProConfig

.

APIKey

=

"YOUR\_API\_KEY"

;

// Send SMS Verification API

SMSVerification

SendSMS

=

new

(

)

;

// Sets SMS details for authentication purpose

SMSVerificationPara

SMSPara

=

new

(

)

\{

Tel

=

"\+123456789"

,

CountryCode

=

"US"

,

Message

=

"Hi, your OTP is &lt;otp&gt;."

,

OtpTimeout

=

3600

\}

;

JObject

result

=

SendSMS

.

SendSMS

(

SMSPara

)

;

Console

.

WriteLine

(

"tran\_id: "

\+

result

\[

"tran\_id"

\]

)

;

Console

.

WriteLine

(

"credits\_remaining: "

\+

result

\[

"credits\_remaining"

\]

)

;

\# 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'

:

'\+123456789'

,

'country\_code'

:

'US'

,

'mesg'

:

'Your OTP for the transaction is &lt;otp&gt;.'

,

\}

print

(

SMSVerification

.

send\_sms

(

sms\_verification\_variables

)

)

curl

https://api.fraudlabspro.com/v2/verification/send

\\

--header

'Content-Type: application/json'

\\

--data

'\{ "key": "Enter\_License\_Key", "format": "json", "country\_code": "Enter\_Country\_Code", "tel": "Enter\_Mobile\_Phone\_Number", "mesg": "Hi, your OTP is &lt;otp&gt;" \}'

require

'fraudlabspro\_ruby'

FraudlabsproRuby

::

Configuration

.

api\_key

=

'YOUR\_API\_KEY'

result

=

FraudlabsproRuby

::

Api

::

SMSVerification

.

sendSMS

(

tel

:

'\+123456789'

,

mesg

:

'Hi, your OTP is &lt;otp&gt;.'

,

country\_code

:

'US'

)

const

\{

SMSVerification

\}

=

require

(

"fraudlabspro-nodejs"

)

;

var

sms

=

new

SMSVerification

(

'YOUR API KEY'

)

;

params

=

\{

tel

:

'\+123456789'

,

mesg

:

'Hi, your OTP is &lt;otp&gt;.'

,

otp\_timeout

:

3600

,

country\_code

:

'US'

,

\}

;

sms

.

sendSMS

(

params

,

(

err

,

data

)

=&gt;

\{

if

(

\!

err

)

\{

console

.

log

(

data

)

;

\}

\}

)

;

use

fraudlabspro

::

sms

::

SMSVerification

;

fn

main

(

)

-&gt;

Result

&lt;

(

)

,

Box

&lt;

dyn

std

::

error

::

Error

&gt;&gt;

\{

let

sms

=

SMSVerification

::

new

(

"YOUR\_API\_KEY"

)

;

let

sent

=

sms

.

send\_sms

(

Some

(

"\+60175063088"

.

into

(

)

)

,

Some

(

"1"

.

into

(

)

)

,

Some

(

"Your OTP for the transaction is &lt;otp&gt;."

.

into

(

)

)

,

None

)

?

;

println\!

(

"\{\}"

,

sent

)

;

Ok

(

(

)

)

\}

package

main

import

(

"github.com/fraudlabspro/fraudlabspro-go/fraudlabspro"

"fmt"

)

func

main

(

)

\{

apikey

:=

"YOUR\_API\_KEY"

config

,

err

:=

fraudlabspro

.

OpenConfiguration

(

apikey

)

if

err

\!=

nil

\{

fmt

.

Print

(

err

)

return

\}

sms

,

err

:=

fraudlabspro

.

OpenSmsVerification

(

config

)

if

err

\!=

nil

\{

fmt

.

Print

(

err

)

return

\}

params

:=

make

(

map

\[

string

\]

string

)

params

\[

"tel"

\]

=

"\+11111111111111"

// replace with the actual recipient mobile phone number

params

\[

"country\_code"

\]

=

"XX"

// replace with the actual recipient country

params

\[

"mesg"

\]

=

"Hello, your OTP is &lt;otp&gt;."

// custom message

res

,

err

:=

sms

.

SendSms

(

params

)

if

err

\!=

nil

\{

fmt

.

Print

(

err

)

return

\}

fmt

.

Printf

(

"%\+v\\n"

,

res

)

\}

object

TestSendSMS

\{

@JvmStatic

fun

main

(

args

:

Array

&lt;

String

&gt;

)

\{

// Configures FraudLabs Pro API key

FraudLabsPro

.

APIKEY

=

"YOUR\_API\_KEY"

// Send SMS Verification API

val

sms

=

SMSVerification

(

)

// Sets SMS details for authentication purpose

val

data

=

java

.

util

.

Hashtable

&lt;

String

?

,

String

?

&gt;

(

)

data

\[

"tel"

\]

=

"\+123456789"

data

\[

"country\_code"

\]

=

"US"

data

\[

"mesg"

\]

=

"Hi, your OTP is &lt;otp&gt;."

data

\[

"otp\_timeout"

\]

=

"3600"

val

result

=

sms

.

sendSMS

(

data

)

print

(

result

)

\}

\}

import

com

.

fraudlabspro

.

\_

import

java

.

util

object

TestSendSMS

\{

def

main

(

args

:

Array

\[

String

\]

)

:

Unit

=

\{

// Configures FraudLabs Pro API key

FraudLabsPro

.

APIKEY

=

"YOUR\_API\_KEY"

// Send SMS Verification API

val

sms

=

new

SMSVerification

// Sets SMS details for authentication purpose

val

data

=

new

util

.

Hashtable

\[

String

,

String

\]

data

.

put

(

"tel"

,

"\+123456789"

)

data

.

put

(

"country\_code"

,

"US"

)

data

.

put

(

"mesg"

,

"Hi, your OTP is &lt;otp&gt;."

)

data

.

put

(

"otp\_timeout"

,

"3600"

)

val

result

=

sms

.

sendSMS

(

data

)

println

(

result

)

\}

\}

[SIGN UP NOW](https://www.fraudlabspro.com/checkout-micro)

[ISO 3166 country code](https://www.fraudlabspro.com/developer/reference/country-codes-sms)