Trillet AI logo

Add Text to Knowledge Base

Set or replace the plain text content of a knowledge base.

POSThttps://api.trillet.ai/v1/api/knowledgebase/{id}/text

A knowledge base holds one text entry, alongside any uploaded files. Each call replaces the previous text: the old text and its search index are removed, and uploaded files are left as they are. To keep existing text, send it again together with the new content.

The text entry counts toward the limit of 5 files per knowledge base. Replacing existing text never hits the limit; adding text to a knowledge base that already holds 5 files does.

Requires the knowledge_base:create and knowledge_base:edit permissions.

Headers

x-workspace-idstringrequired

Workspace identifier for the API.

Path Parameters

idstringrequired

The unique identifier of the knowledge base.

Request Body

textstringrequired

The full text content of the knowledge base. Must not be empty.

namestringdefault: Plain Text

Label for the text entry, shown as its filename.

Response

201 with the text entry as it now appears in the knowledge base's files.

filenamestring

The entry's label (name, or Plain Text).

keystring

Internal key for the entry. A new key is minted on every call.

urlstring

Always empty: text is not stored as a file.

mimetypestring

Always text/plain.

sizenumber

Length of the text in characters.

isTextboolean

Always true. Marks this entry as the text entry rather than an uploaded file.

uploadedAtstring

When the text was saved.

Errors

StatusBodyWhen
400{"message": "Workspace ID header is required"}No x-workspace-id
400{"message": "Text content is required"}text is missing or blank
409{"message", "code": "KB_FILE_LIMIT_REACHED", "details": {"limit", "current"}}The knowledge base has no text yet and already holds 5 files
500{"message": "..."}Anything else
{
  "filename": "Opening hours",
  "key": "workspaces/d1d1d1d1d1d1d1d1d1d1d1d1/knowledge-bases/a4a4a4a4a4a4a4a4a4a4a4a4/text-1761735600000.txt",
  "url": "",
  "mimetype": "text/plain",
  "size": 412,
  "isText": true,
  "uploadedAt": "2026-10-29T10:00:00.000Z"
}

Last updated on