Skip to main content

Room Management

Learn how to create, retrieve, validate, list, deactivate, and end VideoSDK rooms and sessions from your server.

A room is the reusable resource identified by a roomId, while a session represents one live occurrence inside that room.

For the relationship between rooms and sessions, see Rooms, Sessions, Participants, and Streams.

Server-side operations generally fall into two categories:

  • Live operations use a roomId and work with the room's active session.
  • Historical operations use the sessions resource to access previous sessions and their participants.

Initialize the Server SDK

All server-side operations on this page use the VideoSDK Server SDK or REST API.

When using a Server SDK, initialize the client with your API key and secret from the VideoSDK dashboard. The SDK uses these credentials to authenticate requests automatically.

When using REST, generate a management token yourself and include it in the Authorization header.

# A management token signed using your API key and secret,
# or a temporary token generated from the dashboard.
export VIDEOSDK_TOKEN="eyJhbGciOi..."

curl \
-H "Authorization: $VIDEOSDK_TOKEN" \
https://api.videosdk.live/v2/rooms
caution

The secret signs tokens, so it stays on the server.

For installation and environment setup, see the Server SDK introduction.

If you are integrating directly over HTTP, see the REST API reference.

Create a room

Create a room before participants join.

VideoSDK returns a roomId that clients can use to join the room.

curl -X POST https://api.videosdk.live/v2/rooms \
-H "Authorization: $VIDEOSDK_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "geoFence": "us002" }'

# { "roomId": "abcd-efgh-ijkl", ... }

Room configuration options are optional.

If you provide a customRoomId that already exists, VideoSDK returns the existing room instead of creating another one. This makes it useful for mapping VideoSDK rooms to records in your own system.

OptionTypeDescription
customRoomIdstringYour own room identifier. Room creation is idempotent for this value.
geoFencestringRegion where the room should run, such as us002, eu001, or in002.
webhookobjectWebhook configuration for session events in this room, including url and events.
autoCloseConfigobjectAutomatically ends a session after the configured period of inactivity.
autoStartConfigobjectAutomatically starts features such as recording or HLS when the session begins.
allowedParticipantIdsstring[]Restricts room access to specified participant IDs.

List rooms

Retrieve rooms associated with your VideoSDK account.

You can filter the list using query with an exact roomId or customRoomId.

curl "https://api.videosdk.live/v2/rooms?page=1&perPage=20" \
-H "Authorization: $VIDEOSDK_TOKEN"

# {
# "pageInfo": {
# "currentPage": 1,
# "lastPage": 5,
# ...
# },
# "data": [
# {
# "roomId": "...",
# "createdAt": "..."
# }
# ]
# }

# Use the `page` parameter to paginate manually over REST.

Get or validate a room

Use get when you want to retrieve an existing room.

Use validate when you only need to determine whether a supplied room identifier is valid.

Both operations accept a roomId or customRoomId.

curl https://api.videosdk.live/v2/rooms/abcd-efgh-ijkl \
-H "Authorization: $VIDEOSDK_TOKEN"

curl "https://api.videosdk.live/v2/rooms/validate/$USER_INPUT" \
-H "Authorization: $VIDEOSDK_TOKEN"

For REST, an unknown room ID returns an error response, so check the HTTP status code.

tip

Use validate for IDs typed by a user, such as a join code, so a typo is a result and not an exception.

Deactivate a room

Deactivating a room permanently disables it. The room cannot be joined again.

If a session is currently active, VideoSDK disconnects the participants and ends that session as well.

Use the VideoSDK-generated roomId for this operation, not the customRoomId.

curl -X POST https://api.videosdk.live/v2/rooms/deactivate \
-H "Authorization: $VIDEOSDK_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "roomId": "abcd-efgh-ijkl" }'
caution

Deactivating a room is permanent. To end the current call but keep the room for the next one, end the session instead.

Room object

Room operations such as create, get, list, validate, and end return room information. The end operation is the one that deactivates a room.

FieldTypeDescription
roomIdstringVideoSDK-generated room identifier, typically in xxxx-xxxx-xxxx format.
customRoomIdstringCustom identifier supplied by your application, when configured.
geoFencestringRegion associated with the room.
disabledbooleanIndicates whether the room has been deactivated.
createdAt / updatedAtstringISO timestamps for room creation and the most recent update.

Manage sessions

A room can be reused across multiple calls. Each individual live occurrence is stored as a separate session.

Use the sessions resource when you need to:

  • Retrieve previous calls for a room.
  • Inspect when a session started or ended.
  • Access participant history.
  • End the currently active session without disabling the room.

List sessions

List sessions and optionally filter them by:

  • roomId
  • customRoomId
  • userId
  • startDate
  • endDate
  • status

startDate and endDate use epoch milliseconds.

The supported status values are ongoing and ended.

curl "https://api.videosdk.live/v2/sessions?roomId=$ROOM_ID&page=1&perPage=20" \
-H "Authorization: $VIDEOSDK_TOKEN"

# {
# "pageInfo": { ... },
# "data": [
# {
# "id": "...",
# "start": "...",
# "end": "...",
# "status": "ended"
# }
# ]
# }

The Server SDK can apply the status filter. The REST request returns sessions for the specified room.

Get a session

Retrieve a specific session using its unique session ID.

curl https://api.videosdk.live/v2/sessions/session_abc123 \
-H "Authorization: $VIDEOSDK_TOKEN"

End a session

End the current live session without disabling the room.

Participants are disconnected from the active session, but the roomId remains valid and can be reused for a future session.

Provide a roomId or meetingId. You can also provide a sessionId to target a specific session and use force when you need to end it while participants are still connected.

curl -X POST https://api.videosdk.live/v2/sessions/end \
-H "Authorization: $VIDEOSDK_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "roomId": "'"$ROOM_ID"'" }'

# Add "sessionId" to target a specific session.

Session object

A session contains information about one live occurrence of a room.

FieldTypeDescription
idstringUnique identifier for the session.
roomIdstringRoom the session belongs to.
customRoomIdstringCustom room identifier, when configured.
startstringSession start time in ISO-8601 format.
endstringSession end time in ISO-8601 format. null while the session is active.
statusstringCurrent status: ongoing or ended.
regionstringRegion where the session ran.
participantsobject[]Participant information when included in the session response. See Participant management.

For session statistics and participant-level quality information, see the Sessions reference.

Handle server-side errors

Server SDK errors provide information that your application can use for logging, retries, and error handling.

Errors can include:

  • message - human-readable description.
  • code - machine-readable error code.
  • requestId - identifier you can provide to VideoSDK support.
  • httpStatus - corresponding HTTP status when available.

Network failures and timeouts may not contain an httpStatus.

curl -i https://api.videosdk.live/v2/rooms/does-not-exist \
-H "Authorization: $VIDEOSDK_TOKEN"

# HTTP/1.1 404 Not Found
# x-request-id: req_...
#
# {
# "message": "Room not found",
# "code": "ROOM_NOT_FOUND"
# }

For REST integrations, handle errors using the HTTP status code and the code returned in the response body.

For the complete set of Server SDK errors and error categories, see Error handling.

Next steps