Prayer times that hold up
in the mountains.

This is the only prayer-times API that corrects for elevation. You get all five prayers, every major calculation school and both the Hanafi and Shafi Asr methods, computed from the JPL DE421 ephemeris.

Read the API docs See pricing

Every major school

MWL (18°/17°), ISNA (15°/15°), Egyptian (19.5°/17.5°), Umm al-Qura (Maghrib + 90 min), Karachi (18°/18°).

Both Asr methods

Shafi (N=1, the majority view) and Hanafi (N=2). You choose one on each request.

Works in the mountains

Times are corrected for elevation, so Muslim communities in Tehran, Sarajevo, Bandung or Quito get the right times for where they live.

One call per location per day

curl -H "Authorization: Bearer $THIRDTRAIL_KEY" \
  "https://thirdtrail.life/v1/ephemerides/prayer-times/?lat=35.6892&lon=51.3890&elevation=1190&date=2026-06-21&school=mwl&asr_method=hanafi&tz=Asia/Tehran"

Tehran (1 190 m), MWL school, Hanafi Asr method, summer solstice.

Response:

{
  "request":  { "lat": 35.6892, "lon": 51.3890, "elevation_m": 1190,
                "date": "2026-06-21",
                "school": "mwl", "asr_method": "hanafi" },
  "resolved": { "school": "mwl", "asr_method": "hanafi",
                "elevation_m": 1190, "elevation_source": "user",
                "timezone": "Asia/Tehran", "plan": "pro" },
  "date":     "2026-06-21",
  "prayer_times": {
    "fajr":     "2026-06-21T03:54:30+04:30",
    "sunrise":  "2026-06-21T05:33:18+04:30",
    "dhuhr":    "2026-06-21T13:01:08+04:30",
    "asr":      "2026-06-21T17:48:12+04:30",
    "maghrib":  "2026-06-21T20:30:24+04:30",
    "isha":     "2026-06-21T22:09:01+04:30"
  }
}

Why we don't pick a default school

Whichever school we picked as the default would be wrong for many users, and could read as a slight to others. The schools differ on the Fajr and Isha angles and on how to calculate Asr, for principled reasons. So the endpoint requires an explicit school parameter, and the supported schools and their twilight angles are listed on this page. You choose the school and we do the calculation.

asr_method defaults to shafi (N=1) because that is the majority position across the schools of jurisprudence (Shafi, Maliki, Hanbali and Jafari). Hanafi callers pass asr_method=hanafi.

Methodology

  • Sun position: an NREL SPA-equivalent computation using JPL DE421. The sun's position is accurate to under an arcsecond, and prayer times to about a minute, for 1900 to 2050.
  • Fajr / Isha: time when the sun centre crosses −angle° below the elevation-corrected horizon (or Maghrib + 90 min for Umm al-Qura).
  • Sunrise / Maghrib: standard rise/set, with horizon dip applied for the observer's elevation (the same horizon used by our main Ephemerides endpoint).
  • Dhuhr: solar transit (true noon).
  • Asr: shadow-length formula. asr_alt = arccot(N + cot(noon_alt)) where N=1 (Shafi) or N=2 (Hanafi). Asr is when the sun drops through that altitude.

We review this methodology with qualified scholars. If you find an error, please email support (at) thirdtrail.life. These are computed values provided for information only. Check them with your local religious authority before relying on them. See safe use and methodology.

Start using it

Create a free account