🔌 Prayer Times API for Developers
A free, open API — no API key, no request limits — providing prayer times and Qibla direction for over 4999 cities worldwide in JSON format, ready to use directly in your app or website.
Base URL
https://times.afkaark.com/api/v1/
1. List of all cities
GET /api/v1/cities.json
Returns a list of all available cities with their id, country, coordinates, and the URL for their prayer-times data, for building a city picker in your app.
2. Prayer times for a specific city
GET /api/v1/times/{country}/{city_id}.json
Example: /api/v1/times/egypt/cairo.json
Returns the five daily prayer times plus sunrise for the current day, along with the Qibla direction, the distance to the Kaaba, and the calculation method used for that city. Sample response:
{
"city": {"id": "cairo", "name_en": "Cairo", "country": "egypt"},
"date": "2026-08-29",
"method": "Egyptian General Authority of Survey",
"times": {"fajr": "04:12", "sunrise": "05:41", "dhuhr": "12:03", "asr": "15:29", "maghrib": "18:24", "isha": "19:47"},
"qibla": {"angle": 136.02, "distance_km": 1240.5},
"source": "https://times.afkaark.com/en/egypt/cairo/"
}Quick usage examples
JavaScript (fetch):
fetch("https://times.afkaark.com/api/v1/times/egypt/cairo.json")
.then(r => r.json())
.then(data => console.log(data.times));
Python:
import requests
r = requests.get("https://times.afkaark.com/api/v1/times/egypt/cairo.json")
print(r.json()["times"])
cURL:
curl https://times.afkaark.com/api/v1/times/egypt/cairo.json
Usage notes
| Authentication | Not required — the API is fully open |
| Rate limits | No strict limits currently, but it's recommended to cache the result on your server for one day, since the data is only updated once daily |
| CORS | Enabled — the API can be called directly from a user's browser on any domain |
| Format | JSON only, UTF-8 encoded |
| Attribution | Not required, but a backlink to our site helps us keep updating the data for free |
Frequently Asked Questions About the API
Does using the API require an API key?
No, the API is fully open and requires no registration or API key.
Is there a maximum number of requests?
There's no strict limit currently, but it's recommended to cache the result on your server for one day, since the data is only updated once daily.
Is CORS enabled to use the API directly from the browser?
Yes, the API can be called directly from JavaScript in the browser, from any domain.
What format is the response in?
JSON only, UTF-8 encoded, with clear fields for the city, date, prayer times, and Qibla.
Can I get future days' prayer times through the API?
The current API only returns today's times for each city; use the city's own page to see the weekly and monthly table.