Skip to main content

GET /api/all-verses

Retrieve all 703 verses from the Bhagavad Gita in a single request. This endpoint is designed for client-side search functionality and caching.

Request

No parameters required. This is a simple GET request.

Response

status
string
Response status - always “success” for successful requests
data
array
Array of all verses, sorted by chapter and verse number
data[].chapter
integer
Chapter number (1-18)
data[].verse
integer
Verse number within the chapter
data[].translation
string
English translation of the verse
data[].summary
string
Brief summary of the verse (max 500 characters)

Response Example

{
  "status": "success",
  "data": [
    {
      "chapter": 1,
      "verse": 1,
      "translation": "Dhritarashtra said: O Sanjaya, assembled in the place of pilgrimage at Kurukshetra, desiring to fight, what did my sons and the sons of Pandu do?",
      "summary": "King Dhritarashtra inquires about the events at Kurukshetra."
    },
    {
      "chapter": 1,
      "verse": 2,
      "translation": "Sanjaya said: King Duryodhana, observing the army arrayed by the Pandavas, approached his teacher Drona and spoke the following words.",
      "summary": "Duryodhana approaches his teacher as battle preparations begin."
    },
    ...
  ]
}

Error Responses

Status CodeDescription
429Rate limit exceeded (10 requests per minute)
500Internal server error or failed to fetch from backend

Rate Limiting

  • Backend: 10 requests per minute per IP address
  • Lower rate limit due to large response size

Caching

  • Frontend: Cached for 1 hour (3600 seconds)
  • CDN: Public cache with s-maxage of 3600 seconds
  • Backend: Data loaded once on server startup from Pinecone vector database
  • Responses include Cache-Control headers for optimal performance

Code Examples

curl -X GET https://gitachat.org/api/all-verses

Use Cases

  • Client-side search: Load all verses once and implement fast filtering
  • Offline functionality: Cache verses for offline access
  • Browse mode: Display complete chapter/verse listings
  • Analytics: Count verses per chapter or analyze content

Performance Notes

  • Response contains all 703 verses (~200-300KB payload)
  • Use caching to avoid repeated requests
  • Data is sorted by chapter and verse for easy navigation
  • Backend loads verses from Pinecone once at startup
  • Summaries are truncated to 500 characters maximum

Build docs developers (and LLMs) love