Skip to content

Send OTP SMS

POST
/v2/otp-global/send

Sends an OTP SMS message using a JSON payload in the request body
Note: This method is for generate a OTP Codes, not is a OTP Route.

This method allows structured transmission of the SMS parameters and is recommended for server-to-server integrations.

JSON body containing the required parameters for sending an SMS.

object
msg
required

GSM-encoded message (max 160 characters).

Note: If the [code] tag is omitted, it will be added to the end of the message.

string
>= 3 characters <= 160 characters
Your otp code is [code], please don't share it with anyone.
phone
required

11-15 digits destination phone number

string
/^\d{11,15}$/
528100001234
sender

Sender ID authorized by carrier (optional)

string
AWESOMEINC
id

External reference ID (optional)

string
my-external-id

SMS sent successfully

object
status
boolean
true
error
boolean
description
object
added_on
string format: date-time
2023-09-20 16:47:15
charge
number format: float
0.99
country
object
country
string
MEXICO
iso_code
string
MX
type
string
MOVIL
encoding
string
Allowed values: gsm unicode
gsm
id
integer
199999
job_id
string
199999
length
integer
12
message
string
Your otp code is 0000, please don't share it with anyone.
number
string
528100001234
segments
integer
1
sender
string
AWESOMEINC
Example
{
"status": true,
"error": false,
"description": {
"added_on": "2023-09-20 16:47:15",
"charge": 0.99,
"country": {
"country": "MEXICO",
"iso_code": "MX",
"type": "MOVIL"
},
"encoding": "gsm",
"id": 199999,
"job_id": 199999,
"length": 12,
"message": "Your otp code is 0000, please don't share it with anyone.",
"number": "528100001234",
"segments": 1,
"sender": "AWESOMEINC"
}
}

Missing required parameters

object
status
boolean
error
boolean
true
message
string
Missing params, please verify or contact to support
Example
{
"status": false,
"error": true,
"description": "Missing params, please verify or contact to support"
}

Your key auth is not valid

object
status
boolean
error
boolean
true
message
string
Your key auth is not valid, please check with your administrator to get the new key
Example
{
"status": false,
"error": true,
"description": "Your key auth is not valid, please check with your administrator to get the new key"
}

Your account dont have credits availables for send

object
status
boolean
error
boolean
true
message
string
Your account dont have credits availables for send this, please contact your administrator
Example
{
"status": false,
"error": true,
"description": "Your account dont have credits availables for send this, please contact your administrator"
}

Country or carrier not reachable or assigned to your account

object
status
boolean
error
boolean
true
message
string
Country or carrier not reachable or assigned to your account, please contact an administrator or support
Example
{
"status": false,
"error": true,
"description": "Country or carrier not reachable or assigned to your account, please contact an administrator or support"
}

Failed to append to the queue, no need to resend

object
status
boolean
error
boolean
true
message
string
Failed to append to the queue, no need to resend
Example
{
"status": false,
"error": true,
"description": "Failed to append to the queue, no need to resend"
}

Your account don’t have enabled for send multi messages

object
status
boolean
error
boolean
true
message
string
Your account don't have enabled for send multi messages, please contact your administrator
Example
{
"status": false,
"error": true,
"description": "Your account don't have enabled for send multi messages, please contact your administrator"
}

Useful for guiding users to view code examples in different developer languages.

developer@developer:~#
curl -X POST "https://api.example.com/v2/otp-global/send" \
-H "Accept: application/json" \
-H "Connection: keep-alive" \
-H "Content-Type: application/json" \
-H "Authorization: Basic <base64-encoded-credentials>" \
-d '{"msg":"Your otp code is [code], please don't share it with anyone.","phone":"528100001234","sender":"AWESOMEINC","id":"my-external-id"}'