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_seconds in body)
  • 503 - Service temporarily unavailable

User

GET/api/user/me

Returns the current user’s email and whether they have superadmin access.

Response

{ "email": "user@example.com", "isSuperadmin": false }
GET/api/model-options

Returns allowed model IDs and BYOK providers for the current org (for model selector).

Response

{ "allowedModels": string[] | null, "byokProviders": string[], "effectivePlanName": "Free" | "Pro" | "Business" }

Chats

GET/api/chats

List 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.).

POST/api/chats

Create a new chat. Optional body: model_id, agent_id (UUID).

Response

Created chat object.

PATCH/api/chats/:id

Update the chat’s model. Body: { "model_id": "model-id" }.

Response

{ "ok": true }

DELETE/api/chats/:id

Delete a chat. Returns 204 No Content.

Messages

GET/api/chats/:id/messages

List messages for a chat (oldest first).

Response

Array of message objects: id, chat_id, role, content, created_at, model_id (assistant only), feedback.

POST/api/chats/:id/messages

Send 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).

PATCH/api/chats/:id/messages/:messageId

Set feedback on an assistant message. Body: { "feedback": "up" | "down" | "none" }.

Collections

GET/api/collections

List all collections for the current organization.

POST/api/collections

Create a collection. Body: { "name": "Collection name" } (name 1-200 chars). Returns 201 with created collection.

DELETE/api/collections/:id

Delete a collection. Returns 204 No Content.

POST/api/collections/:id/documents

Upload a document to a collection. Content-Type: multipart/form-data. Field: file. Returns 201 with document object. Subject to storage limits.

POST/api/collections/:id/urls

Add 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.

GET/api/agents

List agents the user can access.

POST/api/agents

Create an agent. Body: name, description, instructions, visibility, document types, etc. See in-app API or docs for full schema.

GET/api/agents/:id

Get a single agent.

PATCH/api/agents/:id

Update an agent (partial body).

DELETE/api/agents/:id

Delete 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.