User-related API environment
Production user-related API docs
These pages describe the Production user-related API stack.
Use production OAuth credentials, production API base URLs, and production app URLs when following this documentation.
Need to test before going live? Switch to the Pre-live docs using the environment switcher above.
OAuth2 Scopes
Quran Foundation's OAuth 2.0 scopes limit the access granted to an access token. When requesting an access token, clients should request only the scopes they need. For User APIs, the user must consent to grant access to the scopes your app is requesting.
Parent and Child Scopes
Some API areas have a parent scope and more specific child scopes. For example, note is the parent
scope for note.read, note.create, note.update, note.delete, and note.publish. A parent scope
authorizes the matching child actions when calling Quran Foundation APIs.
When building an OAuth authorization URL, request the exact scopes approved for your client. If your
client is approved for a parent scope such as note or post, request that parent scope directly.
Do not also request child scopes unless those child scopes were separately approved for the client.
| If your client is approved for | Request in the OAuth URL | Do not request unless separately approved |
|---|---|---|
note | note | note.read note.create note.update note.delete note.publish |
post | post | post.read post.create post.update post.delete post.save post.like post.report post.log post.export |
collection | collection | collection.read collection.create collection.update collection.delete |
qiraat | qiraat | qiraat.read |
Requesting a scope that is not approved for your client can cause the authorization server to return
invalid_scope, even when a parent scope would be enough for the API call.
Standard OAuth2
| Scope | Description |
|---|---|
| openid | OpenID Connect authentication |
| offline_access | Allows obtaining refresh tokens |
Content
| Scope | Description |
|---|---|
| content | Read Quran Foundation's non user-related content e.g. Tafsirs, Translations, etc |
content keeps working for every client that already holds it. It is no longer issued to new
clients: a new backend client receives the granular content scopes
below in its place, and a new browser or mobile client receives no Content scope.
Granular content scopes
The content umbrella is split into nine narrower read scopes, so a new integration can ask for
the Quran text without also gaining access to audio, hadith or public reflections. Which scopes a
client holds depends on when and how it was set up: see
If you already have credentials and
New credentials.
| Scope | Reads |
|---|---|
content.quran.read | Chapters, structure, pages, verses and scripts |
content.translations.read | Translation catalogs, information, verse translations and footnotes |
content.tafsirs.read | Tafsir catalogs, information and text |
content.audio.read | Reciters, recitations, audio files, timing and lookup, recitation styles |
content.hadith.read | Hadith references, text and range counts |
content.metadata.read | Languages and verse media |
content.sync.read | Public content delta sync and resource snapshots |
content.answers.read | Answers by ayah, answer detail and range counts |
content.reflections.read | The five public QuranReflect post and comment reads |
These scopes are flat, not a hierarchy. Unlike note or post above, none of them authorizes
another: content.quran.read does not grant content.audio.read, and a shared content. prefix
is never authorization. Request each scope your integration actually calls.
They are also read-only. None of them authorizes a write, and content.create is unchanged and
unrelated.
content.sync.read reads public content deltas. It is a different permission from the user-data
sync scope, and neither implies the other.
content.reflections.read covers only the five public QuranReflect reads: the public feed, a public
post, a public user's posts, and a post's comments and all-comments. It grants no private posts, no
my-posts, no private rooms, no user-specific feeds, and no mutations or moderation. Upstream
visibility rules still apply on those routes.
What each endpoint needs
Every content operation records its scopes in the OpenAPI document under the x-qf-scopes
extension, with legacyAnyOf (what works today) and granularAnyOf (its successor). For the
confidential application tokens used by these operations, the API accepts any one of the listed
scopes, so either the legacy or the granular scope can authorize the request. The nine granular
scopes are application-credentials only: they do not authorize user-bound access tokens, even if a
granular name appears in such a token's scope claim.
If your backend also signs users in. A user's access token from Authorization Code + PKCE is
never authorized by a granular content scope alone: when every scope on a user token that a route
accepts is granular, the API returns 403. A backend that signs users in and reads Content with
granular scopes therefore requests a separate application token with client_credentials for the
Content calls, and uses the user's token for User APIs. A user token that carries content keeps
working as it does today.
The Qira'at endpoints are not part of this split. They keep their own qiraat.read scope (see
Qira'at), and none of the nine scopes authorizes them.
x-qf-scopes exists because these endpoints authenticate with the x-auth-token and x-client-id
headers together, which OpenAPI models as two apiKey schemes. OpenAPI can only attach scopes to
an oauth2 scheme, so the scope list could not go in security without misrepresenting the
transport. These are not Authorization: Bearer credentials.
If you already have credentials
Nothing to do, and nothing to change.
- Your existing scopes keep working.
contentandcontent.readcontinue to authorize every read they authorize today. This holds for every client that already has them, including browser and mobile clients. - No secret rotation, no re-authorization, no new client, and no forced user login. Access tokens you have already been issued stay valid for their normal lifetime with their original scopes.
- Eligible existing clients will additionally gain the equivalent granular scopes. Nothing is removed.
contentstays broad. Gaining a granular scope does not narrow it, and removing one granular scope from a client that still holdscontentdoes not narrow that client's access either. There is no sunset date forcontent.- Refresh tokens behave as before: a refresh returns the scopes originally granted and never a wider set. To use a new scope, make a new authorization or token request.
- Rate limits are unchanged. Your aggregate content allowance is not split per scope, and a request is not charged twice because a token carries both a legacy and a granular scope.
New credentials
A new client no longer receives content. What it receives depends on where its code runs:
- New backend (confidential) client: one that keeps a Client Secret on a server and has the
client_credentialsgrant. In place ofcontentit receives the eight read scopescontent.quran.read,content.translations.read,content.tafsirs.read,content.audio.read,content.hadith.read,content.metadata.read,content.sync.readandcontent.answers.read, where its default permissions includedcontent. It receivescontent.reflections.readonly where its defaults already cover all five public QuranReflect reads. Request the specific scopes your integration calls, space-separated in thescopeparameter, for examplecontent.quran.read content.translations.read. Requestingcontentwith such a client returnsinvalid_scope. - New browser or mobile (public) client, or any client without
client_credentials: no Content scope at all, legacy or granular, because it cannot obtain an application token. Keep Authorization Code + PKCE for User APIs, and read Content through your own backend, which uses a confidential client.
Check your SDK version before using new credentials:
- An SDK that hard-codes a
contentscope request cannot work with credentials that were never grantedcontent. Use a release that lets you choose the scopes, or set them explicitly. - JavaScript and TypeScript: use
@quranjs/api3.17.0 or later, and create the backend client withcreateServerClientandcontentScopeMode: "granular"so each call requests the scope it needs. Earlier releases always requestcontentand cannot use these credentials. Credentials that holdcontentstay on the defaultcontentScopeMode. - Python:
client_credentials()takes an explicitscope, so pass the granular scopes you call. Release 0.12.0 addsquran_foundation.content_scopeswith constants for the nine names.
Two different errors can follow a scope mistake:
- A scope your client was not approved for is rejected at the token endpoint with
invalid_scope(HTTP 400). Fix the scope request or the client's approvals. - A valid token that lacks the scope a route needs is rejected by the API with an insufficient-scope error (HTTP 403). Request the right scope for that call; for a user token, see If your backend also signs users in.
Endpoint families, not data filtering
These scopes select endpoint families; they do not filter fields out of a response. A verse
endpoint authorized by content.quran.read can still include translations, tafsirs or audio when
you ask for them, and a content sync snapshot can still return resources across content types.
Response shapes are unchanged.
Qira'at
| Scope | Description |
|---|---|
| qiraat | Manage access to Qira'at (Quran recitation variants) content |
| qiraat.read | Read Qira'at readers, transmitters, junctures, readings, and matrix data |
qiraat grants the same read access as qiraat.read. The Qira'at endpoints under
/content/api/v4/qiraat/ are scope-gated: the content scope alone is not enough and returns 403
(insufficient_scope). Request qiraat.read, or the parent qiraat scope if that is what your
client is approved for. See the
Content API Qira'at endpoints.
The Qira'at scopes and endpoints are available in production only. They are not available in the prelive environment.
Search
| Scope | Description |
|---|---|
| search | Search Quran Foundation's indexed content |
Analytics
| Scope | Description |
|---|---|
| analytics.events.write | Submit product analytics events using the client_credentials grant type; events may optionally include a QF user ID for analytics correlation |
Bookmarks
| Scope | Description |
|---|---|
| bookmark | Manage your bookmarks |
| bookmark.read | Read your existing bookmarks |
| bookmark.create | Create a new bookmark |
| bookmark.delete | Delete your existing bookmarks |
Collections
| Scope | Description |
|---|---|
| collection | Manage your collections list |
| collection.read | Read your existing collections list |
| collection.create | Create a new collection |
| collection.update | Update your existing collections list |
| collection.delete | Delete your existing collections list |
Reading Sessions
| Scope | Description |
|---|---|
| reading_session | Manage your reading sessions |
| reading_session.read | See your latest reading sessions |
| reading_session.create | Create a new reading session |
| reading_session.update | Update your existing reading sessions |
Preferences
| Scope | Description |
|---|---|
| preference | Manage your reading and audio preferences |
| preference.read | See your current reading and audio preferences |
| preference.update | Update your current reading and audio preferences |
Activity Days
| Scope | Description |
|---|---|
| activity_day | Manage your activity days |
| activity_day.read | See your latest activity days |
| activity_day.create | Create a new activity day |
| activity_day.estimate | Estimate your reading speed of Ayahs |
| activity_day.update | Update your existing activity days |
| activity_day.delete | Delete your existing activity days |
Goals
| Scope | Description |
|---|---|
| goal | Manage your goal |
| goal.read | See your goal |
| goal.estimate | Estimate your goal's week plan |
| goal.create | Create a new goal |
| goal.update | Update your existing goal |
| goal.delete | Delete your existing goal |
Streaks
| Scope | Description |
|---|---|
| streak | Manage your streak |
| streak.read | See your streak |
| streak.update | Update your streak |
Users
| Scope | Description |
|---|---|
| user | Manage your user profile data |
| user.profile.read | Read your user profile data |
| user.profile.update | Update your user profile data |
| user.rooms.read | Read your rooms list |
| user.search | Search for users |
| user.follow | Follow/unfollow users |
| user.followers.read | Read user's followers list |
| user.following.read | Read user's following list |
Posts
| Scope | Description |
|---|---|
| post | Manage your QuranReflect posts |
| post.read | Read your QuranReflect timeline posts |
| post.create | Create a new QuranReflect post |
| post.update | Update your QuranReflect posts |
| post.delete | Delete your QuranReflect posts |
| post.save | Save QuranReflect posts to your profile |
| post.like | Like QuranReflect posts |
| post.report | Report QuranReflect posts |
| post.log | Track post views |
| post.export | Export posts (e.g., PDF) |
Comments
| Scope | Description |
|---|---|
| comment | Manage your QuranReflect post comments |
| comment.read | Read QuranReflect posts' comments |
| comment.create | Create a new QuranReflect post comment |
| comment.delete | Delete your QuranReflect post comments |
| comment.like | Like/unlike comments |
Rooms
| Scope | Description |
|---|---|
| room | Manage your QuranReflect rooms |
| room.read | Read room profiles and lists |
| room.create | Create new groups/pages |
| room.update | Update groups/pages |
| room.admin | Manage room admin access |
| room.search | Search for rooms |
| room.invite | Invite users, accept/reject invites |
| room.join | Join a group |
| room.leave | Leave a group |
| room.follow | Follow a page |
| room.unfollow | Unfollow a page |
| room.members.read | Read room members list |
| room.members.remove | Remove members from room |
| room.posts.read | Read posts in a room |
| room.posts.update | Update post privacy in room |
Tags
| Scope | Description |
|---|---|
| tag | Access tags |
| tag.read | Read/search tags |
Notes
| Scope | Description |
|---|---|
| note | Manage your notes |
| note.read | Read your notes |
| note.create | Create a new note |
| note.update | Update your notes |
| note.delete | Delete your notes |
| note.publish | Publish your notes |
App State
| Scope | Description |
|---|---|
| app_state | Store and sync approved private app-specific user state |
| app_state.read | Read and synchronize approved App State collections |
| app_state.write | Create, update, and delete approved App State documents |
app_state grants both read and write access. When your client is approved for the child scopes and
needs least privilege, request app_state.read, app_state.write, or both instead. Request only the
scopes approved for your OAuth client.
Any App State scope can read the active data-group configuration from
GET /auth/v1/app-state:config. This reports the allowed collection names and effective limits; it
does not return stored user values. A user-delegated access token is required; client-credentials
tokens cannot use this endpoint.
Read the complete App State API, reconciliation, lifecycle, and SDK guide before integrating.
Sync
| Scope | Description |
|---|---|
| sync | Pull and push offline-first sync mutations with GET/POST /v1/sync |
sync only grants access to the sync endpoints. Each synced resource also needs its own scope, for
example bookmark, collection, note, or reading_session. See the
Sync API guide for the full resource-to-scope mapping.