search_knowledge_base tool. Attach documents (or grouping
knowledge bases) to an agent with the knowledge_base_ids /
knowledge_document_ids fields on Agents.
Documents are ingested asynchronously: uploads start in
status="pending", move through processing (text extraction for
PDF/DOCX, chunking, embedding), and land on ready or failed.
All write operations on this page require the
admin role (or
an sk_live_ key, which carries full access). Reads are available
to every member.Endpoints
The primary store is flat (“upload-first”) under/v1/knowledge/:
Legacy base-scoped routes remain available as adapters (a base is
now just a named grouping over the flat store):
Knowledge document object
The detail endpoint (
GET /v1/knowledge/documents/{id}) adds:
content (the canonical extracted text), uploaded_by
({id, name, email} or null), source_origin (upload or
google_drive), replaced_at, has_original, original_size_bytes,
and original_mime_type.
Upload limits
Anything else is rejected with a
400 field error naming the file.
List documents
Returns a plain array of document objects,
newest first.
Create documents
Two content types are accepted: Multipart upload — one or more files infiles[] (or a single
file part, optionally with a name field):
{name, content} creates a source_type="text" document.
Response (201 Created)
400. Duplicate-content uploads are
allowed but reported in warnings.
Retrieve, edit, delete
GET /v1/knowledge/documents/{id} returns the
detail shape including extracted
content.
PATCH accepts JSON {name?, content?} (or a multipart file to
swap content). Changing name or content re-queues ingestion
(status returns to pending). Returns the updated document.
DELETE returns 204 No Content and removes the document and its
chunks from the index.
Download the original file
Forfile-sourced documents, fetch the exact bytes that were uploaded.
download=1 sets an attachment Content-Disposition. Returns 404
when no original is stored (text documents).
Replace the file
POST /v1/knowledge/documents/{id}/replace with a multipart file
part swaps the document’s content for the new file (same validation
and limits as upload), stores the new original, stamps replaced_at,
and re-queues ingestion.
Response
Retry ingestion
POST /v1/knowledge/documents/{id}/retry re-queues a failed
document. Returns the document with status="pending", or 400 with
{"detail": "Only failed documents can be retried."} if it is not in
failed.
Import from Google Drive
Imports Google Docs (exported to text) and supported Drive files. You supply a short-lived Drive access token obtained client-side (the dashboard uses the Google Picker); ThunderPhone downloads the selected files server-side.Response (201 when anything imported, else 200)
status is imported, skipped (unsupported type /
oversize), or error — failures never abort the other files.
Search
Semantic (embedding) search over ready documents. This is the same retrieval the agent’ssearch_knowledge_base tool uses at call time.
Response
score closer to 1 is
better), capped per document so one file can’t fill every slot, and
each text is length-capped.
POST /v1/knowledge-bases/{id}/search takes the same body and scopes
the search to that base’s documents.
Knowledge bases (grouping)
A knowledge base is a named group:{id (UUID), name, description, document_count, created_at, updated_at}.
Create with POST /v1/knowledge-bases {name, description?} (201);
update with PATCH; DELETE (204) detaches the base’s documents
back into the flat store without deleting them. Attach whole bases to
an agent via knowledge_base_ids.
Related
Agents
Attach documents and bases via
knowledge_document_ids / knowledge_base_ids.Calls
Knowledge lookups appear in the call history as tool calls.