1Overview
This device uses token-based authentication. You must log in to obtain a token before accessing the protected control API:
- Call the login endpoint with the administrator password.
- On successful authentication, the server returns a
token. - Add
Authorization: Bearer <token>to the header of subsequent requests.
2Connection Details
| Protocol | Default Port | Base URL |
|---|---|---|
| HTTP | 80 | http://<camera-ip>/ |
| HTTPS | 443 | https://<camera-ip>/ |
Both the request and response content type are application/json.
3Login Endpoints
None of the following endpoints require a token, and all use the POST method.
Log in with the administrator password and obtain a token.
Request Parameters
| Field | Type | Required | Description |
|---|---|---|---|
password | string | Yes | Administrator password |
Request
POST /login
Content-Type: application/json
{ "password": "<admin_password>" }
Response · 200 OK
{
"code": 200,
"msg": "ok",
"data": {
"token": "<access_token>",
"option": "1"
}
}
| Response Field | Description |
|---|---|
token | Access token used for subsequent requests |
option | Administrator status indicator value (string) |
Log in with the administrator name and password; both must be correct.
Request Parameters
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Administrator name |
password | string | Yes | Administrator password |
Request
POST /login_name
Content-Type: application/json
{
"name": "<admin_name>",
"password": "<admin_password>"
}
Response · 200 OK
{
"code": 200,
"msg": "ok",
"data": { "token": "<access_token>" }
}
token, not option.Query the administrator status. No password is required, and no token is returned.
Request
POST /login_option
Response · 200 OK
{ "code": 200, "msg": "ok", "data": 1 }
4Using the Token
When calling the protected control API, include the token in the HTTP header:
Authorization: Bearer <access_token>
If the token is missing, invalid, or expired, 401 Unauthorized is returned.
5Session Rules
- Token bound to password: After the administrator password is changed, all previously issued tokens are immediately invalidated and you must log in again.
- Concurrent login limit: By default only a single active session is allowed; a new login terminates the previous session (the later login takes precedence).
- System readiness: If initialization has not completed, a login may return
500; wait and retry.
6Responses and Error Codes
All responses use a uniform JSON structure:
{ "code": <http_status>, "msg": "<message>", "data": <payload> }
| HTTP | Message | Meaning |
|---|---|---|
200 | ok | Success |
400 | invalid params | Malformed request or a required field is missing |
401 | invalid password | Incorrect password or name mismatch |
401 | token password error | Token invalidated (usually because the password was changed) |
401 | token malformed / failed | Token is malformed or not accepted |
423 | — | Concurrent login limit reached |
500 | get token failed | System not yet ready or unable to issue a token |
7Flow Example
Step 1 · Log in to obtain a token
curl -X POST https://<camera-ip>/login \
-H "Content-Type: application/json" \
-d '{"password":"<admin_password>"}'
Step 2 · Call the protected API with the token
curl -X POST https://<camera-ip>/<protected_endpoint> \
-H "Authorization: Bearer <access_token>" \
-H "Content-Type: application/json" \
-d '{ ... }'