Synchronously create a Room.
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const room = await client.rooms.create();
console.log(room.data);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
room = client.rooms.create()
print(room.data)
package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
room, err := client.Rooms.New(context.TODO(), telnyx.RoomNewParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", room.Data)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.rooms.RoomCreateParams;
import com.telnyx.sdk.models.rooms.RoomCreateResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
RoomCreateResponse room = client.rooms().create();
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
room = telnyx.rooms.create
puts(room)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$room = $client->rooms->create(
enableRecording: true,
maxParticipants: 10,
uniqueName: 'My room',
webhookEventFailoverURL: 'https://failover.example.com',
webhookEventURL: 'https://example.com',
webhookTimeoutSecs: 25,
);
var_dump($room);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx rooms create \
--api-key 'My API Key'curl --request POST \
--url https://api.telnyx.com/v2/rooms \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"unique_name": "My room",
"max_participants": 10,
"enable_recording": true,
"webhook_event_url": "https://example.com",
"webhook_event_failover_url": "https://failover.example.com",
"webhook_timeout_secs": 25
}
'{
"data": {
"id": "7b61621f-62e0-4aad-ab11-9fd19e272e73",
"max_participants": 50,
"unique_name": "My Room",
"created_at": "2021-04-16T09:46:20.954863Z",
"updated_at": "2021-04-16T10:24:55.962200Z",
"active_session_id": "7b61621f-62e0-4aad-ab11-9fd19e272e74",
"enable_recording": true,
"webhook_event_failover_url": "https://failover.example.com",
"webhook_timeout_secs": 25,
"webhook_event_url": "https://www.example.com",
"sessions": [
{
"id": "7b61621f-62e0-4aad-ab11-9fd19e272e74",
"room_id": "7b61621f-62e0-4aad-ab11-9fd19e272e73",
"active": true,
"created_at": "2021-04-16T09:46:20.954863Z",
"updated_at": "2021-04-16T10:24:55.962200Z",
"participants": [],
"record_type": "room_session"
}
],
"record_type": "room"
}
}{
"errors": [
{
"code": "10027",
"title": "Unprocessable Entity",
"detail": "The server understood the syntax of the request but was unable to process the instructions."
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
Parameters that can be defined during room creation.
The unique (within the Telnyx account scope) name of the room.
"My room"
The maximum amount of participants allowed in a room. If new participants try to join after that limit is reached, their request will be rejected.
2 <= x <= 5010
Enable or disable recording for that room.
true
The URL where webhooks related to this room will be sent. Must include a scheme, such as 'https'.
"https://example.com"
The failover URL where webhooks related to this room will be sent if sending to the primary URL fails. Must include a scheme, such as 'https'.
"https://failover.example.com"
Specifies how many seconds to wait before timing out a webhook.
0 <= x <= 3025
Response
Create room response.
Show child attributes
Show child attributes
{ "id": "7b61621f-62e0-4aad-ab11-9fd19e272e73", "max_participants": 50, "unique_name": "My Room", "created_at": "2021-04-16T09:46:20.954863Z", "updated_at": "2021-04-16T10:24:55.962200Z", "active_session_id": "7b61621f-62e0-4aad-ab11-9fd19e272e74", "enable_recording": true, "webhook_event_failover_url": "https://failover.example.com", "webhook_timeout_secs": 25, "webhook_event_url": "https://www.example.com", "sessions": [ { "id": "7b61621f-62e0-4aad-ab11-9fd19e272e74", "room_id": "7b61621f-62e0-4aad-ab11-9fd19e272e73", "active": true, "created_at": "2021-04-16T09:46:20.954863Z", "updated_at": "2021-04-16T10:24:55.962200Z", "participants": [], "record_type": "room_session" } ], "record_type": "room" }
Was this page helpful?
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const room = await client.rooms.create();
console.log(room.data);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
room = client.rooms.create()
print(room.data)
package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
room, err := client.Rooms.New(context.TODO(), telnyx.RoomNewParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", room.Data)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.rooms.RoomCreateParams;
import com.telnyx.sdk.models.rooms.RoomCreateResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
RoomCreateResponse room = client.rooms().create();
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
room = telnyx.rooms.create
puts(room)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$room = $client->rooms->create(
enableRecording: true,
maxParticipants: 10,
uniqueName: 'My room',
webhookEventFailoverURL: 'https://failover.example.com',
webhookEventURL: 'https://example.com',
webhookTimeoutSecs: 25,
);
var_dump($room);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx rooms create \
--api-key 'My API Key'curl --request POST \
--url https://api.telnyx.com/v2/rooms \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"unique_name": "My room",
"max_participants": 10,
"enable_recording": true,
"webhook_event_url": "https://example.com",
"webhook_event_failover_url": "https://failover.example.com",
"webhook_timeout_secs": 25
}
'{
"data": {
"id": "7b61621f-62e0-4aad-ab11-9fd19e272e73",
"max_participants": 50,
"unique_name": "My Room",
"created_at": "2021-04-16T09:46:20.954863Z",
"updated_at": "2021-04-16T10:24:55.962200Z",
"active_session_id": "7b61621f-62e0-4aad-ab11-9fd19e272e74",
"enable_recording": true,
"webhook_event_failover_url": "https://failover.example.com",
"webhook_timeout_secs": 25,
"webhook_event_url": "https://www.example.com",
"sessions": [
{
"id": "7b61621f-62e0-4aad-ab11-9fd19e272e74",
"room_id": "7b61621f-62e0-4aad-ab11-9fd19e272e73",
"active": true,
"created_at": "2021-04-16T09:46:20.954863Z",
"updated_at": "2021-04-16T10:24:55.962200Z",
"participants": [],
"record_type": "room_session"
}
],
"record_type": "room"
}
}{
"errors": [
{
"code": "10027",
"title": "Unprocessable Entity",
"detail": "The server understood the syntax of the request but was unable to process the instructions."
}
]
}