Skip to Content
Docs are being rebuilt — start at Introduction → How it works.
API referenceKnowledge bases APIManage knowledge bases

Manage knowledge bases

CRUD for knowledge bases and their content. All endpoints require an admin key (see Authentication) and return the { "data": ... } envelope. See KnowledgeBaseResponse for the returned shape.


Create a knowledge base

POST/knowledge-basesAdmin key

The body is a discriminated union on type. Content is embedded synchronously; returns 201.

text

curl -X POST https://tmmate.ai/api/v1/knowledge-bases \ -H "Authorization: Bearer $TEAMMATE_API_KEY" -H "Content-Type: application/json" \ -d '{ "type": "text", "title": "Refund policy", "content": ["Refunds are processed within 5 business days."] }'

content is a string or array of strings (each non-empty).

website

curl -X POST https://tmmate.ai/api/v1/knowledge-bases \ -H "Authorization: Bearer $TEAMMATE_API_KEY" -H "Content-Type: application/json" \ -d '{ "type": "website", "title": "Docs", "urls": ["https://example.com/help"] }'

urls is 1–50 URLs.

files — creates an empty shell; attach files with upload.

curl -X POST https://tmmate.ai/api/v1/knowledge-bases \ -H "Authorization: Bearer $TEAMMATE_API_KEY" -H "Content-Type: application/json" \ -d '{ "type": "files", "title": "Contracts" }'

Common fields: title (1–255, required), description (≤2000, optional). Returns 201 → { "data": KnowledgeBaseResponse }. On ingest failure for text/website, the shell is rolled back and a 400 is returned.


List knowledge bases

GET/knowledge-basesAdmin key
QueryTypeDefault
pageinteger > 01
limitinteger 1–10020
qstring— (searches title/description)
typestring
createdByUUID
from / toISO 8601
sortfield:directioncreatedAt:desc
curl "https://tmmate.ai/api/v1/knowledge-bases?page=1&limit=20" \ -H "Authorization: Bearer $TEAMMATE_API_KEY"
{ "data": { "knowledgeBases": [ /* KnowledgeBaseResponse[] */ ] }, "pagination": { "total": 42, "page": 1, "limit": 20, "totalPages": 3, "hasNextPage": true, "hasPrevPage": false } }

Get a knowledge base

GET/knowledge-bases/{knowledgeBaseId}Admin key
curl https://tmmate.ai/api/v1/knowledge-bases/b2f1…UUID \ -H "Authorization: Bearer $TEAMMATE_API_KEY"

200 → { "data": KnowledgeBaseResponse }. 404 KNOWLEDGE_BASE_NOT_FOUND otherwise.


Update a knowledge base

PATCH/knowledge-bases/{knowledgeBaseId}Admin key

Partial update (strict). All fields optional: title, description, content (string | string[] — replaces text content and re-embeds), urls (string[] 1–50 — replaces website content and re-embeds). Omitting content/urls leaves content untouched. There is no PUT for knowledge bases.

curl -X PATCH https://tmmate.ai/api/v1/knowledge-bases/b2f1…UUID \ -H "Authorization: Bearer $TEAMMATE_API_KEY" -H "Content-Type: application/json" \ -d '{ "title": "Refund policy (2026)" }'

200 → { "data": KnowledgeBaseResponse }.


Delete a knowledge base

DELETE/knowledge-bases/{knowledgeBaseId}Admin key

Cascades: removes the knowledge base, its content rows, and all embeddings.

{ "data": { "id": "b2f1…UUID", "deleted": true } }

Append content

POST/knowledge-bases/{knowledgeBaseId}/contentAdmin key

Adds content to an existing knowledge base (embedded synchronously). Discriminated on type:

curl -X POST https://tmmate.ai/api/v1/knowledge-bases/b2f1…UUID/content \ -H "Authorization: Bearer $TEAMMATE_API_KEY" -H "Content-Type: application/json" \ -d '{ "type": "text", "content": ["New FAQ entry."] }'

Or { "type": "website", "urls": ["https://…"] } (1–50). Returns 201:

{ "data": { "knowledgeBaseId": "b2f1…UUID", "contentIds": ["d4e5…UUID"] } }

Delete a content row

DELETE/knowledge-bases/{knowledgeBaseId}/content/{contentId}Admin key
{ "data": { "id": "d4e5…UUID", "deleted": true } }

404 if the knowledge base or content row isn’t found (the row must belong to the knowledge base).


Upload a file

POST/knowledge-bases/{knowledgeBaseId}/filesAdmin key

multipart/form-data with a single file under the field file. Embedded synchronously.

  • Max size: 25 MB.
  • Allowed types: application/pdf, text/plain, text/csv, text/markdown, application/msword (.doc), application/vnd.openxmlformats-officedocument.wordprocessingml.document (.docx).
curl -X POST https://tmmate.ai/api/v1/knowledge-bases/b2f1…UUID/files \ -H "Authorization: Bearer $TEAMMATE_API_KEY" \ -F "file=@./handbook.pdf"

Returns 201:

{ "data": { "contentId": "d4e5…UUID", "knowledgeBaseId": "b2f1…UUID", "fileName": "handbook.pdf", "mimeType": "application/pdf", "sizeBytes": 184320, "status": "ready" } }

400 for no/empty file, too large, or unsupported type.