SMS Messaging API

Send text messages to one or multiple recipients. Please read API General Reference before reading this document.

Effortlessly send verification codes, transactional, and promotional messages to one or multiple recipients in any country worldwide. The interface offers a concise, flexible, yet comprehensive parameter input method to meet various SMS usage scenarios.

If you plan to send SMS verification codes to users via Unimatrix, we recommend using our more integrated Send OTP API, which will improve your development efficiency and user experience.

Definitions

  • Action: sms.message.send
  • HTTP Method: POST
  • Content-Type: application/json

Request Parameters

NameTypeRequiredDescriptionExample
tostring | string[]YesRecipient's phone number. Using E.164 format.+12068800123
signaturestringNoSMS sender name. Must between 2-16 characters.Unimatrix
textstringNoFull text of the SMS.
* Either templateId, text or content is required
701522 is your verification code, valid for 10 minutes.
contentstringNoMain content of the SMS, will be combined with signature as the full text of the SMS.
* Either templateId, text or content is required
701522 is your verification code, valid for 10 minutes.
templateIdstringNoSMS template ID or custom template code.
* Either templateId, text or content is required
pub_verif_en_ttl
templateDataJSONNoTemplate variables, used with templateId.{"code": "701522", "ttl": "10"}

Request Example

curl -X POST 'https://api.unimtx.com/?action=sms.message.send&accessKeyId=YOUR_ACCESS_KEY_ID' \
-H 'Content-Type: application/json' \
-d '{
  "to": "+12068800xxx",
  "text": "Your verification code is 204806."
}'

Response Parameters

NameTypeDescriptionExample
codestringReturn code0
messagestringReturn messageSuccess
dataJSONResults

Results data

NameTypeDescriptionExample
recipientsintegerNumber of recipients1
messageCountintegerTotal number of billing messages1
currencystringCurrencyUSD
totalAmountstringTotal consumption amount0.045000
messagesJSON[]Sent messages details

Messages data.messages

NameTypeDescriptionExample
idstringMessage IDc9159d19f394833327e43c8e7285a6b3
tostringRecipient's phone number (E.164)+12068800123
isostringCountry code (iso2)US
ccstringCountry code (International call prefix)1
partsintegerNumber of message parts1
pricestringConsumption amount0.008500

Response Examples

Successful response example

Status Code: 200, Response Body:

{
  "code": "0",
  "message": "Success",
  "data": {
    "recipients": 1,
    "messageCount": 1,
    "totalAmount": "0.008500",
    "messages": [
      {
        "id": "c9159d19f394833327e43c8e7285a6b3",
        "to": "+12068800123",
        "iso": "US",
        "cc": "1",
        "parts": 1,
        "price": "0.008500"
      }
    ]
  }
}

Failure response example

Status Code: 400, Response Body:

{
  "code": "105400",
  "message": "InsufficientFunds"
}