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

# Create Room

> Create live rooms and retrieve broadcaster data with the current SDK room APIs.

Create a room before you publish it to a feed or connect a broadcaster. Room creation stores the room record and initial configuration; creating the feed post and connecting the media layer are separate steps.

<Note>
  Flutter does not currently expose a public room broadcasting repository in the audited SDK source. Use TypeScript, iOS, Android, or a backend-supported flow when your product needs to create rooms.
</Note>

## Parameters

| Parameter         | Required                                                                                   | Platform support         | Description                                                                                                                           |
| ----------------- | ------------------------------------------------------------------------------------------ | ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------- |
| `title`           | TypeScript and Android: yes. iOS initializer accepts `nil`; send a title for usable rooms. | TypeScript, iOS, Android | Room title shown in your product experience.                                                                                          |
| `description`     | No                                                                                         | TypeScript, iOS, Android | Optional room description.                                                                                                            |
| `thumbnailFileId` | No                                                                                         | TypeScript, iOS, Android | File ID for an uploaded thumbnail image.                                                                                              |
| `metadata`        | No                                                                                         | TypeScript, iOS, Android | Custom key-value data stored with the room.                                                                                           |
| `liveChatEnabled` | No                                                                                         | TypeScript, iOS, Android | Whether the room should support live chat linkage. iOS defaults this to `true`.                                                       |
| `parentRoomId`    | No                                                                                         | TypeScript, iOS, Android | Parent room ID for room hierarchy scenarios.                                                                                          |
| `participants`    | No                                                                                         | iOS, Android             | Initial participant user IDs. TypeScript room creation does not expose this field.                                                    |
| `type`            | No                                                                                         | TypeScript, iOS          | Room type such as `coHosts` / `.coHosts` or `directStreaming` / `.directStreaming`. Android creation does not expose a type argument. |

## Create a Room

Create a room with the title and configuration your product needs before publishing it or connecting a broadcaster.

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { RoomRepository } from "@amityco/ts-sdk";

  const { data: room } = await RoomRepository.createRoom({
    title: "Product Launch Event",
    description: "Join us for the unveiling of our latest features",
    liveChatEnabled: true,
    type: "coHosts",
    metadata: {
      category: "education",
    },
  });

  showSuccessMessage(room.roomId);
  ```

  ```kotlin Android theme={null}
  import com.amity.socialcloud.sdk.api.video.AmityVideoClient
  import com.google.gson.JsonObject

  val metadata = JsonObject().apply {
      addProperty("category", "education")
  }

  AmityVideoClient.newRoomRepository()
      .createRoom(
          title = "Product Launch Event",
          description = "Join us for the unveiling of our latest features",
          metadata = metadata,
          liveChatEnabled = true,
          participants = listOf(userId)
      )
      .subscribe(
          { room -> showSuccessMessage(room.getRoomId()) },
          { error -> handleGeneralError(error) }
      )
  ```

  ```swift iOS theme={null}
  let options = AmityRoomCreateOptions(
      title: "Product Launch Event",
      description: "Join us for the unveiling of our latest features",
      metadata: ["category": "education"],
      liveChatEnabled: true,
      participants: [userId],
      type: .coHosts
  )

  let room = try await AmityRoomRepository().createRoom(with: options)
  showSuccessMessage(room.roomId)
  ```
</CodeGroup>

## Create with Thumbnail or Parent Room

Use `thumbnailFileId` after uploading an image through the file APIs. Use `parentRoomId` only when your product intentionally creates a room hierarchy.

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { RoomRepository } from "@amityco/ts-sdk";

  const { data: childRoom } = await RoomRepository.createRoom({
    title: "Regional Breakout",
    thumbnailFileId: imageFileId,
    parentRoomId: roomId,
    liveChatEnabled: true,
  });

  showSuccessMessage(childRoom.roomId);
  ```

  ```kotlin Android theme={null}
  import com.amity.socialcloud.sdk.api.video.AmityVideoClient

  AmityVideoClient.newRoomRepository()
      .createRoom(
          title = "Regional Breakout",
          thumbnailFileId = imageFileId,
          parentRoomId = roomId,
          liveChatEnabled = true
      )
      .subscribe(
          { room -> showSuccessMessage(room.getRoomId()) },
          { error -> handleGeneralError(error) }
      )
  ```

  ```swift iOS theme={null}
  let options = AmityRoomCreateOptions(
      title: "Regional Breakout",
      thumbnailFileId: imageFileId,
      liveChatEnabled: true,
      parentRoomId: roomId
  )

  let childRoom = try await AmityRoomRepository().createRoom(with: options)
  showSuccessMessage(childRoom.roomId)
  ```
</CodeGroup>

## Get Broadcaster Data

After creating the room, request broadcaster credentials before connecting the media layer. TypeScript and Android expose broadcaster-data APIs. iOS exposes room token generation.

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { RoomRepository } from "@amityco/ts-sdk";

  const broadcasterData = await RoomRepository.getBroadcasterData(roomId);

  if (broadcasterData.coHostUrl && broadcasterData.coHostToken) {
    showSuccessMessage(broadcasterData.coHostUrl);
  }
  ```

  ```kotlin Android theme={null}
  import com.amity.socialcloud.sdk.api.video.AmityVideoClient
  import com.amity.socialcloud.sdk.model.video.room.AmityRoomBroadcastData

  AmityVideoClient.newRoomRepository()
      .getBroadcasterData(roomId)
      .subscribe(
          { broadcasterData ->
              when (broadcasterData) {
                  is AmityRoomBroadcastData.CoHosts -> {
                      showSuccessMessage(broadcasterData.getCoHostUrl())
                  }
                  is AmityRoomBroadcastData.DirectStreaming -> {
                      showSuccessMessage(broadcasterData.getDirectStreamUrl())
                  }
              }
          },
          { error -> handleGeneralError(error) }
      )
  ```

  ```swift iOS theme={null}
  let broadcasterData = try await AmityRoomRepository()
      .generateRoomToken(withId: roomId)

  let coHostUrl = broadcasterData?["coHostUrl"] as? String
  let coHostToken = broadcasterData?["coHostToken"] as? String

  if let coHostUrl, let coHostToken {
      showSuccessMessage("\(coHostUrl):\(coHostToken)")
  }
  ```
</CodeGroup>

<Info>
  Use the returned broadcaster data with your media stack, such as a LiveKit client. The social.plus SDK returns room and credential data; it does not publish camera or microphone tracks for your SDK integration.
</Info>

## Publish the Room

To show the room in a user or community feed, create a room post from the room ID.

<CardGroup cols={2}>
  <Card title="Room Posts" icon="newspaper" href="/social-plus-sdk/social/content-management/posts/creation/room-post">
    Create a feed post that references an existing room.
  </Card>

  <Card title="Rooms Overview" icon="circle-info" href="./rooms-overview">
    Review room fields, statuses, participants, and playback metadata.
  </Card>
</CardGroup>

## Platform Notes

* TypeScript exposes `RoomRepository.createRoom()` and returns `Amity.Cached<Amity.Room>`.
* iOS creates rooms with `AmityRoomCreateOptions` and `AmityRoomRepository().createRoom(with:)`.
* Android creates rooms with `AmityVideoClient.newRoomRepository().createRoom(...)`.
* Flutter does not currently expose a public room creation API in the audited SDK source.

## Related Topics

<CardGroup cols={2}>
  <Card title="Manage Rooms" icon="gear" href="./manage-rooms">
    Observe, query, update, stop, and delete rooms after creation.
  </Card>

  <Card title="Start Broadcasting" icon="play" href="./start-broadcasting">
    Connect the broadcaster after retrieving credentials.
  </Card>
</CardGroup>
