OpenCamera API Reference

Open Camera APIs to provide a secure / open security camera solution.

Version: 1.0.0

Authentication

basicAuth

key

in
header
name
x-token

device

Everything about device itself, such as firmware version, health status

Get device information

GET /device

Get device information

200 OK

Success

401 Unauthorized

Access token is missing or invalid

Response Content-Types: application/json
Response Example (200 OK)
{
  "uuid": "123e4567-e89b-12d3-a456-426614174000",
  "uptime": "integer (int64)",
  "resolution": "1920×1080",
  "fps": 30,
  "video_codec": "H.265",
  "audio_codec": "G.711"
}
key

user

User to manage the camera

Create user

POST /user

Only one user is supported.

Created user object

Request Example
{
  "id": 10,
  "firstName": "John",
  "lastName": "James",
  "email": "john@email.com",
  "password": 12345,
  "phone": "12345"
}
200 OK

successful operation

Response Content-Types: application/json
key

Logs user into the system and obtain token

POST /user/token/obtain
200 OK

Encoded token

400 Bad Request

Invalid username/password supplied

Response Example (200 OK)
{
  "access_token": "string (string)",
  "valid_until": "2022-02-02T00:00:00.000Z"
}

Refresh token

POST /user/token/refresh
200 OK

New extend date

400 Bad Request

Invalid username/password supplied

Response Example (200 OK)
{
  "valid_until": "2022-02-02T00:00:00.000Z"
}
key

Logs out current logged in user session

GET /user/logout
200 OK

successful operation

401 Unauthorized

Access token is missing or invalid

key

Reset user password

PUT /user/reset

Created user object

Request Example
123456
200 OK

successful operation

Response Content-Types: application/json
key

media

Camera audio and video operation

Update live session configuration

PUT /media/live/config

Update live session configuration, such as ice servers

Live session configuration

Request Content-Types: application/json
Request Example
{
  "ice_servers": [
    "stun.l.google.com:19302"
  ]
}
200 OK

successful operation

400 Bad Request

bad request

500 Internal Server Error

internal server error

key

Start live media session

POST /media/live/session

Start media session to view camera live status

SDP

sdp data of peer connect data

Request Content-Types: application/json
Request Example
{
  "type": "offer",
  "sdp": "",
  "valid_until": "2022-02-02T00:00:00.000Z"
}
200 OK
SDP

successful operation

400 Bad Request

bad request

500 Internal Server Error

internal server error

Response Content-Types: application/json
Response Example (200 OK)
{
  "type": "offer",
  "sdp": "",
  "valid_until": "2022-02-02T00:00:00.000Z"
}
key

Download recorded videos

GET /media/vod/{start}/{end}

Download record videos

start

recording start time

type
string
in
path
end

recording end time

type
string
in
path
200 OK

successful operation

Response Content-Types: application/json
key

system

Get system information

GET /system

Get system information

200 OK

Success

401 Unauthorized

Access token is missing or invalid

Response Content-Types: application/json
Response Example (200 OK)
{
  "firmwareVersion": "1.0.1",
  "sdcard_free": 10,
  "sdcard_total": 10,
  "live_session_config": {
    "ice_servers": [
      "stun.l.google.com:19302"
    ]
  }
}
key

Upgrade system firmware with uploaded file

POST /system/upgrade

Upgrade system firmware

img_file

The firmware image to upload.

type
file
in
formData
200 OK

Success

401 Unauthorized

Access token is missing or invalid

key

Schema Definitions

DeviceInfo: object

uuid: string
uptime: integer (int64)

device uptime in unix time

resolution: string

camera resolution. Its format is "widthxheight"

fps: integer

frame per second

video_codec: string , x ∈ { H.264 , H.265 }

video codec

audio_codec: string , x ∈ { G.711 }

audio codec

Example
{
  "uuid": "123e4567-e89b-12d3-a456-426614174000",
  "uptime": "integer (int64)",
  "resolution": "1920×1080",
  "fps": 30,
  "video_codec": "H.265",
  "audio_codec": "G.711"
}

SDP: object

type: string
sdp: string
valid_until: string (date)

data is valid until this specified date in UTC.

Example
{
  "type": "offer",
  "sdp": "",
  "valid_until": "2022-02-02T00:00:00.000Z"
}

LiveSessionConfig: object

ice_servers: string[]
Example
{
  "ice_servers": [
    "stun.l.google.com:19302"
  ]
}

SystemInfo: object

firmwareVersion: string
sdcard_free: integer

free sd card disk in GB

sdcard_total: integer

total sd card disk in GB

live_session_config: LiveSessionConfig
Example
{
  "firmwareVersion": "1.0.1",
  "sdcard_free": 10,
  "sdcard_total": 10,
  "live_session_config": {
    "ice_servers": [
      "stun.l.google.com:19302"
    ]
  }
}

User: object

id: integer (int64)
firstName: string
lastName: string
email: string
password: string
phone: string
Example
{
  "id": 10,
  "firstName": "John",
  "lastName": "James",
  "email": "john@email.com",
  "password": 12345,
  "phone": "12345"
}