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

# LiveKit rooms

> Lists all LiveKit rooms belonging to the authenticated client.
Rooms are filtered by `metadata.auth_id` for tenant isolation.

# Arguments
* `state` - Shared application state containing LiveKit configuration
* `auth` - Authentication context from middleware

# Returns
* `Response` - JSON response with rooms list or error status

# Filtering
- When `auth.id` is present: Returns only rooms where `metadata.auth_id == auth.id`
- When `auth.id` is absent: Returns all rooms (backward-compatible mode)

# Errors
* 500 Internal Server Error - LiveKit service not configured or API call failed

Lists all LiveKit rooms belonging to the authenticated tenant. Rooms are filtered by `metadata.auth_id` for tenant isolation.

## Filtering behavior

| Mode                               | Behavior                                                            |
| ---------------------------------- | ------------------------------------------------------------------- |
| Authenticated (`auth.id` present)  | Returns only rooms where `metadata.auth_id` matches your tenant ID. |
| Unauthenticated (`auth.id` absent) | Returns all rooms (backward-compatible mode).                       |

<Note>
  This endpoint may return fewer rooms than exist in LiveKit when authentication is enabled. Each tenant only sees their own rooms.
</Note>

## Response

Returns `{ rooms: [...] }` with each room containing:

* `name` - The room name (clean, no prefixes)
* `num_participants` - Current participant count
* `creation_time` - Unix timestamp when the room was created


## OpenAPI

````yaml GET /livekit/rooms
openapi: 3.1.0
info:
  title: Sayna API
  description: >-
    Real-time voice processing server with Speech-to-Text (STT) and
    Text-to-Speech (TTS) services
  contact:
    name: Sayna
    url: https://api.sayna.ai
  license:
    name: Apache-2.0
    identifier: Apache-2.0
  version: 0.1.0
servers:
  - url: https://api.sayna.ai
    description: Production API
  - url: http://localhost:3001
    description: Local development
security: []
tags:
  - name: health
    description: Health check endpoints
  - name: voices
    description: TTS voice management
  - name: tts
    description: Text-to-speech synthesis
  - name: livekit
    description: LiveKit room and token management
  - name: recordings
    description: Recording download operations
  - name: sip
    description: SIP webhook configuration management
  - name: websocket
    description: WebSocket API for real-time communication
paths:
  /livekit/rooms:
    get:
      tags:
        - livekit
      summary: Handler for GET /livekit/rooms endpoint
      description: >-
        Lists all LiveKit rooms belonging to the authenticated client.

        Rooms are filtered by `metadata.auth_id` for tenant isolation.


        # Arguments

        * `state` - Shared application state containing LiveKit configuration

        * `auth` - Authentication context from middleware


        # Returns

        * `Response` - JSON response with rooms list or error status


        # Filtering

        - When `auth.id` is present: Returns only rooms where `metadata.auth_id
        == auth.id`

        - When `auth.id` is absent: Returns all rooms (backward-compatible mode)


        # Errors

        * 500 Internal Server Error - LiveKit service not configured or API call
        failed
      operationId: list_rooms
      responses:
        '200':
          description: Rooms listed successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListRoomsResponse'
        '500':
          description: LiveKit service not configured or failed to list rooms
      security:
        - auth: []
components:
  schemas:
    ListRoomsResponse:
      type: object
      description: |-
        Response containing the list of LiveKit rooms

        # Example
        ```json
        {
          "rooms": [
            {
              "name": "room-1",
              "num_participants": 2,
              "creation_time": 1703123456
            },
            {
              "name": "room-2",
              "num_participants": 0,
              "creation_time": 1703123789
            }
          ]
        }
        ```
      required:
        - rooms
      properties:
        rooms:
          type: array
          items:
            $ref: '#/components/schemas/RoomInfo'
          description: >-
            List of rooms belonging to the authenticated client (filtered by
            metadata.auth_id)
    RoomInfo:
      type: object
      description: |-
        Information about a LiveKit room

        # Example
        ```json
        {
          "name": "conversation-room-123",
          "num_participants": 2,
          "creation_time": 1703123456
        }
        ```
      required:
        - name
        - num_participants
        - creation_time
      properties:
        creation_time:
          type: integer
          format: int64
          description: Room creation time (Unix timestamp in seconds)
          example: 1703123456
        name:
          type: string
          description: The room name
          example: conversation-room-123
        num_participants:
          type: integer
          format: int32
          description: Number of current participants in the room
          example: 2
          minimum: 0
  securitySchemes:
    auth:
      type: http
      scheme: bearer
      bearerFormat: Token
      description: >-
        Authentication token for protected endpoints. Can be provided as
        `Authorization: Bearer <token>` or `?api_key=<token>`. Required when
        AUTH_REQUIRED is enabled.

````