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

# Start agent session

> Starts a video call session with an agent. This endpoint creates a Daily.co room and returns the connection details needed to join the call. 

 ### How it works
1. Call this endpoint with an agent ID
2. Receive a `roomUrl`, `dailyToken`, and `webLink`
3. Use `roomUrl` and `dailyToken` with the [Daily.co SDK](https://docs.daily.co/reference) to join programmatically, or share the `webLink` for browser-based access.




## OpenAPI

````yaml post /start-agent-session
openapi: 3.0.3
info:
  title: iwy API
  description: >
    API for managing AI agents and custom tools. Create conversational AI agents
    with custom capabilities,

    manage tool integrations, and embed AI avatars in your applications.


    ## Authentication

    All endpoints require authentication using a Bearer token
    (IWY_SERVICE_API_KEY).

    You can find your API key at
    [app.iwy.ai/settings](https://app.iwy.ai/settings).


    ## Base URL

    ```

    https://api.iwy.ai/v1

    ```
  version: 1.0.0
  contact:
    name: iwy Support
    url: https://www.iwy.ai/contact
servers:
  - url: https://api.iwy.ai/v1
    description: Production server
security:
  - bearerAuth: []
tags:
  - name: Ephemeral Agents
    description: Create one-time use agents with automatic expiration
  - name: Agents
    description: Manage AI agents and their configurations
  - name: Tools
    description: Manage custom tools and functions for agents
  - name: Sessions
    description: Start and manage agent video call sessions
paths:
  /start-agent-session:
    post:
      tags:
        - Sessions
      summary: Start agent session
      description: >
        Starts a video call session with an agent. This endpoint creates a
        Daily.co room and returns the connection details needed to join the
        call. 

         ### How it works
        1. Call this endpoint with an agent ID

        2. Receive a `roomUrl`, `dailyToken`, and `webLink`

        3. Use `roomUrl` and `dailyToken` with the [Daily.co
        SDK](https://docs.daily.co/reference) to join programmatically, or share
        the `webLink` for browser-based access.
      operationId: startAgentSession
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/StartAgentSessionRequest'
            examples:
              with_agent_id:
                summary: Start session with an agent
                value:
                  agentId: 550e8400-e29b-41d4-a716-446655440000
              demo_mode:
                summary: Start demo session
                value:
                  agentId: demo
      responses:
        '200':
          description: Session started successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StartAgentSessionResponse'
              example:
                roomUrl: https://iwy.daily.co/abc123xyz
                dailyToken: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
                webLink: https://meet.iwy.ai/550e8400-e29b-41d4-a716-446655440000
        '400':
          description: Bad request - agentId is required
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: agentId is required
        '401':
          description: Authentication failed with the session service
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: Authentication failed with the session service.
        '403':
          description: Access denied by the session service
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: Access denied by the session service.
        '500':
          $ref: '#/components/responses/InternalServerError'
      security: []
components:
  schemas:
    StartAgentSessionRequest:
      type: object
      description: Request to start a video call session with an agent
      required:
        - agentId
      properties:
        agentId:
          type: string
          description: >-
            The agent ID (UUID) to start a session with, or 'demo' for a demo
            session
          example: 550e8400-e29b-41d4-a716-446655440000
    StartAgentSessionResponse:
      type: object
      description: >-
        Response containing Daily.co room connection details and a web link for
        browser-based access
      required:
        - roomUrl
        - dailyToken
        - webLink
      properties:
        roomUrl:
          type: string
          format: uri
          description: The Daily.co room URL to join
          example: https://iwy.daily.co/abc123xyz
        dailyToken:
          type: string
          description: Authentication token for joining the Daily.co room
          example: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
        webLink:
          type: string
          format: uri
          description: A shareable web link for joining the agent session in a browser
          example: https://meet.iwy.ai/550e8400-e29b-41d4-a716-446655440000
    Error:
      type: object
      required:
        - success
        - error
      properties:
        success:
          type: boolean
          example: false
        error:
          type: string
          description: Error message
          example: Parameter validation failed
        details:
          description: Additional error details
          oneOf:
            - type: string
            - type: object
        execution_time_ms:
          type: integer
          description: Execution time before error occurred
  responses:
    InternalServerError:
      description: Internal server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            success: false
            error: Internal server error
            details: An unexpected error occurred
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >
        Your iwy Service API Key. Find it at
        [app.iwy.ai/settings](https://app.iwy.ai/settings).


        Include it in the Authorization header:

        ```

        Authorization: Bearer YOUR_API_KEY

        ```

````