Skip to content
Server

Rooms and participants

List and close rooms, send data, and manage participants and admins.

These in-room routes take the user_token from the Token API, sent as Authorization: Bearer <user_token>. Paths start with https://stream.zavryn.online/api/v1.

List endpoints take page (default 1) and per_page (default 20, maximum 100), and return { "data": [...], "pagination": { "page", "per_page", "total", "total_pages" } }.

Rooms

Method and pathDescription
GET /roomsLists active rooms
GET /rooms/:room_nameReturns the room and its live participants. 404 Room not found if it isn't active.
DELETE /rooms/:room_nameRemoves everyone and closes the room
PUT /rooms/:room_name/metadataSets the room's metadata: { "metadata": { ... } }
POST /rooms/:room_name/send-dataSends data to the room

Send data

{
  "data": { "type": "chat", "message": "Hello everyone!" },
  "destination_identities": ["user-456"]
}

Leave out destination_identities to send to everyone. This isn't affected by locked chat.

Participants

Method and pathDescription
GET /rooms/:room_name/participants/:identityReturns one participant and their tracks
GET /rooms/:room_name/participants/by-role?role=hostLists connected participants with a role
PUT /rooms/:room_name/participants/:identity/roleChanges a role. Owner only.
DELETE /rooms/:room_name/participants/:identityRemoves a participant
PUT /rooms/:room_name/participants/:identity/permissionsSets can_publish, can_subscribe and can_publish_data. All are optional.
PUT /rooms/:room_name/participants/:identity/muteMutes: { "audio": true, "video": false }, or { "track_sid": "TR_abc", "muted": true }
PUT /rooms/:room_name/participants/:identity/metadataSets the participant's metadata
PUT /rooms/:room_name/participants/:identity/forbid-streamRemoves the ability to publish, and keeps the role
PUT /rooms/:room_name/participants/:identity/resume-streamRestores the ability to publish

To change a role, send { "actor_identity": "owner-user", "role": "admin" }.

Roles

Every role can subscribe and send data, such as chat and gifts. These are the media permissions:

RoleMicrophoneCameraScreen share
hostYesYesYes
adminYesYesYes
guestYesYesNo
audienceNoNoNo
visitorNoNoNo
  • In a seated room, someone who isn't on a seat can't publish, unless they're a host or admin.
  • live_stream rooms work differently. See Stage.
  • audience and visitor have the same permissions. The difference is yours to use.

Admins

Admins are saved on the room, so the owner can assign someone who's offline. A client asking for role: "admin" is ignored.

Method and pathDescription
GET /rooms/:room_name/admins?presence=allLists admins. presence is all, online or offline.
PUT /rooms/:room_name/admins/:identityAssigns an admin. Owner only.
DELETE /rooms/:room_name/admins/:identityRevokes an admin. Owner only.
{
  "actor_identity": "owner-user",
  "name": "Moderator",
  "attributes": { "avatar": "https://example.com/mod.webp" }
}

The response's applied_online is true if a connected user's permissions were updated immediately. If it's false, the assignment is still saved and applies when they next join or reconnect.

Bans

Method and pathDescription
POST /rooms/banBans a user
DELETE /rooms/banRemoves a ban: { "identity", "room_name" }. Leave out room_name to remove all of the user's bans.
GET /rooms/bansLists active bans
{
  "identity": "user-789",
  "room_name": "public-chat",
  "reason": "Violation of community guidelines",
  "duration": 3600
}

Leave out room_name for a project-wide ban, and duration for a permanent one. A ban removes the user from active rooms, and they get 403 User is banned when they ask for a token.

Project info

GET /project with X-App-Id and X-App-Secret returns your project's status, limits, enabled_types and active_rooms.