POST /api/query
Query the Bhagavad Gita with natural language questions. This endpoint uses semantic search to find the most relevant verse and generates contextual commentary tailored to your specific question.Request
The user’s question or search query. Must be 1-500 characters.
Request Body Example
Response
Returns a verse with contextual commentary addressing the user’s question.Chapter number (1-18)
Verse number within the chapter
English translation of the verse
AI-generated contextual commentary that addresses the user’s specific question
Complete traditional commentary on the verse
Response Example
Error Responses
Error message describing what went wrong
| Status Code | Description |
|---|---|
| 400 | Invalid request - query is missing, empty, or too long (>500 characters) |
| 404 | No matching verses found |
| 429 | Rate limit exceeded (20 requests per minute) |
| 500 | Internal server error |
| 504 | Request timeout (>30 seconds) |
Rate Limiting
- Frontend: 20 requests per minute per client
- Backend: 30 requests per minute per IP address
Code Examples
Notes
- Query results are automatically saved to the authenticated user’s history
- The contextual commentary is generated using AI to address the specific question
- If AI commentary generation fails, the endpoint falls back to pre-computed summaries
- Queries are trimmed of whitespace before processing