# 获取 AI 助手会话线程 (/zh/api/analytics/assistant-thread)

<!-- agent-signals: reading_time_min: 2 · est_tokens: 1428 · updated: 2026-09-23 -->
Related: [获取反馈](/zh/api/analytics/feedback.md), [按页面获取反馈](/zh/api/analytics/feedback-by-page.md), [获取 AI 助手会话记录](/zh/api/analytics/assistant-conversations.md), [获取 AI 助手调用方统计](/zh/api/analytics/assistant-caller-stats.md), [获取搜索查询](/zh/api/analytics/searches.md), [获取页面浏览量](/zh/api/analytics/views.md)

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

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

常见用途：

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

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

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

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

## 速率限制 [#速率限制]

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

`GET /v1/analytics/{projectId}/assistant/threads/{threadId}`

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

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

## OpenAPI

```json
{
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "parameters": [
    {
      "schema": {
        "type": "string",
        "description": "你的项目 ID，可在控制台的 [API keys](https://dashboard.mintlify.com/settings/organization/api-keys) 页面中复制。"
      },
      "required": true,
      "name": "projectId",
      "in": "path"
    },
    {
      "schema": {
        "type": "string",
        "description": "AI 助手会话线程 ID（ULID）。"
      },
      "required": true,
      "name": "threadId",
      "in": "path"
    }
  ],
  "responses": {
    "200": {
      "description": "会话转录",
      "content": {
        "application/json": {
          "schema": {
            "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"
            ]
          }
        }
      }
    },
    "400": {
      "description": "线程 ID 无效",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "描述错误原因的错误信息。"
              },
              "details": {
                "type": "array",
                "description": "关于该错误的其他详细信息。",
                "items": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "对某个特定校验或处理错误的说明。"
                    }
                  },
                  "required": [
                    "message"
                  ]
                }
              }
            },
            "required": [
              "error"
            ]
          }
        }
      }
    },
    "404": {
      "description": "未找到线程",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "描述错误原因的错误信息。"
              },
              "details": {
                "type": "array",
                "description": "关于该错误的其他详细信息。",
                "items": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "对某个特定校验或处理错误的说明。"
                    }
                  },
                  "required": [
                    "message"
                  ]
                }
              }
            },
            "required": [
              "error"
            ]
          }
        }
      }
    },
    "500": {
      "description": "服务器错误",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "描述错误原因的错误信息。"
              },
              "details": {
                "type": "array",
                "description": "关于该错误的其他详细信息。",
                "items": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "对某个特定校验或处理错误的说明。"
                    }
                  },
                  "required": [
                    "message"
                  ]
                }
              }
            },
            "required": [
              "error"
            ]
          }
        }
      }
    }
  }
}
```
