Skip to main content
The RAG Chat API provides endpoints for creating and managing persistent chat sessions that integrate with knowledge bases using Retrieval-Augmented Generation (RAG).

Base URL

http://localhost:8080/api/rag-chat

Available Endpoints

Create Session

POST /sessions - Start a new chat session

Send Message

POST /sessions//messages/stream - Send message with streaming response

List Sessions

GET /sessions - Get all chat sessions

Get Details

GET /sessions/ - Get session with full message history

Update Title

PUT /sessions//title - Change session title

Pin Session

PUT /sessions//pin - Toggle pin status

Update Knowledge Bases

PUT /sessions//knowledge-bases - Change queried knowledge bases

Delete Session

DELETE /sessions/ - Remove session and messages

Authentication

Currently, the API does not require authentication. In production deployments, implement authentication and authorization to ensure users can only access their own sessions.

Response Format

All endpoints (except streaming) return responses in this format:
{
  "code": 200,
  "message": "success",
  "data": { /* endpoint-specific data */ }
}
Error responses:
{
  "code": 400,
  "message": "Invalid request: knowledgeBaseIds cannot be empty",
  "data": null
}

Common Error Codes

CodeDescription
200Success
400Bad Request - Invalid input
404Not Found - Session does not exist
500Internal Server Error

Session Lifecycle

See Also

Build docs developers (and LLMs) love