โ† Recipes

Search a date range for muhurta windows

The API answers "what are the windows on this date". A booking flow asks "when in the next week can we do it". The search in between is a few lines of interval arithmetic that you own, because the rules are your product's.

You build
A list of bookable 60-minute-plus windows over seven days, from 14 calls
Code
Node.js - no SDK, runnable as shown

Updated

Per-day building blocks

There is no range endpoint; each muhurta endpoint takes one date plus place. Two are enough for a common search:

/v1/muhurta/auspicious (Abhijit, Brahma Muhurat, Amrit Kaal) slots in the same way if your rule wants them. Which windows count as good is a decision for you and your users; the code makes it a constant.

Cost and caching

  • Calls = days x endpoints. A week is 14 calls; a 90-day wedding-date search is 180. On the Hobby plan's per-minute limit, fetch in small batches as above rather than 180 at once - or plan it with the rate-limit planner.
  • Cache per place and date. Windows depend only on date and location, so every user searching Delhi for the same week shares the 14 responses. Precompute popular cities nightly.
  • Night windows are in chog.night and run past midnight UTC-wise; include them only if your product does evening events.
  • The UTC trap again: 09:00 here is built as +05:30 local. For DST zones derive the offset per date, as in daily panchang for a city.

Questions

What do I end up with?
A list of bookable 60-minute-plus windows over seven days, from 14 calls. The code is in Node.js.
Which endpoints does this recipe call, and in what order?
3 endpoints, in this order: Choghadiya (POST /v1/muhurta/choghadiya), then Rahu Kaal, Yamaganda and Gulika (POST /v1/muhurta/inauspicious), then Auspicious Muhurta (Abhijit, Amrit Kaal) (POST /v1/muhurta/auspicious).