Skip to main content
The knowledge base stores documents that genies reference during conversations. Documents can be created from PDFs, websites, YouTube videos, or plain text. Each document is stored both in the HelpGenie database and in the voice agent system.
Standard users can only access their own documents. Admin users can access all documents and filter by owner when passing adminMode: true.

List all documents

Retrieves all documents with pagination, filtering, and role-based access control. Returns documents along with their dependent agents.
string
required
Must be "knowledge-base"
string
required
Must be "all"
object
boolean
Whether the request succeeded.
object

List documents

Retrieves a compact, paginated list of documents. Returns only essential fields — optimized for dropdowns, selects, and search results. For full document details including metadata and folder info, use the all action instead.
string
required
Must be "knowledge-base"
string
required
Must be "list"
object
boolean
Whether the request succeeded.
object

Get document

Retrieves a single document by its UUID or 20-character external document ID. Returns full details including metadata, folder info, and dependent agents.
string
required
Must be "knowledge-base"
string
required
Must be "get"
string
required
The document UUID or external document ID (el_doc_id).
object
boolean
Whether the request succeeded.
object
Non-admin users can only access their own documents or documents marked as public. Admin users with adminMode: true can access all documents and see owner information.

Get document content

Retrieves the plain-text content of a document. Uses a priority order: manual edits → optimised content → original parsed content.
string
required
Must be "knowledge-base"
string
required
Must be "get-content"
string
required
The document UUID.
object
boolean
Whether the request succeeded.
object
Non-admin users can only retrieve content for their own documents or documents marked as public. A 404 is returned when no readable content is available yet — the document may still be processing.

Create document (text)

The simplest way to add a knowledge base document. Pass title and content directly — no file upload needed. If you omit the nested action field, create-notes is used by default.
string
required
Must be "knowledge-base"
string
required
Must be "create"
object
required
Documents are processed asynchronously. After creation, the document transitions through stages: pending_extractionpending_optimizationcompleted.

Create document (advanced)

For content sources other than text, use the nested sub-action pattern. The create action delegates to the internal document upload pipeline.
string
required
Must be "knowledge-base"
string
required
Must be "create"
object
required
boolean
Whether the request succeeded.
object
The create action delegates to the internal document upload pipeline (doc-upload edge function). The nested data.action field determines which content source is used. Supported sub-actions:
  • upload-website — Extract content from a single URL
  • scrape-website — Crawl and parse website content
  • extract-youtube — Extract the transcript from a YouTube video URL
  • upload-pdf — Upload and process a PDF file
  • extract-document — Extract content from various document formats (DOCX, TXT, etc.)

Update document (data mode)

Updates document metadata fields without changing the content. Only the fields you provide are updated. Metadata is intelligently merged with existing values. If the document name changes and the document has been synced with the voice platform, the name is also updated there.
string
required
Must be "knowledge-base"
string
required
Must be "update"
string
required
The document UUID to update.
object
required
boolean
Whether the request succeeded.
object

Update document (content mode)

Replaces the document content. A new voice platform document is created with the updated content, and all dependent genies are automatically updated with the new external document ID (fire-and-forget sync). The new content is also saved to storage and a signed URL is returned.
string
required
Must be "knowledge-base"
string
required
Must be "update"
string
required
The document UUID to update.
object
required
boolean
Whether the request succeeded.
object
Content mode deletes the old external document and creates a new one. All genies that depend on this document are automatically updated with the new external document ID.

Bulk update documents

Updates multiple documents at once. Only metadata fields can be bulk-updated — document content cannot be changed via this action.
string
required
Must be "knowledge-base"
string
required
Must be "bulk-update"
object
required
boolean
Whether all documents were updated successfully.
string
Human-readable summary of the operation.
number
Number of documents actually updated.
string[]
The document IDs that were targeted by the update.
object
The update payload that was applied, containing only the fields that were provided.

Delete document

Permanently deletes a document, removes it from storage and the voice agent system, and syncs the removal with all dependent agents.
string
required
Must be "knowledge-base"
string
required
Must be "delete"
string
required
The document UUID to delete.
object
boolean
Whether the request succeeded.
object
This action is irreversible. The document, its storage file, and its external record will be permanently removed. All dependent genies will have the document removed from their knowledge base unless skipAgentSync is set to true.

Attach documents to agent

Adds one or more documents to a genie’s knowledge base. Duplicate documents are automatically skipped.
string
required
Must be "knowledge-base"
string
required
Must be "attach"
object
required
boolean
Whether the request succeeded.
string
Summary of attached documents.
number
Number of documents successfully attached.

Detach documents from agent

Removes specific documents from a genie’s knowledge base.
string
required
Must be "knowledge-base"
string
required
Must be "detach"
object
required
boolean
Whether the request succeeded.
string
Summary of detached documents.
number
Number of documents successfully detached.

Replace agent knowledge base

Atomically replaces a genie’s entire knowledge base with a new document set. Each document is validated before the update is applied. The genie’s voice platform configuration is updated with the new document list, agent_document relations are synced (old documents removed, new documents upserted), and connected clients are notified via a realtime broadcast.
string
required
Must be "knowledge-base"
string
required
Must be "replace"
object
required
boolean
Whether the request succeeded.
string
Summary of the replacement, including document count.
number
Number of documents in the new knowledge base.
Document IDs passed in the documents array are voice platform external IDs, not HelpGenie document UUIDs. All documents are validated against the platform before the replacement is applied — if no valid documents are found in a non-empty array, the request is rejected with a VALIDATION_ERROR.

Sync documents with agents

Synchronizes document changes across all dependent agents. Removes old external documents and adds updated ones to each agent’s knowledge base. Typically used internally after document content is updated or deleted.
string
required
Must be "knowledge-base"
string
required
Must be "sync-with-agents"
object
boolean
Whether the request succeeded.
object

Clone document

Creates a copy of an existing document.
string
required
clone
string
required
UUID of the document to clone.

Response

Returns the newly created document object.

Consolidate documents

Merges multiple documents into a single new document. Optionally prunes the originals after consolidation. This delegates to the doc-upload edge function.
string
required
consolidate
object
required

Documents outside workspace

Returns documents that are attached to one of the workspace’s genies but are owned by a different user. This surfaces documents that were added to a genie by an admin on behalf of the workspace — they would otherwise be invisible because documents are normally scoped to the owner’s account. Pagination is supported. Results are sorted newest-first. Only the current user’s workspace is searched — no additional parameters are required.
string
required
Must be "knowledge-base"
string
required
Must be "outside-workspace"
object
boolean
Whether the request succeeded.
object

Error codes