Voicebot realtime sessions

    Create a realtime voicebot session, connect a browser media client with the returned room payload, read persisted transcript messages, and close the session when the call ends.

    Create Session

    Request Body

    ParameterTypeRequiredDescription
    voicebotIdstringYesVoicebot identifier.
    participantNamestringNoParticipant name shown in the realtime session.

    Response (201)

    FieldTypeDescription
    sessionIdstringLogical session identifier.
    participantTokenstringToken used by the browser media client to join the room.
    livekitUrlstringRealtime media server WebSocket URL.
    roomNamestringRoom name used for connection, transcript reads, and end.
    voicebotNamestringVoicebot display name, when available.
    voicebotAvatarUrlstringVoicebot avatar URL, when available.
    imageMappingsarrayOptional image key mappings for UI rendering.
    expiresAtstringParticipant token expiry timestamp.
    curl -X POST https://api.valsea.ai/v1/voicebot-livekit/session \
      -H "Authorization: Bearer YOUR_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "voicebotId": "665f5aa613e4fe2f12ab34cd",
        "participantName": "web-user-001"
      }'
    

    Browser Connection Flow

    After creating a session, keep participantToken, livekitUrl, and roomName in memory. Use the media client to connect to livekitUrl with participantToken, enable the local microphone, subscribe to remote audio tracks, and listen for transcript or image events on the data channel. When the call ends, disconnect the room and call the end-session endpoint with roomName.

    Image Mappings

    Use this as a fallback when the create-session response does not include enough imageMappings data.

    cURL

    curl -X GET https://api.valsea.ai/v1/voicebot-livekit/voicebots/665f5aa613e4fe2f12ab34cd/image-mappings/library \
      -H "Authorization: Bearer YOUR_API_KEY"
    

    Session Messages

    Read transcript messages persisted by the realtime agent.

    QueryTypeDefaultDescription
    limitnumber50Number of messages to return.
    offsetnumber0Pagination offset.

    End Session

    Always end the session when the call finishes so final duration billing and cleanup can complete.

    cURL

    curl -X DELETE https://api.valsea.ai/v1/voicebot-livekit/session/ext-vb-665f5aa613e4fe2f12ab34cd-a1b2c3d4e5f6 \
      -H "Authorization: Bearer YOUR_API_KEY"
    

    Errors

    StatusDescription
    400Invalid body, path parameter, or query parameter
    401Missing or invalid API key
    402Insufficient credits for session creation
    403Session belongs to another organization
    500Internal server error

    Was this page helpful?