Welcome to Habous Prayer Times API

This API provides access to Morocco's prayer times and information about available cities from the Habous government website. It is unofficial and not affiliated with the official "Ministry of Habous and Islamic Affairs."

Please note: This API is hosted on render.com's free tier. Render occasionally spins down free web services that go 15 minutes without receiving inbound traffic. When a request is made, Render resumes the service, causing a brief delay before the API is back up and running. Users may experience this slight delay due to service reactivation.

Endpoints

1. Available Cities

This endpoints retrieves a list of available cities on the Habous gov website

Endpoint

GET https://habous-prayer-times-api.onrender.com/api/v1/available-cities

Response

{
  "cities": [
    {
      "id": "1",
      "arabicCityName": "الرباط",
      "frenshCityName": "Rabat"
    },
    {
      "id": "2",
      "arabicCityName": "الخميسات",
      "frenshCityName": "Khémissat"
    },
    {
      "id": "3",
      "arabicCityName": "تيفلت",
      "frenshCityName": "Tiflet"
    },

    // More available cities, there are 191 cities in total
  ]
}

2. Prayer Times

This endpoint retrieves prayer times of the current Hijri month for a specific city using the city's ID. If you don't know the ID for a specific city you can use the available-cities endpoint to retreive all the cities available

Endpoint

GET https://habous-prayer-times-api.onrender.com/api/v1/prayer-times?cityId={cityId}

Replace {cityId} with the ID of the desired city.

Example Request

GET https://habous-prayer-times-api.onrender.com/api/v1/prayer-times?cityId=109

Example Response

{
  "data": {
      "city": {
      "ar": "الرحامنة",
      "fr": "Rehamna"
    },
    "timings": [
      {
        "date": {
          "readable": "15 Nov 2023",
          "formatedDate": "15-nov-2023",
          "gregorian": {
            "day": 15,
            "month": "November",
            "year": 2023
          },
          "hijri": {
            "day": 1,
            "month": "جمادى الأولى",
            "year": 1445
          }
        },
        "prayers": {
          "fajr": "06:31",
          "sunrise": "07:55",
          "dhuhr": "13:21",
          "asr": "16:11",
          "maghrib": "18:38",
          "ishaa": "19:51"
        }
      },

      // More prayer time objects for subsequent dates
    ]
  }
}