REST API: Rooms
Overview
The Programmable Video Rooms resource represents a communications session among multiple endpoints using one of Twilio's Programmable Video SDKs. Connected users (Participants) can share video and audio Tracks to the Room, and receive video and audio Tracks from other Participants in the Room.
The Rooms resource lets you dynamically create and complete Rooms and configure a Room's topology and behavior. Use this API to set Room properties such as its name, type, TURN configuration, webhook status callback URL, and the maximum number of Participants.
All Programmable Video REST API resources use the following base URL.
https://video.twilio.com
Contents
Room Instance Resource
Resource URI
/v1/Rooms/{RoomNameOrSid}
Resource Properties
Resource Properties in REST API format | |
---|---|
sid
|
The unique string that we created to identify the Room resource. |
status
|
The status of the room. Can be: |
date_created
|
The date and time in GMT when the resource was created specified in ISO 8601 format. |
date_updated
|
The date and time in GMT when the resource was last updated specified in ISO 8601 format. |
account_sid
|
The SID of the Account that created the Room resource. |
enable_turn
|
Deprecated, now always considered to be true. |
unique_name
|
An application-defined string that uniquely identifies the resource. It can be used as a |
status_callback
|
The URL we call using the |
status_callback_method
|
The HTTP method we use to call |
end_time
|
The UTC end time of the room in ISO 8601 format. |
duration
|
The duration of the room in seconds. |
type
|
The type of room. Can be: |
max_participants
|
The maximum number of concurrent Participants allowed in the room. |
max_concurrent_published_tracks
|
The maximum number of published audio, video, and data tracks all participants combined are allowed to publish in the room at the same time. |
record_participants_on_connect
|
Whether to start recording when Participants connect. This feature is not available in |
video_codecs
|
An array of the video codecs that are supported when publishing a track in the room. Can be: |
media_region
|
The region for the media server in Group Rooms. Can be: one of the available Media Regions. This feature is not available in |
url
|
The absolute URL of the resource. |
links
|
The URLs of related resources. |
HTTP GET
Returns a single Room resource represented by {RoomNameOrSid}
.
Retrieve an in-progress
Room instance by UniqueName
You can retrieve an in-progress
Room instance object using the Room's UniqueName
. This makes it easier to interact with Twilio's REST API without having to keep track of Twilio's Room SID identifiers.
For example:
GET /Rooms/DailyStandup
Will return the Room instance object for the Room DailyStandup
if the room is currently in-progress
. If no Room exists by the name DailyStandup
, or a Room by that name is only in completed
status, the above request will return an HTTP 404 response.
Retrieve an in-progress
or completed
Room instance by RoomSid
A Room's Sid
property is Twilio's own canonical unique identifier for a Room. You can always use the Room Sid
to retrieve the Room, whether the room is in-progress
or completed
.
For example:
GET /Rooms/RMxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Will return the Room instance object for the Room with Sid
RMxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
, regardless of its status. If no Room exists with that Sid, the above request will return an HTTP 404 response.
HTTP POST
Modifies a Room resource.
Supported POST parameters
Parameters in REST API format | |
---|---|
sid
Path
|
The SID of the Room resource to update. |
status
Required
|
The new status of the resource. Set to |
Complete a Room
Update a Room's status to completed
with the following request to end the Room. All connected
Participants will be immediately disconnected from the Room.
Rooms List Resource
Resource URI
/v1/Rooms
HTTP POST
Create a new Room with an HTTP POST to the Rooms list resource.
Supported POST parameters
Parameters in REST API format | |
---|---|
enable_turn
Optional
|
Deprecated, now always considered to be true. |
type
Optional
|
The type of room. Can be: |
unique_name
Optional
|
An application-defined string that uniquely identifies the resource. It can be used as a |
status_callback
Optional
|
The URL we should call using the |
status_callback_method
Optional
|
The HTTP method we should use to call |
max_participants
Optional
|
The maximum number of concurrent Participants allowed in the room. Peer-to-peer rooms can have up to 10 Participants. Small Group rooms can have up to 4 Participants. Group rooms can have up to 50 Participants. |
record_participants_on_connect
Optional
|
Whether to start recording when Participants connect. This feature is not available in |
video_codecs
Optional
|
An array of the video codecs that are supported when publishing a track in the room. Can be: |
media_region
Optional
|
The region for the media server in Group Rooms. Can be: one of the available Media Regions. This feature is not available in |
Note: Rooms created via the REST API exist for five minutes to allow the first Participant to connect. If no Participants join within five minutes, the Room times out and a new Room must be created.
Example 1: Create a Room called "DailyStandup"
Once a Room is created, generate an Access Token containing the Room name and use one of Twilio's Video SDKs to connect to the Room.
For example, using the JavaScript SDK:
Twilio.Video.connect('$AccessTokenContainingRoomName').then(function(room) { console.log('Successfully joined a Room: ', room); }, function(error) { console.error('Unable to connect to Room: ' + error.message); });
HTTP GET
Returns a list of Room resources created in the given account. The list includes paging information.
List Filters
The following GET query string parameters allow you to limit the list returned. Note, parameters are case-sensitive.
Parameters in REST API format | |
---|---|
status
Optional
|
Read only the rooms with this status. Can be: |
unique_name
Optional
|
Read only rooms with the this |
date_created_after
Optional
|
Read only rooms that started on or after this date, given as |
date_created_before
Optional
|
Read only rooms that started before this date, given as |
Returns a list containing any Rooms with the name DailyStandup
.
Filter Rooms by Status
Need some help?
We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd browsing the Twilio tag on Stack Overflow.