Skip to main content

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

PermissionDescription
Read-OnlyCan only read status and config
Read-WriteCan read status and config, and change config
AdminCan manage clients and tokens; includes Read-Write permission

Admin Permission can only be granted by admin user account login.

HTTP Methods

MethodUsage
GETRetrieves simple data
POSTManipulates 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).

FieldTypeDescription
statstringok for success, fail for failure
responseanyAdditional information on success
codenumberError code (only on failure)
messagestringError message (only on failure)
noticeobjectExtra 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

MethodEndpointDescription
POST/api/loginLogin
POST/api/logoutLogout
GET/api/auth.clientGet client list
POST/api/auth.clientCreate/remove client
GET/api/auth.client.tokenGet access token list
POST/api/auth.token.grantGenerate access token
POST/api/auth.token.revokeRevoke access token

Commands -- Cellular & Carrier

MethodEndpointDescription
POST/api/cmd.billing.newCycleStart new billing cycle
GET/api/cmd.carrier.scanGet carrier scan results
POST/api/cmd.carrier.scanTrigger carrier scan
POST/api/cmd.carrier.selectSelect cellular network
POST/api/cmd.channelPci.lockLock channel/PCI
POST/api/cmd.channelPci.scanScan channel/PCI
POST/api/cmd.cellularModule.rescanNetworkRescan cellular network
POST/api/cmd.cellularModule.resetReset cellular module
POST/api/cmd.wan.cellularChange SIM priority

Commands -- Wi-Fi

MethodEndpointDescription
POST/api/cmd.wifi.connectConnect to Wi-Fi
POST/api/cmd.wifi.disconnectDisconnect Wi-Fi
POST/api/cmd.wifi.forgetForget SSID profile
GET/api/cmd.wifi.resultGet Wi-Fi connection result
GET/api/cmd.wifi.scanScan nearby Wi-Fi APs

Commands -- SMS & USSD

MethodEndpointDescription
POST/api/cmd.sim.ussd.sendSend USSD code
POST/api/cmd.sms.deleteDelete SMS messages
GET/api/cmd.sms.getGet SMS messages
POST/api/cmd.sms.sendMessageSend SMS message

Commands -- System & Misc

MethodEndpointDescription
POST/api/cmd.config.applyApply pending config
POST/api/cmd.config.discardDiscard pending config
GET/api/cmd.apGet AP status
POST/api/cmd.apEnable/disable AP
POST/api/cmd.port.poe.disableDisable PoE
POST/api/cmd.port.poe.enableEnable PoE
POST/api/cmd.starlinkStarlink dish control
POST/api/cmd.system.rebootReboot device

Commands -- Mesh

MethodEndpointDescription
POST/api/cmd.mesh.discoverTrigger mesh discovery
GET/api/cmd.mesh.discover.resultGet discovery results
POST/api/cmd.mesh.requestSend mesh request

Configuration

MethodEndpointDescription
POST/api/config.gpioConfigure GPIO
GET/api/config.meshGet mesh config
POST/api/config.meshAdd/update/remove mesh profile
GET/api/config.speedfusionConnectProtectGet SFC Protect config
POST/api/config.speedfusionConnectProtectUpdate SFC Protect config
GET/api/config.ssid.profileGet SSID profiles
POST/api/config.ssid.profileUpdate SSID profile
GET/api/config.wan.connectionGet WAN config
POST/api/config.wan.connectionUpdate WAN config
POST/api/config.wan.connection.priorityChange WAN priority

Status

MethodEndpointDescription
POST/api/status.cellularModule.temperatureGet module temperature
GET/api/status.clientGet client list
GET/api/status.extap.meshGet mesh status
GET/api/status.extap.mesh.linkGet mesh link status
GET/api/status.lan.profileGet LAN status
GET/api/status.pepvpnGet SpeedFusion VPN status
GET/api/status.wan.connectionGet WAN status
GET/api/status.wan.connection.allowanceGet bandwidth allowance

Info

MethodEndpointDescription
GET/api/info.firmwareGet firmware info
GET/api/info.locationGet GPS/location data