Skip to main content
POST
/
assistant
/
{domain}
/
message
Assistant message
curl --request POST \
  --url https://api-dsc.mintlify.com/v1/assistant/{domain}/message \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "fp": "<string>",
  "threadId": null,
  "messages": [
    {
      "id": "foobar",
      "role": "user",
      "content": "how do i get started",
      "parts": [
        {
          "type": "text",
          "text": "How do I get started"
        }
      ]
    }
  ],
  "retrievalPageSize": 5,
  "filter": null
}'
{}

Integration with useChat

The recommended way to integrate the assistant API into your application is with the useChat hook from Vercel’s AI SDK.
1

Install the AI SDK

npm i ai
2

Use the hook

import { useChat } from 'ai/react';

function MyComponent({ domain }) {
  const { messages, input, handleInputChange, handleSubmit, isLoading } = useChat({
    api: `https://api-dsc.mintlify.com/v1/assistant/${domain}/message`,
    headers: {
      'Authorization': `Bearer ${process.env.MINTLIFY_TOKEN}`,
    },
    body: {
      fp: 'anonymous',
      messages: [
        { role: 'user', content: 'What is this documentation about?' }
      ]
    },
    streamProtocol: 'data',
    sendExtraMessageFields: true,
  });

  return (
    <div>
      {messages.map((message) => (
        <div key={message.id}>
          {message.role === 'user' ? 'User: ' : 'Assistant: '}
          {message.content}
        </div>
      ))}
      <form onSubmit={handleSubmit}>
        <input value={input} onChange={handleInputChange} />
        <button type="submit">Send</button>
      </form>
    </div>
  );
}
See useChat in the AI SDK documentation for more details.

Rate limits

The assistant API has the following limits:
  • 10,000 uses per key per month
  • 10,000 requests per Mintlify organization per hour
  • 10,000 requests per IP per day

Authorizations

Authorization
string
header
required

Path Parameters

domain
string
required

Body

application/json
fp
string
required
messages
object[]
required
threadId
string
retrievalPageSize
number
default:5
filter
object

Response

200 - application/json