> ## Documentation Index
> Fetch the complete documentation index at: https://developers.telnyx.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a room.

> Synchronously create a Room.



## OpenAPI

````yaml https://telnyx-openapi-ng.s3.us-east-1.amazonaws.com/real-time-communications/video.yml post /rooms
openapi: 3.1.0
info:
  title: Telnyx Video API
  version: 2.0.0
  description: API for Video.
  contact:
    email: support@telnyx.com
servers:
  - url: https://api.telnyx.com/v2
security:
  - bearerAuth: []
paths:
  /rooms:
    post:
      tags:
        - Rooms
      summary: Create a room.
      description: Synchronously create a Room.
      operationId: CreateRoom
      requestBody:
        description: Parameters that can be defined during room creation.
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateRoomRequest'
      responses:
        '201':
          $ref: '#/components/responses/CreateRoomResponse'
        '422':
          $ref: '#/components/responses/video_UnprocessableEntity'
      x-codeSamples:
        - lang: JavaScript
          source: |-
            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);
        - lang: Python
          source: |-
            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)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/team-telnyx/telnyx-go\"\n\t\"github.com/team-telnyx/telnyx-go/option\"\n)\n\nfunc main() {\n\tclient := telnyx.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\troom, err := client.Rooms.New(context.TODO(), telnyx.RoomNewParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", room.Data)\n}\n"
        - lang: Java
          source: |-
            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();
                }
            }
        - lang: Ruby
          source: |-
            require "telnyx"

            telnyx = Telnyx::Client.new(api_key: "My API Key")

            room = telnyx.rooms.create

            puts(room)
        - lang: PHP
          source: >-
            <?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();
            }
        - lang: CLI
          source: |-
            telnyx rooms create \
              --api-key 'My API Key'
components:
  schemas:
    CreateRoomRequest:
      type: object
      properties:
        unique_name:
          description: The unique (within the Telnyx account scope) name of the room.
          type: string
          example: My room
        max_participants:
          description: >-
            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.
          type: integer
          example: 10
          default: 10
          minimum: 2
          maximum: 50
        enable_recording:
          description: Enable or disable recording for that room.
          type: boolean
          example: true
          default: false
        webhook_event_url:
          type: string
          format: uri
          description: >-
            The URL where webhooks related to this room will be sent. Must
            include a scheme, such as 'https'.
          example: https://example.com
        webhook_event_failover_url:
          type: string
          format: uri
          description: >-
            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'.
          example: https://failover.example.com
          default: ''
        webhook_timeout_secs:
          type: integer
          minimum: 0
          maximum: 30
          description: Specifies how many seconds to wait before timing out a webhook.
          example: 25
          default: null
    Room:
      type: object
      properties:
        id:
          description: A unique identifier for the room.
          type: string
          format: uuid
          example: 0ccc7b54-4df3-4bca-a65a-3da1ecc777f0
        max_participants:
          description: Maximum participants allowed in the room.
          type: integer
          example: 50
        unique_name:
          description: The unique (within the Telnyx account scope) name of the room.
          type: string
          example: My room
        created_at:
          description: ISO 8601 timestamp when the room was created.
          type: string
          format: date-time
          example: '2021-03-26T17:51:59.588408Z'
        updated_at:
          description: ISO 8601 timestamp when the room was updated.
          type: string
          format: date-time
          example: '2021-03-26T17:51:59.588408Z'
        active_session_id:
          description: The identifier of the active room session if any.
          type: string
          format: uuid
          example: 0ccc7b54-4df3-4bca-a65a-3da1ecc777f0
        sessions:
          type: array
          items:
            $ref: '#/components/schemas/RoomSession'
        enable_recording:
          description: Enable or disable recording for that room.
          type: boolean
          example: true
          default: false
        webhook_event_url:
          type: string
          format: uri
          description: >-
            The URL where webhooks related to this room will be sent. Must
            include a scheme, such as 'https'.
          example: https://example.com
        webhook_event_failover_url:
          type: string
          format: uri
          description: >-
            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'.
          example: https://failover.example.com
          default: ''
        webhook_timeout_secs:
          type: integer
          minimum: 0
          maximum: 30
          description: Specifies how many seconds to wait before timing out a webhook.
          example: 25
          default: null
        record_type:
          type: string
          example: room
          readOnly: true
      example:
        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
    video_Errors:
      properties:
        errors:
          type: array
          items:
            $ref: '#/components/schemas/video_Error'
      type: object
    RoomSession:
      type: object
      properties:
        id:
          description: A unique identifier for the room session.
          type: string
          format: uuid
          example: 0ccc7b54-4df3-4bca-a65a-3da1ecc777f0
        room_id:
          description: Identify the room hosting that room session.
          type: string
          format: uuid
          example: 0ccc7b54-4df3-4bca-a65a-3da1ecc777b0
        active:
          description: Shows if the room session is active or not.
          type: boolean
          example: false
        created_at:
          description: ISO 8601 timestamp when the room session was created.
          type: string
          format: date-time
          example: '2021-03-26T17:51:59.588408Z'
        updated_at:
          description: ISO 8601 timestamp when the room session was updated.
          type: string
          format: date-time
          example: '2021-03-26T17:51:59.588408Z'
        ended_at:
          description: ISO 8601 timestamp when the room session has ended.
          type: string
          format: date-time
          example: '2021-03-26T17:51:59.588408Z'
        participants:
          type: array
          items:
            $ref: '#/components/schemas/RoomParticipant'
        record_type:
          type: string
          example: room_session
          readOnly: true
      example:
        id: 7b61621f-62e0-4aad-ab11-9fd19e272e73
        room_id: 7b61621f-5fe4-4aad-ab11-9fd19e272e73
        active: false
        created_at: '2021-04-16T09:46:20.954863Z'
        updated_at: '2021-04-16T10:24:55.962200Z'
        ended_at: '2021-04-16T10:24:55.962200Z'
        participants: []
        record_type: room_session
    video_Error:
      required:
        - code
        - title
      properties:
        code:
          type: string
        title:
          type: string
        detail:
          type: string
        source:
          type: object
          properties:
            pointer:
              description: JSON pointer (RFC6901) to the offending entity.
              type: string
            parameter:
              description: Indicates which query parameter caused the error.
              type: string
        meta:
          type: object
          additionalProperties: true
      type: object
    RoomParticipant:
      type: object
      properties:
        id:
          description: A unique identifier for the room participant.
          type: string
          format: uuid
          example: 0ccc7b54-4df3-4bca-a65a-3da1ecc777f0
        session_id:
          description: Identify the room session that participant is part of.
          type: string
          format: uuid
          example: 0ccc7b54-4df3-4bca-a65a-3da1ecc777b0
        context:
          description: Context provided to the given participant through the client SDK
          type: string
          example: Alice
        joined_at:
          description: ISO 8601 timestamp when the participant joined the session.
          type: string
          format: date-time
          example: '2021-03-26T17:51:59.588408Z'
        updated_at:
          description: ISO 8601 timestamp when the participant was updated.
          type: string
          format: date-time
          example: '2021-03-26T17:51:59.588408Z'
        left_at:
          description: ISO 8601 timestamp when the participant left the session.
          type: string
          format: date-time
          example: '2021-03-26T17:51:59.588408Z'
        record_type:
          type: string
          example: room_participant
          readOnly: true
      example:
        id: 7b61621f-62e0-4aad-ab11-9fd19e272e73
        session_id: 7b61621f-5fe4-4aad-ab11-9fd19e272e73
        context: Alice
        joined_at: '2021-04-16T09:46:20.954863Z'
        updated_at: '2021-04-16T10:24:55.962200Z'
        left_at: '2021-04-16T10:24:55.962200Z'
        record_type: room_participant
  responses:
    CreateRoomResponse:
      description: Create room response.
      content:
        application/json:
          schema:
            type: object
            properties:
              data:
                $ref: '#/components/schemas/Room'
    video_UnprocessableEntity:
      description: Unprocessable entity. Check the 'detail' field in response for details.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/video_Errors'
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http

````