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
Section titled “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
Section titled “Request”Path parameters
Section titled “Path parameters”documentation_id(string, required) — The id of a document from the knowledge base. This is returned on document addition.
Query parameters
Section titled “Query parameters”agent_id(string, optional, default: )
Response
Section titled “Response”Successful Response
conversational_ai_knowledge_base_documents_get_Response_200type: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
- Allowed values:
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
- Allowed values:
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
- Allowed values:
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
- Allowed values:
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
- Allowed values:
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
- Allowed values:
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
- Allowed values:
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
Section titled “Errors”422 Unprocessable Entity Error
Section titled “422 Unprocessable Entity Error”Validation Error
detail(list of ValidationError, optional)
ResourceAccessInfo
Section titled “ResourceAccessInfo”is_creator(boolean, required) — Whether the user making the request is the creator of the agentcreator_name(string, required) — Name of the agent's creatorcreator_email(string, required) — Email of the agent's creatorrole(enum, required) — The role of the user making the request- Allowed values:
admin,editor,commenter,viewer
- Allowed values:
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
- Allowed values:
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
- Allowed values:
KnowledgeBaseDocumentMetadataResponseModel
Section titled “KnowledgeBaseDocumentMetadataResponseModel”created_at_unix_secs(integer, required)last_updated_at_unix_secs(integer, required)size_bytes(integer, required)
AutoSyncInfo
Section titled “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 unavailableauto_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 failuresnext_refresh_by(integer, optional, nullable) — Unix timestamp for the next scheduled sync or None (in case of folders)
KnowledgeBaseFolderPathSegmentResponseModel
Section titled “KnowledgeBaseFolderPathSegmentResponseModel”id(string, required)name(string, required, nullable)
ExternalFileSyncInfo
Section titled “ExternalFileSyncInfo”Tracks the link back to the original file in an external source.
type(enum, required) — Provider identifier- Allowed values:
google_drive
- Allowed values:
source_entity_id(string, required) — Entity ID in the external systemintegration_connection_id(string, required) — Integration connection instance IDsource_parent_entity_id(string, required) — Folder ID in the external system this file was synced fromsource_mime_type(string, required) — Original MIME type in the external systemsource_modified_time(string, required) — Last modified time from the external systemroot_folder_id(string, optional, nullable) — KB folder ID of the sync root, used to query all entities under a sync tree
FileRefreshStatus
Section titled “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
- Allowed values:
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
Section titled “KbExternalSyncJob”type(enum, required)- Allowed values:
google_drive
- Allowed values:
folder_id(string, required)integration_connection_id(string, required)triggered_by(enum, required)- Allowed values:
on_demand,on_connect,auto
- Allowed values:
updated_at(integer, required)id(string, required)created_at(integer, required)status(enum, optional, default: queued)- Allowed values:
queued,processing,succeeded,failed,skipped,cancelled
- Allowed values:
sync_type(enum, optional, nullable)- Allowed values:
full,incremental
- Allowed values:
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
Section titled “ExternalFolderSyncInfo”Metadata for a KB folder that mirrors an external source folder.
type(enum, required) — Provider identifier- Allowed values:
google_drive
- Allowed values:
source_entity_id(string, required) — Entity ID in the external systemintegration_connection_id(string, required) — Integration connection instance IDroot_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 providerlast_sync_at(integer, optional, nullable) — Unix timestamp of last completed sync
ValidationError
Section titled “ValidationError”loc(list of ValidationErrorLocItems, required)msg(string, required)type(string, required)
ValidationErrorLocItems
Section titled “ValidationErrorLocItems”Examples
Section titled “Examples”Response
{
"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
import { ElevenLabsClient } from "@elevenlabs/elevenlabs-js";
async function main() {
const client = new ElevenLabsClient();
await client.conversationalAi.knowledgeBase.documents.get("21m00Tcm4TlvDq8ikWAM", {});
}
main();
from elevenlabs import ElevenLabs
client = ElevenLabs()
client.conversational_ai.knowledge_base.documents.get(
documentation_id="21m00Tcm4TlvDq8ikWAM",
)
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))
}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_bodyimport 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
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();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);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()