---
title: Embed Ask AI
subtitle: Put an Ask AI button or input bar on your website, in your dashboard, or inside your product, so readers can ask the docs without leaving the page.
description: Embed ButterIX Ask AI in other websites — allowed origins, the button and input bar entries, light and dark accent colors and color mode, panel size and position, opening it and changing options from code with window.ButterIX, sending the address and breadcrumb of the reader's page with each question, the Content Security Policy directives to allow, and where it's available.
---

The embedded assistant is the same [Ask AI](./ask-ai.mdx) as on your docs site: the same model, instructions, custom answers, and content sources. Questions go to the same [question log](./ask-ai.mdx#question-log) and count toward the same limits.

## Get started

<Steps>
  <Step title="Add the allowed origins">
    Under "Ask AI → Embed" of the site, enter the websites that may embed the site's assistant (requires the admin role), for example `https://app.acme.com`; `https://*.acme.com` covers any subdomain. Up to 20, https only except for `localhost`. Changes apply right away.

    You can also set them through the [API](/api-reference/ai/update-embed). Without any origins, the assistant can't be embedded.
  </Step>
  <Step title="Add the script">
    Copy the embed code on the same page and paste it before `</body>` on your pages:

    ```html
    <script src="https://docs.acme.com/_biti/embed.js" async></script>
    ```

    The default entry set in the console appears on the page (a button in the bottom-right corner until you choose otherwise) and opens the panel. To use a button or an input bar on this page regardless, add `data-trigger="button"` or `data-trigger="bar"`.
  </Step>
</Steps>

## Entry styles

`data-trigger` sets where readers open the panel from:

- `button`: a floating button in the bottom-right corner, with an icon and "Ask AI".
- `bar`: an input bar at the bottom center of the screen. Readers type their question right there; Enter expands the panel and answers at once. When there's already a conversation, clicking into the bar opens the panel; when there isn't, up to three suggested questions (from [`ai.suggestions`](./ask-ai.mdx)) float up above the bar, ready to ask with one click.
- `none`: no entry; you open it [from code](#open-it-from-code).
- A CSS selector (such as `#ask-docs`): opens it when a matching element on the page is clicked.

Without `data-trigger`, the default entry style set under the site's "Ask AI → Embed → Appearance" applies (a button until you choose otherwise). When set, the page's choice applies, whatever the console says. For example, to keep the button across your website but use the input bar on your help center:

```html
<script src="https://docs.acme.com/_biti/embed.js" data-trigger="bar" async></script>
```

The panel opens where the entry is. Readers can:

- Drag its top edge, its sides, or its top corners to resize it, and double-click an edge to bring back the default size and position.
- Hold the panel's header to move it.
- Use the buttons in the panel's top-right corner to switch between light and dark, or to enlarge it to nearly the full height of the screen.
- Drag the entry anywhere on the screen: hold and drag the button itself, or hold the stars at the left of the input bar. Double-click the button or the stars to put it back where the website places it.

These adjustments stay in the reader's browser for a day and apply whenever they open the panel again in that time. On phones and other narrow screens, the panel slides up from the bottom instead.

## Skins

There are two skins:

- **Classic** (default): a clean, solid entry and panel.
- **Aurora**: the entry and panel are frosted glass, with colored light flowing slowly along the edges. The light brightens when a reader focuses the input bar and flares once when the panel opens.

In both skins, rotating neon light glows inward from the panel's edges while the AI answers, and fades out when the answer is done. The light stands still when the system's "reduce motion" setting is on.

The skin, along with the entry style, color mode, and accent colors below, can be set under "Ask AI → Embed → Appearance" of the site. It applies as soon as you save, with no new deployment and no change to your website's code.

## Options

You can also set them on the page with data attributes on the script tag. Attributes you write take priority; the rest follow the appearance set in the console:

```html
<script
  src="https://docs.acme.com/_biti/embed.js"
  data-trigger="bar"
  data-skin="aurora"
  data-theme="light"
  data-color="#7c5cff"
  data-color-dark="#9e8aff"
  data-width="520"
  data-height="680"
  data-left="50"
  data-bottom="32"
  data-breadcrumb="Console / Buckets / Settings"
  async
></script>
```

<ParamField path="data-trigger" type='"button" | "bar" | "none" | string'>Entry style: `button` for a button, `bar` for an input bar; see [Entry styles](#entry-styles). When set, it takes priority; when missing, the default entry style from the console applies.</ParamField>
<ParamField path="data-skin" type='"classic" | "aurora"'>Skin; see [Skins](#skins). Defaults to `classic`.</ParamField>
<ParamField path="data-theme" type='"dark" | "light" | "auto"' default="dark">Color mode. `auto` follows the visitor's system setting. Once a reader switches it in the panel, their choice applies until the website changes this attribute again.</ParamField>
<ParamField path="data-color" type="string">Accent color for light mode, in hex, such as `#7c5cff`. Used for the entry's icon, the send button, and the accents in the panel. Defaults to the docs site's light-mode accent.</ParamField>
<ParamField path="data-color-dark" type="string">Accent color for dark mode, in hex. Without it, it's derived from `data-color` when that's set (lightened if too dark), or else the docs site's dark-mode accent is used.</ParamField>
<ParamField path="data-width" type="number" default="480">Default width of the open panel in pixels, 360 to 1600.</ParamField>
<ParamField path="data-height" type="number" default="640">Default height of the open panel in pixels, 440 to 1600. Shrinks to fit smaller screens; where even the smallest size doesn't fit, it opens as a sheet from the bottom.</ParamField>
<ParamField path="data-left" type="number" default="100 for the button, 50 for the bar">Where the entry sits from the left of the screen, as a percentage of the screen width from 0 to 100: `0` far left, `50` centered, `100` far right. The entry always stays fully on screen. You can also fill it in under "Ask AI → Embed → Embed code", and the code you copy includes it.</ParamField>
<ParamField path="data-bottom" type="number" default="20">How far the entry sits from the bottom of the screen, in pixels, at least 16. Use it to keep clear of a bar fixed to the bottom of your page or another floating button; the suggested questions and the panel move up with the entry. On a screen too short for it, the entry moves down so it always stays fully on screen. You can also fill it in under "Ask AI → Embed → Embed code", and the code you copy includes it.</ParamField>
<ParamField path="data-label" type="string">Text on the button, or the placeholder in the input bar, up to 40 characters. An empty string shows the button's icon only.</ParamField>
<ParamField path="data-lang" type="string">Language of the panel, one of the docs site's languages. Defaults to the language in the page's `<html lang>`, or the docs site's default language when neither matches.</ParamField>
<ParamField path="data-breadcrumb" type="string">Breadcrumb of the page the reader is on, such as `Console / Buckets / Settings`, up to 200 characters. Defaults to the page's current title. See [The reader's page](#the-readers-page).</ParamField>

Where the accent is used for icons and outlines, a color that's too pale or too deep is adjusted so it stays visible on the current background.

You can change these attributes at any time, and the change applies right away. For example, to follow your website's own theme switch:

```js
document.querySelector('script[src$="/_biti/embed.js"]').dataset.theme = "dark";
// or
ButterIX.configure({ theme: "dark" });
```

## Open it from code

Once loaded, the script provides `window.ButterIX`:

```js
ButterIX.open();                                                  // open the panel
ButterIX.open({ question: "How do I verify webhook signatures?" }); // open with a question written in; the reader sends it
ButterIX.close();
ButterIX.toggle();
ButterIX.configure({ theme: "light", color: "#0ea5e9", left: 20 }); // change options; null restores the default
```

`configure` takes the same keys as the data attributes, without `data-` and in camelCase: `trigger`, `skin`, `theme`, `color`, `colorDark`, `width`, `height`, `left`, `bottom`, `label`, `lang`, and `breadcrumb`.

## The reader's page

With every question, the panel sends the address and breadcrumb of the page the reader is on at that moment. The AI uses them to understand what "here", "this page" or "this setting" means, and answers with what is relevant to that page first.

The breadcrumb defaults to the page's current title (in a single-page app, a new title after navigation is picked up too). When the title doesn't say where the reader is, pass a clearer path with `data-breadcrumb` and update it on navigation:

```js
router.afterEach((to) => {
  ButterIX.configure({ breadcrumb: ["Console", ...to.matched.map((r) => r.meta.title)].join(" / ") });
});
```

In the console's Ask AI question log, the channel shows as "Embed"; hover the page to see the breadcrumb and the full address, and expand a question to see the full question, answer and all details. Parameters in the address that look like keys or tokens are masked.

## Content Security Policy

If your website sets a CSP, allow the docs site's address:

```text
script-src https://docs.acme.com;
frame-src https://docs.acme.com;
font-src https://docs.acme.com;
```

Add these values to the directives you already have.

## Limits

- [Password-protected](../deploy/access-control.mdx) sites can't be embedded.
- Embedding is unavailable when Ask AI is off (`ai.enabled: false`).
- Source links in the panel open in a new tab.
