Web API Overview
The NE301 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
| Item | Description |
|---|---|
| Base path | /api/v1 |
| Data format | application/json for both requests and responses (except file uploads) |
| Authentication | HTTP Basic Auth |
| Endpoint count | auto-extracted from source, see endpoint reference |
Unified Response Format
All APIs return a uniform JSON structure:
json
{
"code": 0,
"message": "Success",
"data": { }
}code:0on 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.
| Range | Category | Common codes |
|---|---|---|
| 0 | Success | 0 no error |
| 1001–1099 | Auth | 1001 invalid password · 1003 unauthorized · 1004 session expired · 1005 invalid token · 1007 permission denied |
| 1101–1199 | Parameter validation | 1101 invalid param · 1102 missing param · 1103 out of range · 1104 bad format |
| 1201–1299 | Device & hardware | 1201 device offline · 1202 device busy · 1204 camera error · 1206 hardware error |
| 1301–1399 | Network | 1301 network error · 1302 network timeout · 1304 MQTT not connected · 1305 WiFi not connected |
| 1401–1499 | Storage | 1401 storage full · 1403 file not found · 1407 insufficient space · 1408 dir not empty |
| 1501–1599 | AI & model | 1501 model not loaded · 1502 invalid model · 1503 reload failed · 1505 inference timeout |
| 1601–1699 | Config | 1601 invalid config · 1602 config not found · 1604 update failed |
| 1701–1799 | Operations | 1701 operation timeout · 1702 operation failed · 1705 operation in progress · 1706 AT command failed |
| 1801–1899 | OTA & firmware | 1801 invalid firmware · 1804 OTA in progress · 1805 OTA failed · 1806 header validation failed |
| 1901–1999 | Resources | 1901 resource not found · 1902 resource busy |
| 9999 | Unknown | 9999 |
Modules
| Module | Description |
|---|---|
| Authentication | Device login and password management |
| Network Management | WiFi / HaLow / cellular / PoE configuration and status |
| Device Management | Device info, time, logs and maintenance |
| Work Mode | Device work mode and linkage policies |
| Live Preview | Camera live preview control |
| ISP Tuning | Image quality parameter get/set |
| RTMP Streaming | RTMP stream configuration and control |
| RTSP Streaming | RTSP pull-stream service management |
| MQTT | MQTT connection configuration and status |
| Webhook | Event callback notification configuration |
| OTA Upgrade | Firmware over-the-air upgrade |
| AI Model Management | Upload, switch and configure AI models |
| Model Validation | AI model package validation |
The endpoint reference pages are auto-generated by
Script/gen_web_api_docs.pyand 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/infoSee Authentication & Quick Start for details.