Chat API
Conversational Q&A with message history.
The Chat API maintains conversation history. Pass conversation_id from a previous response to continue the same thread.
Ask a question
POST
/chatcurl
curl -X POST https://api.docubix.com/chat \
-H "Content-Type: application/json" \
-d '{
"api_key": "rag_live_your_api_key_here",
"message": "What is ATP?"
}'Request
json
{
"api_key": "rag_live_your_api_key_here",
"message": "What is ATP?",
"conversation_id": "optional-for-follow-ups",
"session_id": "optional-client-id"
}Response fields
json
{
"conversation_id": "550e8400-e29b-41d4-a716-446655440000",
"answer": "ATP is adenosine triphosphate...",
"sources": [
{
"document": "biology.pdf",
"chunk_id": "abc123",
"score": 0.92,
"page": 12,
"chunk_index": 4
}
],
"usage": {
"input_tokens": 1200,
"output_tokens": 85
},
"metadata": {
"retrieved_chunks": 3,
"retrieval_score": 0.92,
"model": "gpt-5.2"
}
}answer
The generated assistant reply.
sources
Retrieved chunks with document name, score, and optional page number.
usage
Token counts for input and output.
metadata
Retrieval stats including retrieved_chunks, retrieval_score, and model.
Query API (stateless)
For one-shot questions without history, use POST /query with a question field instead of message:
curl
curl -X POST https://api.docubix.com/query \
-H "Content-Type: application/json" \
-d '{
"api_key": "rag_live_your_api_key_here",
"question": "What is ATP?"
}'