Create a Knowledge Base
Build a searchable document collection for a team and choose the indexing models
A knowledge base must belong to a team. Two decisions are hard to reverse: the embedding model fixes the vector dimension (it cannot be changed once documents are processed), and visibility decides who can read it without a share. The name must be unique within the team.
Prerequisites
- You are a member of the target team with the
kb:createpermission; 2) the team is authorized for anembeddingmodel (an unauthorized model is rejected at creation, and without one the knowledge base cannot be searched); 3) authorize arerankmodel too if you want reranking. See Managing Models for authorization and provider setup.
Permissions and visibility
| Action | Permission | Team role requirement |
|---|---|---|
| View knowledge base / documents / chunks | kb:read | Within the visibility rules |
| Hit testing (retrieval) | kb:test | Read access |
| Create a knowledge base | kb:create | Team member |
| Edit settings, upload/process/delete documents, edit chunks | kb:update | The creator, or a team owner/admin |
| Delete a knowledge base | kb:delete | Team owner/admin |
| Share with another team | kb:update | Owning team owner/admin |
| Revoke a share | kb:delete | Owning team owner/admin |
Visibility is set in the create/edit dialog:
| Visibility | Who can read | Notes |
|---|---|---|
private | The creator only | Other team members cannot see it; cannot be shared with other teams |
team | All members of the team | Writing still requires the creator or a team admin |
public | Reserved value | Not offered in the UI, kept for compatibility |
Cross-team access is only ever granted through a share and is always read-only — see “Cross-team sharing (read-only)” below.
Creating a knowledge base
- Go to Knowledge Bases and select Create Knowledge Base.
- Fill in the basics:
- Name:
1-100characters, unique within the team; a duplicate returnskb_name_exists. - Description: up to
500characters describing purpose and scope. - Team: the current team (the admin dashboard form can target another team).
- Name:
- Select models:
- Embedding Model: an
embeddingmodel authorized for the team.embedding_model_idcannot be changed after creation. - Rerank Model: optional; once bound, recall results can be re-scored during retrieval.
- Embedding Model: an
- Configure chunking and reranking:
- Chunk Size
chunk_size: default1000characters, minimum100(UI suggests a maximum of2000). - Chunk Overlap
chunk_overlap: default100characters, minimum0(UI suggests a maximum of500). - Custom Separator: escape sequences such as
\n\nare allowed and act as a hard split boundary. - Enable Reranking: on by default; Rerank Candidate Pool defaults to
10(1-100); Rerank Score Threshold defaults to empty (0-1).
- Chunk Size
- Choose visibility (
privateorteam). - Click Create Knowledge Base and open the detail page; confirm the status is Active.
When editing an existing knowledge base the dialog also offers an Enable Knowledge Base switch (turning it off sets archived, and archived knowledge bases are not searched).

The embedding model cannot be replaced
Stored vectors are bound to the embedding model chosen at creation. Updating embedding_model_id is rejected outright (embedding_model_locked_after_kb_creation), while the rerank model can be swapped at any time (team authorization is checked on change). To use another embedding model, create a new knowledge base and process its documents with the new model.
Models and vector dimensions
Embedding model
A platform model with model_type = embedding. It appears in the create form only after being granted to the team through model authorization. A knowledge base references exactly one embedding model; without an available model, neither document processing nor retrieval can run.
Vector dimensions
embedding_dimension is written and frozen when the first batch of documents finishes vectorization. From then on:
- documents with a matching dimension are indexed normally;
- vectors with a mismatched dimension raise a dimension mismatch error, and retrieval reports the
configuration_mismatchcategory so you can verify the model and index dimension; - changing the embedding model never rebuilds the index automatically — create a new knowledge base or run a full reprocessing flow.
Chunking and retrieval settings
| Field | Default | Range | Where it applies |
|---|---|---|---|
chunk_size | 1000 | >=100 characters | Document processing (next process/reprocess) |
chunk_overlap | 100 | >=0 characters | Document processing |
separator | empty | any string | Document processing, a hard split boundary |
rerank_enabled | true | boolean | Retrieval (needs a bound rerank model) |
rerank_candidate_k | 10 | 1-100 | Retrieval |
rerank_score_threshold | empty | 0-1 | Retrieval |
search_mode | empty (null) | vector / fulltext / hybrid | Default mode for Agent/workflow retrieval |
top_k | empty (null) | 1-100 | Agent/workflow retrieval |
score_threshold | empty (null) | 0-1 | Agent/workflow retrieval |
dense_weight / lexical_weight | empty (null) | >=0 | Hybrid retrieval weights |
rrf_k | empty (null) | 1-1000 | Hybrid fusion constant |
KB settings and search requests are two separate sets of defaults
The retrieval fields in the knowledge base settings default to empty and only apply once set explicitly, whereas a search request without parameters runs with search_mode=hybrid, top_k=5, score_threshold=0, and rrf_k=60. The hit-testing panel initializes from the knowledge base settings and Apply to Production writes the configuration back. In practice the setting mainly drives Agent/workflow retrieval, as described in Retrieval & Quality Tuning.
For the character semantics of chunking, the Markdown versus plain-text difference, preview, and failure retries, see Chunking and Document Processing.
Cross-team sharing (read-only)
Sharing gives another team read and retrieval access to a knowledge base, but no editing rights. It is the only form of cross-team access.
Steps
- In the Knowledge Bases list, hover a card, open the ⋯ menu, and choose Share.
- The entry is only shown for knowledge bases your own team owns, and only to team owners/admins.
- In the Share dialog, select a team.
- The list comes from the teams you belong to and automatically excludes the current team and teams already shared with.
- The Permission Level offers only Read Only and cannot be changed.
- Click Share. The entry appears with a read-only badge and a "Shared by …" note.
- To revoke, click the delete icon on that entry under Shared With and confirm; the knowledge base disappears from the receiving team's list immediately.
Rules and failure reasons
| Rule | Result |
|---|---|
A private knowledge base | Cannot be shared; returns private_kb_cannot_be_shared (400) |
| Sharing with the owning team | Rejected with kb_cannot_share_to_own_team (400) |
| Sharing with the same team twice | Rejected with kb_already_shared (400) |
| What the receiving team sees | Only knowledge bases whose visibility is team or public |
| Receiving-team permission | read_only only: view, retrieve, and associate with Agents/workflows; cannot change settings, upload, process, or delete documents |
| Revoking a share that does not exist | Returns kb_share_not_found (404) |
After sharing, both sides show a marker in their lists:
- Receiver: a From + team name badge, and every write entry point is disabled on the detail page (
is_owned = false). - Owner: a Shared with N teams badge, with N coming from
shared_with_count.
Sharing through the API
# Share with another team (read_only is the only valid permission value)
curl -X POST "https://your-domain.com/api/v1/knowledge-bases/$KB_ID/share" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"team_id": "TARGET_TEAM_UUID", "permission": "read_only"}'
# List the teams it is shared with (owning-team members only)
curl "https://your-domain.com/api/v1/knowledge-bases/$KB_ID/shares" \
-H "Authorization: Bearer $ACCESS_TOKEN"
# Revoke a share
curl -X DELETE "https://your-domain.com/api/v1/knowledge-bases/$KB_ID/share/$TARGET_TEAM_ID" \
-H "Authorization: Bearer $ACCESS_TOKEN"On the receiving side, GET /api/v1/knowledge-bases accepts include_shared (default true) and own_only (default false); set include_shared=false or own_only=true to see only your own teams' knowledge bases.
Document management
Document management covers upload, processing, reprocessing, and deletion; the detailed steps are in Import Documents and Chunking and Document Processing.
| Capability | Notes |
|---|---|
| Upload | POST /api/v1/knowledge-bases/{kb_id}/documents/upload (multipart); the document becomes pending and is not processed automatically |
| URL import | After a safety check a url document is created and you confirm its chunks on the preview page |
| Supported formats | PDF, DOC/DOCX, PPTX, TXT, Markdown, HTML, CSV, XLS/XLSX, JSON, URL (no .ppt, archives, or OCR) |
| Bulk actions | Select several documents: Quick Process pending ones, Retry Failed Chunks on failed ones, or Delete |
| Single-file limit | Site setting kb_document_max_upload_size_mb, default 50MB, range 1-1024MB |
Uploading and processing are two separate stages: a document appearing in the list does not mean it has been embedded. Only completed documents are retrievable, and only those are suitable for binding to an Agent.
Statistics
The knowledge base detail page shows statistic cards at the top (documents, chunks, tokens, and per-status counts); Hit Testing in the dropdown opens the retrieval lab.
GET /api/v1/knowledge-bases/{kb_id}/stats returns:
document_count(recomputed from actual documents, not the cached value)total_chunks,total_tokens(aggregated from documents and written back to the KB cache fields)documents_by_status,documents_by_typeembedding_dimensionandembedding_stats
Not implemented / Roadmap: retrieval analytics (query volume, latency, cache hit rate, top queries), storage usage trends, and statistics export are unavailable.
Troubleshooting
Document processing failed
- Confirm the format is supported, the file is not corrupted, and it is within the size limit.
- Open the document detail to read the error and identify whether extraction, chunking, or embedding failed.
- Common causes and fixes:
| Cause | Fix |
|---|---|
| Extraction failed (corrupted, encrypted, image-only) | Convert the format or remove the password and upload again |
| Zero chunks | Confirm the file contains extractable text, or turn text cleaning off and retry |
| Embedding failed (credentials, quota, dimension) | Verify model authorization and embedding_dimension, then retry failed chunks |
| Indexing failed (vector store unavailable) | Check Qdrant and the Worker logs |
No results or irrelevant results
- Confirm the documents are
completed. - Use Hit Testing to verify scores: with zero results, lower
score_thresholdfirst, then switch search mode. - Check whether an Agent overrides the knowledge base settings (
retrieval_top_k,score_threshold, andsearch_modeon the association). - Check that the vector store and
pg_searchare healthy; reprocess documents if needed.
Cost or performance anomalies
- High cost: avoid unnecessary reprocessing, tune chunking (larger chunks, less overlap), switch to a cheaper embedding model, and delete redundant documents.
- Slow retrieval: lower
top_k, disable reranking for simple queries, narrow the document scope, and check vector store resources.
Not implemented / Roadmap: per-knowledge-base document limits, daily embedding quotas, and cost alerts are all unavailable.
Best practices
- ✅ Name knowledge bases by content scope; avoid names like "Docs" or "Materials" that carry no information.
- ✅ Get one representative document working with the defaults (
1000/100), then compare adjustments with hit testing. - ✅ Clean up stale documents regularly; duplicate content competes with itself in the ranking.
- ✅ Keep private knowledge bases for personal drafts; use
teamvisibility for anything the team shares. - ❌ Do not expect to "add metadata" to improve retrieval —
metadatais generated by the processing pipeline and has no editing entry point. - ❌ Do not replace the embedding model in production, and do not scale chunk size up without validating retrieval first.
API access
Manage knowledge bases through the API; the endpoint list is in the Knowledge Base API. Knowledge base endpoints accept only a signed-in user's JWT session (Authorization: Bearer <ACCESS_TOKEN>) and do not accept a clou_ API key.
# List knowledge bases — supports team_id, search, status, own_only, include_shared
kbs = api.get("/api/v1/knowledge-bases", params={"team_id": "team-123", "include_shared": True})
# Create a knowledge base for a team
kb = api.post("/api/v1/knowledge-bases", json={
"name": "Product Docs",
"team_id": "team-123",
"embedding_model_id": "model-456",
"visibility": "team",
"settings": {"chunk_size": 1000, "chunk_overlap": 100, "rerank_enabled": True}
})
# Upload a document
with open("document.pdf", "rb") as f:
doc = api.post(
f"/api/v1/knowledge-bases/{kb_id}/documents/upload",
files={"file": f}
)
# Search a knowledge base
results = api.post(f"/api/v1/knowledge-bases/{kb_id}/search", json={
"query": "How to reset password?",
"top_k": 5
})Document processing API:
| Endpoint | Notes |
|---|---|
POST /api/v1/knowledge-bases/{kb_id}/documents/{doc_id}/process | Process a pending document (chunk settings optional) |
POST /api/v1/knowledge-bases/{kb_id}/documents/{doc_id}/process-with-chunks | Submit the chunks confirmed in the preview |
POST /api/v1/knowledge-bases/{kb_id}/documents/{doc_id}/reprocess | Delete old chunks and process again |
POST /api/v1/knowledge-bases/{kb_id}/documents/{doc_id}/rechunk | Re-chunk with new chunk settings |
POST /api/v1/knowledge-bases/{kb_id}/documents/{doc_id}/retry-failed-chunks | Retry embedding for failed chunks only |
POST /api/v1/knowledge-bases/{kb_id}/documents/{doc_id}/chunks/{chunk_id}/retry-embedding | Retry a single chunk embedding |
Related pages
- Import Documents — upload, URL import, and failure retries
- Chunking and Document Processing — preview, process, and edit chunks
- Browsing Documents & Metadata — sharing badges and system fields
- Retrieval & Quality Tuning — the retrieval lab and diagnostics
- Knowledge Base settings reference — every field and limit
How is this guide?