Skip to contentSkip to navigationSkip to topbar
Rate this page:
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.


_10
https://video.twilio.com

Contents

contents page anchor


_10
/v1/Rooms/{RoomNameOrSid}

Property nameTypePIIDescription
sidSID<RM>
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>

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

Possible values:
in-progresscompletedfailed

date_createdstring<date-time>

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>

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>

The SID of the Account that created the Room resource.

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

enable_turnboolean

Deprecated, now always considered to be true.


unique_namestring

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>

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>

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>

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


durationinteger

The duration of the room in seconds.


typeenum<string>

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_participantsinteger

The maximum number of concurrent Participants allowed in the room.


max_participant_durationinteger

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


max_concurrent_published_tracksinteger

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_connectboolean

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


video_codecsarray[enum<string>]

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_regionstring

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_onlyboolean

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_timeoutinteger

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.


unused_room_timeoutinteger

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.


large_roomboolean

Indicates if this is a large room.


urlstring<uri>

The absolute URL of the resource.


linksobject<uri-map>

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:


_10
GET /Rooms/DailyStandup

Retrieve an in-progress Room instance by UniqueName

retrieve-an-in-progress-room-instance-by-uniquename page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_16
// Download the helper library from https://www.twilio.com/docs/node/install
_16
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_16
_16
// Find your Account SID and Auth Token at twilio.com/console
_16
// and set the environment variables. See http://twil.io/secure
_16
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_16
const authToken = process.env.TWILIO_AUTH_TOKEN;
_16
const client = twilio(accountSid, authToken);
_16
_16
async function fetchRoom() {
_16
const room = await client.video.v1.rooms("DailyStandup").fetch();
_16
_16
console.log(room.sid);
_16
}
_16
_16
fetchRoom();

Output

_32
{
_32
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_32
"date_created": "2015-07-30T20:00:00Z",
_32
"date_updated": "2015-07-30T20:00:00Z",
_32
"status": "in-progress",
_32
"type": "peer-to-peer",
_32
"sid": "DailyStandup",
_32
"enable_turn": true,
_32
"unique_name": "unique_name",
_32
"max_participants": 10,
_32
"max_participant_duration": 86400,
_32
"max_concurrent_published_tracks": 0,
_32
"duration": 0,
_32
"status_callback_method": "POST",
_32
"status_callback": null,
_32
"record_participants_on_connect": false,
_32
"video_codecs": [
_32
"VP8"
_32
],
_32
"audio_only": false,
_32
"media_region": "us1",
_32
"empty_room_timeout": 5,
_32
"unused_room_timeout": 5,
_32
"end_time": "2015-07-30T20:00:00Z",
_32
"large_room": false,
_32
"url": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_32
"links": {
_32
"participants": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants",
_32
"recordings": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Recordings",
_32
"recording_rules": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RecordingRules"
_32
}
_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:


_10
GET /Rooms/RMxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Retrieve an in-progress or completed Room instance by RoomSid

retrieve-an-in-progress-or-completed-room-instance-by-roomsid page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_18
// Download the helper library from https://www.twilio.com/docs/node/install
_18
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_18
_18
// Find your Account SID and Auth Token at twilio.com/console
_18
// and set the environment variables. See http://twil.io/secure
_18
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_18
const authToken = process.env.TWILIO_AUTH_TOKEN;
_18
const client = twilio(accountSid, authToken);
_18
_18
async function fetchRoom() {
_18
const room = await client.video.v1
_18
.rooms("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
_18
.fetch();
_18
_18
console.log(room.sid);
_18
}
_18
_18
fetchRoom();

Output

_32
{
_32
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_32
"date_created": "2015-07-30T20:00:00Z",
_32
"date_updated": "2015-07-30T20:00:00Z",
_32
"status": "in-progress",
_32
"type": "peer-to-peer",
_32
"sid": "RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_32
"enable_turn": true,
_32
"unique_name": "unique_name",
_32
"max_participants": 10,
_32
"max_participant_duration": 86400,
_32
"max_concurrent_published_tracks": 0,
_32
"duration": 0,
_32
"status_callback_method": "POST",
_32
"status_callback": null,
_32
"record_participants_on_connect": false,
_32
"video_codecs": [
_32
"VP8"
_32
],
_32
"audio_only": false,
_32
"media_region": "us1",
_32
"empty_room_timeout": 5,
_32
"unused_room_timeout": 5,
_32
"end_time": "2015-07-30T20:00:00Z",
_32
"large_room": false,
_32
"url": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_32
"links": {
_32
"participants": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants",
_32
"recordings": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Recordings",
_32
"recording_rules": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RecordingRules"
_32
}
_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.

Property nameTypeRequiredPIIDescription
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.

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_18
// Download the helper library from https://www.twilio.com/docs/node/install
_18
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_18
_18
// Find your Account SID and Auth Token at twilio.com/console
_18
// and set the environment variables. See http://twil.io/secure
_18
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_18
const authToken = process.env.TWILIO_AUTH_TOKEN;
_18
const client = twilio(accountSid, authToken);
_18
_18
async function updateRoom() {
_18
const room = await client.video.v1
_18
.rooms("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
_18
.update({ status: "completed" });
_18
_18
console.log(room.sid);
_18
}
_18
_18
updateRoom();

Output

_32
{
_32
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_32
"date_created": "2015-07-30T20:00:00Z",
_32
"date_updated": "2015-07-30T20:00:00Z",
_32
"status": "completed",
_32
"type": "peer-to-peer",
_32
"sid": "RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_32
"enable_turn": true,
_32
"unique_name": "unique_name",
_32
"max_participants": 10,
_32
"max_participant_duration": 86400,
_32
"max_concurrent_published_tracks": 10,
_32
"status_callback_method": "POST",
_32
"status_callback": null,
_32
"record_participants_on_connect": false,
_32
"video_codecs": [
_32
"VP8"
_32
],
_32
"media_region": "us1",
_32
"audio_only": false,
_32
"empty_room_timeout": 5,
_32
"unused_room_timeout": 5,
_32
"end_time": "2015-07-30T20:00:00Z",
_32
"large_room": false,
_32
"duration": 10,
_32
"url": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_32
"links": {
_32
"participants": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants",
_32
"recordings": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Recordings",
_32
"recording_rules": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RecordingRules"
_32
}
_32
}



_10
/v1/Rooms

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

Supported POST parameters

post-parameters page anchor
Property nameTypeRequiredPIIDescription
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
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_18
// Download the helper library from https://www.twilio.com/docs/node/install
_18
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_18
_18
// Find your Account SID and Auth Token at twilio.com/console
_18
// and set the environment variables. See http://twil.io/secure
_18
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_18
const authToken = process.env.TWILIO_AUTH_TOKEN;
_18
const client = twilio(accountSid, authToken);
_18
_18
async function createRoom() {
_18
const room = await client.video.v1.rooms.create({
_18
uniqueName: "DailyStandup",
_18
});
_18
_18
console.log(room.sid);
_18
}
_18
_18
createRoom();

Output

_32
{
_32
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_32
"date_created": "2015-07-30T20:00:00Z",
_32
"date_updated": "2015-07-30T20:00:00Z",
_32
"status": "in-progress",
_32
"type": "peer-to-peer",
_32
"sid": "RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_32
"enable_turn": true,
_32
"unique_name": "DailyStandup",
_32
"max_concurrent_published_tracks": 0,
_32
"max_participants": 10,
_32
"max_participant_duration": 86400,
_32
"duration": 0,
_32
"status_callback_method": "POST",
_32
"status_callback": null,
_32
"record_participants_on_connect": false,
_32
"video_codecs": [
_32
"VP8"
_32
],
_32
"media_region": "us1",
_32
"audio_only": false,
_32
"empty_room_timeout": 5,
_32
"unused_room_timeout": 5,
_32
"end_time": "2015-07-30T20:00:00Z",
_32
"large_room": false,
_32
"url": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_32
"links": {
_32
"participants": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants",
_32
"recordings": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Recordings",
_32
"recording_rules": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RecordingRules"
_32
}
_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

Create a Peer-to-Peer Room

create-a-peer-to-peer-room page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_20
// Download the helper library from https://www.twilio.com/docs/node/install
_20
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_20
_20
// Find your Account SID and Auth Token at twilio.com/console
_20
// and set the environment variables. See http://twil.io/secure
_20
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_20
const authToken = process.env.TWILIO_AUTH_TOKEN;
_20
const client = twilio(accountSid, authToken);
_20
_20
async function createRoom() {
_20
const room = await client.video.v1.rooms.create({
_20
statusCallback: "http://example.org",
_20
type: "peer-to-peer",
_20
uniqueName: "SalesMeeting",
_20
});
_20
_20
console.log(room.sid);
_20
}
_20
_20
createRoom();

Output

_32
{
_32
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_32
"date_created": "2015-07-30T20:00:00Z",
_32
"date_updated": "2015-07-30T20:00:00Z",
_32
"status": "in-progress",
_32
"type": "peer-to-peer",
_32
"sid": "RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_32
"enable_turn": true,
_32
"unique_name": "SalesMeeting",
_32
"max_concurrent_published_tracks": 0,
_32
"max_participants": 10,
_32
"max_participant_duration": 86400,
_32
"duration": 0,
_32
"status_callback_method": "POST",
_32
"status_callback": "http://example.org",
_32
"record_participants_on_connect": false,
_32
"video_codecs": [
_32
"VP8"
_32
],
_32
"media_region": "us1",
_32
"audio_only": false,
_32
"empty_room_timeout": 5,
_32
"unused_room_timeout": 5,
_32
"end_time": "2015-07-30T20:00:00Z",
_32
"large_room": false,
_32
"url": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_32
"links": {
_32
"participants": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants",
_32
"recordings": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Recordings",
_32
"recording_rules": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RecordingRules"
_32
}
_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 enabled

create-a-group-room-with-recordings-enabled page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_21
// Download the helper library from https://www.twilio.com/docs/node/install
_21
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_21
_21
// Find your Account SID and Auth Token at twilio.com/console
_21
// and set the environment variables. See http://twil.io/secure
_21
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_21
const authToken = process.env.TWILIO_AUTH_TOKEN;
_21
const client = twilio(accountSid, authToken);
_21
_21
async function createRoom() {
_21
const room = await client.video.v1.rooms.create({
_21
recordParticipantsOnConnect: true,
_21
statusCallback: "http://example.org",
_21
type: "group",
_21
uniqueName: "DailyStandup",
_21
});
_21
_21
console.log(room.sid);
_21
}
_21
_21
createRoom();

Output

_32
{
_32
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_32
"date_created": "2015-07-30T20:00:00Z",
_32
"date_updated": "2015-07-30T20:00:00Z",
_32
"status": "in-progress",
_32
"type": "group",
_32
"sid": "RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_32
"enable_turn": true,
_32
"unique_name": "DailyStandup",
_32
"max_participants": 50,
_32
"max_participant_duration": 86400,
_32
"max_concurrent_published_tracks": 170,
_32
"duration": 0,
_32
"status_callback_method": "POST",
_32
"status_callback": "http://example.org",
_32
"record_participants_on_connect": true,
_32
"video_codecs": [
_32
"VP8"
_32
],
_32
"media_region": "us1",
_32
"audio_only": false,
_32
"empty_room_timeout": 5,
_32
"unused_room_timeout": 5,
_32
"end_time": "2015-07-30T20:00:00Z",
_32
"large_room": false,
_32
"url": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_32
"links": {
_32
"participants": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants",
_32
"recordings": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Recordings",
_32
"recording_rules": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RecordingRules"
_32
}
_32
}

Example 4: Create an Audio-Only Group Room

example-4-create-an-audio-only-group-room page anchor

Create an Audio-Only Group Room

create-an-audio-only-group-room page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_20
// Download the helper library from https://www.twilio.com/docs/node/install
_20
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_20
_20
// Find your Account SID and Auth Token at twilio.com/console
_20
// and set the environment variables. See http://twil.io/secure
_20
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_20
const authToken = process.env.TWILIO_AUTH_TOKEN;
_20
const client = twilio(accountSid, authToken);
_20
_20
async function createRoom() {
_20
const room = await client.video.v1.rooms.create({
_20
audioOnly: true,
_20
type: "group",
_20
uniqueName: "Audio-Only Call",
_20
});
_20
_20
console.log(room.sid);
_20
}
_20
_20
createRoom();

Output

_32
{
_32
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_32
"date_created": "2015-07-30T20:00:00Z",
_32
"date_updated": "2015-07-30T20:00:00Z",
_32
"status": "in-progress",
_32
"type": "group",
_32
"sid": "RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_32
"enable_turn": true,
_32
"unique_name": "Audio-Only Call",
_32
"max_concurrent_published_tracks": 0,
_32
"max_participants": 10,
_32
"max_participant_duration": 86400,
_32
"duration": 0,
_32
"status_callback_method": "POST",
_32
"status_callback": null,
_32
"record_participants_on_connect": false,
_32
"video_codecs": [
_32
"VP8"
_32
],
_32
"media_region": "us1",
_32
"audio_only": true,
_32
"empty_room_timeout": 5,
_32
"unused_room_timeout": 5,
_32
"end_time": "2015-07-30T20:00:00Z",
_32
"large_room": false,
_32
"url": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_32
"links": {
_32
"participants": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants",
_32
"recordings": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Recordings",
_32
"recording_rules": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RecordingRules"
_32
}
_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 Timeout

create-a-room-with-a-60-minute-empty-room-timeout page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_19
// Download the helper library from https://www.twilio.com/docs/node/install
_19
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_19
_19
// Find your Account SID and Auth Token at twilio.com/console
_19
// and set the environment variables. See http://twil.io/secure
_19
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_19
const authToken = process.env.TWILIO_AUTH_TOKEN;
_19
const client = twilio(accountSid, authToken);
_19
_19
async function createRoom() {
_19
const room = await client.video.v1.rooms.create({
_19
emptyRoomTimeout: 60,
_19
uniqueName: "DailyStandup",
_19
});
_19
_19
console.log(room.sid);
_19
}
_19
_19
createRoom();

Output

_32
{
_32
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_32
"date_created": "2015-07-30T20:00:00Z",
_32
"date_updated": "2015-07-30T20:00:00Z",
_32
"status": "in-progress",
_32
"type": "peer-to-peer",
_32
"sid": "RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_32
"enable_turn": true,
_32
"unique_name": "DailyStandup",
_32
"max_concurrent_published_tracks": 0,
_32
"max_participants": 10,
_32
"max_participant_duration": 86400,
_32
"duration": 0,
_32
"status_callback_method": "POST",
_32
"status_callback": null,
_32
"record_participants_on_connect": false,
_32
"video_codecs": [
_32
"VP8"
_32
],
_32
"media_region": "us1",
_32
"audio_only": false,
_32
"empty_room_timeout": 60,
_32
"unused_room_timeout": 5,
_32
"end_time": "2015-07-30T20:00:00Z",
_32
"large_room": false,
_32
"url": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_32
"links": {
_32
"participants": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants",
_32
"recordings": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Recordings",
_32
"recording_rules": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RecordingRules"
_32
}
_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:


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

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

Retrieve a list of Rooms by UniqueName

retrieve-a-list-of-rooms-by-uniquename page anchor

Retrieve a list of completed Rooms by UniqueName

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_20
// Download the helper library from https://www.twilio.com/docs/node/install
_20
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_20
_20
// Find your Account SID and Auth Token at twilio.com/console
_20
// and set the environment variables. See http://twil.io/secure
_20
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_20
const authToken = process.env.TWILIO_AUTH_TOKEN;
_20
const client = twilio(accountSid, authToken);
_20
_20
async function listRoom() {
_20
const rooms = await client.video.v1.rooms.list({
_20
status: "completed",
_20
uniqueName: "DailyStandup",
_20
limit: 20,
_20
});
_20
_20
rooms.forEach((r) => console.log(r.sid));
_20
}
_20
_20
listRoom();

Output

_12
{
_12
"rooms": [],
_12
"meta": {
_12
"page": 0,
_12
"page_size": 50,
_12
"first_page_url": "https://video.twilio.com/v1/Rooms?PageSize=50&Page=0",
_12
"previous_page_url": null,
_12
"url": "https://video.twilio.com/v1/Rooms?PageSize=50&Page=0",
_12
"next_page_url": null,
_12
"key": "rooms"
_12
}
_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

Retrieve a list of Rooms by Status

retrieve-a-list-of-rooms-by-status page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_19
// Download the helper library from https://www.twilio.com/docs/node/install
_19
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_19
_19
// Find your Account SID and Auth Token at twilio.com/console
_19
// and set the environment variables. See http://twil.io/secure
_19
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_19
const authToken = process.env.TWILIO_AUTH_TOKEN;
_19
const client = twilio(accountSid, authToken);
_19
_19
async function listRoom() {
_19
const rooms = await client.video.v1.rooms.list({
_19
status: "completed",
_19
limit: 20,
_19
});
_19
_19
rooms.forEach((r) => console.log(r.sid));
_19
}
_19
_19
listRoom();

Output

_12
{
_12
"rooms": [],
_12
"meta": {
_12
"page": 0,
_12
"page_size": 50,
_12
"first_page_url": "https://video.twilio.com/v1/Rooms?PageSize=50&Page=0",
_12
"previous_page_url": null,
_12
"url": "https://video.twilio.com/v1/Rooms?PageSize=50&Page=0",
_12
"next_page_url": null,
_12
"key": "rooms"
_12
}
_12
}

Using multiple list filters

multiple-list-filters page anchor

Retrieve a list of completed Rooms

retrieve-a-list-of-completed-rooms page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_20
// Download the helper library from https://www.twilio.com/docs/node/install
_20
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_20
_20
// Find your Account SID and Auth Token at twilio.com/console
_20
// and set the environment variables. See http://twil.io/secure
_20
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_20
const authToken = process.env.TWILIO_AUTH_TOKEN;
_20
const client = twilio(accountSid, authToken);
_20
_20
async function listRoom() {
_20
const rooms = await client.video.v1.rooms.list({
_20
status: "completed",
_20
uniqueName: "DailyStandup",
_20
limit: 20,
_20
});
_20
_20
rooms.forEach((r) => console.log(r.sid));
_20
}
_20
_20
listRoom();

Output

_12
{
_12
"rooms": [],
_12
"meta": {
_12
"page": 0,
_12
"page_size": 50,
_12
"first_page_url": "https://video.twilio.com/v1/Rooms?PageSize=50&Page=0",
_12
"previous_page_url": null,
_12
"url": "https://video.twilio.com/v1/Rooms?PageSize=50&Page=0",
_12
"next_page_url": null,
_12
"key": "rooms"
_12
}
_12
}

Configure the maximum Participant duration

configure-the-maximum-participant-duration page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_19
// Download the helper library from https://www.twilio.com/docs/node/install
_19
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_19
_19
// Find your Account SID and Auth Token at twilio.com/console
_19
// and set the environment variables. See http://twil.io/secure
_19
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_19
const authToken = process.env.TWILIO_AUTH_TOKEN;
_19
const client = twilio(accountSid, authToken);
_19
_19
async function createRoom() {
_19
const room = await client.video.v1.rooms.create({
_19
maxParticipantDuration: 86400,
_19
uniqueName: "DailyStandup",
_19
});
_19
_19
console.log(room.sid);
_19
}
_19
_19
createRoom();

Output

_32
{
_32
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_32
"date_created": "2015-07-30T20:00:00Z",
_32
"date_updated": "2015-07-30T20:00:00Z",
_32
"status": "in-progress",
_32
"type": "peer-to-peer",
_32
"sid": "RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_32
"enable_turn": true,
_32
"unique_name": "DailyStandup",
_32
"max_concurrent_published_tracks": 0,
_32
"max_participants": 10,
_32
"max_participant_duration": 86400,
_32
"duration": 0,
_32
"status_callback_method": "POST",
_32
"status_callback": null,
_32
"record_participants_on_connect": false,
_32
"video_codecs": [
_32
"VP8"
_32
],
_32
"media_region": "us1",
_32
"audio_only": false,
_32
"empty_room_timeout": 5,
_32
"unused_room_timeout": 5,
_32
"end_time": "2015-07-30T20:00:00Z",
_32
"large_room": false,
_32
"url": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_32
"links": {
_32
"participants": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants",
_32
"recordings": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Recordings",
_32
"recording_rules": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RecordingRules"
_32
}
_32
}


Rate this page: