Indonesian Prayer Times API: Prayer Times per City in JSON

By , Tim Engineering APIPedia · Published · Updated · 7 min read

The APIPedia prayer schedule API returns Imsak, Fajr, Rising, Dhuhr, Asr, Maghrib, and Isha per district/city in Indonesia via one endpoint.

API APIPedia prayer schedule: Imsak to Isha times per district/city with a choice of Shafi'i and Hanafi madhabs

The prayer schedule API is an HTTP service that returns Imsak, Fajr, Sunrise, Dhuhr, Asr, Maghrib and Isha times for one location and one date. In APIPedia, just dial GET /sholat/harian with the Ministry of Home Affairs district/city code, for example 32.73 for Bandung City, and the schedule comes back in JSON.

This article discusses the parameters and responses of these endpoints, how to get the city code, madhab options for Asr times, then two usage examples: prayer schedule widget and prayer time reminder.

How to call the prayer schedule API?

The endpoint is one: GET https://api.apipedia.id/v1/sholat/harian, with header Authorization: Bearer apk_xxx. Key apk_ is created in the API Token menu of the APIPedia console.

ParameterMustInformation
kotaYesThe Ministry of Home Affairs district/city code is dotted, e.g. 32.73
tanggalNoFormat YYYY-MM-DD. Default today (WIB)
madhabNosyafii (default) or hanafi, affects Asr time
curl "https://api.apipedia.id/v1/sholat/harian?kota=32.73&tanggal=2026-10-26" \
  -H "Authorization: Bearer apk_xxx"
{
  "is_success": true,
  "message": "Jadwal sholat berhasil dihitung",
  "data": {
    "kota": "Kota Bandung",
    "kode_kota": "32.73",
    "zona_waktu": "WIB",
    "koordinat": { "lat": -6.91066, "lng": 107.60987, "elevasi": 726 },
    "madhab": "syafii",
    "tanggal": "2026-10-26",
    "imsak": "03:57",
    "subuh": "04:07",
    "terbit": "05:19",
    "dzuhur": "11:36",
    "ashar": "14:48",
    "maghrib": "17:49",
    "isya": "18:57"
  }
}

What fields are in the response?

FieldsInformation
kota, kode_kotaThe name and code of the district/city being calculated
zona_waktuWIB, WITA, or WIT. All clock responses use this zone
koordinatlat, lng, and elevasi (meters) city reference points
madhabAsr method used
tanggalSchedule date
imsakSahur deadline, 10 minutes before dawn
subuh, dzuhur, ashar, maghrib, isyaTimes of the five obligatory prayers, format HH:MM
terbitSunrise time, end of dawn time

The schedule is calculated from the coordinates of the district/city reference points, including the elevation. Because one district can span a wide area, a difference of a few minutes with the local mosque schedule or the official schedule of the Ministry of Religion is normal. For certainty of worship, always refer to the official schedule for your area.

Where to get the city code?

Code kota is the same as the district/city code in the APIPedia region API. Take the list of provinces, then list the districts/cities in the user's chosen province, and use field kode.

curl https://api.apipedia.id/v1/wilayah/kabupaten/32 \
  -H "Authorization: Bearer apk_xxx"

Some frequently used codes:

CodeCityZoneMaghrib, 26 Oct 2026
31.71Central JakartaWIB17:48
32.73BandungWIB17:49
34.71Yogyakarta CityWIB17:37
35.78Surabaya CityWIB17:26
73.71Makassar CityWITA17:57

A complete explanation of the multilevel region dropdown is in the API article Indonesian regions and postal codes.

What is the difference between the Shafi'i and Hanafi madhabs?

The only difference is in Asr time. The Shafi'i school of thought, which is adhered to by the majority of Indonesian Muslims, determines the beginning of Ashar when the length of the shadow is equal to the height of the object plus the shadow at midday. The Hanafi school uses twice the height of objects, so the Asr time is slower, generally around one hour, depending on the location and season. Other prayer times have not changed.

curl "https://api.apipedia.id/v1/sholat/harian?kota=32.73&madhab=hanafi" \
  -H "Authorization: Bearer apk_xxx"

For general applications in Indonesia, leave the default syafii. Provide a Hanafi option in settings if your users are diverse.

Example: today's prayer schedule widget

Do not call the API directly from the browser, as the key will be visible. Create a small route in the backend that forwards requests and stores the results. One city's schedule for one date does not change, so cache until midnight is safe.

// server: GET /jadwal-sholat?kota=32.73
const cache = new Map();

app.get("/jadwal-sholat", async (req, res) => {
  const kota = String(req.query.kota ?? "");
  const tanggal = new Date().toLocaleDateString("sv-SE", { timeZone: "Asia/Jakarta" });
  const kunci = `${kota}:${tanggal}`;

  if (!cache.has(kunci)) {
    const r = await fetch(
      `https://api.apipedia.id/v1/sholat/harian?kota=${encodeURIComponent(kota)}&tanggal=${tanggal}`,
      { headers: { Authorization: `Bearer ${process.env.APIPEDIA_KEY}` } }
    );
    const body = await r.json();
    if (!body.is_success) return res.status(r.status).json(body);
    cache.set(kunci, body.data);
  }
  res.json(cache.get(kunci));
});

On the frontend, display five prayer times and mark the next time. The following function searches for the next prayer from the response data:

const URUTAN = ["subuh", "dzuhur", "ashar", "maghrib", "isya"];

function sholatBerikutnya(jadwal, sekarang = new Date()) {
  const menitSekarang = sekarang.getHours() * 60 + sekarang.getMinutes();
  for (const nama of URUTAN) {
    const [j, m] = jadwal[nama].split(":").map(Number);
    if (j * 60 + m > menitSekarang) return { nama, jam: jadwal[nama] };
  }
  return { nama: "subuh", jam: "besok" };
}

Pay attention to time zones. The hours in the response follow those zona_waktu cities, while new Date() in the browser follow the user's device zone. If a user in Jakarta looks at the Makassar (WITA) timetable, calculate "now" in that city zone.

Example: prayer time reminder in bot

For WhatsApp, Telegram, or Slack bots, fetch the schedule once a day after midnight, then schedule messages for each prayer time. Five messages per day per city only require one API request, so the Free package quota of 500 requests per day is sufficient for hundreds of cities.

async function jadwalkanPengingat(kota) {
  const r = await fetch(
    `https://api.apipedia.id/v1/sholat/harian?kota=${kota}`,
    { headers: { Authorization: `Bearer ${process.env.APIPEDIA_KEY}` } }
  );
  const { is_success, message, data } = await r.json();
  if (!is_success) throw new Error(message);

  for (const nama of ["subuh", "dzuhur", "ashar", "maghrib", "isya"]) {
    jadwalkan(data.tanggal, data[nama], data.zona_waktu, () =>
      kirimPesan(`Waktu ${nama} untuk ${data.kota}: ${data[nama]} ${data.zona_waktu}`)
    );
  }
}

Functions jadwalkan and kirimPesan are replaced by the scheduler and message channel you are using. For Ramadan, add reminders at the imsak and maghrib to signal the end of sahur and breaking the fast. If you want the schedule to automatically adjust to Eid al-Fitr holidays, combine it with the national holiday API.

How to make a monthly imsakiyah schedule?

This endpoint counts one day per request. For the 30 day imsakiyah table, call 30 times with tanggal different ones, then save the results. Do it once before Ramadan and serve from your cache or database. Leave a break between requests to stay below the rate limit of 10 requests per second.

async function imsakiyah(kota, mulai, jumlahHari) {
  const hasil = [];
  const d = new Date(`${mulai}T00:00:00Z`);
  for (let i = 0; i < jumlahHari; i++) {
    const tanggal = d.toISOString().slice(0, 10);
    const r = await fetch(
      `https://api.apipedia.id/v1/sholat/harian?kota=${kota}&tanggal=${tanggal}`,
      { headers: { Authorization: `Bearer ${process.env.APIPEDIA_KEY}` } }
    );
    const { data } = await r.json();
    hasil.push({ tanggal, imsak: data.imsak, subuh: data.subuh, maghrib: data.maghrib });
    d.setUTCDate(d.getUTCDate() + 1);
    await new Promise((ok) => setTimeout(ok, 150)); // jaga rate limit
  }
  return hasil;
}

Frequently asked questions

Is this prayer schedule API free?

Yes. Endpoint /sholat/harian is available in the Free package which is free forever, with a quota of 500 requests per day and a rate limit of 10 requests per second.

Can it reach the sub-district level?

Not yet. The schedule is calculated per district/city based on the reference point. For most cities, the differences between subdistricts are only a few minutes or less.

Why is the schedule a few minutes different from the mosque near your house?

The coordinates, altitude and sun angle criteria used by each scheduler can be different, so small differences are normal. For worship purposes, follow the official schedule of the Ministry of Religion or local mosque.

What time zone does the response use?

The city's local time zone, according to field zona_waktu: WIB, WITA, or WIT.

Can it be asked via AI assistant?

Can. With the APIPedia MCP server, Claude can answer "what time is maghrib in Bandung today?" using tool jadwal_sholat.

Start using the prayer schedule API

Register for free at console.apipedia.id, create a key in the API Token menu, then run the curl example above with your city code. One request per city per day is enough for widgets, reminders, or imsakiyah tables.

Topics:

${c.about}

Tim APIPedia — Tim Engineering APIPedia

Tim engineering di balik APIPedia yang membangun dan memelihara API data Indonesia - ongkir, OCR KTP, data wilayah, BMKG, hingga server MCP - dan menulis panduan integrasinya dari pengalaman langsung.