For Developers

Prayer Times API

Free REST API for accurate Islamic prayer times worldwide. Simple to use, with no API key required. Suitable for mosque websites, Islamic apps, and community platforms.

Simple Requests

One GET request returns all five prayer times, sunrise and the qibla direction

Global Coverage

Works anywhere in the world with lat/long coordinates

Highly Accurate

Based on astronomical calculations using Adhan library

Free to Use

Please keep request volume reasonable; limits may be added

Quick Start

Get Started in 2 Minutes

No API Key Required: No registration or API key is needed. Free to use. Please keep request volume reasonable; limits may be added. Just add attribution=islamcave.com to your requests.

GET Request
GET https://islamcave.com/api/prayer-times?
latitude=40.7128&
longitude=-74.0060&
attribution=islamcave.com

Try It Now

Examples

Code Examples

Time zone note: the times values are UTC timestamps (ISO 8601) and are correct for any location. The formatted values, used in the examples below, currently use the server time zone rather than the time zone of the requested location. Until this is fixed, convert the times values to local time in your app.

// Fetch prayer times for New York City
const response = await fetch(
  'https://islamcave.com/api/prayer-times?' +
  'latitude=40.7128&longitude=-74.0060&' +
  'attribution=islamcave.com'
);

const data = await response.json();

console.log('Fajr:', data.data.formatted.fajr);
console.log('Dhuhr:', data.data.formatted.dhuhr);
console.log('Asr:', data.data.formatted.asr);
console.log('Maghrib:', data.data.formatted.maghrib);
console.log('Isha:', data.data.formatted.isha);
Reference

API Documentation

Endpoint

GET https://islamcave.com/api/prayer-times

Query Parameters

ParameterTypeRequiredDescription
latitudenumberYesLatitude coordinate (-90 to 90)
longitudenumberYesLongitude coordinate (-180 to 180)
datestringNoDate in YYYY-MM-DD format (default: today)
methodstringNoCalculation method (default: MWL). See below for options
madhabstringNo"hanafi" or "shafi" (default: shafi) - affects Asr time
attributionstringRecommendedSet to "islamcave.com" to acknowledge attribution

Calculation Methods

An unknown method returns a 400 error that lists the valid codes.

MWL

Muslim World League

Standard method, used globally

ISNA

Islamic Society of North America

Used in USA and Canada

EGYPT

Egyptian General Authority

Used in Egypt and Middle East

MAKKAH

Umm al-Qura University

Used in Saudi Arabia

KARACHI

University of Islamic Sciences, Karachi

Used in Pakistan

DUBAI

Dubai

Used in UAE

QATAR

Qatar

Used in Qatar

KUWAIT

Kuwait

Used in Kuwait

SINGAPORE

Singapore

Used in Singapore and Malaysia

TURKEY

Turkey

Diyanet İşleri Başkanlığı

Attribution Required

This API is free to use. Please keep request volume reasonable; limits may be added. We only ask that you:

  • Add a link to IslamCave.com from your website or app
  • Include attribution=islamcave.com in API requests
  • Display "Powered by IslamCave" somewhere in your application

Example attribution:

<a href="https://islamcave.com">Prayer times powered by IslamCave</a>

Need Help?

Questions about the API? Want to discuss custom integration?

Contact API Support