Peplink Router API Documentation
Firmware 8.5.2
Overview
The Peplink Router API is a set of HTTP endpoints. Each endpoint accepts HTTP GET or POST requests with JSON arguments and returns JSON responses.
The access port is the same as that configured for Web Admin access. For security reasons, the API should always be used under Secure HTTP (HTTPS) access.
API Resource URL
https://<device_ip_address>/api/<function_endpoint>
Example:
https://192.168.1.1/api/status.wan.connection
Authentication
There are two methods of authentication:
Admin User Account
As with Web Admin Access, admin user accounts can access the API with username and password. After a successful login, the session is authorized for subsequent API access.
The session ID is returned from the cookie named bauth under Secure HTTP access.
Client ID / Secret
API can be accessed with a Client ID and secret, generated in advance from an authenticated user, without disclosing username and password information.
Successful authorization with Client ID / secret grants an access token, which can be used for subsequent API access.
Permissions
| Permission | Description |
|---|---|
| Read-Only | Can only read status and config |
| Read-Write | Can read status and config, and change config |
| Admin | Can manage clients and tokens; includes Read-Write permission |
Admin Permission can only be granted by admin user account login.
HTTP Methods
| Method | Usage |
|---|---|
GET | Retrieves simple data |
POST | Manipulates configuration or executes actions, with JSON-encoded arguments |
GET Request Parameters
Parameters are passed in the query string (after the ? in the URL):
GET /api/status.wan.connection?id=1&lite=yes HTTP/1.1
Host: 192.168.1.1
POST Request Parameters
Parameters must be in JSON-encoded format:
POST /api/login HTTP/1.1
Host: 192.168.1.1
Content-Type: application/json
{
"username": "admin",
"password": "admin"
}
Response Format
All API responses are JSON-encoded. The JSON response object contains a stat field indicating success (ok) or failure (fail).
| Field | Type | Description |
|---|---|---|
stat | string | ok for success, fail for failure |
response | any | Additional information on success |
code | number | Error code (only on failure) |
message | string | Error message (only on failure) |
notice | object | Extra information (e.g. beta/deprecated status) |
Success Response
{
"stat": "ok",
"response": { }
}
Success Response (Beta API)
{
"stat": "ok",
"notice": {
"status": "beta"
},
"response": { }
}
Error Response
{
"stat": "fail",
"code": 1234,
"message": "Error description"
}
API Reference List
Authentication
| Method | Endpoint | Description |
|---|---|---|
POST | /api/login | Login |
POST | /api/logout | Logout |
GET | /api/auth.client | Get client list |
POST | /api/auth.client | Create/remove client |
GET | /api/auth.client.token | Get access token list |
POST | /api/auth.token.grant | Generate access token |
POST | /api/auth.token.revoke | Revoke access token |
Commands -- Cellular & Carrier
| Method | Endpoint | Description |
|---|---|---|
POST | /api/cmd.billing.newCycle | Start new billing cycle |
GET | /api/cmd.carrier.scan | Get carrier scan results |
POST | /api/cmd.carrier.scan | Trigger carrier scan |
POST | /api/cmd.carrier.select | Select cellular network |
POST | /api/cmd.channelPci.lock | Lock channel/PCI |
POST | /api/cmd.channelPci.scan | Scan channel/PCI |
POST | /api/cmd.cellularModule.rescanNetwork | Rescan cellular network |
POST | /api/cmd.cellularModule.reset | Reset cellular module |
POST | /api/cmd.wan.cellular | Change SIM priority |
Commands -- Wi-Fi
| Method | Endpoint | Description |
|---|---|---|
POST | /api/cmd.wifi.connect | Connect to Wi-Fi |
POST | /api/cmd.wifi.disconnect | Disconnect Wi-Fi |
POST | /api/cmd.wifi.forget | Forget SSID profile |
GET | /api/cmd.wifi.result | Get Wi-Fi connection result |
GET | /api/cmd.wifi.scan | Scan nearby Wi-Fi APs |
Commands -- SMS & USSD
| Method | Endpoint | Description |
|---|---|---|
POST | /api/cmd.sim.ussd.send | Send USSD code |
POST | /api/cmd.sms.delete | Delete SMS messages |
GET | /api/cmd.sms.get | Get SMS messages |
POST | /api/cmd.sms.sendMessage | Send SMS message |
Commands -- System & Misc
| Method | Endpoint | Description |
|---|---|---|
POST | /api/cmd.config.apply | Apply pending config |
POST | /api/cmd.config.discard | Discard pending config |
GET | /api/cmd.ap | Get AP status |
POST | /api/cmd.ap | Enable/disable AP |
POST | /api/cmd.port.poe.disable | Disable PoE |
POST | /api/cmd.port.poe.enable | Enable PoE |
POST | /api/cmd.starlink | Starlink dish control |
POST | /api/cmd.system.reboot | Reboot device |
Commands -- Mesh
| Method | Endpoint | Description |
|---|---|---|
POST | /api/cmd.mesh.discover | Trigger mesh discovery |
GET | /api/cmd.mesh.discover.result | Get discovery results |
POST | /api/cmd.mesh.request | Send mesh request |
Configuration
| Method | Endpoint | Description |
|---|---|---|
POST | /api/config.gpio | Configure GPIO |
GET | /api/config.mesh | Get mesh config |
POST | /api/config.mesh | Add/update/remove mesh profile |
GET | /api/config.speedfusionConnectProtect | Get SFC Protect config |
POST | /api/config.speedfusionConnectProtect | Update SFC Protect config |
GET | /api/config.ssid.profile | Get SSID profiles |
POST | /api/config.ssid.profile | Update SSID profile |
GET | /api/config.wan.connection | Get WAN config |
POST | /api/config.wan.connection | Update WAN config |
POST | /api/config.wan.connection.priority | Change WAN priority |
Status
| Method | Endpoint | Description |
|---|---|---|
POST | /api/status.cellularModule.temperature | Get module temperature |
GET | /api/status.client | Get client list |
GET | /api/status.extap.mesh | Get mesh status |
GET | /api/status.extap.mesh.link | Get mesh link status |
GET | /api/status.lan.profile | Get LAN status |
GET | /api/status.pepvpn | Get SpeedFusion VPN status |
GET | /api/status.wan.connection | Get WAN status |
GET | /api/status.wan.connection.allowance | Get bandwidth allowance |
Info
| Method | Endpoint | Description |
|---|---|---|
GET | /api/info.firmware | Get firmware info |
GET | /api/info.location | Get GPS/location data |