API reference
The KndTech AI API lets you manage chats, collections, and assistants programmatically. All endpoints use JSON (except file uploads) and return JSON. You must be authenticated for every request.
Overview
Base URL for API requests is your app origin (e.g. https://chat.kndtech.io). Send Content-Type: application/json for request bodies. Responses are JSON unless noted (e.g. 204 No Content on delete).
Authentication
When using the app in a browser, you are authenticated via session (cookie). For server-to-server or headless use, create an API key in the app under Settings → Developers. Send the key in the request header:
Authorization: Bearer YOUR_API_KEY
Keys are scoped to your organization and inherit the same plan limits and permissions as your workspace. Keep keys server-side only; never expose them in client-side code.
Errors
Errors return a JSON object with an error field (string). Some endpoints also return error_code for programmatic handling.
- 401 - Unauthorized (missing or invalid auth)
- 403 - Forbidden (no access to resource or plan limit)
- 404 - Resource not found
- 429 - Rate limit exceeded (see
retry_after_secondsin body) - 503 - Service temporarily unavailable
User
/api/user/meReturns the current user’s email and whether they have superadmin access.
Response
{ "email": "user@example.com", "isSuperadmin": false }/api/model-optionsReturns allowed model IDs and BYOK providers for the current org (for model selector).
Response
{ "allowedModels": string[] | null, "byokProviders": string[], "effectivePlanName": "Free" | "Pro" | "Business" }Chats
/api/chatsList all chats for the current user in the current organization.
Response
Array of chat objects (id, title, model_id, organization_id, user_id, created_at, etc.).
/api/chatsCreate a new chat. Optional body: model_id, agent_id (UUID).
Response
Created chat object.
/api/chats/:idUpdate the chat’s model. Body: { "model_id": "model-id" }.
Response
{ "ok": true }
/api/chats/:idDelete a chat. Returns 204 No Content.
Messages
/api/chats/:id/messagesList messages for a chat (oldest first).
Response
Array of message objects: id, chat_id, role, content, created_at, model_id (assistant only), feedback.
/api/chats/:id/messagesSend a user message and get the assistant reply (non-streaming). RAG and agents are applied based on chat and body.
Request body
{
"content": "Your question (required, 1-32000 chars)",
"model_id": "optional-override",
"collection_ids": ["uuid", "..."],
"gpt_id": "optional-gpt-uuid",
"exclude_model_id": "optional-exclude"
}Response
{ "userMessage": { ... }, "assistantMessage": { ... } }Possible error codes: RATE_LIMIT_EXCEEDED (429), MESSAGE_COST_TOO_HIGH (400), NO_API_KEY (400), SERVICE_BUSY (503).
/api/chats/:id/messages/:messageIdSet feedback on an assistant message. Body: { "feedback": "up" | "down" | "none" }.
Collections
/api/collectionsList all collections for the current organization.
/api/collectionsCreate a collection. Body: { "name": "Collection name" } (name 1-200 chars). Returns 201 with created collection.
/api/collections/:idDelete a collection. Returns 204 No Content.
/api/collections/:id/documentsUpload a document to a collection. Content-Type: multipart/form-data. Field: file. Returns 201 with document object. Subject to storage limits.
/api/collections/:id/urlsAdd a URL source to a collection. Body includes URL; see in-app docs or try from the UI for exact schema.
Agents
Agents are custom assistants with their own instructions and knowledge sources. Endpoints use :id for the agent UUID.
/api/agentsList agents the user can access.
/api/agentsCreate an agent. Body: name, description, instructions, visibility, document types, etc. See in-app API or docs for full schema.
/api/agents/:idGet a single agent.
/api/agents/:idUpdate an agent (partial body).
/api/agents/:idDelete an agent. Returns 204.
Additional routes: GET/POST /api/agents/:id/documents, GET/POST /api/agents/:id/sources, POST /api/agents/:id/test. See in-app reference under Settings → Developers for request/response schemas.
Resources
- Documentation - setup, workspaces, collections, and concepts
- Sign up - create an account to get API access
- Contact - enterprise or custom integration questions
For a full endpoint list and request/response examples, sign in and open Settings → Developers in the app.