DEV Community

Cover image for How to Add Quran, Hadith & Prayer Times to Your App with a Free Islamic API
SunnahSource
SunnahSource

Posted on

How to Add Quran, Hadith & Prayer Times to Your App with a Free Islamic API

How to Add Quran, Hadith & Prayer Times to Your App with a Free Islamic API

If you've ever built a Muslim app, whether a Quran reader, a prayer-time app or a simple "Hadith of the Day" widget, you know the hard part isn't the UI. It's the data. You need the authentic Arabic text, reliable translations, consistent formatting, and you need it in the languages your users actually speak.

In this post I'll show how to plug Islamic content into an app using SunnahSource, an Islamic API platform that serves Quran, Hadith, Duas, Azkar, Tafseer, Prayer Times and more as clean JSON, in 9 languages (English, Urdu, Russian, Malay, Indonesian, French, German, Turkish and Chinese).

Why use an Islamic API instead of scraping?

  • Authenticity: the data comes from verified sources, with references (collection, hadith number, narrator).
  • Consistency: every API uses the same structure: arabic, transliteration, and a translations object keyed by language code.
  • Less work: no PDFs to parse, no OCR, no Unicode headaches with Arabic diacritics.
  • Multilingual out of the box: switch translations.en to translations.ur or translations.ms and you're done.

What's available

Need API
Quran text + translations (free) Quran API
Word-by-word meanings Word by Word Quran API
Commentary Tafseer API
Bukhari & Muslim Hadith API
22 hadith books Hadith 22 Books API
Salah times for any city Prayer Times API
Duas & Azkar Duas API · Azkar API
Hijri date & events Hijri Calendar API

There are 19 APIs in total. The Quran Translations and Quran Topics APIs are free; the rest are premium.

Step 1: Prototype with the public sample data

Each API page has a live preview backed by a public sample JSON file. That's perfect for building your UI before you have a key:

https://sunnahsource.org/data/json/quran-translations.json
https://sunnahsource.org/data/json/hadith.json
https://sunnahsource.org/data/json/prayer-times.json
Enter fullscreen mode Exit fullscreen mode

Here's what the Hadith sample looks like (shortened):

{
  "title": "Hadith Collections",
  "items": [
    {
      "collection": "Sahih Bukhari",
      "hadith_number": 1,
      "arabic": "إِنَّمَا الأَعْمَالُ بِالنِّيَّاتِ",
      "narrator": "Umar ibn Al-Khattab (RA)",
      "translations": {
        "en": "Actions are judged by intentions, and every person will get what they intended.",
        "ur": "اعمال کا دارومدار نیتوں پر ہے..."
      }
    }
  ]
}
Enter fullscreen mode Exit fullscreen mode

Step 2: Show a Quran surah (Node.js)

const res = await fetch("https://sunnahsource.org/data/json/quran-translations.json");
const { surah, ayahs } = await res.json();

console.log(`Surah ${surah.name_english} (${surah.name_arabic})`);
for (const ayah of ayahs) {
  console.log(`${ayah.number}. ${ayah.arabic}`);
  console.log(`   ${ayah.translations.en}`);
}
Enter fullscreen mode Exit fullscreen mode

Want Urdu instead? Change translations.en to translations.ur.

Step 3: A "Hadith of the Day" in Python

import random, requests

data = requests.get("https://sunnahsource.org/data/json/hadith.json", timeout=10).json()
h = random.choice(data["items"])
print(f'{h["collection"]} #{h["hadith_number"]} — narrated by {h["narrator"]}')
print(h["arabic"])
print(h["translations"]["en"])
Enter fullscreen mode Exit fullscreen mode

Step 4: Prayer times in Flutter

import 'dart:convert';
import 'package:http/http.dart' as http;

class PrayerTimes {
  final String city;
  final Map<String, dynamic> times;
  PrayerTimes(this.city, this.times);
}

Future<PrayerTimes> fetchPrayerTimes() async {
  final res = await http.get(Uri.parse('https://sunnahsource.org/data/json/prayer-times.json'));
  final data = jsonDecode(utf8.decode(res.bodyBytes)); // utf8 keeps the Arabic text intact
  return PrayerTimes(data['city'], Map<String, dynamic>.from(data['times']));
}
Enter fullscreen mode Exit fullscreen mode

Render times['fajr'], times['dhuhr'], times['asr'], times['maghrib'] and times['isha'] in a list, and you have the core of a salah-times screen.

Tip for Arabic text: use a font with good Arabic support (Amiri, Noto Naskh/Nastaliq) and set textDirection: TextDirection.rtl on Arabic widgets.

Step 5: Get your API key and go to production

The sample files only contain a preview (e.g. Surah Al-Fatiha, a couple of hadith). For the full datasets:

  1. Go to sunnahsource.org and fill in the Get API Access form, or use the form on any API page.
  2. Within 12–24 hours you'll get an email with your API key, production endpoint and docs.
  3. Replace the sample URL with your production endpoint and you're live.

Wrapping up

With a structured Islamic API you can build a Quran reader, a hadith widget or a prayer-time screen in an afternoon, in 9 languages, without managing a database. Start with the free Quran API, explore the Hadith API and the Prayer Times API, and if you need a complete app, the team behind SunnahSource (Hafiz Developers) builds those too.

JazakAllahu khairan for reading. If you build something with it, share it in the comments!

Top comments (0)