> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hibonsai.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Bonsai Search

> Self-serve guide for integrating Bonsai AI Search into your website

## Getting Started

Before getting started, ensure that you've had a chance to review the [Quickstart prerequisites](/project/docs/quickstart#prerequisites).

Once you have your API key, you can integrate Bonsai AI search into any website in just a few minutes using our web component.

<Callout color="#0A5B3B" icon="circle-alert">
  If you only need the redirecting search bar (not the full results UI), use the<br /> [Bonsai Search Bar Web Component](/project/docs/bonsai-searchbar/integration) instead.
</Callout>

## Quick Installation

Use this minimal 2-step setup to render Bonsai Search on your website.

<Callout color="#0A5B3B" icon="info">
  **Theming is managed in the Bonsai dashboard.** When the component loads, it fetches your tenant's theme and behavior settings from the Settings API using your `api-key` and applies them automatically. You can still override any value per-embed via CSS custom properties on the `<bonsai-search>` element — see [Advanced Styling](/project/docs/bonsai-search/styling).
</Callout>

<Steps>
  <Step title="Install the script">
    Add the Bonsai Search `<script>` tag to your HTML page. Place this in the `<head>` section, or before the closing `</body>` tag.
    This ensures the script is loaded before the component is rendered.

    ```html theme={null}
    <!-- Load Bonsai Search Web Component --> 
    <script
      src="https://assets.hibonsai.com/sdk/bonsai-search-webcomponent-latest.js"
      defer
    ></script>
    ```
  </Step>

  <Step title="Add the Web Component">
    Add the `<bonsai-search>` web component where you want search to appear. Only `api-key` and `base-url` are required — the component fetches its placeholder text and suggestion chips from the Settings API using your `api-key`.

    ```html theme={null}
    <bonsai-search
      api-key="API-KEY"
      base-url="https://api.hibonsai.com/rest/search/v3/"
    ></bonsai-search>
    ```

    <Callout color="#0A5B3B" icon="triangle-alert">
      **Important:** Replace `API-KEY` with your actual API key provided by your CSM.
    </Callout>

    <Callout color="#0A5B3B" icon="info">
      **All content and behavior come from the Settings API.** Placeholder text, suggestions, result count, price rendering, markdown rendering, and theming are configured per-tenant in the Bonsai dashboard and returned by `/rest/search-component-config/` when the component loads. The only attributes you set on the tag are `api-key`, `base-url`, and optionally `theme`.

      If you need to override a specific value for a single embed you can still pass the corresponding attribute — it takes precedence over the Settings API response — but prefer the dashboard so every embed stays in sync.
    </Callout>
  </Step>

  <Step title="Test the search experience with a query">
    Not working? Check the [Troubleshooting](/project/docs/troubleshooting) guide for common issues.
  </Step>
</Steps>

## Next Steps

Customize your component to match your site's layout and design. For expanded installation guides and pre-styled templates see [Examples](/project/docs/bonsai-search/examples).

<CardGroup cols={2}>
  <Card title="Configuration" icon="sliders-horizontal" href="/project/docs/bonsai-search/config">
    Full attribute reference and default values.
  </Card>

  <Card title="Advanced Styling" icon="palette" href="/project/docs/bonsai-search/styling">
    CSS variables, shadow parts, and themes.
  </Card>

  <Card title="Events Reference" icon="radio" href="/project/docs/bonsai-search/events">
    Event lifecycle reference.
  </Card>

  <Card title="Examples" icon="file-code" href="/project/docs/bonsai-search/examples">
    Expanded integration templates.
  </Card>
</CardGroup>
