Documents
Manage and inspect documents in your knowledge base.
List Documents
GET /v1/kb/workspaces/{id}/documentsReturns all documents in a workspace.
Scope: kb:read
Get Document
GET /v1/kb/documents/{id}Returns metadata for a specific document.
Scope: kb:read
Delete Document
DELETE /v1/kb/documents/{id}Permanently deletes a document and its embeddings.
Scope: kb:write
Preview Document
GET /v1/kb/documents/{id}/preview?workspace_id={ws_id}&chunks=10Returns the document content along with its first N chunks. Useful for inspecting how a document was parsed and chunked.
Scope: kb:read
| Parameter | Type | Description |
|---|---|---|
workspace_id | string | Required. Workspace ID |
chunks | number | Number of chunks to include (default: 10) |
Get Document Chunks
GET /v1/kb/documents/{id}/chunks?workspace_id={ws_id}Returns all chunks for a document, showing how it was split for embedding.
Scope: kb:read
| Parameter | Type | Description |
|---|---|---|
workspace_id | string | Required. Workspace ID |
Get Chunk Context
GET /v1/kb/documents/{id}/chunks/{chunk_index}/context?workspace_id={ws_id}&before=2&after=2Returns surrounding chunks for context around a specific chunk. Useful for understanding where a search result fits in the original document.
Scope: kb:read
| Parameter | Type | Description |
|---|---|---|
workspace_id | string | Required. Workspace ID |
before | number | Number of chunks before (default: 2) |
after | number | Number of chunks after (default: 2) |
Grep Document
GET /v1/kb/documents/{id}/grep?workspace_id={ws_id}&pattern={pattern}Pattern search within a document's chunks. Returns matching chunks with highlighted matches.
Scope: kb:read
| Parameter | Type | Description |
|---|---|---|
workspace_id | string | Required. Workspace ID |
pattern | string | Required. Search pattern |
case_sensitive | boolean | Case-sensitive search (default: false) |