Skip to main content

Audio API

The Audio API provides access to audio recitations including chapter audio and verse-by-verse audio with timing.

Chapter Recitations​

Get All Chapter Recitations​

const recitations = await client.audio.findAllChapterRecitations("2");

console.log(recitations[0]);
// {
// id: 1,
// chapterId: 1,
// fileSize: 12345,
// format: "mp3",
// audioUrl: "https://audio.quran.com/..."
// }

ChapterRecitation Type​

FieldTypeNotes
idnumberUnique identifier for the chapter audio record.
chapterIdnumberSurah that the audio recitation belongs to.
fileSizenumberFile size in bytes.
formatstringAudio format, typically mp3.
audioUrlstringDownload URL for the chapter recitation.

Get Specific Chapter​

const audio = await client.audio.findChapterRecitationById("2", "1");

console.log(`URL: ${audio.audioUrl}`);
console.log(`Format: ${audio.format}`);

Verse Recitations​

By Chapter​

const { audioFiles, pagination } = await client.audio.findVerseRecitationsByChapter(
"1", // Chapter ID
"2" // Recitation ID
);

audioFiles.forEach((audio) => {
console.log(`${audio.verseKey}: ${audio.url}`);
});

VerseRecitation Type​

FieldTypeNotes
verseKeystringVerse identifier such as 2:255.
urlstringDirect URL to the verse audio file.
idnumberUnique identifier for the verse recitation.
chapterIdnumberSurah that the verse belongs to.
segmentsSegment[]Optional timing metadata for word-level playback.
formatstringAudio format, e.g. mp3.

Segment entries include the timestamp ranges (start, end) that power word-level playback.

By Verse Key​

const { audioFiles } = await client.audio.findVerseRecitationsByKey(
"2:255",
"2"
);

const audio = audioFiles[0];
console.log(`URL: ${audio.url}`);
console.log(`Format: ${audio.format ?? "stream"}`);

Field Selection​

const { audioFiles } = await client.audio.findVerseRecitationsByChapter("1", "2", {
fields: {
segments: true,
format: true,
id: true,
chapterId: false,
},
});

// Available verse fields: id, chapterId, segments, format