Connect API
Establish a live chatbot session for your Convai character, enabling users to connect via audio or video and maintain conversational context.
Overview
The Connect API establishes a live interactive session between an end-user and a Convai character.
It allows developers to maintain conversational context using the character_session_id returned in each response and supports both audio and video connections.
Optionally, scene descriptions or dynamic information can be included to tailor the interaction.
Connecting to a Character
POST https://live.convai.com/connect
Headers
X-API-Key*
String
Your Convai API key.
Content-Type
String
Must be set to application/json.
Request Body
character_id*
String
Unique ID of the character to connect with.
connection_type
String
Connection mode for the session.
Supported values: "audio" (default) or "video".
character_session_id
String
Existing session ID for maintaining conversation continuity. If omitted, a new one is generated.
end_user_id
String
User managed unique identifier to tag sessions and use Long Term Memory
debug
Bool
Enables RTVI metrics on data channel.
audio_config
Configuration for audio output behaviour. Only supported with LiveKit transport (default).
Fields
audio_routing - Controls audio delivery method:
"audio_only"(default) - Standard WebRTC audio track (recommended)"data_only"- Receiveaudio-datamessages via data channel for custom processing"both"- Receive via both audio track and data channel
max_chunk_duration_ms - Audio chunk size (10-1000ms, default: 100ms)
Lower values = lower latency, more overhead
Higher values = better for unstable networks
Rounds up to nearest 10ms:
95ms → 100ms,45ms → 50ms
add_wav_header - Include WAV header in data channel chunks (default: false)
Only applies when using
data_onlyorbothrouting
Response
Important Notes
Convai strictly follows OpenAI’s Content Policy for API usage. Users must not generate or distribute toxic, harmful, or inappropriate content. Repeated violations will result in your API key being blacklisted.
Always reuse the same character_session_id if you want to maintain context between interactions.
A new character_session_id creates a fresh session without prior context.
Example Requests
Conclusion
The Connect API is a key component for integrating Convai’s real-time conversational capabilities into your applications. By maintaining session context and dynamically adapting scene or character information, developers can build seamless, context-aware voice or video interactions powered by Convai.
Last updated
Was this helpful?