Skip to main content

Commands -- SMS & USSD

POST /api/cmd.sim.ussd.send

Send a USSD code to the target address, if there is a SIM card that supports it.

Available in 8.5.2 or later

Input Parameters

FieldTypeRequiredDescription
connIdnumberWAN connection ID
iccidstringoptionalICCID of the SIM card. If not specified, the active SIM will be chosen.
ussdstringUSSD code (characters: 0-9, *, #)

cURL Example

curl -b cookies.txt -H "Content-Type: application/json" \
-X POST -d '{"connId":2,"ussd":"*109#"}' \
http://192.168.1.1/api/cmd.sim.ussd.send
{
"stat": "ok",
"response": {
"message": "Request is sent successfully"
}
}

POST /api/cmd.sms.delete

Delete one or more SMS messages from a supported SIM card.

Available in 8.5.2 or later

Input Parameters

FieldTypeRequiredDescription
connIdnumberWAN connection ID
iccidstringICCID of the SIM card
idnumber, array, or stringSMS message ID(s) to delete. Options: a single integer, an array of integers, or the string "all" to delete all messages.

cURL Example

curl -b cookies.txt -H "Content-Type: application/json" \
-X POST -d '{"connId":2,"iccid":"85235984335","id":"all"}' \
http://192.168.1.1/api/cmd.sms.delete
{
"stat": "ok"
}

GET /api/cmd.sms.get

Fetch the active SIM SMS messages by connection ID.

Available in 8.1.0 or later

Input Parameters

FieldTypeRequiredDescription
connIdnumberWAN connection ID

Response

FieldTypeDescription
connIdnumberConnection ID
simIdnumberSIM ID (1 or 2)
imsistringInternational Mobile Subscriber Identity (fw 8.2.0+)
iccidstringIntegrated Circuit Card Identity (fw 8.2.0+)
mtnstringMobile Telecommunications Network (fw 8.2.0+)
smsarrayList of SMS objects

SMS Object:

FieldTypeDescription
senderstringSender of the SMS
messagearrayList of Message objects

Message Object:

FieldTypeDescription
idintegerSMS message ID
datestringDate of the SMS
timestampintegerTimestamp of the SMS
lengthintegerLength of the SMS content
contentstringSMS content

cURL Example

curl -b cookies.txt \
"http://192.168.1.1/api/cmd.sms.get?connId=6"
{
"stat": "ok",
"response": {
"connId": 6,
"simId": 1,
"sms": [
{
"sender": "988",
"message": [
{
"id": 1,
"date": "Feb 17 13:55",
"timestamp": 1581774925,
"length": "50",
"message": "The is the 1st line SMS,\nand this is the 2nd line."
}
]
},
{
"sender": "+81325359875",
"message": [
{
"id": 2,
"date": "Feb 05 01:55",
"timestamp": 1580867113,
"length": "24",
"message": "Multipart message part 1"
},
{
"id": 6,
"date": "Feb 05 01:55",
"timestamp": 1580867113,
"length": "24",
"message": "Multipart message part 2"
}
]
}
]
}
}

POST /api/cmd.sms.sendMessage

Send an SMS message to the target address, if there is a SIM card that supports it.

Available in 8.0.0 or later

Input Parameters

FieldTypeRequiredDescription
connIdnumberoptionalWAN connection ID
addressstringTarget address. Must begin with + followed by 2--15 digits (first digit cannot be 0).
contentstringoptionalContent of the SMS message

cURL Example

curl -b cookies.txt -H "Content-Type: application/json" \
-X POST -d '{"address":"+85235984335","content":"SMS Content"}' \
http://192.168.1.1/api/cmd.sms.sendMessage
{
"stat": "ok"
}