Read a Document
GET /v1/knowledge-bases/{knowledge_base_id}/documents/{document_id}
| Property | Value |
|---|---|
| Operation | get_knowledge_document |
| Group | Knowledge bases |
| Scope | knowledge:read |
Scopes of include values | names needs knowledge:read |
| Route class | read |
| Idempotency | No Idempotency-Key |
| Audit | An audited content read knowledge.document.read, when the request names an include value |
| Released in | 1.53.0 |
| Phase 0 host | Served (the hosted api pins 1.65.0) |
Answers the Document with the facts of its current revision (1.53.0); title and external_ref are null unless include=names adds them, which makes the read an audited content read.
Request
Set VOCAL_API to the base URL of your API and VOCAL_API_KEY to an API key with the knowledge:read scope (Authentication and keys). Replace each placeholder, such as agt_... or <name>, with your own value.
curl "$VOCAL_API/v1/knowledge-bases/kb_.../documents/kdoc_..." \
-H "Authorization: Bearer $VOCAL_API_KEY"const response = await fetch(`${process.env.VOCAL_API}/v1/knowledge-bases/kb_.../documents/kdoc_...`, {
headers: {
Authorization: `Bearer ${process.env.VOCAL_API_KEY}`,
},
});
console.log(response.status, await response.text());import os
import requests
response = requests.get(
f"{os.environ['VOCAL_API']}/v1/knowledge-bases/kb_.../documents/kdoc_...",
headers={
"Authorization": f"Bearer {os.environ['VOCAL_API_KEY']}",
},
)
print(response.status_code, response.text)Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
knowledge_base_id | path | KnowledgeBaseId | yes | The id of a Knowledge base: kb_ and the row's UUIDv7 in 26 Crockford base32 characters. Opaque and safe to log. |
document_id | path | KnowledgeDocumentId | yes | The id of a Document of a Knowledge base: kdoc_ and the row's UUIDv7 in 26 Crockford base32 characters. Opaque and safe to log. |
include | query | array of KnowledgeDocumentInclude | no | Content classes to add, comma-separated: names answers title and external_ref and makes the read an audited content read (1.53.0, second part). |
Responses
| Status | Content type | Shape | Error codes |
|---|---|---|---|
200 | application/json | KnowledgeDocument | |
400 | application/json | ErrorEnvelope | invalid_request |
401 | application/json | ErrorEnvelope | unauthenticated |
403 | application/json | ErrorEnvelope | forbidden |
404 | application/json | ErrorEnvelope | not_found |
429 | application/json | ErrorEnvelope | rate_limited |
500 | application/json | ErrorEnvelope | internal_error |
Fields of the 200 answer
The shape is KnowledgeDocument.
| Field | Type | Required | Description |
|---|---|---|---|
byte_size | integer or null | yes | |
chunk_count | integer | yes | |
chunker_version | string or null | yes | |
classification | KnowledgeClassification or null | yes | |
created_at | Timestamp | yes | |
embedding_space | EmbeddingSpace or null | yes | |
entity_counts | array of KnowledgeEntityCount | yes | |
error_code | IngestionErrorCode or null | yes | Set when failed. |
external_ref | string or null | yes | The file name, URL or vendor reference the Source knows the Document by. The content class names: null unless the read names include=names, and null in the answer of a write (1.53.0, second part). |
id | KnowledgeDocumentId | yes | |
indexed_at | Timestamp or null | yes | |
knowledge_base_id | KnowledgeBaseId | yes | |
last_ingestion_run_id | IngestionRunId or null | yes | |
media_type | KnowledgeMediaType or null | yes | |
object | "knowledge_document" | yes | |
page_count | integer or null | yes | |
parser_version | string or null | yes | |
purged_at | Timestamp or null | yes | |
quarantine_expires_at | Timestamp or null | yes | When the parsed text held for review is deleted, 14 days after the quarantine (a target); null otherwise. |
quarantined_at | Timestamp or null | yes | |
review_status | KnowledgeReviewStatus | yes | |
revision | integer | yes | Counts writes to the Document; returned as the ETag and required in If-Match. Not the number of content revisions. |
source_id | KnowledgeSourceId | yes | |
status | KnowledgeDocumentStatus | yes | |
tags | array of DocumentTag | yes | |
title | string or null | yes | The title the upload or the parse stage gave, or null when it has none. The content class names: null unless the read names include=names, and null in the answer of a write (1.53.0, second part). |
updated_at | Timestamp | yes |