> ## Documentation Index
> Fetch the complete documentation index at: https://www.mintlify.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# 获取 AI 助手会话线程

> 返回单个 AI 助手会话线程的完整消息转录。线程 ID 可从 AI 助手会话端点获取，或作为 AI 助手链接转接支持 URL 上追加的 `threadId` 查询参数获取。

使用管理员 API 密钥进行身份验证。

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

使用此端点以 JSON 格式获取某个 AI 助手会话的完整消息转录。响应包含用户与 AI 助手之间按顺序排列的消息列表，每条消息都带有 ID、角色、内容和时间戳。

常见用途：

* 当用户从 AI 助手联系支持时，将会话转录附加到工单。
* 为审查、质量保证或离线分析重建特定会话。

<div id="getting-a-thread-id">
  ## 获取 thread ID
</div>

你可以通过以下任一来源获取 `threadId`：

* [获取 AI 助手会话](/docs/zh/api/analytics/assistant-conversations) 返回的任一行的 `id` 字段。
* 当 AI 助手通过[链接转接](/docs/zh/assistant/configure#deflect-to-a-support-link)将用户引导到你的支持平台时，Mintlify 追加到支持 URL 上的 `threadId` 查询参数。

## 速率限制

此端点每个组织每小时允许 100 次请求。所有 analytics 端点共享此限制。


## OpenAPI

````yaml zh/analytics.openapi.json GET /v1/analytics/{projectId}/assistant/threads/{threadId}
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/threads/{threadId}:
    get:
      tags:
        - Analytics
      summary: 获取 AI 助手会话线程
      description: >-
        返回单个 AI 助手会话线程的完整消息转录。线程 ID 可从 AI 助手会话端点获取，或作为 AI 助手链接转接支持 URL 上追加的
        `threadId` 查询参数获取。


        使用管理员 API 密钥进行身份验证。
      parameters:
        - $ref: '#/components/parameters/projectId'
        - schema:
            type: string
            description: AI 助手会话线程 ID（ULID）。
          required: true
          name: threadId
          in: path
      responses:
        '200':
          description: 会话转录
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AssistantThreadResponse'
        '400':
          description: 线程 ID 无效
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnalyticsErrorResponse'
        '404':
          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:
    AssistantThreadResponse:
      type: object
      properties:
        threadId:
          type: string
          description: AI 助手会话线程标识符（ULID）。
        createdAt:
          type: string
          description: 线程创建时间戳。
        messages:
          type: array
          description: 该线程中按顺序排列的消息列表。
          items:
            type: object
            properties:
              id:
                type: string
                description: 消息的唯一标识符。
              role:
                type: string
                enum:
                  - user
                  - assistant
                description: 该消息由用户还是 AI 助手发送。
              content:
                type: string
                description: 消息的文本内容。
              createdAt:
                type: string
                description: 消息发送时间戳。
            required:
              - id
              - role
              - content
              - createdAt
      required:
        - threadId
        - createdAt
        - messages
    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 令牌。请使用管理员 API 密钥。这是仅供服务端使用的机密密钥。你可以在控制台的
        [API
        密钥页面](https://dashboard.mintlify.com/settings/organization/api-keys)
        中生成一个。

````

## Related topics

- [配置 AI 助手](/docs/zh/assistant/configure.md)
- [获取 AI 助手会话记录](/docs/zh/api/analytics/assistant-conversations.md)
- [简介](/docs/zh/api/introduction.md)
