---
title: "搜索文档"
method: POST
path: "/v1/search/{domain}"
language: "zh-Hans"
---

# 搜索文档

`POST /v1/search/{domain}`

## Request

- Base URL: `https://api.mintlify.com/discovery`
- URL: `https://api.mintlify.com/discovery/v1/search/{domain}`
- Auth: HTTP bearer

使用语义搜索和关键词搜索来搜索你的文档，并支持可配置的过滤和分页。

使用 assistant API 密钥进行身份验证。搜索请求不消耗额度。

## Path parameters

- `domain` string, required

## Request body

- object
  - `query` string, required: 在文档内容中要执行的搜索查询。
  - `pageSize` integer: 要返回的搜索结果数量。必须在 1 到 50 之间。若未指定，默认为 10。
  - `scoreThreshold` number: 结果的最低相关性分数。仅返回分数等于或高于此阈值的结果。必须介于 0 和 1 之间。
  - `filter` object: 用于缩小搜索结果范围的可选过滤参数。
    - `version` string: 按文档版本筛选结果。
    - `language` string: 按内容语言筛选结果。
    - `tag` string: 按标签筛选结果。
    - `groups` string[]: 你为其搜索的用户所属的可选分组。如果省略 `groups`，结果只包含公开内容。在所有页面都需要身份验证的部署上，省略 `groups` 等同于传入空数组。空数组表示一个没有分组的已登录用户：结果还会包含对所有已登录用户开放的页面。传入分组时，结果还会包含仅限其中至少一个分组访问的页面。面向已登录读者或特定分组的 `<Visibility>` 部分遵循相同的规则。Mintlify 不会验证分组成员身份，因此你的后端必须为每个用户选择分组。在包含公开页面的受密码保护部署上，传入空数组即可搜索未标记为公开的页面。

## Response `200`

搜索结果

- object[]
  - `content` string: 来自文档中匹配的内容。
  - `path` string: 源文档所在的路径或 URL。
  - `metadata` object: 与搜索结果相关的附加 metadata。

## Other responses

- `400`: `query` 缺失或不是字符串，或者 `pageSize` 或 `filter` 无效。响应体会描述具体错误。
- `401`: API 密钥缺失或无效。
- `403`: 你的 API 密钥无权访问此 domain、你的套餐不包含 assistant API 访问权限，或者你的请求来自不在 API 密钥允许列表中的 IP 地址。
- `404`: 该 domain 不存在文档站点，或者搜索未返回任何结果。
- `429`: 你已超出每个组织每小时 10,000 个请求的速率限制。
- `500`: 发生了意外的服务器错误。请重试该请求。如果错误仍然存在，请联系支持团队。

## Changes

- **2026-10-30** `32c3b9d9e79d`: 6 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 `403`
  - added the non-success response with the status `404`
  - …2 more
- **2026-07-23** `98b9bd030d2c`: 1 info
  - added the new optional request property `filter/groups`
- **2026-03-23** `baee5e30d5de`: 1 breaking, 2 warning, 1 info
  - the `pageSize` request property type changed from `number` to `integer`
  - the `pageSize` request property's max was set to `50.00`
  - the `pageSize` request property's min was set to `1.00`
  - added the new optional request property `scoreThreshold`
- **2026-03-23** `f10d97fd0e52`: 1 info
  - added the new optional request property `filter/tag`
- **2026-02-02** `2aeef0f7008d`: 1 info
  - endpoint added

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

---

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