Fasting API

This API provides endpoints to retrieve fasting times, including Sahur and Iftar timings for today, a specific date, or the full month. You can also adjust Hijri dates using the shifting parameter to match your region's official moon sighting announcements.

Request:

GET https://islamicapi.com/api/v1/fasting/?lat={lat}&lon={lon}&api_key={YOUR_API_KEY}

Query Parameters

lat (string) *

Latitude coordinates of the user's location.

Example: 51.5194682

lon (string) *

Longitude coordinates of the user's location.

Example: -0.1360365

method (integer)

Method for calculating fasting times based on geographical location and algorithms.

Example: 3

Allowed values:
1 - University of Islamic Sciences, Karachi
2 - Islamic Society of North America
3 - Muslim World League
4 - Umm Al-Qura University, Makkah
5 - Egyptian General Authority of Survey
7 - Institute of Geophysics, Tehran
8 - Gulf Region
9 - Kuwait
10 - Qatar
11 - MUIS, Singapore
12 - UOIF, France
13 - Diyanet, Turkey
14 - Russia
15 - Moonsighting Committee Worldwide
16 - Dubai (experimental)
17 - JAKIM, Malaysia
18 - Tunisia
19 - Algeria
20 - KEMENAG, Indonesia
21 - Morocco
22 - Lisbon, Portugal
23 - Jordan
0 - Jafari / Shia Ithna-Ashari

calender (enum)

Calendar Calculation Method.

Default: UAQ

Allowed: HJCoSA, UAQ, DIYANET, MATHEMATICAL

date (string)

The date you want to get fasting times for. Use this format: YYYY-MM-DD or YYYY-MM

Example: 2025-07-25 (for specifc date)

Example: 2025-07 (for full month)

* If no date is provided, it will use today's date.

shifting (integer)

Manual adjustment for Hijri dates based on local moon sighting. Use this when your region observes the Hijri date a day earlier or later than the calculated date.

Default: 0 (no adjustment)

Allowed: -2, -1, 0, +1, +2

Example: If the API calculates a new Hijri month beginning on a certain date, but your region's moon sighting committee officially declared it began one day earlier, use shifting=1 to shift forward. Conversely, if declared one day later, use shifting=-1 to shift backward. The fasting times remain unchanged, only the Hijri date labels adjust.
JSON Response (success)
{
    "code": 200,
    "status": "success",
    "range": "day",
    "data": {
        "fasting": [
            {
                "date": "2025-07-25",
                "hijri": "29-01-1447",
                "hijri_readable": "29 Muharram 1447 AH",
                "time": {
                    "sahur": "4:04 AM",
                    "iftar": "6:53 PM",
                    "duration": "14 hours 49 minutes"
                }
            }
        ],
        "white_days": {
            "status": "next_month",
            "days": {
                "13th": "2025-08-08",
                "14th": "2025-08-09",
                "15th": "2025-08-10"
            }
        }
    }
}
JSON Response (error)
{
                                        
    "code": 502,
    "status": "error",
    "message": "Unable to fetch fasting time"

}
WhatsApp