Skip to content
BotBaseDocs
PricingDashboardStart free
  • Build AI assistants that know your business
  • Quick start
  • Core concepts
  • Create an account
  • Documents
  • Websites
  • Social media posts
  • How answers are grounded
  • Languages
  • Assistant types and plans
  • Create an assistant
  • Personality and instructions
  • Testing your assistant
  • Conversations
  • Leads, forms and human support
  • Booking agent
  • Email replies
  • AI models
  • Website widget
  • Widget appearance and design
  • Chat link and QR code
  • Connect your business platform
  • CRM lead sync
  • Management Agents overview
  • Integration guide
  • Roles and permissions
  • Security model
  • Server and browser API reference
  • Examples by industry
  • Audit log and troubleshooting
  • Developer API overview
  • API keys
  • Chat API reference
  • Errors and limits
  • Plans and the free trial
  • Billing and payments
  • Emails and notifications
  • Security and privacy
  • Troubleshooting
  • Frequently asked questions
Docs/Developer API/Chat API reference

Chat API reference

Request and response formats for the health, agents and chat endpoints, with cURL, JavaScript and Python examples.

Developer API·3 min read·Updated 2 Dec 2026

Base URL: https://YOUR-API-HOST/api/v1. Replace YOUR-API-HOST with the host shown in your workspace's Developer tab. All request and response bodies are JSON.

Authenticated endpoints need the header X-API-Key: sk-botbase-.... See API keys.

#GET /health

A liveness check. No API key needed.

bash
curl "https://YOUR-API-HOST/api/v1/health"

Response 200:

JSON
{
  "status": "ok",
  "version": "1.0",
  "docs": "..."
}

Use status for monitoring. The other fields are informational.

#GET /agents

Lists the active assistants in the key's workspace that this key may call, newest first. If the key is restricted to certain assistants, only those are listed.

cURL
curl "https://YOUR-API-HOST/api/v1/agents" \
  -H "X-API-Key: $BOTBASE_API_KEY"

Response 200:

JSON
{
  "agents": [
    {
      "agent_id": "2b7f6a8e-5c1d-4f0a-9d33-6a1e2c4b8f10",
      "name": "Msaidizi wa Duka",
      "description": "Answers questions about our products and delivery",
      "language": "Swahili",
      "is_active": true
    }
  ],
  "workspace_id": "a4c0..."
}
FieldTypeDescription
agents[].agent_idstringThe ID to send to /chat.
agents[].namestringThe assistant's name.
agents[].descriptionstring or nullThe assistant's description.
agents[].languagestringThe assistant's configured language.
agents[].is_activebooleanAlways true here; inactive assistants are not listed.
workspace_idstringThe workspace the key belongs to.

#POST /chat

Sends one message to an assistant and returns its answer.

#Request body

FieldTypeRequiredDescription
agent_idstringYesAn assistant ID from /agents.
messagestringYesThe user's message. Leading and trailing spaces are trimmed. Must not be empty; at most 4,000 characters.
conversation_idstring or nullNoOmit or send null to start a new conversation. Send the ID from a previous response to continue it.
streambooleanNoMust be false or omitted. Streaming is not supported yet.

#Examples

cURL
curl -X POST "https://YOUR-API-HOST/api/v1/chat" \
  -H "X-API-Key: $BOTBASE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "agent_id": "YOUR_AGENT_ID",
    "message": "What are your opening hours?",
    "conversation_id": null
  }'

#Response 200

JSON
{
  "answer": "Tunafungua kila siku kuanzia saa 2:00 asubuhi hadi saa 12:00 jioni.",
  "citations": [
    { "source": "opening-hours.pdf", "chunk_index": 0 },
    { "source": "Contact us", "chunk_index": 2, "source_url": "https://duka-langu.co.tz/contact" }
  ],
  "conversation_id": "f3a2c1d0-9b8e-4c7a-8d6f-1e2d3c4b5a69",
  "agent_id": "2b7f6a8e-5c1d-4f0a-9d33-6a1e2c4b8f10",
  "model_used": "..."
}
FieldTypeDescription
answerstringThe assistant's reply, as plain text.
citationsarrayKnowledge the answer was based on. May be empty.
citations[].sourcestringDocument name or page label.
citations[].chunk_indexintegerWhich part of that source was used.
citations[].source_urlstringOnly present for website pages.
conversation_idstringSend this back to continue the same conversation.
agent_idstringThe assistant that answered.
model_usedstringIdentifier of the AI model that produced the answer. Informational; do not build logic on it.

#Conversations

  • Each /chat call without conversation_id starts a new conversation.
  • To keep context ("And on Saturday?"), store the conversation_id per end user, for example per WhatsApp number, and send it with every message from that user.
  • A conversation belongs to one assistant. Using a conversation_id from another assistant, or one that does not exist, returns 404 Conversation not found.
  • API conversations appear in the assistant's Conversations tab in the dashboard.

#Responses are not streamed

The call returns when the full answer is ready. Answers usually take a few seconds; set your HTTP client timeout to at least 30 to 60 seconds.

#Errors

Errors from these endpoints use a flat body:

JSON
{ "error": "Invalid or revoked API key." }

The full list of status codes, messages and rate limits is in Errors and limits.

PreviousAPI keysNext Errors and limits

On this page

  • GET /health
  • GET /agents
  • POST /chat
  • Request body
  • Examples
  • Response 200
  • Conversations
  • Responses are not streamed
  • Errors