Skip to main content

Chatbots API

API endpoints for managing chatbots.

Endpoints​

List Chatbots​

GET /api/chatbots

Returns chatbots accessible to the current user.

Query Parameters:

ParameterTypeDescription
statusstringFilter by status
typestringFilter by type (private, shared, public)
limitnumberMax results

Get Chatbot​

GET /api/chatbots/:id

Returns chatbot configuration and connected datasets.

Create Chatbot​

POST /api/chatbots

Body:

{
"name": "My Chatbot",
"system_prompt": "You are a helpful assistant.",
"type": "private",
"dataset_ids": ["uuid1", "uuid2"]
}

Update Chatbot​

PATCH /api/chatbots/:id

Body:

{
"name": "Updated Name",
"system_prompt": "Updated prompt",
"status": "published",
"dataset_ids": ["uuid1", "uuid2", "uuid3"]
}

Delete Chatbot​

DELETE /api/chatbots/:id

Chat Endpoints​

Send Message​

POST /api/chatbots/:id/chat

Body:

{
"message": "What is Village Data?",
"conversation_id": "optional-uuid"
}

Response: Server-Sent Events (SSE) stream

data: {"type": "chunk", "content": "Village"}
data: {"type": "chunk", "content": " Data"}
data: {"type": "chunk", "content": " is..."}
data: {"type": "done", "conversation_id": "uuid"}

Get Conversation​

GET /api/chatbots/:id/conversations/:conversationId

Returns conversation history.

Analytics​

Get Usage Stats​

GET /api/chatbots/:id/analytics

Returns usage metrics for chatbot owner.

Response:

{
"total_conversations": 150,
"total_messages": 1200,
"unique_users": 45,
"period": "30d"
}