Publicly accessible, highly-optimized developer endpoints providing complete structured access to the Valmiki Ramayana and Srimad Bhagavad Gita. Fully enabled with CORS headers for direct client-side consumption.
Provides access to all 23,402 shlokas across all 7 Kandas of the classical epic.
| Parameter | Type | Description |
|---|---|---|
| mode | string | Set to kandas to get the list of all 7 Kandas with their synopsis. |
| kandaId | string | Filter by Kanda number (1 to 7). |
| sarga | number | Filter by specific Sarga (chapter) number. |
| shloka | number | Filter by specific shloka (verse) number. |
| search | string | Case-insensitive search across shloka text, transliteration, translation, and purport. |
| page | number | Current page (default: 1). |
| limit | number | Results per page (default: 20, max: 100). |
| random | boolean | Set to true to fetch a random shloka. Can be combined with other filters. |
fetch('/api/ramayana?random=true')
.then(res => res.json())
.then(data => console.log(data));