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
/knowledge-basesAdmin keyThe 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
/knowledge-basesAdmin key| Query | Type | Default |
|---|---|---|
page | integer > 0 | 1 |
limit | integer 1–100 | 20 |
q | string | — (searches title/description) |
type | string | — |
createdBy | UUID | — |
from / to | ISO 8601 | — |
sort | field:direction | createdAt: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
/knowledge-bases/{knowledgeBaseId}Admin keycurl 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
/knowledge-bases/{knowledgeBaseId}Admin keyPartial 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
/knowledge-bases/{knowledgeBaseId}Admin keyCascades: removes the knowledge base, its content rows, and all embeddings.
{ "data": { "id": "b2f1…UUID", "deleted": true } }Append content
/knowledge-bases/{knowledgeBaseId}/contentAdmin keyAdds 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
/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
/knowledge-bases/{knowledgeBaseId}/filesAdmin keymultipart/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.