GET /api/daily
Get a personalized daily verse for the authenticated user. The system intelligently selects verses based on what the user has already seen, preferring unseen verses.Authentication
Requires Clerk authentication. Include authentication headers with the request.Query Parameters
User’s timezone (e.g., “America/New_York”, “Asia/Kolkata”). Defaults to “UTC” if not provided. Used to determine what “today” means for the user.
How It Works
- Checks if a daily verse has already been generated for the user today (based on their timezone)
- If cached, returns the cached verse
- If not cached:
- Analyzes the user’s query history to find seen verses
- Selects a random unseen verse (or any random verse if all have been seen)
- Fetches the full verse details from the backend
- Caches the result for the rest of the day
Response
Chapter number (1-18)
Verse number
English translation of the verse
Commentary or summary for the verse
Whether this verse was retrieved from cache (true) or newly generated (false)
Response Example
Cached Response Example
Error Responses
| Status Code | Description |
|---|---|
| 401 | Unauthorized - authentication required |
| 429 | Rate limit exceeded (10 requests per minute) |
| 500 | Failed to get daily verse |
| 503 | Database not configured |
Rate Limiting
10 requests per minute per clientCode Examples
Smart Verse Selection
The daily verse feature uses intelligent selection:- Prioritizes unseen verses: Checks user’s query history to avoid repetition
- Falls back gracefully: If all 703 verses have been seen, randomly selects any verse
- Timezone-aware: Same “today” across all requests from the same timezone
- Cached per day: Once generated, the same verse is returned for the entire day (in user’s timezone)
Caching Behavior
- Verses are cached in the
daily_versetable - Cache key:
user_id+date(formatted as YYYY-MM-DD in user’s timezone) - Cache duration: Until midnight in the user’s timezone
- The
cachedfield indicates if the verse was retrieved from cache
Use Cases
- Daily meditation or reflection apps
- Morning/evening verse notifications
- Spiritual practice tracking
- Progressive learning through the Gita (preferring unseen verses)
Performance Notes
- First request of the day: ~15 seconds (fetches from backend)
- Subsequent requests: less than 100ms (retrieved from cache)
- Backend timeout: 15 seconds
- Uses abort controller to prevent hanging requests