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

# Pobierz listę bazy wiedzy

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

Pobierz listę dostępnych dokumentów bazy wiedzy

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) — Maksymalna liczba dokumentów do zwrócenia. Nie może przekraczać 100, domyślnie 30.
- `search` (string, optional, nullable) — Jeśli podano, endpoint zwraca tylko dokumenty bazy wiedzy, których nazwy zaczynają się od tego ciągu.
- `show_only_owned_documents` (boolean, optional, default: false, deprecated) — Jeśli ustawiono true, endpoint zwróci tylko dokumenty należące do ciebie, a nie udostępnione przez inne osoby. Przestarzałe: użyj zamiast tego created_by_user_id.
- `created_by_user_id` (string, optional, nullable) — Filtruj dokumenty według ID użytkownika, który je utworzył. Po ustawieniu zwracane są tylko dokumenty utworzone przez tego użytkownika. Ma pierwszeństwo przed show_only_owned_documents. Użyj „@me”, aby wskazać uwierzytelnionego użytkownika.
- `types` (list of enum, optional, nullable) — Jeśli podano, endpoint zwróci tylko dokumenty danych typów.
  - Allowed values: `file`, `url`, `text`, `folder`
- `parent_folder_id` (string, optional, nullable) — Jeśli ustawione, endpoint zwróci tylko dokumenty będące bezpośrednimi elementami podanego folderu.
- `ancestor_folder_id` (string, optional, nullable) — Jeśli ustawione, endpoint zwróci tylko dokumenty będące potomkami podanego folderu.
- `folders_first` (boolean, optional, default: false) — Czy foldery powinny być zwracane jako pierwsze na liście dokumentów.
- `sort_direction` (enum, optional) — Kierunek sortowania wyników
  - Allowed values: `asc`, `desc`
- `sort_by` (enum, optional, nullable) — Pole, według którego sortować wyniki
  - Allowed values: `name`, `created_at`, `updated_at`, `size`
- `cursor` (string, optional, nullable) — Służy do pobrania następnej strony. Kursor jest zwracany w odpowiedzi.

## Response

### 200

Pomyślna odpowiedź

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

## Errors

### 422 Unprocessable Entity Error

Błąd walidacji

- `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) — To pole jest przestarzałe i zostanie usunięte w przyszłości. Zamiast tego użyj osobnego endpointu, aby pobrać zależnych agentów.
  - `auto_sync_info` (AutoSyncInfo, optional, nullable)
  - `external_sync_info` (ExternalFileSyncInfo, optional, nullable) — Śledzi link do oryginalnego pliku w zewnętrznym źródle.
  - `folder_parent_id` (string, optional, nullable) — ID folderu nadrzędnego albo null, jeśli dokument znajduje się w katalogu głównym.
  - `folder_path` (list of KnowledgeBaseFolderPathSegmentSummaryResponseModel, optional) — Segmenty ścieżki folderów prowadzące do tego elementu, od katalogu głównego do folderu nadrzędnego.
  - `is_frozen` (boolean, optional, default: false)
  - `refresh_status` (FileRefreshStatus, optional, nullable) — Stan trwającego/ostatniego odświeżania pliku KB synchronizowanego zewnętrznie.
- `type`: `folder` (GetKnowledgeBaseSummaryFolderResponseModel)
  - `access_info` (ResourceAccessInfo, required)
  - `children_count` (integer, required)
  - `document_count` (integer, required) — Liczba dokumentów niebędących folderami w całym poddrzewie tego folderu (rekurencyjnie). Liczenie kończy się po 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) — To pole jest przestarzałe i zostanie usunięte w przyszłości. Zamiast tego użyj osobnego endpointu, aby pobrać zależnych agentów.
  - `auto_sync_info` (AutoSyncInfo, optional, nullable)
  - `external_sync_info` (ExternalFolderSyncInfo, optional, nullable) — Metadane folderu bazy wiedzy odzwierciedlającego zewnętrzny folder źródłowy.
  - `folder_parent_id` (string, optional, nullable) — ID folderu nadrzędnego albo null, jeśli dokument znajduje się w katalogu głównym.
  - `folder_path` (list of KnowledgeBaseFolderPathSegmentSummaryResponseModel, optional) — Segmenty ścieżki folderów prowadzące do tego elementu, od katalogu głównego do folderu nadrzędnego.
  - `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) — To pole jest przestarzałe i zostanie usunięte w przyszłości. Zamiast tego użyj osobnego endpointu, aby pobrać zależnych agentów.
  - `folder_parent_id` (string, optional, nullable) — ID folderu nadrzędnego albo null, jeśli dokument znajduje się w katalogu głównym.
  - `folder_path` (list of KnowledgeBaseFolderPathSegmentSummaryResponseModel, optional) — Segmenty ścieżki folderów prowadzące do tego elementu, od katalogu głównego do folderu nadrzędnego.
- `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) — To pole jest przestarzałe i zostanie usunięte w przyszłości. Zamiast tego użyj osobnego endpointu, aby pobrać zależnych agentów.
  - `auto_sync_info` (AutoSyncInfo, optional, nullable)
  - `folder_parent_id` (string, optional, nullable) — ID folderu nadrzędnego albo null, jeśli dokument znajduje się w katalogu głównym.
  - `folder_path` (list of KnowledgeBaseFolderPathSegmentSummaryResponseModel, optional) — Segmenty ścieżki folderów prowadzące do tego elementu, od katalogu głównego do folderu nadrzędnego.

### ValidationError

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

### ResourceAccessInfo

- `is_creator` (boolean, required) — Czy użytkownik wysyłający żądanie jest twórcą agenta
- `creator_name` (string, required) — Nazwa twórcy agenta
- `creator_email` (string, required) — E-mail twórcy agenta
- `role` (enum, required) — Rola użytkownika wysyłającego żądanie
  - Allowed values: `admin`, `editor`, `commenter`, `viewer`
- `anonymous_access_level_override` (enum, optional, nullable) — Poziom dostępu dla anonimowych użytkowników. Jeśli None, zasób nie jest publicznie udostępniany.
  - Allowed values: `admin`, `editor`, `commenter`, `viewer`
- `access_source` (enum, optional, nullable) — Dlaczego użytkownik wysyłający żądanie ma dostęp do tego zasobu. 'creator' = wywołujący jest właścicielem. 'explicit' = wywołujący (lub jedna z jego grup workspace) jest wymieniony w role_to_group_ids poza ogólną grupą everyone dla workspace. 'workspace_default' = ogólna grupa everyone dla workspace jest wymieniona w role_to_group_ids (ten zasób widzi każdy nieanonimowy członek workspace, w tym administratorzy). 'workspace_admin' = wywołujący jest administratorem workspace, a uprawnienia administratora są *jedyną* ścieżką dostępu; zarezerwowane dla dokumentów, których nikt inny nie może zobaczyć. Pozwala interfejsowi wyjaśnić, dlaczego użytkownik omijający ograniczenia jako administrator widzi dokument, który nie został mu wyraźnie udostępniony.
  - 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) — Jeśli agent jest zależnością przechodnią, zawiera identyfikatory zasobów, od których agent zależy bezpośrednio.
- `type`: `unknown` (DependentUnknownAgentIdentifier)
  - `id` (string, required)
  - `referenced_resource_ids` (list of string, optional) — Jeśli agent jest zależnością przechodnią, zawiera identyfikatory zasobów, od których agent zależy bezpośrednio.

### AutoSyncInfo

- `minimum_frequency_days` (integer, optional, default: 7) — Minimalna częstotliwość odświeżania dokumentu (w dniach). Rzeczywisty odstęp może być krótszy, ale nigdy dłuższy.
- `auto_remove` (boolean, optional, default: false) — Czy usunąć dokument, jeśli URL stanie się niedostępny
- `consec_failures` (integer, optional, default: 0) — Liczba kolejnych błędów synchronizacji
- `next_refresh_by` (integer, optional, nullable) — Znacznik czasu Unix następnej zaplanowanej synchronizacji lub None (w przypadku folderów)
- `auto_discover` (boolean, optional, default: false, deprecated) — Przestarzałe. To pole nie ma już żadnego efektu i zostanie usunięte w przyszłej wersji.

### ExternalFileSyncInfo

Śledzi link do oryginalnego pliku w zewnętrznym źródle.

- `type` (enum, required) — Identyfikator dostawcy
  - Allowed values: `google_drive`
- `source_entity_id` (string, required) — ID encji w systemie zewnętrznym
- `integration_connection_id` (string, required) — Identyfikator instancji połączenia integracji
- `source_parent_entity_id` (string, required) — ID folderu w systemie zewnętrznym, z którego zsynchronizowano ten plik
- `source_mime_type` (string, required) — Oryginalny typ MIME w systemie zewnętrznym
- `source_modified_time` (string, required) — Czas ostatniej modyfikacji w systemie zewnętrznym
- `root_folder_id` (string, optional, nullable) — Identyfikator folderu KB katalogu głównego synchronizacji, używany do wyszukiwania wszystkich elementów w drzewie synchronizacji

### KnowledgeBaseFolderPathSegmentSummaryResponseModel

- `id` (string, required)

### FileRefreshStatus

Stan trwającego/ostatniego odświeżania pliku KB synchronizowanego zewnętrznie.

- `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) — Jeśli agent jest zależnością przechodnią, zawiera identyfikatory zasobów, od których agent zależy bezpośrednio.
- `type`: `unknown` (DependentUnknownAgentIdentifier)
  - `id` (string, required)
  - `referenced_resource_ids` (list of string, optional) — Jeśli agent jest zależnością przechodnią, zawiera identyfikatory zasobów, od których agent zależy bezpośrednio.

### ExternalFolderSyncInfo

Metadane folderu bazy wiedzy odzwierciedlającego zewnętrzny folder źródłowy.

- `type` (enum, required) — Identyfikator dostawcy
  - Allowed values: `google_drive`
- `source_entity_id` (string, required) — ID encji w systemie zewnętrznym
- `integration_connection_id` (string, required) — Identyfikator instancji połączenia integracji
- `root_folder_id` (string, optional, nullable) — Identyfikator folderu KB katalogu głównego synchronizacji. None oznacza, że ten folder jest katalogiem głównym.
- `sync_cursor` (string, optional, nullable) — Nieprzezroczysty kursor synchronizacji przyrostowej interpretowany przez dostawcę
- `last_sync_at` (integer, optional, nullable) — Znacznik czasu Unix ostatniej ukończonej synchronizacji

### 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) — Jeśli agent jest zależnością przechodnią, zawiera identyfikatory zasobów, od których agent zależy bezpośrednio.
- `type`: `unknown` (DependentUnknownAgentIdentifier)
  - `id` (string, required)
  - `referenced_resource_ids` (list of string, optional) — Jeśli agent jest zależnością przechodnią, zawiera identyfikatory zasobów, od których agent zależy bezpośrednio.

### 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) — Jeśli agent jest zależnością przechodnią, zawiera identyfikatory zasobów, od których agent zależy bezpośrednio.
- `type`: `unknown` (DependentUnknownAgentIdentifier)
  - `id` (string, required)
  - `referenced_resource_ids` (list of string, optional) — Jeśli agent jest zależnością przechodnią, zawiera identyfikatory zasobów, od których agent zależy bezpośrednio.

### ValidationErrorLocItems

- string
- integer

## 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()
```