Skip to main content

Add a device

POST /server/v1/agent/create Authentication: required (see Overview) Register external devices such as SIP / H.323 phones, GB28181 surveillance devices, and RTSP streams under your app; then you can use “Invite devices to the channel” to bring them into a channel. The response is the device ID—save it; you need it to update, delete, and query details later. Request body fields vary with the URL query parameter type (each integration type has different required fields); what to pass for each of the six integration types is listed below by value. For how to choose an integration type, see the “Device integration guide”. URL query parameters
string
required
Integration type. For values, see the “Device integration guide”
Request parameters The request body fields depend on the URL query parameter type. The fields for each value are listed below.

type=ipsip — SIP phone, direct IP

string
required
Device address, ip:port (max length 100) Example: 192.168.1.50:5060
string
required
Display name; the device’s display name after it joins the channel (max length 100) Example: 3rd-floor meeting room phone
string
required
Device gateway. For values, see “List device gateways” (max length 60) Example: devgw-1
string
Remarks (max length 200) Example: East wing, 3F
Request example:

type=regsip — SIP phone, registration mode

string
required
Username; the account the device uses to register with the gateway; must not contain : (max length 100) Example: 6001
string
required
Password; must match the device configuration (max length 50) Example: Abc123456
string
required
Display name; the device’s display name after it joins the channel (max length 100) Example: 3rd-floor meeting room phone
string
required
Device gateway. For values, see “List device gateways” (max length 60) Example: devgw-1
string
Remarks (max length 200) Example: East wing, 3F
Request example:

type=iph323 — H.323 endpoint, direct IP

string
required
Device address, ip:port (max length 100) Example: 192.168.1.60:1720
string
required
Display name; the device’s display name after it joins the channel (max length 100) Example: 3rd-floor meeting room endpoint
string
required
Device gateway. For values, see “List device gateways” (max length 60) Example: devgw-1
string
Remarks (max length 200) Example: East wing, 3F
Request example:

type=regh323 — H.323 endpoint, registration mode

string
required
Username; must be a short numeric extension (max length 100) Example: 6002
string
required
Password; must match the device configuration (max length 50) Example: Abc123456
string
required
Display name; the device’s display name after it joins the channel (max length 100) Example: 3rd-floor meeting room endpoint
string
required
Device gateway. For values, see “List device gateways” (max length 60) Example: devgw-1
string
Remarks (max length 200) Example: East wing, 3F
Request example:

type=gb28181 — GB28181 surveillance device

string
required
Device SIP number, 18–20 digits; can be generated with “Generate a GB28181 device SIP number” (max length 20) Example: 33010806661328458475
string
required
Password; must match the GB28181 settings on the device (max length 50) Example: Abc123456
object
Channel number → name: the video feeds under one device. After registration, you can also add or change them with “Set a GB28181 device channel” Example: {"33010806661329301268":"Guest seats"}
string
required
Display name; the device’s display name after it joins the channel (max length 100) Example: Dome camera 1
string
required
Device gateway. For values, see “List device gateways” (max length 60) Example: devgw-1
string
Remarks (max length 200) Example: Lobby entrance
Request example:

type=rtsp — RTSP stream pull

string
required
RTSP stream URL; must start with rtsp (max length 100) Example: rtsp://192.168.1.70:554/stream1
string
required
Display name; the device’s display name after it joins the channel (max length 100) Example: Lobby camera
string
Transport: UDP (default) | TCP Example: TCP
string
required
Device gateway. For values, see “List device gateways” (max length 60) Example: devgw-1
string
Remarks (max length 200) Example: Lobby entrance
Request example:
Response parameters
string
ID of the new device, used later to update, delete, and query details
Response example:

Update a device

POST /server/v1/agent/update Authentication: required (see Overview) Update the connection info or display name of a registered device. The request body fields are the same as for “Add a device” (they vary with type), plus the device id; the full fields for each value are listed below.
  • type must match how the device was originally integrated; you can’t use this to turn a SIP device into an RTSP one. To change the integration type, delete the device and register it again
  • Changes take effect the next time the device connects; devices currently in a channel are not affected
URL query parameters
string
required
Integration type; must match the one used when the device was registered
Request parameters The request body fields depend on the URL query parameter type. The fields for each value are listed below.

type=ipsip — SIP phone, direct IP (update)

string
required
Device ID, from the response of “Add a device” or from “List devices” (max length 64) Example: sw8kjx
string
required
Device address, ip:port (max length 100) Example: 192.168.1.50:5060
string
required
Display name; the device’s display name after it joins the channel (max length 100) Example: 3rd-floor meeting room phone
string
required
Device gateway. For values, see “List device gateways” (max length 60) Example: devgw-1
string
Remarks (max length 200) Example: East wing, 3F
Request example:

type=regsip — SIP phone, registration mode (update)

string
required
Device ID, from the response of “Add a device” or from “List devices” (max length 64) Example: sw8kjx
string
required
Username; the account the device uses to register with the gateway; must not contain : (max length 100) Example: 6001
string
required
Password; must match the device configuration (max length 50) Example: Abc123456
string
required
Display name; the device’s display name after it joins the channel (max length 100) Example: 3rd-floor meeting room phone
string
required
Device gateway. For values, see “List device gateways” (max length 60) Example: devgw-1
string
Remarks (max length 200) Example: East wing, 3F
Request example:

type=iph323 — H.323 endpoint, direct IP (update)

string
required
Device ID, from the response of “Add a device” or from “List devices” (max length 64) Example: sw8kjx
string
required
Device address, ip:port (max length 100) Example: 192.168.1.60:1720
string
required
Display name; the device’s display name after it joins the channel (max length 100) Example: 3rd-floor meeting room endpoint
string
required
Device gateway. For values, see “List device gateways” (max length 60) Example: devgw-1
string
Remarks (max length 200) Example: East wing, 3F
Request example:

type=regh323 — H.323 endpoint, registration mode (update)

string
required
Device ID, from the response of “Add a device” or from “List devices” (max length 64) Example: sw8kjx
string
required
Username; must be a short numeric extension (max length 100) Example: 6002
string
required
Password; must match the device configuration (max length 50) Example: Abc123456
string
required
Display name; the device’s display name after it joins the channel (max length 100) Example: 3rd-floor meeting room endpoint
string
required
Device gateway. For values, see “List device gateways” (max length 60) Example: devgw-1
string
Remarks (max length 200) Example: East wing, 3F
Request example:

type=gb28181 — GB28181 surveillance device (update)

string
required
Device ID, from the response of “Add a device” or from “List devices” (max length 64) Example: sw8kjx
string
required
Device SIP number, 18–20 digits; can be generated with “Generate a GB28181 device SIP number” (max length 20) Example: 33010806661328458475
string
required
Password; must match the GB28181 settings on the device (max length 50) Example: Abc123456
object
Channel number → name: the video feeds under one device. After registration, you can also add or change them with “Set a GB28181 device channel” Example: {"33010806661329301268":"Guest seats"}
string
required
Display name; the device’s display name after it joins the channel (max length 100) Example: Dome camera 1
string
required
Device gateway. For values, see “List device gateways” (max length 60) Example: devgw-1
string
Remarks (max length 200) Example: Lobby entrance
Request example:

type=rtsp — RTSP stream pull (update)

string
required
Device ID, from the response of “Add a device” or from “List devices” (max length 64) Example: sw8kjx
string
required
RTSP stream URL; must start with rtsp (max length 100) Example: rtsp://192.168.1.70:554/stream1
string
required
Display name; the device’s display name after it joins the channel (max length 100) Example: Lobby camera
string
Transport: UDP (default) | TCP Example: TCP
string
required
Device gateway. For values, see “List device gateways” (max length 60) Example: devgw-1
string
Remarks (max length 200) Example: Lobby entrance
Request example:
Response parameters
string
ID of the updated device
Response example:

Set a GB28181 device channel

POST /server/v1/agent/set-gb28181-subject Authentication: required (see Overview) Add or update a channel of a GB28181 device (one GB28181 device can have multiple camera channels). If the channel number already exists, its name is updated; otherwise a new channel is added. You can also pass them in bulk with subjects when calling “Add a device”. Request parameters
string
required
Device ID, from the response of “Add a device” or from “List devices” (max length 64) Example: sw8kjx
string
required
Channel number; must match the device’s actual configuration. Can be generated automatically per the standard with “Generate a GB28181 channel number” (max length 20) Example: 50010700001320000001
string
required
GB28181 channel name, used in the channel to tell apart the different video feeds of the same device (max length 100) Example: Guest seats
Request example:
Response parameters data is null Response example:

Delete a GB28181 device channel

POST /server/v1/agent/del-gb28181-subject Authentication: required (see Overview) Delete one channel of a GB28181 device. The device itself is not affected; the GB28181 channel simply can no longer be invited to a channel. If the GB28181 channel is currently in a channel, it is removed from that channel first. Request parameters
string
required
Device ID (max length 64) Example: sw8kjx
string
required
GB28181 channel number (max length 20) Example: 50010700001320000001
Request example:
Response parameters data is null Response example:

Generate a GB28181 channel number

POST /server/v1/agent/gen-gb28181-subject Authentication: required (see Overview) Generate an unused channel number for the specified device according to the GB28181 standard, so you avoid format errors when building numbers yourself or conflicts with existing channels. The generated number is only returned to you and is not registered automatically—after getting it, you still need to call “Set a GB28181 device channel” and provide the channel name. Request parameters
string
required
Device ID (max length 64) Example: sw8kjx
Request example:
Response parameters
string
Generated channel number, not registered yet; call “Set a GB28181 device channel” next
Response example:

Generate a GB28181 device SIP number

POST /server/v1/agent/gen-gb28181-sip-no Authentication: required (see Overview) Generate an unused GB28181 device SIP number for registering a new GB28181 device (sip_no when type=gb28181). No request parameters. Likewise, this only returns a number and doesn’t create a device automatically. Request parameters None Response parameters
string
Generated device SIP number; no device has been created yet
Response example:

Control GB28181 device PTZ (direction and zoom)

POST /server/v1/agent/gb28181-ptz Authentication: required (see Overview) Control the PTZ (direction and zoom) of a GB28181 camera. command supports up/down/left/right/zoomin/zoomout/stop, and a ”+” combination of two actions (such as left+up). Speed ranges from 0 to 255: when speed_h/speed_v/speed_zoom is 0 it falls back to speed; when speed is also 0, the gateway default speed of 50 is used. The device must already be registered with “Add a device” (type gb28181); otherwise the gateway it belongs to can’t be located. Request parameters
string
required
Device number, the SIP number of a GB28181 device (max length 20) Example: 33010806661328458475
string
required
Channel number; must match the device configuration. Can be generated with “Generate a GB28181 channel number” (max length 20) Example: 33010806661329301268
string
required
PTZ action; supports a + combination of two actions Example: left+up
integer
Base speed Example: 50
integer
Horizontal rotation speed Example: 50
integer
Vertical rotation speed Example: 50
integer
Zoom speed Example: 50
Request example:
Response parameters data is null Response example:

Manage GB28181 device preset positions

POST /server/v1/agent/gb28181-preset Authentication: required (see Overview) Operate the preset positions of a GB28181 camera: set saves the current position, goto moves to a preset position, and delete removes a preset position; all three actions require the preset number num (1–255). As with “Control GB28181 device PTZ (direction and zoom)”, the device must already be registered. Request parameters
string
required
Device number, the SIP number of a GB28181 device (max length 20) Example: 33010806661328458475
string
required
GB28181 channel number (max length 20) Example: 33010806661329301268
string
required
Preset action: set saves the current position, goto moves to the preset position, delete removes the preset position Example: goto
integer
required
Preset number Example: 1
Request example:
Response parameters data is null Response example:

List device gateways

POST /server/v1/agent/list-gw Authentication: required (see Overview) List the available device gateways. Call this before registering a device to get the value for gw. A device gateway is the translation layer between external devices and RTC: SIP, H.323, and GB28181 each have their own signaling protocol, which the gateway handles, converting the media into a format RTC can use. Different gateways support different integration types, so filter with type; for values, see the “Device integration guide”. URL query parameters
string
required
Filter by integration type; returns only gateways that support it. For values, see the “Device integration guide”
Request parameters None (all parameters are passed in the URL query string) Response parameters
string
gw id
array<integer>
Agent type
integer
Last heartbeat time
string
API endpoint for RTC to call the device gateway
object
Node load piggybacked on the most recent heartbeat (empty for older gateways that don’t report it)
Response example:

List device gateway platform info

POST /server/v1/agent/list-gw-info Authentication: required (see Overview) Get the gateway’s platform-side info for configuring the device side. The typical use is GB28181 integration: a GB28181 camera needs the “upstream platform” SIP number, domain, IP, and port filled in on the device side. Take these values from here and enter them on the camera’s GB28181 settings page so the device can register. How this differs from “List device gateways”: that one answers “which gateways do we have”; this one answers “to connect a device to a given gateway, what should be filled in on the device side”. URL query parameters
string
required
Integration type; different types return different platform info fields. For values, see the “Device integration guide”
Request parameters None (all parameters are passed in the URL query string) Response parameters
string
gw id
array<integer>
Agent type
integer
Last heartbeat time
string
API endpoint for RTC to call the device gateway
object
Node load piggybacked on the most recent heartbeat (empty for older gateways that don’t report it)
any
Gateway platform info
Response example:

Call a gateway API

POST /server/v1/agent/call-gw-api Authentication: required (see Overview) Pass a call through to the device gateway’s own API, for troubleshooting and operations scenarios the regular endpoints don’t cover (such as querying the gateway’s internal state or triggering a device reconnect). The data in the response is what the gateway returns, as is. This is a low-level endpoint for operations: the values of api and params depend on the gateway version, with no stability guarantee. Don’t rely on it in business code; prefer the other named endpoints in this group. Request parameters
string
required
Gateway. For values, see “List device gateways” Example: devgw-1
string
required
The gateway’s own API path Example: /api/v1/status
object
Parameters passed to the gateway API Example: {"device_id":"sw8kjx"}
Request example:
Response parameters
any
Data returned by the gateway as is (structure varies)
Response example:

Delete a device

POST /server/v1/agent/delete Authentication: required (see Overview) Delete a registered device. The data in the response is the ID of the deleted device. If the device is currently in a channel, it is removed from the channel first. After deletion, the same physical device can be registered again, but it gets a new device ID. Request parameters
string
required
Device ID (max length 64) Example: sw8kjx
Request example:
Response parameters
string
ID of the deleted device
Response example:

Get device details

POST /server/v1/agent/detail Authentication: required (see Overview) Query the details of a single device, including connection parameters, the gateway it belongs to, and online status. The device id comes from the response of “Add a device” or from “List devices”. Request parameters
string
required
Device ID (max length 64) Example: sw8kjx
Request example:
Response parameters
string
agent id
string
Agent name
integer
Agent type
integer
Online status
integer
Last heartbeat time
string
Device identifier
object
Connection parameters with secrets removed; see NewAgent
string
Device gateway
string
Remarks
array<object>
List of GB28181 channels, each with its most recently reported location
object
Device-level location (the report that carries no channel number)
Response example:

List devices

POST /server/v1/agent/list-invite Authentication: required (see Overview) List the devices available for invitation with pagination, typically so users can pick devices in your UI. Each channel of a GB28181 device takes its own entry. The contact (device identifier) in the response is the value to pass to “Invite devices to the channel”. Request parameters
array<integer>
required
Agent type: 2 SIP, 3 H.323, 4 GB28181 surveillance, 5 RTSP stream pull Example: 2,4
string
Keyword; fuzzy-matches the display name and device identifier (max length 100) Example: meeting room
string
Display name, exact match (max length 100) Example: Guest seats camera
string
Device identifier, exact match (max length 100) Example: 50010700001320000001
integer
Page number, starting from 1 Example: 1
integer
Page size Example: 10
Request example:
Response parameters
string
agent id
string
Agent name
integer
Agent type
integer
Online status
integer
Last heartbeat time
string
Device identifier
object
Connection parameters with secrets removed; see NewAgent
string
Device gateway
string
Remarks
array<object>
List of GB28181 channels, each with its most recently reported location
object
Device-level location (the report that carries no channel number)
Response example:

Invite devices to the channel

POST /server/v1/agent/invite Authentication: required (see Overview) Bring devices into a channel; you can invite several at once. Take each device’s type and contact from “List devices”. Devices join asynchronously: a successful response only means the invitation has been sent; the device is actually online when the user_join callback arrives (the device’s uid has the agent prefix). Inviting a device that is already in the channel doesn’t bring it in again. The agent_join callback is triggered before the device accepts the invitation. If you subscribe to this event, you must return sid as required, otherwise the device can’t join the channel—see the “Callback events guide” for details. Request parameters
array<any>
required
Devices to invite
string
required
Target room number (the meeting number for an SMeeting-layer app, or the channel name for an SRTC-layer app) Example: fire
Request example:
Response parameters data is null Response example:

Turn device video on or off

POST /server/v1/agent/set-camera-enabled Authentication: required (see Overview) Turn a device’s camera on or off. Unlike a regular client, a device can’t operate this itself; it can only be controlled from the server. If you subscribe to the agent_operate callback, this operation first asks your backend, and a non-zero response means rejection; if you don’t subscribe, it is allowed by default. Request parameters
string
In-channel user ID of the device; omit to apply to all devices in the channel. Has the agent prefix; get it from “List online or offline users” or the user_join callback (letters, digits, underscores (_), and hyphens (-) only) Example: _agent_co63jg6g54hu3b0xhtie
string
required
Channel name (up to 64 bytes; letters, digits, underscores (_), and hyphens (-) only) Example: fire
boolean
Whether to turn it on
string
Operator uid, used for auditing Example: 1001
Request example:
Response parameters data is null Response example:

Turn device audio on or off

POST /server/v1/agent/set-mic-enabled Authentication: required (see Overview) Turn a device’s microphone on or off; same semantics as “Turn device video on or off”. Request parameters
string
In-channel user ID of the device; omit to apply to all devices in the channel. Has the agent prefix (letters, digits, underscores (_), and hyphens (-) only) Example: _agent_co63jg6g54hu3b0xhtie
string
required
Channel name (up to 64 bytes; letters, digits, underscores (_), and hyphens (-) only) Example: fire
boolean
Whether to turn it on
string
Operator uid, used for auditing Example: 1001
Request example:
Response parameters data is null Response example: