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
Name | Type | Required | Description | Example |
---|---|---|---|---|
to | string | string[] | Yes | Recipient's phone number. Using E.164 format. | +12068800123 |
signature | string | No | SMS sender name. Must between 2-16 characters. | Unimatrix |
text | string | No | Full text of the SMS. * Either templateId , text or content is required | 701522 is your verification code, valid for 10 minutes. |
content | string | No | Main 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. |
templateId | string | No | SMS template ID or custom template code. * Either templateId , text or content is required | pub_verif_en_ttl |
templateData | JSON | No | Template 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
Name | Type | Description | Example |
---|---|---|---|
code | string | Return code | 0 |
message | string | Return message | Success |
data | JSON | Results |
Results data
Name | Type | Description | Example |
---|---|---|---|
recipients | integer | Number of recipients | 1 |
messageCount | integer | Total number of billing messages | 1 |
currency | string | Currency | USD |
totalAmount | string | Total consumption amount | 0.018900 |
messages | JSON[] | Sent messages details |
Messages data.messages
Name | Type | Description | Example |
---|---|---|---|
id | string | Message ID | c9159d19f394833327e43c8e7285a6b3 |
to | string | Recipient's phone number (E.164) | +12068800123 |
iso | string | Country code (iso2) | US |
cc | string | Country code (International call prefix) | 1 |
parts | integer | Number of message parts | 1 |
price | string | Consumption amount | 0.018900 |
Response Examples
Successful response example
Status Code: 200
, Response Body:
{
"code": "0",
"message": "Success",
"data": {
"recipients": 1,
"messageCount": 1,
"totalAmount": "0.018900",
"messages": [
{
"id": "c9159d19f394833327e43c8e7285a6b3",
"to": "+12068800123",
"iso": "US",
"cc": "1",
"parts": 1,
"price": "0.018900"
}
]
}
}
Failure response example
Status Code: 400
, Response Body:
{
"code": "105400",
"message": "InsufficientFunds"
}