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

# Create hosted session

> Creates a hosted session for the specified LemonSlice agent.



## OpenAPI

````yaml /openapi.json post /liveai/rooms
openapi: 3.1.0
info:
  title: LemonSlice
  description: An API that gives access to a LemonSlice agent via a Daily room.
  license:
    name: MIT
    identifier: MIT
  version: 1.0.0
servers:
  - url: https://lemonslice.com/api
security:
  - apiKeyAuth: []
paths:
  /liveai/rooms:
    post:
      summary: Create hosted session
      description: Creates a hosted session for the specified LemonSlice agent.
      operationId: createRoom
      requestBody:
        description: The LemonSlice agent to use in the session.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AgentInfo'
            example:
              agent_id: agent_abc123
        required: true
      responses:
        '201':
          description: Room created successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Room'
              example:
                room_url: https://lemonslice.daily.co/abc123
                token: eyJhbGciOiJIUzI1NiIsInR5a...
                image_url: https://cdn.lemonslice.com/agents/agent_abc123.png
                session_id: 3f7c2b91-9e1f-4a6a-8e9d-2c7c3e7d9b5a
        '400':
          description: Invalid arguments
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                detail: Missing required fields
        '401':
          description: Authentication denied
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                detail: Invalid API key
        '402':
          description: Agent owner has insufficient funds
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                detail: Agent agent_123abc owner has insufficient funds
        '404':
          description: Agent not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                detail: Agent not found
        '500':
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServerError'
              example:
                detail: Internal server error
components:
  schemas:
    AgentInfo:
      type: object
      required:
        - agent_id
      properties:
        agent_id:
          description: The ID of the LemonSlice agent.
          type: string
          example: agent_abc123
    Room:
      type: object
      required:
        - room_url
        - token
        - image_url
        - session_id
      properties:
        room_url:
          description: The Daily room URL.
          type: string
          format: uri
          example: https://your-subdomain.daily.co/abc123
        token:
          description: The Daily user token.
          type: string
        image_url:
          description: The placeholder agent image.
          type: string
          format: uri
          example: https://cdn.lemonslice.com/agents/agent_abc123.png
        session_id:
          description: A unique identifier for the room's session.
          type: string
          format: string
          example: 3f7c2b91-9e1f-4a6a-8e9d-2c7c3e7d9b5a
    Error:
      type: object
      properties:
        detail:
          type: string
          example: Agent not found
    ServerError:
      type: object
      properties:
        detail:
          type: string
          example: Internal server error
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: Your LemonSlice API token.

````