> This is a page from the ElevenLabs documentation. For a complete page index, fetch https://elevenlabs.io/docs/llms.txt. For the full documentation in a single file, fetch https://elevenlabs.io/docs/llms-full.txt.

# 按 ID 获取知识库摘要

GET https://api.elevenlabs.io/v1/convai/knowledge-base/summaries

按 ID 获取多个知识库文档摘要。

Reference: https://elevenlabs.io/docs/eleven-agents/api-reference/knowledge-base/get-summaries

## Servers

- `https://api.elevenlabs.io` (Production, default)
- `https://api.us.elevenlabs.io` (Production US)
- `https://api.eu.residency.elevenlabs.io` (Production EU)
- `https://api.in.residency.elevenlabs.io` (Production India)
- `https://api.sg.residency.elevenlabs.io` (Production Singapore)

## Request

### Query parameters

- `document_ids` (string, optional) — 知识库文档的 ID。

## Response

### 200

成功响应

- `map from string to SummariesGetResponseValue`

## Errors

### 422 Summaries Get Request Unprocessable Entity Error

验证错误。

- `detail` (list of ValidationError, optional)

## Types

### SummariesGetResponseValue

- `status`: `success`
  - `data` (KnowledgeBaseSummaryBatchSuccessfulResponseModelData, required)
- `status`: `failure`
  - `error_code` (integer, required)
  - `error_message` (string, required)
  - `error_status` (string, required)

### ValidationError

- `loc` (list of ValidationErrorLocItem, required)
- `msg` (string, required)
- `type` (string, required)

### KnowledgeBaseSummaryBatchSuccessfulResponseModelData

- `type`: `file`
  - `access_info` (ResourceAccessInfo, required)
  - `id` (string, required)
  - `metadata` (KnowledgeBaseDocumentMetadataResponseModel, required)
  - `name` (string, required)
  - `supported_usages` (list of enum, required)
    - Allowed values: `prompt`, `auto`
  - `dependent_agents` (list of GetKnowledgeBaseSummaryFileResponseModelDependentAgentsItem, required, deprecated) — 此字段已弃用，将在未来移除。请改用独立端点获取依赖的智能体。
  - `auto_sync_info` (AutoSyncInfo, optional)
  - `external_sync_info` (ExternalFileSyncInfo, optional) — 跟踪返回外部来源原始文件的链接。
  - `folder_parent_id` (string, optional) — 父文件夹的 ID；如果文档位于根目录，则为 null。
  - `folder_path` (list of KnowledgeBaseFolderPathSegmentSummaryResponseModel, optional) — 从根目录到父文件夹、通往此实体的文件夹路径段。
  - `is_frozen` (boolean, optional, default: false)
  - `refresh_status` (FileRefreshStatus, optional) — 外部同步知识库文件正在进行或最近一次刷新的状态。
- `type`: `folder`
  - `access_info` (ResourceAccessInfo, required)
  - `children_count` (integer, required)
  - `document_count` (integer, required) — 此文件夹子树中任意位置的非文件夹文档数量（递归）。计数超过 1000 后停止；
  - `id` (string, required)
  - `metadata` (KnowledgeBaseDocumentMetadataResponseModel, required)
  - `name` (string, required)
  - `supported_usages` (list of enum, required)
    - Allowed values: `prompt`, `auto`
  - `dependent_agents` (list of GetKnowledgeBaseSummaryFolderResponseModelDependentAgentsItem, required, deprecated) — 此字段已弃用，将在未来移除。请改用独立端点获取依赖的智能体。
  - `auto_sync_info` (AutoSyncInfo, optional)
  - `external_sync_info` (ExternalFolderSyncInfo, optional) — 镜像外部源文件夹的知识库文件夹元数据。
  - `folder_parent_id` (string, optional) — 父文件夹的 ID；如果文档位于根目录，则为 null。
  - `folder_path` (list of KnowledgeBaseFolderPathSegmentSummaryResponseModel, optional) — 从根目录到父文件夹、通往此实体的文件夹路径段。
  - `is_frozen` (boolean, optional, default: false)
- `type`: `text`
  - `access_info` (ResourceAccessInfo, required)
  - `id` (string, required)
  - `metadata` (KnowledgeBaseDocumentMetadataResponseModel, required)
  - `name` (string, required)
  - `supported_usages` (list of enum, required)
    - Allowed values: `prompt`, `auto`
  - `dependent_agents` (list of GetKnowledgeBaseSummaryTextResponseModelDependentAgentsItem, required, deprecated) — 此字段已弃用，将在未来移除。请改用独立端点获取依赖的智能体。
  - `folder_parent_id` (string, optional) — 父文件夹的 ID；如果文档位于根目录，则为 null。
  - `folder_path` (list of KnowledgeBaseFolderPathSegmentSummaryResponseModel, optional) — 从根目录到父文件夹、通往此实体的文件夹路径段。
- `type`: `url`
  - `access_info` (ResourceAccessInfo, required)
  - `id` (string, required)
  - `metadata` (KnowledgeBaseDocumentMetadataResponseModel, required)
  - `name` (string, required)
  - `supported_usages` (list of enum, required)
    - Allowed values: `prompt`, `auto`
  - `url` (string, required)
  - `dependent_agents` (list of GetKnowledgeBaseSummaryUrlResponseModelDependentAgentsItem, required, deprecated) — 此字段已弃用，将在未来移除。请改用独立端点获取依赖的智能体。
  - `auto_sync_info` (AutoSyncInfo, optional)
  - `folder_parent_id` (string, optional) — 父文件夹的 ID；如果文档位于根目录，则为 null。
  - `folder_path` (list of KnowledgeBaseFolderPathSegmentSummaryResponseModel, optional) — 从根目录到父文件夹、通往此实体的文件夹路径段。

### ValidationErrorLocItem

- string
- integer

### ResourceAccessInfo

- `is_creator` (boolean, required) — 发出请求的用户是否为该智能体的创建者
- `creator_name` (string, required) — 智能体创建者名称
- `creator_email` (string, required) — 智能体创建者的邮箱
- `role` (enum, required) — 发出请求的用户角色
  - Allowed values: `admin`, `editor`, `commenter`, `viewer`
- `anonymous_access_level_override` (enum, optional) — 匿名用户的访问级别。若为 None，该资源不会公开共享。
  - Allowed values: `admin`, `editor`, `commenter`, `viewer`
- `access_source` (enum, optional) — 请求用户拥有此资源访问权限的原因。'creator' = 调用者是所有者。'explicit' = 调用者（或其所属的某个工作区群组）列于 role_to_group_ids 中，且不包括工作区范围的所有人群组。'workspace_default' = 工作区范围的所有人群组列于 role_to_group_ids 中（所有非匿名工作区成员，包括管理员，均可查看此资源）。'workspace_admin' = 调用者是工作区管理员，且管理员席位是 *唯一* 的访问路径；此项仅用于其他人均无法查看的文档。这样 UI 可说明管理员绕过权限的查看者为何能看到未明确向其共享的文档。
  - Allowed values: `creator`, `explicit`, `workspace_admin`, `workspace_default`

### KnowledgeBaseDocumentMetadataResponseModel

- `created_at_unix_secs` (integer, required)
- `last_updated_at_unix_secs` (integer, required)
- `size_bytes` (integer, required)

### GetKnowledgeBaseSummaryFileResponseModelDependentAgentsItem

- `type`: `available`
  - `access_level` (enum, required)
    - Allowed values: `admin`, `editor`, `commenter`, `viewer`
  - `created_at_unix_secs` (integer, required)
  - `id` (string, required)
  - `name` (string, required)
  - `referenced_resource_ids` (list of string, optional) — 如果智能体是传递依赖项，则包含该智能体直接依赖资源的 ID。
- `type`: `unknown`
  - `id` (string, required)
  - `referenced_resource_ids` (list of string, optional) — 如果智能体是传递依赖项，则包含该智能体直接依赖资源的 ID。

### AutoSyncInfo

- `minimum_frequency_days` (integer, optional, default: 7) — 刷新文档的最低频率（按天计）。实际间隔可能更短，但不会更长。
- `auto_remove` (boolean, optional, default: false) — 当 URL 不可用时是否删除文档
- `consec_failures` (integer, optional, default: 0) — 连续同步失败次数
- `next_refresh_by` (integer, optional) — 下次计划同步的 Unix 时间戳；文件夹时为 None。
- `auto_discover` (boolean, optional, default: false, deprecated) — 已弃用。此字段已不再生效，并将在未来版本中移除。

### ExternalFileSyncInfo

跟踪返回外部来源原始文件的链接。

- `type` ("google_drive", required) — 提供商标识符
- `source_entity_id` (string, required) — 外部系统中的实体 ID
- `integration_connection_id` (string, required) — 集成连接实例 ID
- `source_parent_entity_id` (string, required) — 此文件同步来源的外部系统文件夹 ID
- `source_mime_type` (string, required) — 外部系统中的原始 MIME 类型
- `source_modified_time` (datetime, required) — 外部系统中的最后修改时间
- `root_folder_id` (string, optional) — 同步根目录的知识库文件夹 ID，用于查询同步树下的所有实体

### KnowledgeBaseFolderPathSegmentSummaryResponseModel

- `id` (string, required)

### FileRefreshStatus

外部同步知识库文件正在进行或最近一次刷新的状态。

- `status` (enum, optional, default: queued)
  - Allowed values: `queued`, `processing`, `succeeded`, `failed`, `skipped`, `cancelled`
- `enqueued_at` (integer, optional)
- `started_at` (integer, optional)
- `completed_at` (integer, optional)
- `last_synced_at` (integer, optional)
- `error_message` (string, optional)

### GetKnowledgeBaseSummaryFolderResponseModelDependentAgentsItem

- `type`: `available`
  - `access_level` (enum, required)
    - Allowed values: `admin`, `editor`, `commenter`, `viewer`
  - `created_at_unix_secs` (integer, required)
  - `id` (string, required)
  - `name` (string, required)
  - `referenced_resource_ids` (list of string, optional) — 如果智能体是传递依赖项，则包含该智能体直接依赖资源的 ID。
- `type`: `unknown`
  - `id` (string, required)
  - `referenced_resource_ids` (list of string, optional) — 如果智能体是传递依赖项，则包含该智能体直接依赖资源的 ID。

### ExternalFolderSyncInfo

镜像外部源文件夹的知识库文件夹元数据。

- `type` ("google_drive", required) — 提供商标识符
- `source_entity_id` (string, required) — 外部系统中的实体 ID
- `integration_connection_id` (string, required) — 集成连接实例 ID
- `root_folder_id` (string, optional) — 同步根目录的知识库文件夹 ID。None 表示此文件夹为根目录。
- `sync_cursor` (string, optional) — 用于增量同步的不透明游标，由提供商解析
- `last_sync_at` (integer, optional) — 上次完成同步的 Unix 时间戳。

### GetKnowledgeBaseSummaryTextResponseModelDependentAgentsItem

- `type`: `available`
  - `access_level` (enum, required)
    - Allowed values: `admin`, `editor`, `commenter`, `viewer`
  - `created_at_unix_secs` (integer, required)
  - `id` (string, required)
  - `name` (string, required)
  - `referenced_resource_ids` (list of string, optional) — 如果智能体是传递依赖项，则包含该智能体直接依赖资源的 ID。
- `type`: `unknown`
  - `id` (string, required)
  - `referenced_resource_ids` (list of string, optional) — 如果智能体是传递依赖项，则包含该智能体直接依赖资源的 ID。

### GetKnowledgeBaseSummaryUrlResponseModelDependentAgentsItem

- `type`: `available`
  - `access_level` (enum, required)
    - Allowed values: `admin`, `editor`, `commenter`, `viewer`
  - `created_at_unix_secs` (integer, required)
  - `id` (string, required)
  - `name` (string, required)
  - `referenced_resource_ids` (list of string, optional) — 如果智能体是传递依赖项，则包含该智能体直接依赖资源的 ID。
- `type`: `unknown`
  - `id` (string, required)
  - `referenced_resource_ids` (list of string, optional) — 如果智能体是传递依赖项，则包含该智能体直接依赖资源的 ID。

## Examples

**Response**

```json
{
  "key": {
    "status": "success",
    "data": {
      "type": "file",
      "access_info": {
        "is_creator": true,
        "creator_name": "John Doe",
        "creator_email": "john.doe@example.com",
        "role": "admin",
        "access_source": "creator"
      },
      "id": "id",
      "metadata": {
        "created_at_unix_secs": 1,
        "last_updated_at_unix_secs": 1,
        "size_bytes": 1
      },
      "name": "name",
      "supported_usages": [
        "prompt"
      ],
      "dependent_agents": [
        {
          "type": "available",
          "access_level": "admin",
          "created_at_unix_secs": 1,
          "id": "id",
          "name": "name"
        }
      ],
      "external_sync_info": {
        "type": "google_drive",
        "source_entity_id": "source_entity_id",
        "integration_connection_id": "integration_connection_id",
        "source_parent_entity_id": "source_parent_entity_id",
        "source_mime_type": "source_mime_type",
        "source_modified_time": "2024-01-15T09:30:00Z"
      },
      "folder_parent_id": "folder_parent_id",
      "folder_path": [
        {
          "id": "id"
        }
      ],
      "is_frozen": true
    }
  }
}
```

**SDK Code**

```python
import requests

url = "https://api.elevenlabs.io/v1/convai/knowledge-base/summaries"

querystring = {"document_ids":"[\"21m00Tcm4TlvDq8ikWAM\",\"31n11Udm5UmwEr9jkXBN\"]"}

response = requests.get(url, params=querystring)

print(response.json())
```

```javascript
const url = 'https://api.elevenlabs.io/v1/convai/knowledge-base/summaries?document_ids=%5B%2221m00Tcm4TlvDq8ikWAM%22%2C%2231n11Udm5UmwEr9jkXBN%22%5D';
const options = {method: 'GET'};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.elevenlabs.io/v1/convai/knowledge-base/summaries?document_ids=%5B%2221m00Tcm4TlvDq8ikWAM%22%2C%2231n11Udm5UmwEr9jkXBN%22%5D"

	req, _ := http.NewRequest("GET", url, nil)

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.elevenlabs.io/v1/convai/knowledge-base/summaries?document_ids=%5B%2221m00Tcm4TlvDq8ikWAM%22%2C%2231n11Udm5UmwEr9jkXBN%22%5D")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.elevenlabs.io/v1/convai/knowledge-base/summaries?document_ids=%5B%2221m00Tcm4TlvDq8ikWAM%22%2C%2231n11Udm5UmwEr9jkXBN%22%5D")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.elevenlabs.io/v1/convai/knowledge-base/summaries?document_ids=%5B%2221m00Tcm4TlvDq8ikWAM%22%2C%2231n11Udm5UmwEr9jkXBN%22%5D');

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.elevenlabs.io/v1/convai/knowledge-base/summaries?document_ids=%5B%2221m00Tcm4TlvDq8ikWAM%22%2C%2231n11Udm5UmwEr9jkXBN%22%5D");
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let request = NSMutableURLRequest(url: NSURL(string: "https://api.elevenlabs.io/v1/convai/knowledge-base/summaries?document_ids=%5B%2221m00Tcm4TlvDq8ikWAM%22%2C%2231n11Udm5UmwEr9jkXBN%22%5D")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```