---
title: "获取聊天历史知识库统计"
method: GET
path: "/messages/chat-history-stats"
tags: ["消息"]
---

# 获取聊天历史知识库统计

`GET /messages/chat-history-stats`

## Request

- Base URL: `/api/v1` (relative, and the document was published on a file host, not at the API’s origin)
- URL: `/api/v1/messages/chat-history-stats`
- Auth: one of:
  - API key in header `Authorization`
  - API key in header `X-API-Key`

获取聊天历史知识库的统计信息（已索引消息数、知识库大小等）

## Response `200`

统计信息

- object
  - `data` GithubComTencentWeKnoraInternalTypesChatHistoryKBStats
    - `embedding_model_id` string: ID of the embedding model used
    - `enabled` boolean: Whether the chat history KB is configured and enabled
    - `has_indexed_messages` boolean: Whether there are any indexed messages (used by frontend to lock embedding model)
    - `indexed_message_count` integer: Number of indexed message entries (Knowledge count)
    - `knowledge_base_id` string: ID of the knowledge base used for chat history
    - `knowledge_base_name` string: Name of the knowledge base
  - `success` boolean

## Changes

- **2026-03-30** `08f8a25fbf1d`: 1 info
  - endpoint added
- **2025-12-16** `edf61e68559d`: 1 breaking
  - api path removed without deprecation

[Operation history](https://skmtc.dev/tencentblueking/apis/weknora-api/changes/messages/chat-history-stats/get.md)

---

[API](https://skmtc.dev/tencentblueking/apis/weknora-api.md) - [All operations](https://skmtc.dev/tencentblueking/apis/weknora-api/llms.txt) - [OpenAPI document](https://skmtc.dev/tencentblueking/apis/weknora-api/revisions/685d1f9fce30?raw)
