Overview
The Cobi chat widget can be embedded on any website as an iframe. Visitors interact with your AI assistant directly on your site. Authentication is handled via embed API keys that you create in the Cobi dashboard.Embed keys are scoped to a single data source and can be restricted to
specific domains for production use.
Getting Started
Create an Embed Key
Navigate to Developer > Channels in the Cobi dashboard. Click Create Embed Key and fill in:
| Field | Description |
|---|---|
| Name | A label for this key (e.g. “Production website”) |
| Data Source | The data source the embed will query against |
| Allowed Origins (optional) | Domains permitted to load the widget (e.g. https://yoursite.com) |
| Expiry Date (optional) | When the key should expire. Leave blank for no expiry |
Add the Iframe to Your Site
After creating the key, you’ll see an embed snippet. Copy and paste it into your website’s HTML:
Configuration
URL Parameters
The embed URL supports the following query parameters:| Parameter | Required | Description |
|---|---|---|
key | Yes | Your embed API key |
theme | No | light, dark, or system (default). Matches the widget’s appearance to your site |
Allowed Origins
When you specify allowed origins during key creation, only those domains can load the widget. Requests from other origins are rejected with a403 error.
- Leave empty during development to allow any origin
- For production, always specify your exact domains (e.g.
https://yoursite.com) - The
Originheader is required when allowed origins are configured
Theming
The widget respects light and dark mode via thetheme parameter:
| Value | Behavior |
|---|---|
system | Matches the user’s OS preference (default) |
light | Forces light mode |
dark | Forces dark mode |
Rate Limiting
Each embed key is rate-limited to 1,000 requests per hour. When the limit is exceeded:- The API returns
429 Too Many Requestswith aRetry-Afterheader - The widget displays a user-friendly message asking the visitor to wait
Security
- Key hashing: Keys are hashed at rest. Only the first 18 characters are stored for display.
- Origin enforcement: When configured, only requests from allowed origins are accepted.
- Data source isolation: The data source is locked to the key. It cannot be changed by the client.
- Scoped access: Embed requests have restricted access and cannot view internal documents.
- No cookies: The widget does not use cookies or require user authentication.
Managing Keys
From Developer > Channels you can:- View keys: See all active embed keys with their allowed origins and status
- Delete keys: Permanently revoke a key. Any site using it will immediately lose access.
Deleting a key takes effect on the next request — there is no delay or grace
period.
Troubleshooting
| Issue | Cause | Solution |
|---|---|---|
| Widget shows “Missing API Key” | No key parameter in the URL | Check the iframe src includes ?key=cobi_embed_... |
403 error | Origin not in allowed list | Add your domain to the key’s allowed origins, or leave origins empty for testing |
401 error | Key is invalid, expired, or deleted | Create a new embed key in Developer > Channels |
429 error | Rate limit exceeded | Wait for the rate limit window to reset (1 hour) |
| Widget crashes / white screen | JavaScript error | The widget includes an error boundary — try refreshing. If persistent, check browser console |