Skip to contentSkip to navigationSkip to topbar
On this page

REST API: Rooms


(warning)

Warning

This documentation is for reference only. We are no longer onboarding new customers to Programmable Video. Existing customers can continue to use the product until December 5, 2026(link takes you to an external page).

We recommend migrating your application to the API provided by our preferred video partner, Zoom. We've prepared this migration guide(link takes you to an external page) to assist you in minimizing any service disruption.


Overview

overview page anchor

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 with 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.

1
https://video.twilio.com
2

Contents

contents page anchor

1
/v1/Rooms/{RoomNameOrSid}
2
Property nameTypeRequiredDescriptionChild properties
sidSID<RM>Optional
Not PII

The unique string that we created to identify the Room resource.

Pattern: ^RM[0-9a-fA-F]{32}$Min length: 34Max length: 34

statusenum<string>Optional

The status of the room. Can be: in-progress, failed, or completed.

Possible values:
in-progresscompletedfailed

date_createdstring<date-time>Optional

The date and time in GMT when the resource was created specified in ISO 8601(link takes you to an external page) format.


date_updatedstring<date-time>Optional

The date and time in GMT when the resource was last updated specified in ISO 8601(link takes you to an external page) format.


account_sidSID<AC>Optional

The SID of the Account that created the Room resource.

Pattern: ^AC[0-9a-fA-F]{32}$Min length: 34Max length: 34

enable_turnbooleanOptional

Deprecated, now always considered to be true.


unique_namestringOptional

An application-defined string that uniquely identifies the resource. It can be used as a room_sid in place of the resource's sid in the URL to address the resource, assuming it does not contain any reserved characters(link takes you to an external page) that would need to be URL encoded. This value is unique for in-progress rooms. SDK clients can use this name to connect to the room. REST API clients can use this name in place of the Room SID to interact with the room as long as the room is in-progress.


status_callbackstring<uri>Optional

The URL we call using the status_callback_method to send status information to your application on every room event. See Status Callbacks for more info.


status_callback_methodenum<http-method>Optional

The HTTP method we use to call status_callback. Can be POST or GET and defaults to POST.

Possible values:
GETPOST

end_timestring<date-time>Optional

The UTC end time of the room in ISO 8601(link takes you to an external page) format.


durationintegerOptional

The duration of the room in seconds.


typeenum<string>Optional

The type of room. Can be: go, peer-to-peer, group-small, or group. The default value is group.

Possible values:
gopeer-to-peergroupgroup-small

max_participantsintegerOptional

The maximum number of concurrent Participants allowed in the room.

Default: 0

max_participant_durationintegerOptional

The maximum number of seconds a Participant can be connected to the room. The maximum possible value is 86400 seconds (24 hours). The default is 14400 seconds (4 hours).

Default: 0

max_concurrent_published_tracksintegerOptional

The maximum number of published audio, video, and data tracks all participants combined are allowed to publish in the room at the same time. Check Programmable Video Limits for more details. If it is set to 0 it means unconstrained.


record_participants_on_connectbooleanOptional

Whether to start recording when Participants connect. This feature is not available in peer-to-peer rooms.


video_codecsarray[enum<string>]Optional

An array of the video codecs that are supported when publishing a track in the room. Can be: VP8 and H264. This feature is not available in peer-to-peer rooms

Possible values:
VP8H264

media_regionstringOptional

The region for the media server in Group Rooms. Can be: one of the available Media Regions. This feature is not available in peer-to-peer rooms.


audio_onlybooleanOptional

When set to true, indicates that the participants in the room will only publish audio. No video tracks will be allowed. Group rooms only.


empty_room_timeoutintegerOptional

Specifies how long (in minutes) a room will remain active after last participant leaves. Can be configured when creating a room via REST API. For Ad-Hoc rooms this value cannot be changed.

Default: 0

unused_room_timeoutintegerOptional

Specifies how long (in minutes) a room will remain active if no one joins. Can be configured when creating a room via REST API. For Ad-Hoc rooms this value cannot be changed.

Default: 0

large_roombooleanOptional

Indicates if this is a large room.


urlstring<uri>Optional

The absolute URL of the resource.


linksobject<uri-map>Optional

The URLs of related resources.

HTTP GET

get-instance page anchor

Returns a single Room resource represented by {RoomNameOrSid} .

Retrieve an in-progress Room instance by UniqueName

get-by-unique-name page anchor

You can retrieve an in-progress Room instance object using the Room's UniqueName, assuming the UniqueName does not contain any reserved characters(link takes you to an external page) that would need to be URL encoded. 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
Retrieve an in-progress Room instance by UniqueNameLink to code sample: Retrieve an in-progress Room instance by UniqueName
1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function fetchRoom() {
11
const room = await client.video.v1.rooms("DailyStandup").fetch();
12
13
console.log(room.sid);
14
}
15
16
fetchRoom();

Output

1
{
2
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
3
"date_created": "2015-07-30T20:00:00Z",
4
"date_updated": "2015-07-30T20:00:00Z",
5
"status": "in-progress",
6
"type": "peer-to-peer",
7
"sid": "DailyStandup",
8
"enable_turn": true,
9
"unique_name": "unique_name",
10
"max_participants": 10,
11
"max_participant_duration": 86400,
12
"max_concurrent_published_tracks": 0,
13
"duration": 0,
14
"status_callback_method": "POST",
15
"status_callback": null,
16
"record_participants_on_connect": false,
17
"video_codecs": [
18
"VP8"
19
],
20
"audio_only": false,
21
"media_region": "us1",
22
"empty_room_timeout": 5,
23
"unused_room_timeout": 5,
24
"end_time": "2015-07-30T20:00:00Z",
25
"large_room": false,
26
"url": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
27
"links": {
28
"participants": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants",
29
"recordings": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Recordings",
30
"recording_rules": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RecordingRules"
31
}
32
}

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

get-by-sid page anchor

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
Retrieve an in-progress or completed Room instance by RoomSidLink to code sample: Retrieve an in-progress or completed Room instance by RoomSid
1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function fetchRoom() {
11
const room = await client.video.v1
12
.rooms("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
13
.fetch();
14
15
console.log(room.sid);
16
}
17
18
fetchRoom();

Output

1
{
2
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
3
"date_created": "2015-07-30T20:00:00Z",
4
"date_updated": "2015-07-30T20:00:00Z",
5
"status": "in-progress",
6
"type": "peer-to-peer",
7
"sid": "RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
8
"enable_turn": true,
9
"unique_name": "unique_name",
10
"max_participants": 10,
11
"max_participant_duration": 86400,
12
"max_concurrent_published_tracks": 0,
13
"duration": 0,
14
"status_callback_method": "POST",
15
"status_callback": null,
16
"record_participants_on_connect": false,
17
"video_codecs": [
18
"VP8"
19
],
20
"audio_only": false,
21
"media_region": "us1",
22
"empty_room_timeout": 5,
23
"unused_room_timeout": 5,
24
"end_time": "2015-07-30T20:00:00Z",
25
"large_room": false,
26
"url": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
27
"links": {
28
"participants": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants",
29
"recordings": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Recordings",
30
"recording_rules": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RecordingRules"
31
}
32
}

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.

Modifies a Room resource.

Supported POST parameters

Property nameTypeRequiredPIIDescription
Sidstringrequired

The SID of the Room resource to update.

Encoding type:application/x-www-form-urlencoded
SchemaExample
Property nameTypeRequiredDescriptionChild properties
Statusenum<string>required

The new status of the resource. Set to completed to end the room.

Possible values:
in-progresscompletedfailed

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.

1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function updateRoom() {
11
const room = await client.video.v1
12
.rooms("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
13
.update({ status: "completed" });
14
15
console.log(room.sid);
16
}
17
18
updateRoom();

Output

1
{
2
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
3
"date_created": "2015-07-30T20:00:00Z",
4
"date_updated": "2015-07-30T20:00:00Z",
5
"status": "completed",
6
"type": "peer-to-peer",
7
"sid": "RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
8
"enable_turn": true,
9
"unique_name": "unique_name",
10
"max_participants": 10,
11
"max_participant_duration": 86400,
12
"max_concurrent_published_tracks": 10,
13
"status_callback_method": "POST",
14
"status_callback": null,
15
"record_participants_on_connect": false,
16
"video_codecs": [
17
"VP8"
18
],
19
"media_region": "us1",
20
"audio_only": false,
21
"empty_room_timeout": 5,
22
"unused_room_timeout": 5,
23
"end_time": "2015-07-30T20:00:00Z",
24
"large_room": false,
25
"duration": 10,
26
"url": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
27
"links": {
28
"participants": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants",
29
"recordings": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Recordings",
30
"recording_rules": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RecordingRules"
31
}
32
}

1
/v1/Rooms
2

Create a new Room with an HTTP POST to the Rooms list resource.

Supported POST parameters

post-parameters page anchor
Encoding type:application/x-www-form-urlencoded
SchemaExample
Property nameTypeRequiredDescriptionChild properties
EnableTurnbooleanOptional

Deprecated, now always considered to be true.


Typeenum<string>Optional

The type of room. Can be: go, peer-to-peer, group-small, or group. The default value is group.

Possible values:
gopeer-to-peergroupgroup-small

UniqueNamestringOptional

An application-defined string that uniquely identifies the resource. It can be used as a room_sid in place of the resource's sid in the URL to address the resource, assuming it does not contain any reserved characters(link takes you to an external page) that would need to be URL encoded. This value is unique for in-progress rooms. SDK clients can use this name to connect to the room. REST API clients can use this name in place of the Room SID to interact with the room as long as the room is in-progress.


StatusCallbackstring<uri>Optional

The URL we should call using the status_callback_method to send status information to your application on every room event. See Status Callbacks for more info.


StatusCallbackMethodenum<http-method>Optional

The HTTP method we should use to call status_callback. Can be POST or GET.

Possible values:
GETPOST

MaxParticipantsintegerOptional

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.


RecordParticipantsOnConnectbooleanOptional

Whether to start recording when Participants connect. This feature is not available in peer-to-peer rooms.


VideoCodecsarray[enum<string>]Optional

An array of the video codecs that are supported when publishing a track in the room. Can be: VP8 and H264. This feature is not available in peer-to-peer rooms

Possible values:
VP8H264

MediaRegionstringOptional

The region for the media server in Group Rooms. Can be: one of the available Media Regions. This feature is not available in peer-to-peer rooms.


RecordingRulesobjectOptional

A collection of Recording Rules that describe how to include or exclude matching tracks for recording


AudioOnlybooleanOptional

When set to true, indicates that the participants in the room will only publish audio. No video tracks will be allowed. Group rooms only.


MaxParticipantDurationintegerOptional

The maximum number of seconds a Participant can be connected to the room. The maximum possible value is 86400 seconds (24 hours). The default is 14400 seconds (4 hours).


EmptyRoomTimeoutintegerOptional

Configures how long (in minutes) a room will remain active after last participant leaves. Valid values range from 1 to 60 minutes (no fractions).


UnusedRoomTimeoutintegerOptional

Configures how long (in minutes) a room will remain active if no one joins. Valid values range from 1 to 60 minutes (no fractions).


LargeRoombooleanOptional

When set to true, indicated that this is the large room.

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"

create-room page anchor
1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function createRoom() {
11
const room = await client.video.v1.rooms.create({
12
uniqueName: "DailyStandup",
13
});
14
15
console.log(room.sid);
16
}
17
18
createRoom();

Output

1
{
2
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
3
"date_created": "2015-07-30T20:00:00Z",
4
"date_updated": "2015-07-30T20:00:00Z",
5
"status": "in-progress",
6
"type": "peer-to-peer",
7
"sid": "RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
8
"enable_turn": true,
9
"unique_name": "DailyStandup",
10
"max_concurrent_published_tracks": 0,
11
"max_participants": 10,
12
"max_participant_duration": 86400,
13
"duration": 0,
14
"status_callback_method": "POST",
15
"status_callback": null,
16
"record_participants_on_connect": false,
17
"video_codecs": [
18
"VP8"
19
],
20
"media_region": "us1",
21
"audio_only": false,
22
"empty_room_timeout": 5,
23
"unused_room_timeout": 5,
24
"end_time": "2015-07-30T20:00:00Z",
25
"large_room": false,
26
"url": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
27
"links": {
28
"participants": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants",
29
"recordings": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Recordings",
30
"recording_rules": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RecordingRules"
31
}
32
}

Example 2: Create a Peer-to-Peer Room called SalesMeeting with the Status Callback URL set

example-2-create-a-peer-to-peer-room-called-salesmeeting-with-the-status-callback-url-set page anchor
1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function createRoom() {
11
const room = await client.video.v1.rooms.create({
12
statusCallback: "http://example.org",
13
type: "peer-to-peer",
14
uniqueName: "SalesMeeting",
15
});
16
17
console.log(room.sid);
18
}
19
20
createRoom();

Output

1
{
2
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
3
"date_created": "2015-07-30T20:00:00Z",
4
"date_updated": "2015-07-30T20:00:00Z",
5
"status": "in-progress",
6
"type": "peer-to-peer",
7
"sid": "RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
8
"enable_turn": true,
9
"unique_name": "SalesMeeting",
10
"max_concurrent_published_tracks": 0,
11
"max_participants": 10,
12
"max_participant_duration": 86400,
13
"duration": 0,
14
"status_callback_method": "POST",
15
"status_callback": "http://example.org",
16
"record_participants_on_connect": false,
17
"video_codecs": [
18
"VP8"
19
],
20
"media_region": "us1",
21
"audio_only": false,
22
"empty_room_timeout": 5,
23
"unused_room_timeout": 5,
24
"end_time": "2015-07-30T20:00:00Z",
25
"large_room": false,
26
"url": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
27
"links": {
28
"participants": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants",
29
"recordings": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Recordings",
30
"recording_rules": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RecordingRules"
31
}
32
}

Example 3: Create a Group Room, enable Recording, and set a Status Callback URL

example-3-create-a-group-room-enable-recording-and-set-a-status-callback-url page anchor
Create a Group Room with recordings enabledLink to code sample: Create a Group Room with recordings enabled
1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function createRoom() {
11
const room = await client.video.v1.rooms.create({
12
recordParticipantsOnConnect: true,
13
statusCallback: "http://example.org",
14
type: "group",
15
uniqueName: "DailyStandup",
16
});
17
18
console.log(room.sid);
19
}
20
21
createRoom();

Output

1
{
2
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
3
"date_created": "2015-07-30T20:00:00Z",
4
"date_updated": "2015-07-30T20:00:00Z",
5
"status": "in-progress",
6
"type": "group",
7
"sid": "RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
8
"enable_turn": true,
9
"unique_name": "DailyStandup",
10
"max_participants": 50,
11
"max_participant_duration": 86400,
12
"max_concurrent_published_tracks": 170,
13
"duration": 0,
14
"status_callback_method": "POST",
15
"status_callback": "http://example.org",
16
"record_participants_on_connect": true,
17
"video_codecs": [
18
"VP8"
19
],
20
"media_region": "us1",
21
"audio_only": false,
22
"empty_room_timeout": 5,
23
"unused_room_timeout": 5,
24
"end_time": "2015-07-30T20:00:00Z",
25
"large_room": false,
26
"url": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
27
"links": {
28
"participants": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants",
29
"recordings": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Recordings",
30
"recording_rules": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RecordingRules"
31
}
32
}

Example 4: Create an Audio-Only Group Room

example-4-create-an-audio-only-group-room page anchor
1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function createRoom() {
11
const room = await client.video.v1.rooms.create({
12
audioOnly: true,
13
type: "group",
14
uniqueName: "Audio-Only Call",
15
});
16
17
console.log(room.sid);
18
}
19
20
createRoom();

Output

1
{
2
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
3
"date_created": "2015-07-30T20:00:00Z",
4
"date_updated": "2015-07-30T20:00:00Z",
5
"status": "in-progress",
6
"type": "group",
7
"sid": "RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
8
"enable_turn": true,
9
"unique_name": "Audio-Only Call",
10
"max_concurrent_published_tracks": 0,
11
"max_participants": 10,
12
"max_participant_duration": 86400,
13
"duration": 0,
14
"status_callback_method": "POST",
15
"status_callback": null,
16
"record_participants_on_connect": false,
17
"video_codecs": [
18
"VP8"
19
],
20
"media_region": "us1",
21
"audio_only": true,
22
"empty_room_timeout": 5,
23
"unused_room_timeout": 5,
24
"end_time": "2015-07-30T20:00:00Z",
25
"large_room": false,
26
"url": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
27
"links": {
28
"participants": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants",
29
"recordings": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Recordings",
30
"recording_rules": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RecordingRules"
31
}
32
}

Example 5: Create a Room with a 60 minute empty room timeout

example-5-create-a-room-with-a-60-minute-empty-room-timeout page anchor

By default, a Room will end five minutes after the last participant disconnects from the Room. You can configure this to be a different value up to 60 minutes when you create the Room via the REST API. The value is specified in minutes.

The example below demonstrates configuring the Room's empty room timeout value. Note that you can also configure with the Room's unused room timeout value in the same way. The unused room timeout determines how long to wait before ending the Room if no participants join.

Create a Room with a 60 Minute Empty Room TimeoutLink to code sample: Create a Room with a 60 Minute Empty Room Timeout
1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function createRoom() {
11
const room = await client.video.v1.rooms.create({
12
emptyRoomTimeout: 60,
13
uniqueName: "DailyStandup",
14
});
15
16
console.log(room.sid);
17
}
18
19
createRoom();

Output

1
{
2
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
3
"date_created": "2015-07-30T20:00:00Z",
4
"date_updated": "2015-07-30T20:00:00Z",
5
"status": "in-progress",
6
"type": "peer-to-peer",
7
"sid": "RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
8
"enable_turn": true,
9
"unique_name": "DailyStandup",
10
"max_concurrent_published_tracks": 0,
11
"max_participants": 10,
12
"max_participant_duration": 86400,
13
"duration": 0,
14
"status_callback_method": "POST",
15
"status_callback": null,
16
"record_participants_on_connect": false,
17
"video_codecs": [
18
"VP8"
19
],
20
"media_region": "us1",
21
"audio_only": false,
22
"empty_room_timeout": 60,
23
"unused_room_timeout": 5,
24
"end_time": "2015-07-30T20:00:00Z",
25
"large_room": false,
26
"url": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
27
"links": {
28
"participants": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants",
29
"recordings": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Recordings",
30
"recording_rules": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RecordingRules"
31
}
32
}

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:

1
Twilio.Video.connect('$AccessTokenContainingRoomName').then(function(room) {
2
console.log('Successfully joined a Room: ', room);
3
}, function(error) {
4
console.error('Unable to connect to Room: ' + error.message);
5
});

Returns a list of Room resources created in the given account. The list includes paging information.

The following GET query string parameters allow you to limit the list returned. Note, parameters are case-sensitive.

Property nameTypeRequiredPIIDescription
Statusenum<string>Optional

Read only the rooms with this status. Can be: in-progress (default) or completed

Possible values:
in-progresscompletedfailed

UniqueNamestringOptional

Read only rooms with the this unique_name.


DateCreatedAfterstring<date-time>Optional

Read only rooms that started on or after this date, given as YYYY-MM-DD.


DateCreatedBeforestring<date-time>Optional

Read only rooms that started before this date, given as YYYY-MM-DD.


PageSizeintegerOptional

How many resources to return in each list page. The default is 50, and the maximum is 1000.

Minimum: 1Maximum: 1000

PageintegerOptional

The page index. This value is simply for client state.

Minimum: 0

PageTokenstringOptional

The page token. This is provided by the API.

Filter Rooms by UniqueName

filter-by-unique-name page anchor
1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function listRoom() {
11
const rooms = await client.video.v1.rooms.list({
12
status: "completed",
13
uniqueName: "DailyStandup",
14
limit: 20,
15
});
16
17
rooms.forEach((r) => console.log(r.sid));
18
}
19
20
listRoom();

Output

1
{
2
"rooms": [],
3
"meta": {
4
"page": 0,
5
"page_size": 50,
6
"first_page_url": "https://video.twilio.com/v1/Rooms?PageSize=50&Page=0",
7
"previous_page_url": null,
8
"url": "https://video.twilio.com/v1/Rooms?PageSize=50&Page=0",
9
"next_page_url": null,
10
"key": "rooms"
11
}
12
}

Returns a list containing any completed Rooms with the name DailyStandup. Note that the status parameter defaults to in-progress. If no status is provided, this endpoint will return a list containing only in-progress rooms with the name DailyStandup.

Filter Rooms by Status

filter-by-status page anchor
1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function listRoom() {
11
const rooms = await client.video.v1.rooms.list({
12
status: "completed",
13
limit: 20,
14
});
15
16
rooms.forEach((r) => console.log(r.sid));
17
}
18
19
listRoom();

Output

1
{
2
"rooms": [],
3
"meta": {
4
"page": 0,
5
"page_size": 50,
6
"first_page_url": "https://video.twilio.com/v1/Rooms?PageSize=50&Page=0",
7
"previous_page_url": null,
8
"url": "https://video.twilio.com/v1/Rooms?PageSize=50&Page=0",
9
"next_page_url": null,
10
"key": "rooms"
11
}
12
}

Using multiple list filters

multiple-list-filters page anchor
1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function listRoom() {
11
const rooms = await client.video.v1.rooms.list({
12
status: "completed",
13
uniqueName: "DailyStandup",
14
limit: 20,
15
});
16
17
rooms.forEach((r) => console.log(r.sid));
18
}
19
20
listRoom();

Output

1
{
2
"rooms": [],
3
"meta": {
4
"page": 0,
5
"page_size": 50,
6
"first_page_url": "https://video.twilio.com/v1/Rooms?PageSize=50&Page=0",
7
"previous_page_url": null,
8
"url": "https://video.twilio.com/v1/Rooms?PageSize=50&Page=0",
9
"next_page_url": null,
10
"key": "rooms"
11
}
12
}
Configure the maximum Participant durationLink to code sample: Configure the maximum Participant duration
1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function createRoom() {
11
const room = await client.video.v1.rooms.create({
12
maxParticipantDuration: 86400,
13
uniqueName: "DailyStandup",
14
});
15
16
console.log(room.sid);
17
}
18
19
createRoom();

Output

1
{
2
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
3
"date_created": "2015-07-30T20:00:00Z",
4
"date_updated": "2015-07-30T20:00:00Z",
5
"status": "in-progress",
6
"type": "peer-to-peer",
7
"sid": "RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
8
"enable_turn": true,
9
"unique_name": "DailyStandup",
10
"max_concurrent_published_tracks": 0,
11
"max_participants": 10,
12
"max_participant_duration": 86400,
13
"duration": 0,
14
"status_callback_method": "POST",
15
"status_callback": null,
16
"record_participants_on_connect": false,
17
"video_codecs": [
18
"VP8"
19
],
20
"media_region": "us1",
21
"audio_only": false,
22
"empty_room_timeout": 5,
23
"unused_room_timeout": 5,
24
"end_time": "2015-07-30T20:00:00Z",
25
"large_room": false,
26
"url": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
27
"links": {
28
"participants": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants",
29
"recordings": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Recordings",
30
"recording_rules": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RecordingRules"
31
}
32
}

Need some help?

Terms of service

Copyright © 2024 Twilio Inc.