跳转到主要内容

REST API

Programmatically interact with your Kodda bots

Authentication
Generate an API key to access the API

Private bot requests require an API key passed in thex-api-keyheader orAuthorization: Bearerheader (available on Pro and above plans). You can manage API keys in your dashboard.

x-api-key: kda_live_xxxxxxxxxxxx
Authorization: Bearer kda_live_xxxxxxxxxxxx
Chat Endpoint
Send a message to a specific bot
POST/api/chat

The core chat endpoint allows you to send queries to your configured RAG bots and receive grounded answers.

Request Body (JSON)

You can send either a single message string or a full messages array for conversation history.

{
  "botId": "YOUR_BOT_ID",
  "messages": [
    { "role": "user", "content": "Hi, who are you?" },
    { "role": "assistant", "content": "I am your AI assistant." },
    { "role": "user", "content": "What is the company leave policy?" }
  ],
  "stream": false
}

💡 Tip: Stateless Conversations

Using the messages array allows you to maintain conversation state on your own side. If both messages and conversationId are provided, the manual history takes precedence.

Single Message Format

{
  "botId": "YOUR_BOT_ID",
  "message": "What is the company leave policy?",
  "stream": false,
  "conversationId": "optional_conversation_id"
}

Response (JSON)

{
  "answer": "Based on the employee handbook, employees get 20 days of PTO...",
  "conversationId": "generated_or_provided_id",
  "latencyMs": 842,
  "sources": [
    {
      "filename": "Employee_Handbook.pdf",
      "score": 0.89,
      "content": "Relevant paragraph snippet..."
    }
  ]
}