Skip to main content

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 forRequest in the OAuth URLDo not request unless separately approved
notenotenote.read note.create note.update note.delete note.publish
postpostpost.read post.create post.update post.delete post.save post.like post.report post.log post.export
collectioncollectioncollection.read collection.create collection.update collection.delete
qiraatqiraatqiraat.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​

ScopeDescription
openidOpenID Connect authentication
offline_accessAllows obtaining refresh tokens

Content​

ScopeDescription
contentRead 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.

ScopeReads
content.quran.readChapters, structure, pages, verses and scripts
content.translations.readTranslation catalogs, information, verse translations and footnotes
content.tafsirs.readTafsir catalogs, information and text
content.audio.readReciters, recitations, audio files, timing and lookup, recitation styles
content.hadith.readHadith references, text and range counts
content.metadata.readLanguages and verse media
content.sync.readPublic content delta sync and resource snapshots
content.answers.readAnswers by ayah, answer detail and range counts
content.reflections.readThe 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. content and content.read continue 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.
  • content stays broad. Gaining a granular scope does not narrow it, and removing one granular scope from a client that still holds content does not narrow that client's access either. There is no sunset date for content.
  • 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_credentials grant. In place of content it receives the eight read scopes content.quran.read, content.translations.read, content.tafsirs.read, content.audio.read, content.hadith.read, content.metadata.read, content.sync.read and content.answers.read, where its default permissions included content. It receives content.reflections.read only where its defaults already cover all five public QuranReflect reads. Request the specific scopes your integration calls, space-separated in the scope parameter, for example content.quran.read content.translations.read. Requesting content with such a client returns invalid_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 content scope request cannot work with credentials that were never granted content. Use a release that lets you choose the scopes, or set them explicitly.
  • JavaScript and TypeScript: use @quranjs/api 3.17.0 or later, and create the backend client with createServerClient and contentScopeMode: "granular" so each call requests the scope it needs. Earlier releases always request content and cannot use these credentials. Credentials that hold content stay on the default contentScopeMode.
  • Python: client_credentials() takes an explicit scope, so pass the granular scopes you call. Release 0.12.0 adds quran_foundation.content_scopes with 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​

ScopeDescription
qiraatManage access to Qira'at (Quran recitation variants) content
qiraat.readRead 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.

Production only

The Qira'at scopes and endpoints are available in production only. They are not available in the prelive environment.

ScopeDescription
searchSearch Quran Foundation's indexed content

Analytics​

ScopeDescription
analytics.events.writeSubmit product analytics events using the client_credentials grant type; events may optionally include a QF user ID for analytics correlation

Bookmarks​

ScopeDescription
bookmarkManage your bookmarks
bookmark.readRead your existing bookmarks
bookmark.createCreate a new bookmark
bookmark.deleteDelete your existing bookmarks

Collections​

ScopeDescription
collectionManage your collections list
collection.readRead your existing collections list
collection.createCreate a new collection
collection.updateUpdate your existing collections list
collection.deleteDelete your existing collections list

Reading Sessions​

ScopeDescription
reading_sessionManage your reading sessions
reading_session.readSee your latest reading sessions
reading_session.createCreate a new reading session
reading_session.updateUpdate your existing reading sessions

Preferences​

ScopeDescription
preferenceManage your reading and audio preferences
preference.readSee your current reading and audio preferences
preference.updateUpdate your current reading and audio preferences

Activity Days​

ScopeDescription
activity_dayManage your activity days
activity_day.readSee your latest activity days
activity_day.createCreate a new activity day
activity_day.estimateEstimate your reading speed of Ayahs
activity_day.updateUpdate your existing activity days
activity_day.deleteDelete your existing activity days

Goals​

ScopeDescription
goalManage your goal
goal.readSee your goal
goal.estimateEstimate your goal's week plan
goal.createCreate a new goal
goal.updateUpdate your existing goal
goal.deleteDelete your existing goal

Streaks​

ScopeDescription
streakManage your streak
streak.readSee your streak
streak.updateUpdate your streak

Users​

ScopeDescription
userManage your user profile data
user.profile.readRead your user profile data
user.profile.updateUpdate your user profile data
user.rooms.readRead your rooms list
user.searchSearch for users
user.followFollow/unfollow users
user.followers.readRead user's followers list
user.following.readRead user's following list

Posts​

ScopeDescription
postManage your QuranReflect posts
post.readRead your QuranReflect timeline posts
post.createCreate a new QuranReflect post
post.updateUpdate your QuranReflect posts
post.deleteDelete your QuranReflect posts
post.saveSave QuranReflect posts to your profile
post.likeLike QuranReflect posts
post.reportReport QuranReflect posts
post.logTrack post views
post.exportExport posts (e.g., PDF)

Comments​

ScopeDescription
commentManage your QuranReflect post comments
comment.readRead QuranReflect posts' comments
comment.createCreate a new QuranReflect post comment
comment.deleteDelete your QuranReflect post comments
comment.likeLike/unlike comments

Rooms​

ScopeDescription
roomManage your QuranReflect rooms
room.readRead room profiles and lists
room.createCreate new groups/pages
room.updateUpdate groups/pages
room.adminManage room admin access
room.searchSearch for rooms
room.inviteInvite users, accept/reject invites
room.joinJoin a group
room.leaveLeave a group
room.followFollow a page
room.unfollowUnfollow a page
room.members.readRead room members list
room.members.removeRemove members from room
room.posts.readRead posts in a room
room.posts.updateUpdate post privacy in room

Tags​

ScopeDescription
tagAccess tags
tag.readRead/search tags

Notes​

ScopeDescription
noteManage your notes
note.readRead your notes
note.createCreate a new note
note.updateUpdate your notes
note.deleteDelete your notes
note.publishPublish your notes

App State​

ScopeDescription
app_stateStore and sync approved private app-specific user state
app_state.readRead and synchronize approved App State collections
app_state.writeCreate, 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​

ScopeDescription
syncPull 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.