Knowledge documents
Upload policies, manuals and price lists, and the AI agent finds the right passage when customers ask.
Knowledge documents are files the AI agent searches for answers: policy terms, product or service manuals, price lists, coverage tables, spreadsheets of reference data. Upload a file once and the AI agent finds the relevant passage when a customer asks, with no need to rewrite it as articles. Documents are one of the three sources of the knowledge base, next to articles and website pages.
Upload a document
In the dashboard, open Settings -> Automation -> Knowledge -> Documents and choose Upload a new document. You can also ask Copilot or your MCP agent to upload or replace a document for you.
Supported formats are TXT, CSV, Markdown, PDF, DOCX, XLSX and XLS. Files must be non-empty and at most 25 MiB. CSV imports support up to 1,000 rows and spreadsheet imports up to 10,000 rows. A text document becomes one searchable entry, while each spreadsheet or CSV row becomes its own entry.
A new document is searchable once it is indexed. The Learned column shows the progress. It usually takes seconds, longer for large PDFs. Uploads from the dashboard, MCP and REST are all processed the same way.
Documents are always active on every channel. When a fact needs a date window or should apply to one channel only, put it in an article instead.
The rest of this page is a reference for developers and AI agents that manage documents through MCP or the REST API, for example to keep a price list in step with a source system.
MCP tools
Use list_documents to find current documents with file IDs and indexing status;
pass includeArchived: true to include retained archives. upload_document accepts inline
text for TXT, CSV and Markdown. For a real file, call
create_document_upload_url, PUT the original bytes to its temporary URL,
then call finalize_document_upload with the returned fileId.
archive_document removes the document from search while keeping its file and
index, so it can be restored. Find archived documents with
list_archived_configuration_resources using resourceType: "document", and
recover them with restore_document.
REST operations
All paths below start with /rest/v1 and require X-API-Key. Use the
REST reference for complete request and response
schemas. Copilot and MCP can discover these endpoints in the Documents
group with list_rest_api_operations.
| Method | Path | Purpose |
|---|---|---|
| GET | /documents?businessSlug=shop | List active documents; add includeArchived=true to include retained archives |
| GET | /documents/{id}?businessSlug=shop | Read one document, its download URL and indexing status, including archives |
| POST | /documents | Upload inline {businessSlug, filename, content} for TXT, CSV or Markdown, up to 500,000 characters |
| POST | /documents/uploads | Reserve a direct upload with {businessSlug, filename} |
| POST | /documents/uploads/{fileId}/finalize | Validate and ingest uploaded bytes; body is {businessSlug} |
| DELETE | /documents/{id}?businessSlug=shop | Recoverably archive the exact document |
| POST | /documents/{id}/restore | Restore the retained document and its previous context enablement; body is {businessSlug} |
Documents are scoped to the API key's organization and requested business.
Cross-business files cannot be finalized or used to archive another business's
knowledge. Archived businesses remain readable but reject mutations. Python
recurring jobs can use their injected OCTOCOM_ORG_API_KEY and
OCTOCOM_API_BASE_URL with the same endpoints.
Upload reservations return {data: {fileId, presignedUrl, uploadHeaders}}.
PUT the original bytes, without an Octocom API key, to presignedUrl using
exactly the returned uploadHeaders. Do not encode
a PDF, Word document or spreadsheet as inline text. Finalization checks size,
format and file safety before ingestion. Repeated finalization of the same
fileId returns its existing document, even if it was archived; it does not
create a second document or restore it.
Upload and download URLs are credentials. Keep them out of logs and version
control. Private download links expire at urlExpiresAt; request document
details again when you need a fresh one. Responses containing these links use
Cache-Control: no-store.
Safely refresh a document
Uploading the same filename creates a new document. There is no implicit overwrite or deletion. Keep the old document active until the new one is ready:
- Fetch and validate the complete new source content. Save the old document ID.
- Upload the replacement and save its returned document ID. Binary uploads require the direct-byte upload and finalization steps above.
- Poll the replacement with GET until
data.statusisready. - Archive the saved old document ID. Do not select it by filename alone.
Ingestion parses the file before returning, but indexing continues asynchronously. Document status has four possible values:
| Status | Meaning |
|---|---|
indexing | Extracted content is not fully indexed yet |
ready | All extracted content is indexed and searchable |
empty | The file produced no searchable content; keep the old document |
archived | The document is kept but excluded from search |
indexing includes work that has not completed, including failed background
indexing. Use a bounded polling deadline and inspect failures if it does not
become ready. A timeout or ingestion error is not a reason to archive the old
snapshot. Record IDs in durable organization storage so a later run can resume
or inspect an uncertain upload, rather than creating another replacement.
For example, after uploading a replacement through REST:
import requests
import time
def wait_for_document(business_slug, document_id, timeout=40):
url = f"{OCTOCOM_API_BASE_URL}/rest/v1/documents/{document_id}"
deadline = time.monotonic() + timeout
while time.monotonic() < deadline:
response = requests.get(
url,
params={"businessSlug": business_slug},
headers={"X-API-Key": OCTOCOM_ORG_API_KEY},
timeout=10,
)
response.raise_for_status()
document = response.json()["data"]
if document["status"] == "ready":
return document
if document["status"] in {"empty", "archived"}:
raise RuntimeError("Replacement is not searchable; keep the old document")
time.sleep(1)
raise TimeoutError("Replacement is not ready; keep the old document")Archiving and restoring are idempotent. Restoring brings back each entry of the document exactly as it was before archiving, including entries that were switched off, and reuses the existing index, so nothing is downloaded or indexed again. Document changes are recorded in change history, without file contents or signed URLs.