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

# Connect Conversation

> Create a conversation session and return room credentials for joining.

Use this endpoint to create a conversation session and receive:

* `room_url`
* `token`
* `conversation_session_id`

The connect endpoint returns immediately after creating the conversation session and Daily room credentials. Use the [updates endpoint](/api-reference/conversations/updates) to poll setup progress until the conversation is ready.

Required headers:

* `Authorization: Bearer <YOUR_AKAPULU_API_KEY>`
* `Content-Type: application/json`

Required request fields:

* `scenario_id` for the scenario to run
* `avatar_id` for the avatar to use in this conversation

Optional request fields include:

* `runtime_vars` for template/runtime values
* `stt_keywords` for speech recognition hints
  * accepts either an array of strings or a comma-separated string
  * maximum `5` keywords
* `record_conversation` whether to record this conversation session (default `false`)

Example request body:

```json theme={null}
{
  "scenario_id": "scenario_1234",
  "avatar_id": "avatar_5678",
  "runtime_vars": {
    "today": "2026-03-19"
  },
  "stt_keywords": ["Akapulu", "Dr. Nguyen", "A1C"],
  "record_conversation": true
}
```


## OpenAPI

````yaml openapi/akapulu.json POST /conversations/connect
openapi: 3.1.0
info:
  title: Akapulu Labs API
  version: 1.0.0
  description: Public Akapulu Labs API reference.
servers:
  - url: https://akapulu.com/api
security:
  - bearerAuth: []
paths:
  /conversations/connect:
    post:
      summary: Connect conversation
      description: Create a conversation session and return room credentials for joining.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ConnectConversationRequest'
            examples:
              default:
                summary: Standard connect request
                value:
                  scenario_id: 11111111-2222-3333-4444-555555555555
                  avatar_id: 66666666-7777-8888-9999-000000000000
                  runtime_vars:
                    user_name: Alex
                    company_name: Acme Corp
                    support_ticket_id: TICK-1024
                  stt_keywords:
                    - Akapulu
                    - Alex
                    - Acme
                  record_conversation: false
      responses:
        '200':
          description: Conversation connection created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConnectConversationResponse'
              examples:
                success:
                  summary: Successful connect response
                  value:
                    room_url: https://your-team.daily.co/room-name
                    token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
                    conversation_session_id: 7f1e7f76-b38d-4d03-b8f8-2570ce8d4e6d
        '400':
          description: Invalid request payload
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              examples:
                invalid_payload:
                  value:
                    error: scenario_id is required
        '401':
          description: Missing or invalid API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              examples:
                invalid_key:
                  value:
                    error: Invalid API key
        '403':
          description: Plan limits reached or unauthorized scenario access
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              examples:
                limit_reached:
                  value:
                    error: No minutes remaining for current plan
                concurrency_limit_reached:
                  value:
                    error: Concurrency limit reached for current plan
                    max_concurrency: 2
                    active_calls: 2
        '404':
          description: Scenario not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              examples:
                missing_scenario:
                  value:
                    error: scenario_id not found
components:
  schemas:
    ConnectConversationRequest:
      type: object
      required:
        - scenario_id
        - avatar_id
      properties:
        scenario_id:
          type: string
          format: uuid
          description: Scenario ID to run for this conversation.
        avatar_id:
          type: string
          format: uuid
          description: Avatar ID to use for this conversation.
        runtime_vars:
          type: object
          description: Runtime variables injected into scenario templates.
          additionalProperties: true
        stt_keywords:
          description: >-
            Optional keywords used in the speech-to-text step of the pipeline to
            improve recognition of specific words in user speech (maximum 5).
          oneOf:
            - type: array
              items:
                type: string
              maxItems: 5
            - type: string
              description: Comma-separated keyword string.
        record_conversation:
          type: boolean
          default: false
          description: If true, enable recording for this conversation session.
    ConnectConversationResponse:
      type: object
      required:
        - room_url
        - token
        - conversation_session_id
      properties:
        room_url:
          type: string
          description: Daily room URL for the session.
        token:
          type: string
          description: Daily access token for joining the room.
        conversation_session_id:
          type: string
          format: uuid
          description: Created conversation session ID.
    ApiError:
      type: object
      required:
        - error
      properties:
        error:
          type: string
          description: Human-readable error message.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````