Skip to main content

Audio API

Purpose: Read chapter and verse recitation audio data.
Use this when: You have a backend and need recitation metadata or audio file URLs.
Do not use this when: You only have frontend or mobile code with no backend.
Backend required: Yes.
Allowed runtimes: Node.js, serverless functions, workers.
Required credentials: client_id, client_secret, Content API access.
Minimal import: @quranjs/api/server.

Use @quranjs/api/server.

import { createServerClient } from "@quranjs/api/server";

const client = createServerClient({
clientId: process.env.QF_CLIENT_ID!,
clientSecret: process.env.QF_CLIENT_SECRET!,
});

const chapterAudio = await client.content.v4.audio.chapterRecitation.list("7");
const verseAudio = await client.content.v4.audio.verseRecitation.byKey("1:1", "7");

Choose the Right Audio Source

Use caseFetch fromReturned shapeNotes
Single-word pronunciationword.audioUrl from the Verses APIRelative wbw/... asset pathResolve it against https://audio.qurancdn.com/ before playing it in the browser.
Chapter playbackclient.content.v4.audio.chapterRecitationFull chapter recitation URLUse this for continuous chapter playback.
Ayah playback with timingclient.content.v4.audio.verseRecitationVerse recitation URL plus optional timing metadataUse this for ayah recitations and highlighting. This is distinct from word.audioUrl.

Common Mistake

Do not assume audio is browser-safe just because the final result is a media URL. The API request still uses server credentials.

Also do not append word.audioUrl to /content/api/v4. Word-by-word audio files are public CDN assets, not authenticated Content API endpoints.