Chapters API
The Chapters API provides access to information about the 114 chapters (surahs) of the Quran.
Get All Chapters​
const chapters = await client.chapters.findAll();
chapters.forEach((chapter) => {
console.log(`${chapter.id}. ${chapter.nameSimple} (${chapter.nameArabic})`);
console.log(` Verses: ${chapter.versesCount}`);
console.log(` Revelation: ${chapter.revelationPlace}`);
});
Chapter Type​
Field | Type | Notes |
---|---|---|
id | number | Sequential chapter identifier. |
versesCount | number | Total verses in the chapter. |
bismillahPre | boolean | Indicates if Bismillah precedes the chapter. |
revelationOrder | number | Order of revelation. |
revelationPlace | string | meccan or medinan . |
pages | number[] | Mushaf page range for the chapter. |
nameComplex | string | Full transliterated name (e.g., Al-Baqarah ). |
nameSimple | string | Common English name. |
transliteratedName | string | Transliteration suitable for URLs. |
nameArabic | string | Arabic chapter name. |
translatedName | TranslatedName | Localized name with language metadata. |
With Language Options​
import { Language } from "@quranjs/api";
const arabicChapters = await client.chapters.findAll({
language: Language.ARABIC,
});
const urduChapters = await client.chapters.findAll({
language: Language.URDU,
});
Get Chapter by ID​
const alFatiha = await client.chapters.findById("1");
const alBaqarah = await client.chapters.findById("2");
const anNas = await client.chapters.findById("114");
Get Chapter Info​
const info = await client.chapters.findInfoById("1");
console.log(info.shortText); // Brief description
console.log(info.text); // Full description
console.log(info.source); // Source attribution
ChapterInfo Type​
Field | Type | Notes |
---|---|---|
id | number | Unique identifier for the info record. |
chapterId | number | Chapter the info is associated with. |
text | string | Full descriptive text. |
shortText | string | Condensed overview for quick display. |
source | string | Attribution for the content. |
languageName | string | Language of the info text (e.g., english ). |