Quick start
const base = "https://pakistan-hijri.github.io/hijri-api";
const index = await fetch(`${base}/hijri/index.json`).then(r => r.json());
const calendar = await fetch(`${base}/hijri/calendar/1448.json`).then(r => r.json());
console.log(index.confirmed_through);
console.log(calendar.days["2026-11-12"]);
All routes are GET and served with access-control-allow-origin: *.
Routes
| Path | Returns |
|---|---|
| /hijri/index.json | Coverage, generation time, Hijri years, confirmed-day count |
| /hijri/overrides.json | Confirmed month starts and source URLs |
| /hijri/calendar/1448.json | Gregorian date → Hijri date, day number and confidence |
| /prayer/karachi/sunni_hanafi/2026.json | Daily calculated prayer times |
Replace 1448, 2026, city and profile as needed. Cities: karachi, lahore, peshawar, quetta. Profiles: sunni_hanafi, sunni_asr1, shia_jafari.
Response shapes
index.json:
{
"coverage_start": "2025-06-27",
"generated_at": "2026-11-21T09:22:41.389Z",
"baseline": "islamic-umalqura (Intl)",
"hijri_years": [1447, 1448, 1449],
"confirmed_days": 532,
"confirmed_through": "2026-12-10"
}
overrides.json entry:
{
"months": {
"1448-01-01": {
"date": "2026-06-17",
"sources": ["https://example.com/committee-announcement"]
}
}
}
One days entry from a calendar file:
"2026-12-11": {
"hijri": "1448-07-01",
"year": 1448,
"month": 7,
"day": 1,
"month_name": { "en": "Rajab", "ur": "رجب" },
"confidence": "predicted",
"uncertainty_days": 2
}
One days entry from a prayer file:
"2026-01-01": {
"date": "2026-01-01",
"times": {
"fajr": "2026-01-01T05:55:00+05:00",
"sunrise": "2026-01-01T07:17:00+05:00",
"dhuhr": "2026-01-01T12:35:00+05:00",
"asr": "2026-01-01T16:18:00+05:00",
"maghrib": "2026-01-01T17:54:00+05:00",
"isha": "2026-01-01T19:16:00+05:00"
}
}
coverage_start is the first confirmed start. confirmed_through is the last published confirmed day. uncertainty_days: 2 appears on predicted days as a documented allowance, not a probability.
Confidence
| Level | Meaning |
|---|---|
confirmed | Inside a month whose start is verified in overrides.json. |
estimated | A month start inferred in a gap between non-adjacent confirmed starts. |
predicted | A month start projected after the last confirmed start. |
unconfirmed | Only a 30th day whose successor start is not confirmed. |
Show ~9 Feb (estimated) and say the date is awaiting an announcement. Do not present it as fact.
TypeScript client
import { HijriCalendar, PrayerTable, hijriDate, sehriIftar } from "hijri-api";
const json = (path) => fetch(`https://pakistan-hijri.github.io/hijri-api${path}`).then(r => r.json());
const calendar = HijriCalendar.fromJSON(await json("/hijri/calendar/1448.json"));
const prayer = PrayerTable.fromJSON(await json("/prayer/karachi/sunni_hanafi/2026.json"));
const date = "2026-11-12";
const noon = hijriDate(new Date(`${date}T12:00:00+05:00`), { calendar });
console.log(noon.hijri, noon.confidence);
const maghrib = prayer.maghrib(date);
if (maghrib !== undefined) {
const evening = hijriDate(new Date(`${date}T20:00:00+05:00`), {
calendar, afterMaghrib: true, maghrib,
});
console.log(evening.hijri);
}
const fast = sehriIftar(prayer, noon.gregorian, noon);
if (fast !== undefined) console.log(fast.sehriEnds, fast.iftar);
hijriDate uses the midnight-based date by default. afterMaghrib needs that day's Maghrib. sehriIftar returns a value only during Ramadan.