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
| Field | Type | Required | Description |
|---|---|---|---|
connId | number | ✅ | WAN connection ID |
iccid | string | optional | ICCID of the SIM card. If not specified, the active SIM will be chosen. |
ussd | string | ✅ | USSD 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
| Field | Type | Required | Description |
|---|---|---|---|
connId | number | ✅ | WAN connection ID |
iccid | string | ✅ | ICCID of the SIM card |
id | number, array, or string | ✅ | SMS 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
| Field | Type | Required | Description |
|---|---|---|---|
connId | number | ✅ | WAN connection ID |
Response
| Field | Type | Description |
|---|---|---|
connId | number | Connection ID |
simId | number | SIM ID (1 or 2) |
imsi | string | International Mobile Subscriber Identity (fw 8.2.0+) |
iccid | string | Integrated Circuit Card Identity (fw 8.2.0+) |
mtn | string | Mobile Telecommunications Network (fw 8.2.0+) |
sms | array | List of SMS objects |
SMS Object:
| Field | Type | Description |
|---|---|---|
sender | string | Sender of the SMS |
message | array | List of Message objects |
Message Object:
| Field | Type | Description |
|---|---|---|
id | integer | SMS message ID |
date | string | Date of the SMS |
timestamp | integer | Timestamp of the SMS |
length | integer | Length of the SMS content |
content | string | SMS 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
| Field | Type | Required | Description |
|---|---|---|---|
connId | number | optional | WAN connection ID |
address | string | ✅ | Target address. Must begin with + followed by 2--15 digits (first digit cannot be 0). |
content | string | optional | Content 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"
}