Welcome to the Quran API, delivering Ayah-by-Ayah JSON data, high-quality audio, and text images. This API is statically generated and globally distributed via Cloudflare's Edge Network for maximum performance and reliability.

Base URLs

The API is separated into three distinct domains based on the required language context. Choose the Base URL that matches your needs:

LanguageBase URLDescription
Bengalihttps://quranapibn.sayed.appIncludes Bengali text/translation images
Englishhttps://quranapien.sayed.appIncludes English text/translation images
Arabichttps://quranapiar.sayed.appIncludes pure Arabic text images
CORS Support: Access-Control-Allow-Origin: * is enabled. You can safely call these endpoints directly from frontend browser applications without running into CORS errors.

Endpoints

1. Surah Index

Fetches a list of all 114 Surahs, providing their lengths and the relative URL to access their detailed data.

GET/index.json

Example Response:

[
  {
    "surah": 1,
    "ayah_count": 8,
    "url": "/json/1.json"
  },
  {
    "surah": 2,
    "ayah_count": 287,
    "url": "/json/2.json"
  }
]

2. Surah Details (Ayah by Ayah)

Fetches the detailed breakdown of a specific Surah, providing links to the audio and image assets for each Ayah.

GET/json/[surah_number].json

Example Request: GET https://quranapien.sayed.app/json/1.json

Example Response:

[
  {
    "surah": 1,
    "ayah": 0,
    "audio": "/audio/1/1-0.mp3",
    "images": {
      "englishP": "/images/englishP/1/1-0.png",
      "englishT": "/images/englishT/1/1-0.png"
    }
  },
  {
    "surah": 1,
    "ayah": 1,
    "audio": "/audio/1/1-1.mp3",
    "images": {
      "englishP": "/images/englishP/1/1-1.png",
      "englishT": "/images/englishT/1/1-1.png"
    }
  }
]
Note: ayah: 0 is reserved for the Bismillah (In the name of Allah) that appears at the start of most Surahs.

Media Delivery

The API does not embed massive base64 media files in the JSON. Instead, it provides relative paths. To fetch the media, append the relative path to your chosen Base URL.

Audio

Audio files are provided as high-quality MP3s for every Ayah.

URL Construction: GET [BASE_URL]/audio/[surah_number]/[surah_number]-[ayah_number].mp3

Example: https://quranapien.sayed.app/audio/1/1-1.mp3

Images

Image files containing the Ayah text are provided in two variants: Pronunciation/Transliteration (P) and Translation (T).

URL Construction: GET [BASE_URL]/images/[language_code]/[surah_number]/[surah_number]-[ayah_number].png

Available Language Codes mapping to Base URLs:

  • Bengali: "bengaliP" and "bengaliT"
  • English: "englishP" and "englishT"
  • Arabic: "arabicP" and "arabicT"

Performance & Caching

This API is built for speed and scales infinitely.

Aggressive Caching: All API responses (JSON, MP3, PNG) carry a Cache-Control: public, max-age=31536000, immutable header.

This means resources are cached in the browser for 1 Year. When building apps, you don't need to write complex local caching logic. The browser will handle it natively, resulting in zero-latency subsequent loads for your users.

Code Examples

JavaScript (Fetch API)
const BASE_URL = "https://quranapien.sayed.app";

async function playFirstAyah(surahNumber) {
    try {
        const response = await fetch(`$[BASE_URL]/json/${surahNumber}.json`);
        if (!response.ok) throw new Error("Surah not found");
        
        const data = await response.json();
        const firstAyah = data[1]; // Index 1 (Index 0 is Bismillah)
        
        console.log("Playing audio for Surah:", surahNumber);
        const audio = new Audio(BASE_URL + firstAyah.audio);
        audio.play();
    } catch (error) {
        console.error(error);
    }
}
playFirstAyah(1);
Python (Requests)
import requests

BASE_URL = "https://quranapibn.sayed.app"

def get_surah_data(surah_number):
    response = requests.get(f"[BASE_URL]/json/[surah_number].json")
    if response.status_code == 200:
        data = response.json()
        print(f"Total Ayahs: {len(data) - 1}") # Subtract 1 for Bismillah
        print(f"First Ayah Audio: [BASE_URL]{data[1]['audio']}")
    else:
        print("Error fetching Surah")

get_surah_data(1)