> 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.

# ナレッジベースリストを取得

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

利用可能なナレッジベースドキュメントのリストを取得します

Reference: https://elevenlabs.io/docs/api-reference/knowledge-base/list

## 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

- `page_size` (integer, optional, default: 30) — 返すドキュメントの最大数です。100を超えることはできず、デフォルトは30です。
- `search` (string, optional, nullable) — 指定すると、エンドポイントは名前がこの文字列で始まるナレッジベースドキュメントのみを返します。
- `show_only_owned_documents` (boolean, optional, default: false, deprecated) — trueに設定すると、エンドポイントは自分が所有するドキュメントのみを返します（他者から共有されたものは含みません）。非推奨：代わりにcreated_by_user_idを使用してください。
- `created_by_user_id` (string, optional, nullable) — 作成者ユーザーIDでドキュメントをフィルタリングします。設定すると、このユーザーが作成したドキュメントのみを返します。show_only_owned_documentsより優先されます。認証済みユーザーを指定するには'@me'を使用してください。
- `types` (list of enum, optional, nullable) — 指定した場合、エンドポイントは指定された種類のドキュメントのみを返します。
  - Allowed values: `file`, `url`, `text`, `folder`
- `parent_folder_id` (string, optional, nullable) — 設定すると、エンドポイントは指定したフォルダの直接の子であるドキュメントのみを返します。
- `ancestor_folder_id` (string, optional, nullable) — 設定すると、エンドポイントは指定したフォルダの子孫であるドキュメントのみを返します。
- `folders_first` (boolean, optional, default: false) — ドキュメント一覧でフォルダーを先に返すかどうか。
- `sort_direction` (enum, optional) — 結果の並べ替え方向
  - Allowed values: `asc`, `desc`
- `sort_by` (enum, optional, nullable) — 結果の並べ替えに使用するフィールド
  - Allowed values: `name`, `created_at`, `updated_at`, `size`
- `cursor` (string, optional, nullable) — 次のページを取得するために使用します。カーソルはレスポンスで返されます。

## Response

### 200

成功レスポンス。

- `documents` (list of GetKnowledgeBaseListResponseModelDocumentsItems, required)
- `has_more` (boolean, required)
- `next_cursor` (string, optional, nullable)

## Errors

### 422 Unprocessable Entity Error

検証エラー

- `detail` (list of ValidationError, optional)

## Types

### GetKnowledgeBaseListResponseModelDocumentsItems

- `type`: `file` (GetKnowledgeBaseSummaryFileResponseModel)
  - `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 V1ConvaiKnowledgeBaseSummariesGetResponsesContentApplicationJsonSchemaDiscriminatorMappingSuccessDataDiscriminatorMappingFileDependentAgentsItems, required, deprecated) — このフィールドは非推奨であり、今後削除されます。代わりに別のエンドポイントを使用して依存エージェントを取得してください。
  - `auto_sync_info` (AutoSyncInfo, optional, nullable)
  - `external_sync_info` (ExternalFileSyncInfo, optional, nullable) — 外部ソース内の元のファイルへのリンクを追跡します。
  - `folder_parent_id` (string, optional, nullable) — 親フォルダのID。ドキュメントがルートレベルにある場合はnullです。
  - `folder_path` (list of KnowledgeBaseFolderPathSegmentSummaryResponseModel, optional) — ルートから親フォルダまでの、このエンティティにつながるフォルダパスセグメント。
  - `is_frozen` (boolean, optional, default: false)
  - `refresh_status` (FileRefreshStatus, optional, nullable) — 外部同期KBファイルの進行中／直近の更新状態です。
- `type`: `folder` (GetKnowledgeBaseSummaryFolderResponseModel)
  - `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 V1ConvaiKnowledgeBaseSummariesGetResponsesContentApplicationJsonSchemaDiscriminatorMappingSuccessDataDiscriminatorMappingFolderDependentAgentsItems, required, deprecated) — このフィールドは非推奨であり、今後削除されます。代わりに別のエンドポイントを使用して依存エージェントを取得してください。
  - `auto_sync_info` (AutoSyncInfo, optional, nullable)
  - `external_sync_info` (ExternalFolderSyncInfo, optional, nullable) — 外部ソースフォルダをミラーリングするナレッジベースフォルダのメタデータ。
  - `folder_parent_id` (string, optional, nullable) — 親フォルダのID。ドキュメントがルートレベルにある場合はnullです。
  - `folder_path` (list of KnowledgeBaseFolderPathSegmentSummaryResponseModel, optional) — ルートから親フォルダまでの、このエンティティにつながるフォルダパスセグメント。
  - `is_frozen` (boolean, optional, default: false)
- `type`: `text` (GetKnowledgeBaseSummaryTextResponseModel)
  - `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 V1ConvaiKnowledgeBaseSummariesGetResponsesContentApplicationJsonSchemaDiscriminatorMappingSuccessDataDiscriminatorMappingTextDependentAgentsItems, required, deprecated) — このフィールドは非推奨であり、今後削除されます。代わりに別のエンドポイントを使用して依存エージェントを取得してください。
  - `folder_parent_id` (string, optional, nullable) — 親フォルダのID。ドキュメントがルートレベルにある場合はnullです。
  - `folder_path` (list of KnowledgeBaseFolderPathSegmentSummaryResponseModel, optional) — ルートから親フォルダまでの、このエンティティにつながるフォルダパスセグメント。
- `type`: `url` (GetKnowledgeBaseSummaryURLResponseModel)
  - `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 V1ConvaiKnowledgeBaseSummariesGetResponsesContentApplicationJsonSchemaDiscriminatorMappingSuccessDataDiscriminatorMappingUrlDependentAgentsItems, required, deprecated) — このフィールドは非推奨であり、今後削除されます。代わりに別のエンドポイントを使用して依存エージェントを取得してください。
  - `auto_sync_info` (AutoSyncInfo, optional, nullable)
  - `folder_parent_id` (string, optional, nullable) — 親フォルダのID。ドキュメントがルートレベルにある場合はnullです。
  - `folder_path` (list of KnowledgeBaseFolderPathSegmentSummaryResponseModel, optional) — ルートから親フォルダまでの、このエンティティにつながるフォルダパスセグメント。

### ValidationError

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

### 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, nullable) — 匿名ユーザーのアクセスレベル。Noneの場合、このリソースは公開共有されません。
  - Allowed values: `admin`, `editor`, `commenter`, `viewer`
- `access_source` (enum, optional, nullable) — リクエストしたユーザーがこのリソースにアクセスできる理由。'creator'＝呼び出し元がオーナーです。'explicit'＝呼び出し元（またはそのワークスペースグループのいずれか）が、ワークスペース全体のeveryoneグループ以外としてrole_to_group_idsに記載されています。'workspace_default'＝ワークスペース全体のeveryoneグループが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)

### V1ConvaiKnowledgeBaseSummariesGetResponsesContentApplicationJsonSchemaDiscriminatorMappingSuccessDataDiscriminatorMappingFileDependentAgentsItems

- `type`: `available` (DependentAvailableAgentIdentifier)
  - `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` (DependentUnknownAgentIdentifier)
  - `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, nullable) — 次回予定されている同期のUnixタイムスタンプ、またはNone（フォルダーの場合）
- `auto_discover` (boolean, optional, default: false, deprecated) — 非推奨です。このフィールドは現在は効果がなく、今後のリリースで削除されます。

### ExternalFileSyncInfo

外部ソース内の元のファイルへのリンクを追跡します。

- `type` (enum, required) — プロバイダー識別子
  - Allowed values: `google_drive`
- `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` (string, required) — 外部システムで最後に変更された日時
- `root_folder_id` (string, optional, nullable) — 同期ツリー配下のすべてのエンティティをクエリするために使用する、同期ルートのKBフォルダID

### KnowledgeBaseFolderPathSegmentSummaryResponseModel

- `id` (string, required)

### FileRefreshStatus

外部同期KBファイルの進行中／直近の更新状態です。

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

### V1ConvaiKnowledgeBaseSummariesGetResponsesContentApplicationJsonSchemaDiscriminatorMappingSuccessDataDiscriminatorMappingFolderDependentAgentsItems

- `type`: `available` (DependentAvailableAgentIdentifier)
  - `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` (DependentUnknownAgentIdentifier)
  - `id` (string, required)
  - `referenced_resource_ids` (list of string, optional) — エージェントが推移的な依存先である場合、エージェントが直接依存するリソースのIDを含みます。

### ExternalFolderSyncInfo

外部ソースフォルダをミラーリングするナレッジベースフォルダのメタデータ。

- `type` (enum, required) — プロバイダー識別子
  - Allowed values: `google_drive`
- `source_entity_id` (string, required) — 外部システム内のエンティティID
- `integration_connection_id` (string, required) — インテグレーション接続インスタンスID
- `root_folder_id` (string, optional, nullable) — 同期ルートのKBフォルダIDです。Noneは、このフォルダがルートであることを意味します。
- `sync_cursor` (string, optional, nullable) — プロバイダーによって解釈される、増分同期用の不透明なカーソル
- `last_sync_at` (integer, optional, nullable) — 最後に完了した同期のUnixタイムスタンプ

### V1ConvaiKnowledgeBaseSummariesGetResponsesContentApplicationJsonSchemaDiscriminatorMappingSuccessDataDiscriminatorMappingTextDependentAgentsItems

- `type`: `available` (DependentAvailableAgentIdentifier)
  - `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` (DependentUnknownAgentIdentifier)
  - `id` (string, required)
  - `referenced_resource_ids` (list of string, optional) — エージェントが推移的な依存先である場合、エージェントが直接依存するリソースのIDを含みます。

### V1ConvaiKnowledgeBaseSummariesGetResponsesContentApplicationJsonSchemaDiscriminatorMappingSuccessDataDiscriminatorMappingUrlDependentAgentsItems

- `type`: `available` (DependentAvailableAgentIdentifier)
  - `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` (DependentUnknownAgentIdentifier)
  - `id` (string, required)
  - `referenced_resource_ids` (list of string, optional) — エージェントが推移的な依存先である場合、エージェントが直接依存するリソースのIDを含みます。

### ValidationErrorLocItems

## Examples

**Response**

```json
{
  "documents": [
    {
      "access_info": {
        "access_source": "creator",
        "creator_email": "john.doe@example.com",
        "creator_name": "John Doe",
        "is_creator": true,
        "role": "admin"
      },
      "auto_sync_info": {
        "auto_discover": false,
        "auto_remove": false,
        "consec_failures": 0,
        "minimum_frequency_days": 7,
        "next_refresh_by": 1
      },
      "dependent_agents": [
        {
          "access_level": "admin",
          "created_at_unix_secs": 1,
          "id": "string",
          "name": "string",
          "referenced_resource_ids": [
            "string"
          ],
          "type": "available"
        }
      ],
      "folder_parent_id": "string",
      "folder_path": [
        {
          "id": "string"
        }
      ],
      "id": "string",
      "metadata": {
        "created_at_unix_secs": 1,
        "last_updated_at_unix_secs": 1,
        "size_bytes": 1
      },
      "name": "string",
      "supported_usages": [
        "auto"
      ],
      "type": "string",
      "url": "string"
    }
  ],
  "has_more": true,
  "next_cursor": "string"
}
```

**SDK Code**

```python
import requests

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

response = requests.get(url)

print(response.json())
```

```javascript
const url = 'https://api.elevenlabs.io/v1/convai/knowledge-base';
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"

	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")

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")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.elevenlabs.io/v1/convai/knowledge-base');

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

```csharp
using RestSharp;

var client = new RestClient("https://api.elevenlabs.io/v1/convai/knowledge-base");
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")! 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()
```