Skip to content

Web API Overview ​

The NE302 device embeds an HTTP server exposing a complete RESTful API for device configuration, status queries and streaming control. The bundled web UI (Web/) is built on top of these APIs.

Basics ​

ItemDescription
Base path/api/v1
Data formatapplication/json for both requests and responses (except file uploads)
AuthenticationHTTP Basic Auth
Endpoint countauto-extracted from source, see endpoint reference

Unified Response Format ​

All APIs return a uniform JSON structure:

json
{
  "code": 0,
  "message": "Success",
  "data": { }
}
  • code: 0 on success, non-zero business error code otherwise (see table below);
  • message: human-readable description;
  • data: payload, structure varies per endpoint.

Business Error Codes ​

Error codes are defined in Custom/Services/Web/api/api_business_error.h, starting at 1000 to avoid clashing with system error codes.

RangeCategoryCommon codes
0Success0 no error
1001–1099Auth1001 invalid password · 1003 unauthorized · 1004 session expired · 1005 invalid token · 1007 permission denied
1101–1199Parameter validation1101 invalid param · 1102 missing param · 1103 out of range · 1104 bad format
1201–1299Device & hardware1201 device offline · 1202 device busy · 1204 camera error · 1206 hardware error
1301–1399Network1301 network error · 1302 network timeout · 1304 MQTT not connected · 1305 WiFi not connected
1401–1499Storage1401 storage full · 1403 file not found · 1407 insufficient space · 1408 dir not empty
1501–1599AI & model1501 model not loaded · 1502 invalid model · 1503 reload failed · 1505 inference timeout
1601–1699Config1601 invalid config · 1602 config not found · 1604 update failed
1701–1799Operations1701 operation timeout · 1702 operation failed · 1705 operation in progress · 1706 AT command failed
1801–1899OTA & firmware1801 invalid firmware · 1804 OTA in progress · 1805 OTA failed · 1806 header validation failed
1901–1999Resources1901 resource not found · 1902 resource busy
9999Unknown9999

Modules ​

ModuleDescription
AuthenticationDevice login and password management
Network ManagementWiFi / HaLow / cellular / PoE configuration and status
Device ManagementDevice info, time, logs and maintenance
Work ModeDevice work mode and linkage policies
Live PreviewCamera live preview control
ISP TuningImage quality parameter get/set
RTMP StreamingRTMP stream configuration and control
RTSP StreamingRTSP pull-stream service management
MQTTMQTT connection configuration and status
WebhookEvent callback notification configuration
OTA UpgradeFirmware over-the-air upgrade
AI Model ManagementUpload, switch and configure AI models
Model ValidationAI model package validation

The endpoint reference pages are auto-generated by Script/gen_web_api_docs.py and map one-to-one to the route registration tables in the firmware source. Their content updates automatically as the code changes (see the sync mechanism). Modules not present in the current code base do not appear.

Quick Start ​

bash
# 1. Login (used by the web UI)
curl -X POST http://<device-ip>/api/v1/login \
  -H "Content-Type: application/json" \
  -d '{"password": "<your-password>"}'

# 2. Call a protected endpoint with Basic Auth
curl -u admin:<your-password> \
  http://<device-ip>/api/v1/device/info

See Authentication & Quick Start for details.

Released under the MIT License.