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

# Manage Rooms

> Observe, query, update, stop, and delete live rooms with current SDK room APIs.

Manage rooms after creation by observing a single room, querying room lists, updating room metadata, stopping a live session, or deleting a room record.

<Note>
  This page covers SDK room management APIs. Media publishing, LiveKit connection handling, and player UI are app-owned concerns.
</Note>

## Platform Surface

| Platform   | Single room                                            | Room list                                                         | Mutations                                                                 | Notes                                                                                                    |
| ---------- | ------------------------------------------------------ | ----------------------------------------------------------------- | ------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
| TypeScript | `RoomRepository.getRoom(roomId, callback)`             | `RoomRepository.getRooms(params, callback)`                       | `updateRoom()`, `stopRoom()`, `deleteRoom()`                              | Live callbacks return an unsubscribe function. Room list pagination uses `hasNextPage` and `onNextPage`. |
| iOS        | `AmityRoomRepository().getRoom(withId:)`               | `AmityRoomRepository().getRooms(with:)`                           | `updateRoom(withId:options:)`, `stopRoom(withId:)`, `deleteRoom(withId:)` | Retain the returned `AmityNotificationToken` while observing.                                            |
| Android    | `AmityVideoClient.newRoomRepository().getRoom(roomId)` | `AmityVideoClient.newRoomRepository().getRooms().build().query()` | `updateRoom()`, `stopRoom()`, `deleteRoom()`                              | Single rooms are `Flowable<AmityRoom>`; room lists are `Flowable<PagingData<AmityRoom>>`.                |
| Flutter    | No current public room repository found in this audit  | Not available                                                     | Not available                                                             | The Flutter SDK source exposes older stream APIs, not the room broadcasting repository.                  |

## Parameters

| Concept          | TypeScript                                   | iOS                                    | Android                                                   |
| ---------------- | -------------------------------------------- | -------------------------------------- | --------------------------------------------------------- |
| Status filter    | `statuses?: Amity.RoomStatus[]`              | `statuses: [AmityRoomStatus]?`         | `setStatuses(Array<AmityRoomStatus>)`                     |
| Room type filter | `type?: Amity.RoomType`                      | `type: AmityRoomType?`                 | `setTypes(Array<AmityRoomType>)`                          |
| Deleted rooms    | `includeDeleted?: boolean`                   | `isDeleted: Bool`                      | `setIsDeleted(Boolean?)`                                  |
| Sort order       | `sortBy?: "firstCreated"` or `"lastCreated"` | `sortBy: AmityRoomSortOption`          | `setSortBy(AmityRoomSortOption?)`                         |
| Page size        | `limit?: number`                             | Not exposed on `AmityRoomQueryOptions` | Paging 3 controls consumption after `PagingData` emission |

### Mutation Parameters

| Operation | TypeScript                   | iOS                           | Android                   |
| --------- | ---------------------------- | ----------------------------- | ------------------------- |
| Update    | `updateRoom(roomId, bundle)` | `updateRoom(withId:options:)` | `updateRoom(roomId, ...)` |
| Stop      | `stopRoom(roomId)`           | `stopRoom(withId:)`           | `stopRoom(roomId)`        |
| Delete    | `deleteRoom(roomId)`         | `deleteRoom(withId:)`         | `deleteRoom(roomId)`      |

| Update field   | TypeScript        | iOS                           | Android                   |
| -------------- | ----------------- | ----------------------------- | ------------------------- |
| Title          | `title`           | `title`                       | `title`                   |
| Description    | `description`     | `description`                 | `description`             |
| Thumbnail      | `thumbnailFileId` | `thumbnailFileId`             | `thumbnailFileId`         |
| Metadata       | `metadata`        | `metadata`                    | `metadata`                |
| Live chat flag | `liveChatEnabled` | `channelEnabled`              | `liveChatEnabled`         |
| Parent room    | `parentRoomId`    | Not exposed by update options | Not exposed by update API |

## Get a Room

Use the single-room API when a screen needs live updates for one room.

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

  function observeRoom(roomId: string): Amity.Unsubscriber {
    return RoomRepository.getRoom(roomId, snapshot => {
      if (snapshot.error) {
        handleError(snapshot.error);
        return;
      }

      showSuccessMessage(snapshot.data.status);
    });
  }
  ```

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

  val disposable = AmityVideoClient.newRoomRepository()
      .getRoom(roomId)
      .subscribe(
          { room -> showSuccessMessage(room.getStatus()) },
          { error -> handleGeneralError(error) }
      )
  ```

  ```swift iOS theme={null}
  var roomObservationToken: AmityNotificationToken?
  let roomObject = AmityRoomRepository().getRoom(withId: roomId)

  roomObservationToken = roomObject.observe { liveObject, error in
      if let error {
          handleGeneralError(error)
          return
      }

      if let room = liveObject.snapshot {
          showSuccessMessage(room.status.rawValue)
      }
  }
  ```
</CodeGroup>

## Query Rooms

Use the room-list API for discovery, dashboards, moderation queues, or live-room shelves.

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

  function observeLiveRooms(): Amity.Unsubscriber {
    return RoomRepository.getRooms(
      {
        statuses: ["live"],
        type: "coHosts",
        sortBy: "lastCreated",
        includeDeleted: false,
        limit: 20,
      },
      snapshot => {
        if (snapshot.error) {
          handleError(snapshot.error);
          return;
        }

        renderResults(snapshot.data);

        if (snapshot.hasNextPage) {
          snapshot.onNextPage?.();
        }
      },
    );
  }
  ```

  ```kotlin Android theme={null}
  import androidx.paging.PagingData
  import com.amity.socialcloud.sdk.api.video.AmityVideoClient
  import com.amity.socialcloud.sdk.model.video.room.AmityRoom
  import com.amity.socialcloud.sdk.model.video.room.AmityRoomSortOption
  import com.amity.socialcloud.sdk.model.video.room.AmityRoomStatus
  import com.amity.socialcloud.sdk.model.video.room.AmityRoomType

  val disposable = AmityVideoClient.newRoomRepository()
      .getRooms()
      .setStatuses(arrayOf(AmityRoomStatus.LIVE))
      .setTypes(arrayOf(AmityRoomType.CO_HOSTS))
      .setIsDeleted(false)
      .setSortBy(AmityRoomSortOption.LastCreated)
      .build()
      .query()
      .subscribe(
          { pagingData: PagingData<AmityRoom> -> showSuccessMessage(pagingData) },
          { error -> handleGeneralError(error) }
      )
  ```

  ```swift iOS theme={null}
  var roomCollectionToken: AmityNotificationToken?
  let options = AmityRoomQueryOptions(
      statuses: [.live],
      type: .coHosts,
      isDeleted: false,
      sortBy: .lastCreated
  )

  let rooms = AmityRoomRepository().getRooms(with: options)

  roomCollectionToken = rooms.observe { collection, error in
      if let error {
          handleGeneralError(error)
          return
      }

      showSuccessMessage(collection.snapshots.map { $0.roomId })

      if collection.hasNext {
          collection.nextPage()
      }
  }
  ```
</CodeGroup>

<Info>
  TypeScript filters by a single `type` value. Android's builder accepts `setTypes(...)` because the Android query model supports an array of room types.
</Info>

## Update a Room

Update room display fields and metadata. Participants, room type, and room identity are not update fields in these APIs.

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

  const { data: updatedRoom } = await RoomRepository.updateRoom(roomId, {
    title: "Updated Room Title",
    description: "New description",
    thumbnailFileId: imageFileId,
    metadata: {
      category: "updated",
    },
    liveChatEnabled: true,
  });

  showSuccessMessage(updatedRoom.roomId);
  ```

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

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

  AmityVideoClient.newRoomRepository()
      .updateRoom(
          roomId = roomId,
          title = "Updated Room Title",
          description = "New description",
          thumbnailFileId = imageFileId,
          metadata = metadata,
          liveChatEnabled = true
      )
      .subscribe(
          { room -> showSuccessMessage(room.getRoomId()) },
          { error -> handleGeneralError(error) }
      )
  ```

  ```swift iOS theme={null}
  let options = AmityRoomUpdateOptions(
      title: "Updated Room Title",
      description: "New description",
      thumbnailFileId: imageFileId,
      metadata: ["category": "updated"],
      channelEnabled: true
  )

  let room = try await AmityRoomRepository()
      .updateRoom(withId: roomId, options: options)

  showSuccessMessage(room.roomId)
  ```
</CodeGroup>

## Stop or Delete a Room

Stop a live session when broadcasting ends. Delete a room when your product flow should remove the room record.

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

  const { data: stoppedRoom } = await RoomRepository.stopRoom(roomId);
  showSuccessMessage(stoppedRoom.status);

  await RoomRepository.deleteRoom(roomId);
  showSuccessMessage(roomId);
  ```

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

  val roomRepository = AmityVideoClient.newRoomRepository()

  roomRepository.stopRoom(roomId)
      .andThen(roomRepository.deleteRoom(roomId))
      .subscribe(
          { showSuccessMessage(roomId) },
          { error -> handleGeneralError(error) }
      )
  ```

  ```swift iOS theme={null}
  let roomRepository = AmityRoomRepository()

  let stoppedRoom = try await roomRepository.stopRoom(withId: roomId)
  showSuccessMessage(stoppedRoom.status.rawValue)

  try await roomRepository.deleteRoom(withId: roomId)
  showSuccessMessage(roomId)
  ```
</CodeGroup>

<Warning>
  Stopping a room ends the current broadcast session. Do not document or build a "restart same room" flow unless your product and backend contract explicitly support it.
</Warning>

## Recorded Playback Boundary

Recorded playback is intentionally separate from room lifecycle management:

* TypeScript exposes `RoomRepository.getRecordedUrl(roomId)`.
* Android exposes `getRecordedUrls(roomId)`.
* iOS reads recorded playback data from `AmityRoom.recordedData`.

See [Recorded Playback](./recorded-playback) for playback-specific guidance.

## Related Topics

<CardGroup cols={3}>
  <Card title="Create Room" icon="plus" href="./create-room">
    Create a room before observing or mutating it.
  </Card>

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

  <Card title="Co-Host Management" icon="users" href="./co-host-management">
    Manage co-host invitations, removal, and permissions.
  </Card>
</CardGroup>
