Integrate RAG Root into your Apps
Use our robust API to query your knowledge bases programmatically. Perfect for building custom chatbots, automated reports, or internal tools.
Authentication
All API requests must include your secret API key in the Authorization header as a Bearer token.
Authorization: Bearer rr_live_...
Query Endpoint
Send a POST request to the following endpoint to interact with a specific brain.
POST
https://rag-root.vercel.app/api/v1/queryRequest Body
| Field | Type | Description |
|---|---|---|
| query | string | The natural language question you want to ask. |
| brain_id | uuid | The unique identifier of the brain (found in URL). |
Implementation Examples
cURL
curl -X POST https://rag-root.vercel.app/api/v1/query \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"query": "What are the main findings in my documents?",
"brain_id": "YOUR_BRAIN_ID"
}'JavaScript (Fetch)
const response = await fetch('https://rag-root.vercel.app/api/v1/query', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
query: 'What are the main findings?',
brain_id: 'YOUR_BRAIN_ID'
})
});
const data = await response.json();
console.log(data.answer);Response Format
The API returns a JSON object containing the grounded answer and the sources used for retrieval.
{
"answer": "The quarterly revenue grew by 15%...",
"sources": [
{
"file_name": "Report_2024.pdf",
"page_label": "4",
"text_snippet": "Revenue in Q3 reached...",
"score": 0.89
}
],
"brain_id": "...",
"created_at": "2024-..."
}