Embed a bitHuman avatar directly on your website so visitors can have real-time conversations without leaving your page.Documentation Index
Fetch the complete documentation index at: https://docs.bithuman.ai/llms.txt
Use this file to discover all available pages before exploring further.
How Embedding Works
Quick Start (Zero Config)
The simplest way to embed an agent — one line of HTML, no backend needed:YOUR_AGENT_CODE with your agent’s code (e.g. A78WKV4515). Find it in the Library or the Deploy & Share dialog.
Customize with URL Parameters
| Parameter | Example | Description |
|---|---|---|
chat_mode | text | Start in text-only mode (text, voice, or video) |
greetingLang | de | Greet in a specific language (ISO 639-1 code) |
greetingMsg | Hello! | Custom greeting message |
embed_theme | light | Widget theme (light or dark) |
theme_color | blue | Accent color (blue, purple, green, red, orange, teal, pink, indigo) |
welcomeMsg | Hi there! | Custom welcome message |
suggestedQuestions | ["How can I help?"] | JSON array of suggested question chips |
model | essence | Avatar model type (essence or expression) |
deployment | chat-widget | Deployment context (chat-widget, gadget, iframe) |
The embed endpoint generates a session token automatically. No API secret or backend is needed. Sessions don’t expire — the embedded agent works indefinitely.
Advanced: Token-Based Embed
For more control (e.g. custom billing, session tracking), generate tokens from your backend:Generate an embed token
Call the embed token API from your backend (never expose your API secret in the browser):
embed.js Widget
For a floating chat button that opens an avatar panel, useembed.js:
With API Secret (server-rendered pages only)
If you need usage billed to your account, pass the API secret — but only on server-rendered pages where the HTML is generated on your backend. Never include your API secret in a public static HTML file or client-side JavaScript.Programmatic Control
Chat Widget
For a full-featured floating chat interface with text, voice, and video modes:Configuration Options
| Option | Type | Default | Description |
|---|---|---|---|
agentUrl | string | required | Full agent URL (e.g. https://bithuman.ai/A78WKV4515) |
theme | string | "light" | "light" or "dark" |
themeColor | string | "blue" | Accent color: blue, purple, green, red, orange, teal, pink, indigo |
position | string | "bottom-right" | Widget position: "bottom-right" or "bottom-left" |
fabStyle | string | "bar" | Button style: "bar" (text + avatar) or "circle" (avatar only) |
fabText | string | "Ask me anything..." | Text shown on the bar-style button |
defaultChatMode | string | "text" | Default mode: "text", "voice", or "video" |
allowModeSwitch | boolean | true | Allow users to switch between text, voice, and video |
welcomeMessage | string | "" | Welcome message shown when chat opens |
suggestedQuestions | string[] | [] | Up to 3 clickable question suggestions |
panelWidth | number | 380 | Chat panel width in pixels |
panelHeight | number | 540 | Chat panel height in pixels |
Public Methods
The widget automatically fetches the agent’s avatar image for the floating button. No manual image configuration needed.
Gadget Widget (Legacy)
For a customizable floating button with avatar thumbnail:Customization
Responsive Sizing
Control the Avatar from Your Page
Use the REST API to send messages to an active avatar session:Troubleshooting
| Problem | Solution |
|---|---|
| Blank iframe | For zero-config embed, check that your agent code is correct. For token-based, verify token is valid. |
| No audio | Ensure allow="microphone *" is set on the iframe (note the * for cross-origin) |
| CORS errors | Use the zero-config embed URL (/api/embed/CODE) which handles CORS automatically |
| Avatar not responding | Check agent exists in your Library and has status “Ready” |
| iframe blocked | Some browsers block third-party iframes. Add allow="microphone *; camera *; autoplay *" |
Next Steps
Webhooks
Get notified when users join sessions
Agent Context API
Control what the avatar says programmatically
