Skip to main content

What you will build

A reusable widget that embeds the assistant directly in your application. The widget provides:
  • A floating button that opens a chat panel when clicked
  • Real-time streaming responses based on information from your documentation
  • Message rendering with Markdown support
Users can use the widget to get help with your product without leaving your application.
Demo of the assistant widget being opened and the user typing in How do I get started? Then the assistant responds.

Prerequisites

  • Mintlify Pro or Enterprise plan
  • Your domain name, which appears at the end of your dashboard URL. For example, if your dashboard URL is https://dashboard.mintlify.com/org-name/domain-name, your domain name is domain-name
  • An assistant API key
  • Node.js v18 or higher and npm installed
  • Basic React knowledge

Get your assistant API key

  1. Navigate to the API keys page in your dashboard.
  2. Click Create Assistant API Key.
  3. Copy the assistant API key (starts with mint_dsc_) and save it securely.
The assistant API key is a public token that you can use in frontend code. Calls using this token count toward your plan’s message allowance and can incur overages.

Set up the example

Clone the example repository and customize it for your needs.
1

Clone the repository

2

Choose your development tool

The repository includes Next.js and Vite examples. Choose the tool you prefer to use.
3

Configure your project

Open src/config.js and update with your Mintlify project details.
src/config.js
Replace:
  • your-domain with your Mintlify project domain found at the end of your dashboard URL.
  • https://yourdocs.mintlify.app with your actual documentation URL.
4

Add your API token

Create a .env file in the project root.
.env
Replace mint_dsc_your_token_here with your assistant API key.
5

Start the development server

Open your application in a browser and click the Ask button to open the assistant widget.

Customization ideas

Source citations

Extract and display sources from assistant responses:

Track conversation thread IDs

Store thread IDs to maintain conversation history across sessions:

Add keyboard shortcuts

Allow users to open the widget and submit messages with keyboard shortcuts: