Here is related HTTP API available to use on all Milesight router, user can follow below steps to invoke them to control and manage devices directly.


  • Milesight Router/CPE
  • Linux system


Step 1. Install Curl software to Linux System

sudo apt install curl

Check install result:

curl -V

If curl software has been installed normally, you can get software version later.

If curl software has been installed normally, you can get software version later.

Step 2. Access to Milesight Router web GUI, go to Network > Firewall > Security, enable SSH access service, and Save it.

Step 3. Access to router web GUI to get “cgi” message to get API token key.

1) Open a Google browser, access to router IP address.

2) Click Main Menu> More Tools >Developer Tools to open developer Tool.

3) Fill in account and password to login router. Then we will get a “cgi” message on right textbox. Click View Source.

4) Copy the current cgi content.

Step 4. Paste step 3 “cgi” content to below command. Remember to change IP”” to your device IP address.

curl -H "Content-Type:application/x-www-form-urlencoded" -c ./cookie.txt -X POST --data '{"id":"1","execute":1,"core":"user","function":"login","values":[{"username":"admin","password":"sI/7ewBCeWunDs6JXXtSHg=="}]}'

Then we will get below response, which means that it gets and saves token key normally.

Step 5. After getting token key successfully, users can invoke other API of Router remotely.

Here related common API commands listed below fore reference, and user can get other API commands by repeat Step 3.


Remember to replace blue content in below command.

1) Make router send SMS to phone number ”17799999999”, SMS content is “123456”.   

curl -H "Content-Type:application/x-www-form-urlencoded" –b ./cookie.txt -X POST --data '{"id":27,"execute":1,"core":"yruo_sms","function":"send","values":[{"base":"yruo_sms","index":1,"value":{"destination":"17799999999","content":"123456"}}]}:'

2) Query router SMS send history.

curl -H "Content-Type:application/x-www-form-urlencoded" -b ./cookie.txt -X POST --data '{"id":7,"execute":1,"core":"yruo_sms","function":"query_outbox","values":[{"base":"query_outbox","limit":10,"start":0,"language":"en","key":"time","order":0,"start_date":"","end_date":"","from":"17799999999"}]}'

3) Query router received SMS history.

curl -H "Content-Type:application/x-www-form-urlencoded" -X POST -b ./cookie.txt --data '{"id":6,"execute":1,"core":"yruo_sms","function":"query_inbox","values":[{"base":"query_inbox","limit":10,"start":0,"language":"en","key":"time","order":0,"start_date":"","end_date":"","from":""}]}'

4) Query router cellular traffic consumption.

curl -H "Content-Type:application/x-www-form-urlencoded" -b ./cookie.txt -X POST --data '{"id":97,"execute":1,"core":"yruo_status","function":"get","values":[{"base":"yruo_celluar"}]}:'

5) Change log severity level to “Debug” level.

curl -H "Content-Type:application/x-www-form-urlencoded" -b ./cookie.txt -X POST --data '{"id":14,"execute":1,"core":"yruo_log","function":"set","values":[{"base":"log_settings","index":1,"value":{"loglevel":8}}]}'

6) Reboot the router.

curl -H "Content-Type:application/x-www-form-urlencoded" -b ./cookie.txt -X POST --data '{"id":6,"execute":1,"core":"yruo_upgrade","function":"reboot","values":[{}]}'

Note: When using related SMS API, please confirm that the SIM card can send and receive message.