---
title: "Create assistant message"
method: POST
path: "/v2/assistant/{domain}/message"
language: "en"
---

# Create assistant message

`POST /v2/assistant/{domain}/message`

## Request

- Base URL: `https://api.mintlify.com/discovery`
- URL: `https://api.mintlify.com/discovery/v2/assistant/{domain}/message`
- Auth: HTTP bearer

Generates a response message from the assistant for the specified domain. Compatible with AI SDK v5+.

Authenticate with an assistant API key.

## Path parameters

- `domain` string, required

## Request body

- object
  - `fp` string, required: Fingerprint identifier for tracking conversation sessions. Use `anonymous` for anonymous users or provide a unique user identifier.
  - `threadId` string: An optional identifier used to maintain conversation continuity across multiple messages. When provided, it allows the system to associate follow-up messages with the same conversation thread. The `threadId` is returned in the response as `event.threadId` when `event.type === 'finish'`.
  - `messages` object[], required: Array of messages in the conversation. Use the handleSubmit function from the @ai-sdk/react package's useChat hook to manage messages and streaming responses.
    - `id` string, required: Unique identifier for the message.
    - `role` 'system' | 'assistant' | 'user', required: The role of the message sender.
    - `createdAt` string, date-time: Timestamp when the message was created.
    - `parts` union[], required: Array of message parts. Each part has a type and type-specific fields.
      - union
        - object: Text content part.
          - `type` 'text', required
          - `text` string, required
        - object: Reasoning content part with optional provider metadata.
          - `type` 'reasoning', required
          - `text` string, required
          - `providerMetadata` object: Optional provider-specific metadata.
        - object: Source URL reference part.
          - `type` 'source-url', required
          - `sourceId` string, required
          - `url` string, required
          - `title` string
          - `providerMetadata` object: Optional provider-specific metadata.
        - object: File attachment part.
          - `type` 'file', required
          - `mediaType` string, required
          - `url` string, required
          - `filename` string
        - object: Marks the start of a new step.
          - `type` 'step-start', required
    - `metadata` object: Optional metadata associated with the message.
  - `retrievalPageSize` number: Number of documentation search results to use for generating the response. Higher values provide more context but may increase response time. Recommended: 5.
  - `filter` object: Optional filter criteria for the search.
    - `version` string: Optional version filter.
    - `language` string: Optional language filter.
    - `groups` string[]: Optional groups of the user the assistant answers for. If you omit `groups`, the assistant reads public content only. On deployments where every page requires authentication, omitting `groups` works like an empty array. An empty array means a signed-in user with no groups: the assistant also reads pages open to any signed-in user. When you pass groups, it also reads pages restricted to at least one of them. `<Visibility>` sections for signed-in readers or for specific groups follow the same rules. Mintlify doesn't verify group membership, so your backend must choose the groups for each user. On password-protected deployments that have public pages, pass an empty array to read pages that aren't marked public.
  - `context` object[]: Optional array of contextual information to provide to the assistant.
    - `type` 'code' | 'textSelection', required: The type of context being provided.
    - `value` string, required: The code snippet or selected text content.
    - `path` string: Optional path to the source file or page.
    - `elementId` string: Optional identifier for the UI element containing the context.
  - `currentPath` string: The path of the page the user is currently viewing. When provided, the assistant uses this context to provide more relevant answers. Maximum length: 200 characters.

## Response `200`

Message generated successfully

- object: Streaming response compatible with AI SDK v5. Use the [useChat hook from @ai-sdk/react](https://ai-sdk.dev/docs/reference/ai-sdk-ui/use-chat#usechat) to handle the response stream.

## Other responses

- `400`: The request body is invalid, such as a missing `fp` or `messages` field. The response body describes the error.
- `401`: The API key is missing or invalid, or the assistant isn't enabled for your organization.
- `402`: Your organization reached its credit limit for this billing cycle.
- `403`: AI features aren't available in your region, your API key doesn't have access to this domain, your plan doesn't include assistant API access, or your request came from an IP address that isn't on your API key's allowlist.
- `404`: No documentation site exists for this domain, or the `threadId` or `threadKey` is invalid.
- `413`: The conversation reached its maximum number of messages, or the input is too long.
- `429`: You exceeded the rate limit of 10,000 requests per hour per organization.
- `500`: An unexpected server error occurred. Retry the request. If the error continues, contact support.

## Changes

- **2026-10-30** `5437addb311d`: 8 info
  - added the non-success response with the status `400`
  - added the non-success response with the status `401`
  - added the non-success response with the status `402`
  - added the non-success response with the status `403`
  - …4 more
- **2026-03-02** `2d31803f8e4b`: 1 info
  - added the new optional request property `currentPath`
- **2026-02-02** `1ad1fcd52d84`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/mintlify/apis/mintlify-assistant-api/changes/v2/assistant/:domain/message/post.md)

---

[API](https://skmtc.dev/mintlify/apis/mintlify-assistant-api.md) - [All operations](https://skmtc.dev/mintlify/apis/mintlify-assistant-api/llms.txt) - [OpenAPI document](https://skmtc.dev/mintlify/apis/mintlify-assistant-api/revisions/8b13d509ec50?raw)
