API Reference · v1.0

Login API

Describes how to authenticate over HTTP/HTTPS to obtain the token required by the camera control API.

1Overview

This device uses token-based authentication. You must log in to obtain a token before accessing the protected control API:

  1. Call the login endpoint with the administrator password.
  2. On successful authentication, the server returns a token.
  3. Add Authorization: Bearer <token> to the header of subsequent requests.

2Connection Details

ProtocolDefault PortBase URL
HTTP80http://<camera-ip>/
HTTPS443https://<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.

POST/loginNo authentication required

Log in with the administrator password and obtain a token.

Request Parameters

FieldTypeRequiredDescription
passwordstringYesAdministrator 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 FieldDescription
tokenAccess token used for subsequent requests
optionAdministrator status indicator value (string)
POST/login_nameNo authentication required

Log in with the administrator name and password; both must be correct.

Request Parameters

FieldTypeRequiredDescription
namestringYesAdministrator name
passwordstringYesAdministrator 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>" }
}
The response contains only token, not option.
POST/login_optionNo authentication required

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

6Responses and Error Codes

All responses use a uniform JSON structure:

{ "code": <http_status>, "msg": "<message>", "data": <payload> }
HTTPMessageMeaning
200okSuccess
400invalid paramsMalformed request or a required field is missing
401invalid passwordIncorrect password or name mismatch
401token password errorToken invalidated (usually because the password was changed)
401token malformed / failedToken is malformed or not accepted
423—Concurrent login limit reached
500get token failedSystem 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 '{ ... }'