Developer API · v1
Build with i-muslim data
A clean JSON API for the things every Islamic app needs: prayer times, Qibla direction, the Hijri calendar, mosque listings, the Quran, and the major Hadith collections — read and write. Free for community use, rate limited per key, no marketing tracking. Issue a key, drop in a fetch call, ship.
What you can do
- Read prayer times for any coordinates, date, calculation method, and madhab — calculated server-side with the canonical
adhanalgorithm. - Get the Qibla bearing from anywhere on Earth (great-circle to the Kaaba).
- Convert dates between Gregorian and Hijri (Umm al-Qura).
- Query mosques by location, country, city, or text — same dataset that powers the i-muslim mosque directory.
- Read the Quran with Arabic + translations in English, Russian, Azerbaijani, Turkish.
- Read Hadithfrom Bukhari, Muslim, Abu Dawud, Tirmidhi, Nasa'i, Ibn Majah, Malik, Nawawi 40, and Qudsi 40.
- Publish translations — your translation pipeline can
PUTdirectly into our Quran and Hadith stores. Arabic original text stays read-only.
Getting a key
Request a key through the contact form with a one-sentence description of what you're building and which endpoints you need. Keys are issued manually during v1 and typically come back within 24 hours. Each key is scoped to a subset of resources (e.g. hadith, prayer-times) and a subset of permissions (read, write, delete).
Quick start
Every request needs the X-API-Key header. Here's the simplest possible request — Qibla bearing for London:
curl
curl -H "X-API-Key: im_live_..." \
"https://i-muslim.com/api/v1/qibla?lat=51.5074&lng=-0.1278"JavaScript (Node 18+, browsers)
const res = await fetch(
"https://i-muslim.com/api/v1/qibla?lat=51.5074&lng=-0.1278",
{ headers: { "X-API-Key": process.env.IMUSLIM_API_KEY } },
);
const { data } = await res.json();
console.log(data.bearing); // → 118.99 degrees from northPython (requests)
import os, requests
r = requests.get(
"https://i-muslim.com/api/v1/qibla",
params={"lat": 51.5074, "lng": -0.1278},
headers={"X-API-Key": os.environ["IMUSLIM_API_KEY"]},
)
print(r.json()["data"]["bearing"])Publishing a translation
With a write-scope key, you can publish or update a translation for any hadith or Quranic ayah. The endpoint is idempotent — call it again with new text and it overwrites. Arabic (text_ar) is never editable via API.
curl -X PUT \
-H "X-API-Key: im_live_..." \
-H "Content-Type: application/json" \
-d '{"text": "The deeds are only by intentions..."}' \
"https://i-muslim.com/api/v1/hadith/collections/bukhari/hadiths/1/translations/en"Every write is recorded in our audit log with your key id, your key name, and a before/after snapshot. If you push a translation that turns out to be wrong, we can roll it back.
Endpoints
Read (GET)
Browser-callable: Access-Control-Allow-Origin: * is set on every response. Safe to call directly from frontend code if your key is read-only.
- GET
/api/v1/prayer-timesFive daily prayer times for coordinates + date + method + madhab.
- GET
/api/v1/qiblaQibla bearing (degrees from north) for coordinates.
- GET
/api/v1/hijriGregorian ↔ Hijri conversion for a date (default today).
- GET
/api/v1/mosquesList published mosques. Filters: near=lat,lng[,radiusKm], country, city, q, limit.
- GET
/api/v1/mosques/{slug}Single mosque by slug.
- GET
/api/v1/quran/surahsAll 114 surahs (id, names, count).
- GET
/api/v1/quran/surahs/{surah}/ayahsAll ayahs of a surah. Optional ?translations=en,ru,tr.
- GET
/api/v1/quran/surahs/{surah}/ayahs/{ayah}Single ayah.
- GET
/api/v1/hadith/collectionsAll hadith collections (slug, name, total).
- GET
/api/v1/hadith/collections/{id}/hadithsPaginated hadiths within a collection. ?limit=, ?startAfter= for cursor.
- GET
/api/v1/hadith/collections/{id}/hadiths/{number}Single hadith with Arabic + translations.
Write (PUT / PATCH / POST)
Server-side only.Write endpoints intentionally don't set CORS headers — call them from your backend so the key never lands in a browser. Requires write permission on the key.
- PUT
/api/v1/hadith/collections/{id}/hadiths/{number}/translations/{locale}Upsert a hadith translation. Body: { text }.
- PATCH
/api/v1/hadith/collections/{id}/hadiths/{number}Patch hadith metadata: narrator, grade, tags, notes, published.
- PUT
/api/v1/quran/surahs/{surah}/ayahs/{ayah}/translations/{locale}Upsert a Quran ayah translation. Body: { text }.
- PATCH
/api/v1/quran/surahs/{surah}/ayahs/{ayah}Patch ayah metadata: tags, notes, published.
- POST
/api/v1/mosquesSubmit a new mosque for moderation. Body: nameEn, addressLine1, city, country, submitterEmail, [nameAr, denomination, phone, website, email, description, languages].
Authentication
Send your key in the X-API-Key header on every request. Keys look like im_live_AbCd… and are shown exactly once when issued — store them in your secrets manager (Vercel env vars, AWS Secrets Manager, GitHub Actions secrets, etc.). We only keep a SHA-256 hash on our side, so we cannot recover a lost key — ask for a new one.
Rate limits
100 requests per minute, per key. Every response carries three headers so you can self-throttle:
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 87
X-RateLimit-Reset: 1747234260When you exceed the limit you'll get 429 Too Many Requests with error code RATE_LIMITED. Wait for the reset timestamp, or contact us if you need a higher cap for a legitimate use case.
Response shape
// Success
{ "data": { "bearing": 118.99, "origin": {...}, "kaaba": {...} } }
// Error
{ "error": { "code": "INVALID_API_KEY", "message": "API key not found or revoked" } }Error codes
MISSING_API_KEY(401) — noX-API-Keyheader sent.INVALID_API_KEY(401) — key not recognized or revoked.EXPIRED_API_KEY(401) — key was issued with an expiration date that has passed.INSUFFICIENT_SCOPE(403) — your key doesn't cover this resource type.INSUFFICIENT_PERMISSION(403) — read-only key trying to write, etc.FORBIDDEN_LOCALE(403) — you tried to write Arabic; it's the sacred original and read-only via API.VALIDATION_ERROR(400) — bad query string or body.INVALID_JSON(400) — body wasn't valid JSON.NOT_FOUND(404) — resource doesn't exist.RATE_LIMITED(429) — over 100 req/min on this key.
Stability & versioning
v1 is the stable surface. Any breaking change ships as v2 on a new path; we'll keep v1 running for at least 12 months after v2 launches.
Attribution & ethics
Quran and Hadith are sacred — please render them faithfully, don't paraphrase, and don't silently truncate. If you publish translations you authored, please make sure you have the right to do so. If you spot a translation error in our data, let us know and we'll roll it back.
Contact
Questions, bug reports, or higher-quota requests — please use the contact form and mention “Developer API” in the subject.