> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify-docs-automation-github-pr-review.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 获取 AI 助手会话记录

> 返回分页后的 AI 助手会话历史

<div id="usage">
  ## 使用方法
</div>

使用此端点从你的文档中导出 AI 助手的会话历史。每个会话都包括用户查询、助手回复、引用的来源、解决状态以及查询类别。

使用响应中返回的 `cursor` 参数对结果进行分页。当 `hasMore` 为 `true` 时继续获取。

<div id="filtering">
  ## 筛选
</div>

使用 `dateFrom` 和 `dateTo` 参数按日期范围过滤会话。

<div id="conversation-data">
  ## 会话数据
</div>

每个会话包含：

* **query**: 用户的问题
* **response**: AI 助手的回答
* **sources**: 回答中引用的页面，包括标题和 URL
* **resolutionStatus**: AI 助手是否成功回答了问题。值为 `answered` 或 `unanswered`。使用此字段可跟踪并分析 AI 助手无法解答的用户问题所暴露出的文档缺口。
* **queryCategory**: query 的类型分类（如果可用）
* **pageUrl**: 会话开始时所在文档页面的完整 URL；如果没有可用的页面路径，则为 `null`。使用此字段可将会话归因到具体页面。


## OpenAPI

````yaml zh/analytics.openapi.json GET /v1/analytics/{projectId}/assistant
openapi: 3.1.0
info:
  title: Mintlify Analytics Export API
  version: 1.0.0
  description: 用于导出文档 Analytics 数据的 API
servers:
  - url: https://api.mintlify.com
    description: 生产环境
security: []
paths:
  /v1/analytics/{projectId}/assistant:
    get:
      tags:
        - Analytics
      summary: 获取 AI 助手会话记录
      description: 返回分页后的 AI 助手会话历史
      parameters:
        - $ref: '#/components/parameters/projectId'
        - schema:
            type: string
            description: ISO 8601 或 YYYY-MM-DD 格式的日期
            example: '2024-01-01'
          required: false
          name: dateFrom
          in: query
        - schema:
            type: string
            description: >-
              ISO 8601 或 YYYY-MM-DD 格式的日期。`dateTo`
              为不包含在内的上限。结果将包含早于该日期的记录，但不包含该日期当天的记录。
            example: '2024-01-01'
          required: false
          name: dateTo
          in: query
        - schema:
            type: number
            minimum: 1
            maximum: 1000
            default: 100
            description: 每页返回的最大结果数
          required: false
          name: limit
          in: query
        - schema:
            type: string
            format: ulid
            description: 分页游标（ULID 格式）
          required: false
          name: cursor
          in: query
      responses:
        '200':
          description: 包含分页信息的会话数据
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AssistantConversationsResponse'
        '400':
          description: 无效的查询参数
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnalyticsErrorResponse'
        '500':
          description: 服务器错误
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnalyticsErrorResponse'
      security:
        - bearerAuth: []
components:
  parameters:
    projectId:
      schema:
        $ref: '#/components/schemas/projectId'
      required: true
      name: projectId
      in: path
  schemas:
    AssistantConversationsResponse:
      type: object
      properties:
        conversations:
          type: array
          description: AI 助手会话列表。
          items:
            type: object
            properties:
              id:
                type: string
                description: 会话的唯一标识符。
              timestamp:
                type: string
                description: 会话发生时的时间戳。
              query:
                type: string
                description: 用户向 AI 助手提出的问题。
              response:
                type: string
                description: AI 助手的回答。
              sources:
                type: array
                description: 在回答中被引用的文档页面。
                items:
                  type: object
                  properties:
                    title:
                      type: string
                      description: 被引用文档页面的标题。
                    url:
                      type: string
                      description: 被引用文档页面的 URL。
                  required:
                    - title
                    - url
              queryCategory:
                type:
                  - string
                  - 'null'
                description: 会话自动分配的分类分组（如适用）。
              pageUrl:
                type:
                  - string
                  - 'null'
                description: 会话开始时所在文档页面的完整 URL。如果没有捕获页面路径，则为 null。
            required:
              - id
              - timestamp
              - query
              - response
              - sources
              - queryCategory
              - pageUrl
        nextCursor:
          type:
            - string
            - 'null'
          description: 用于获取下一页结果的游标；如果没有更多结果则为 null。
        hasMore:
          type: boolean
          description: 指示在当前页之外是否还有更多可用结果。
      required:
        - conversations
        - nextCursor
        - hasMore
    AnalyticsErrorResponse:
      type: object
      properties:
        error:
          type: string
          description: 描述错误原因的错误信息。
        details:
          type: array
          description: 关于该错误的其他详细信息。
          items:
            type: object
            properties:
              message:
                type: string
                description: 对某个特定校验或处理错误的说明。
            required:
              - message
      required:
        - error
    projectId:
      type: string
      description: >-
        你的项目 ID，可在控制台的 [API
        keys](https://dashboard.mintlify.com/settings/organization/api-keys)
        页面中复制。
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Authorization 请求头需要使用 Bearer Token。请使用管理员 API key（以 `mint_`
        开头）。这是仅供服务端使用的密钥。你可以在控制台的 [API keys
        页面](https://dashboard.mintlify.com/settings/organization/api-keys) 中生成。

````