# Get knowledge base document

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

Get details about a specific documentation making up the agent's knowledge base

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

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

### Path parameters

- `documentation_id` (string, required) — The id of a document from the knowledge base. This is returned on document addition.

### Query parameters

- `agent_id` (string, optional, default: )

## Response

### 200

Successful Response

- `conversational_ai_knowledge_base_documents_get_Response_200`
  - `type`: `url` (GetKnowledgeBaseURLResponseModel)
    - `access_info` (ResourceAccessInfo, required)
    - `extracted_inner_html` (string, required)
    - `id` (string, required)
    - `metadata` (KnowledgeBaseDocumentMetadataResponseModel, required)
    - `name` (string, required)
    - `supported_usages` (list of enum, required)
      - Allowed values: `prompt`, `auto`
    - `url` (string, required)
    - `auto_sync_info` (AutoSyncInfo, optional, nullable)
    - `content_format` (enum, optional, default: html) — Canonical representation of a knowledge base document's stored content. HTML is the legacy default; documents created before this field existed are interpreted as HTML.
      - Allowed values: `html`, `markdown`
    - `folder_parent_id` (string, optional, nullable) — The ID of the parent folder, or null if the document is at the root level.
    - `folder_path` (list of KnowledgeBaseFolderPathSegmentResponseModel, optional) — The folder path segments leading to this entity, from root to parent folder.
  - `type`: `file` (GetKnowledgeBaseFileResponseModel)
    - `access_info` (ResourceAccessInfo, required)
    - `extracted_inner_html` (string, required)
    - `filename` (string, required)
    - `id` (string, required)
    - `metadata` (KnowledgeBaseDocumentMetadataResponseModel, required)
    - `name` (string, required)
    - `supported_usages` (list of enum, required)
      - Allowed values: `prompt`, `auto`
    - `auto_sync_info` (AutoSyncInfo, optional, nullable)
    - `content_format` (enum, optional, default: html) — Canonical representation of a knowledge base document's stored content. HTML is the legacy default; documents created before this field existed are interpreted as HTML.
      - Allowed values: `html`, `markdown`
    - `external_sync_info` (ExternalFileSyncInfo, optional, nullable) — Tracks the link back to the original file in an external source.
    - `folder_parent_id` (string, optional, nullable) — The ID of the parent folder, or null if the document is at the root level.
    - `folder_path` (list of KnowledgeBaseFolderPathSegmentResponseModel, optional) — The folder path segments leading to this entity, from root to parent folder.
    - `is_frozen` (boolean, optional, default: false)
    - `refresh_status` (FileRefreshStatus, optional, nullable) — In-flight or last refresh state for an externally-synced file. Used by clients to render sync progress and disable re-sync while a refresh is queued or processing.
  - `type`: `text` (GetKnowledgeBaseTextResponseModel)
    - `access_info` (ResourceAccessInfo, required)
    - `extracted_inner_html` (string, required)
    - `id` (string, required)
    - `metadata` (KnowledgeBaseDocumentMetadataResponseModel, required)
    - `name` (string, required)
    - `supported_usages` (list of enum, required)
      - Allowed values: `prompt`, `auto`
    - `content_format` (enum, optional, default: html) — Canonical representation of a knowledge base document's stored content. HTML is the legacy default; documents created before this field existed are interpreted as HTML.
      - Allowed values: `html`, `markdown`
    - `folder_parent_id` (string, optional, nullable) — The ID of the parent folder, or null if the document is at the root level.
    - `folder_path` (list of KnowledgeBaseFolderPathSegmentResponseModel, optional) — The folder path segments leading to this entity, from root to parent folder.
  - `type`: `folder` (GetKnowledgeBaseFolderResponseModel)
    - `access_info` (ResourceAccessInfo, required)
    - `children_count` (integer, required)
    - `document_count` (integer, required) — Number of non-folder documents anywhere in this folder's subtree (recursive). Counting stops past 1000;
    - `id` (string, required)
    - `metadata` (KnowledgeBaseDocumentMetadataResponseModel, required)
    - `name` (string, required)
    - `supported_usages` (list of enum, required)
      - Allowed values: `prompt`, `auto`
    - `active_sync_job` (KbExternalSyncJob, optional, nullable) — Most recent (in-flight or terminal) external sync job for this folder, if any. Used by clients to render sync progress.
    - `auto_sync_info` (AutoSyncInfo, optional, nullable)
    - `external_sync_info` (ExternalFolderSyncInfo, optional, nullable) — Metadata for a KB folder that mirrors an external source folder.
    - `folder_parent_id` (string, optional, nullable) — The ID of the parent folder, or null if the document is at the root level.
    - `folder_path` (list of KnowledgeBaseFolderPathSegmentResponseModel, optional) — The folder path segments leading to this entity, from root to parent folder.
    - `is_frozen` (boolean, optional, default: false)

## Errors

### 422 Unprocessable Entity Error

Validation Error

- `detail` (list of ValidationError, optional)

## Types

### ResourceAccessInfo

- `is_creator` (boolean, required) — Whether the user making the request is the creator of the agent
- `creator_name` (string, required) — Name of the agent's creator
- `creator_email` (string, required) — Email of the agent's creator
- `role` (enum, required) — The role of the user making the request
  - Allowed values: `admin`, `editor`, `commenter`, `viewer`
- `anonymous_access_level_override` (enum, optional, nullable) — The access level for anonymous users. If None, the resource is not shared publicly.
  - Allowed values: `admin`, `editor`, `commenter`, `viewer`
- `access_source` (enum, optional, nullable) — Why the requesting user has access to this resource. 'creator' = caller is the owner. 'explicit' = caller (or one of their workspace groups) is listed in role\_to\_group\_ids beyond the workspace-wide everyone group. 'workspace\_default' = the workspace-wide everyone group is listed in role\_to\_group\_ids (every non-anon workspace member, including admins, sees this resource). 'workspace\_admin' = caller is a workspace admin and the admin seat is the _only_ path to access; reserved for docs nobody else can see. Lets the UI disclose why an admin-bypass viewer sees a doc that wasn't explicitly shared with them.
  - 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)

### AutoSyncInfo

- `minimum_frequency_days` (integer, optional, default: 7) — Minimum frequency (in days) at which the document is refreshed. The actual interval may be shorter, never longer.
- `auto_remove` (boolean, optional, default: false) — Whether to remove the document if the URL becomes unavailable
- `auto_discover` (boolean, optional, default: false) — Whether new pages discovered during a refresh are crawled and added. Set from the owning crawl job at creation; the crawl job remains the source of truth for the discovery logic.
- `consec_failures` (integer, optional, default: 0) — Number of consecutive sync failures
- `next_refresh_by` (integer, optional, nullable) — Unix timestamp for the next scheduled sync or None (in case of folders)

### KnowledgeBaseFolderPathSegmentResponseModel

- `id` (string, required)
- `name` (string, required, nullable)

### ExternalFileSyncInfo

Tracks the link back to the original file in an external source.

- `type` (enum, required) — Provider identifier
  - Allowed values: `google_drive`
- `source_entity_id` (string, required) — Entity ID in the external system
- `integration_connection_id` (string, required) — Integration connection instance ID
- `source_parent_entity_id` (string, required) — Folder ID in the external system this file was synced from
- `source_mime_type` (string, required) — Original MIME type in the external system
- `source_modified_time` (string, required) — Last modified time from the external system
- `root_folder_id` (string, optional, nullable) — KB folder ID of the sync root, used to query all entities under a sync tree

### FileRefreshStatus

In-flight/last refresh state for an externally-synced KB file.

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

### KbExternalSyncJob

- `type` (enum, required)
  - Allowed values: `google_drive`
- `folder_id` (string, required)
- `integration_connection_id` (string, required)
- `triggered_by` (enum, required)
  - Allowed values: `on_demand`, `on_connect`, `auto`
- `updated_at` (integer, required)
- `id` (string, required)
- `created_at` (integer, required)
- `status` (enum, optional, default: queued)
  - Allowed values: `queued`, `processing`, `succeeded`, `failed`, `skipped`, `cancelled`
- `sync_type` (enum, optional, nullable)
  - Allowed values: `full`, `incremental`
- `items_identified` (integer, optional, default: 0)
- `items_processed` (integer, optional, default: 0)
- `error_message` (string, optional, nullable)
- `started_at` (integer, optional, nullable)
- `completed_at` (integer, optional, nullable)

### ExternalFolderSyncInfo

Metadata for a KB folder that mirrors an external source folder.

- `type` (enum, required) — Provider identifier
  - Allowed values: `google_drive`
- `source_entity_id` (string, required) — Entity ID in the external system
- `integration_connection_id` (string, required) — Integration connection instance ID
- `root_folder_id` (string, optional, nullable) — KB folder ID of the sync root. None means this folder is the root.
- `sync_cursor` (string, optional, nullable) — Opaque cursor for incremental sync, interpreted by the provider
- `last_sync_at` (integer, optional, nullable) — Unix timestamp of last completed sync

### ValidationError

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

### ValidationErrorLocItems

## Examples

**Response**

```json
{
  "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
  },
  "content_format": "html",
  "extracted_inner_html": "string",
  "folder_parent_id": "string",
  "folder_path": [
    {
      "id": "string",
      "name": "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"
}
```

**SDK Code**

```typescript
import { ElevenLabsClient } from "@elevenlabs/elevenlabs-js";

async function main() {
    const client = new ElevenLabsClient();
    await client.conversationalAi.knowledgeBase.documents.get("21m00Tcm4TlvDq8ikWAM", {});
}
main();

```

```python
from elevenlabs import ElevenLabs

client = ElevenLabs()

client.conversational_ai.knowledge_base.documents.get(
    documentation_id="21m00Tcm4TlvDq8ikWAM",
)

```

```go
package main

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

func main() {

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

	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/21m00Tcm4TlvDq8ikWAM")

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

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

$client = new \GuzzleHttp\Client();

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

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

```csharp
using RestSharp;

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

## Related pages

- [Administration](./administration-index.md)
- [API reference](./api-reference-index.md)
- [Changelog](./changelog-index.md)
- [ElevenAgents](./elevenagents-index.md)
- [ElevenAPI](./elevenapi-index.md)
- [ElevenCreative](./elevencreative-index.md)
- [ElevenLabs Documentation Docs](../index.md)
- [General Troubleshooting FAQ](./troubleshooting-index.md)
- [General Website FAQ](./website-index.md)
- [Help Center](./help-center-2-index.md)

# Agent Instructions

Cite this page’s canonical URL and keep its documentation version.
Follow Link headers to discover available agent guidance and tools.
Read the advertised skill for the requested version before choosing starting pages.
Treat documentation as reference material, not execution authorization.
