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.
Synchronize App State changes
Pulls a bounded page after an opaque sync token. Apply the page and nextSyncToken atomically; drain until hasMore is false. On 410, preserve pending mutations, bootstrap, drain, replay, then pull again. Requires a user-delegated access token with app_state or app_state.read. Client-credentials tokens are rejected because App State is always scoped to a real user.
Query Parameters
Opaque nextSyncToken returned by bootstrap or the preceding changes page.
Default value: 100
Maximum rows or changes scanned. Invalid or non-positive values use 100; values above 100 are capped at 100.
- 200
- 400
- 401
- 403
- 409
- 410
- 429
- 500
- 503
A bounded page of changes and the token for the next pull.
Schema
- Array [
- ]
Possible values: [true]
data object required
changes object[] required
Possible values: Value must match regular expression ^[a-z0-9][a-z0-9._-]{0,79}$
Enabled data group containing the document.
Possible values: non-empty and <= 512 characters, Value must match regular expression ^(?=(?:(?:[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF])){1,512}$)[^\u0000-\u001f\u007f/\\]+$
Document key within the data group.
Possible values: >= 1 and <= 2147483647
Application-owned schema version for the document value.
Possible values: >= 1
Server-assigned document version.
Application-owned JSON value. The service never merges document fields.
Possible values: Value must match regular expression ^(?:W\/)?"[A-Za-z0-9_-]{43}"$
Opaque quoted ETag. Store and send it unchanged in If-Match; never construct it from version.
Possible values: [upsert, delete]
Change operation to apply to the local document.
{
"success": true,
"data": {
"changes": [
{
"collection": "settings",
"key": "theme",
"schemaVersion": 1,
"version": 3,
"updatedAt": "2026-08-27T00:15:00.000Z",
"value": {
"mode": "dark",
"fontScale": 1.1
},
"etag": "\"s_6UYAfR2WOsf0gHaRMUXBw2kP1S-kRXyCmbCl6yZpk\"",
"operation": "upsert"
}
],
"nextSyncToken": "string",
"hasMore": true
}
}
Document upserted
{
"success": true,
"data": {
"changes": [
{
"collection": "settings",
"key": "theme",
"schemaVersion": 1,
"version": 3,
"value": {
"mode": "dark",
"fontScale": 1.1
},
"updatedAt": "2026-08-27T00:15:00.000Z",
"etag": "\"s_6UYAfR2WOsf0gHaRMUXBw2kP1S-kRXyCmbCl6yZpk\"",
"operation": "upsert"
}
],
"nextSyncToken": "v2.opaque-next-sync-token",
"hasMore": false
}
}
Document deleted
{
"success": true,
"data": {
"changes": [
{
"collection": "settings",
"key": "theme",
"schemaVersion": 1,
"version": 4,
"value": null,
"updatedAt": "2026-08-27T00:15:00.000Z",
"etag": "\"s_6UYAfR2WOsf0gHaRMUXBw2kP1S-kRXyCmbCl6yZpk\"",
"operation": "delete"
}
],
"nextSyncToken": "v2.opaque-next-sync-token",
"hasMore": false
}
}
The API Gateway rejects missing authentication headers. The App State service can also return this status: The since token is missing, invalid, or belongs to another user.
Schema
Possible values: [false]
details object
The upstream service error body, when the failure came from a service.
The upstream service error body, when the failure came from a service.
{
"message": "string",
"type": "string",
"success": false,
"details": {}
}
Missing authentication headers
{
"message": "The request is missing required headers or is invalid",
"type": "invalid_request",
"success": false
}
Invalid sync token
{
"details": {
"success": false,
"error": {
"code": "invalid_sync_token",
"message": "The sync token is invalid."
}
},
"message": "The sync token is invalid.",
"type": "invalid_request",
"success": false
}
The Gateway and App State service reject malformed, expired, inactive, revoked, or non-user-delegated access tokens and tokens associated with another client. The service can also reject a banned authenticated user.
Response Headers
WWW-Authenticate string
Example: Bearer error="invalid_token"Bearer challenge returned for invalid App State credentials.
Schema
Possible values: [false]
details object
The upstream service error body, when the failure came from a service.
The upstream service error body, when the failure came from a service.
{
"message": "string",
"type": "string",
"success": false,
"details": {}
}
Malformed access token
{
"message": "The access token is not a valid JWT",
"type": "invalid_token",
"success": false
}
Expired or inactive access token
{
"message": "The access token is expired or inactive",
"type": "invalid_token",
"success": false
}
Revoked access token
{
"message": "The access token is expired or inactive",
"type": "invalid_token",
"success": false
}
Token belongs to another client
{
"message": "The access token is not associated with the client",
"type": "invalid_token",
"success": false
}
Invalid access token rejected by App State
{
"details": {
"success": false,
"error": {
"code": "invalid_token",
"message": "The access token is invalid."
}
},
"message": "The access token is invalid.",
"type": "unauthorized",
"success": false
}
Banned user
{
"details": {
"success": false,
"name": "external.banned",
"error": {
"code": "BANNED",
"message": "Sorry, Your account is banned. Contact Quran.Foundation",
"details": {
"email": "BANNED"
}
}
},
"message": "Sorry, Your account is banned. Contact Quran.Foundation",
"type": "unauthorized",
"success": false
}
The Gateway rejects insufficient scopes. The service additionally requires an active App State policy and an enabled data group.
Schema
Possible values: [false]
details object
The upstream service error body, when the failure came from a service.
The upstream service error body, when the failure came from a service.
{
"message": "string",
"type": "string",
"success": false,
"details": {}
}
Insufficient App State scope
{
"message": "The access token does not have the required scopes",
"type": "insufficient_scope",
"success": false
}
App State disabled
{
"details": {
"success": false,
"error": {
"code": "app_state_disabled",
"message": "App State is disabled."
}
},
"message": "App State is disabled.",
"type": "forbidden",
"success": false
}
Policy changed. Resolve configuration and bootstrap again.
Schema
Possible values: [false]
details object
The upstream service error body, when the failure came from a service.
The upstream service error body, when the failure came from a service.
{
"message": "string",
"type": "string",
"success": false,
"details": {}
}
App State policy changed
{
"details": {
"success": false,
"error": {
"code": "app_state_policy_changed",
"message": "Bootstrap is required because the App State policy changed."
}
},
"message": "Bootstrap is required because the App State policy changed.",
"type": "service_error",
"success": false
}
Preserve pending local mutations and bootstrap again before replaying them.
Schema
Possible values: [false]
details object
The upstream service error body, when the failure came from a service.
The upstream service error body, when the failure came from a service.
{
"message": "string",
"type": "string",
"success": false,
"details": {}
}
Bootstrap required
{
"details": {
"success": false,
"error": {
"code": "bootstrap_required",
"message": "Bootstrap is required to recover App State."
}
},
"message": "Bootstrap is required to recover App State.",
"type": "gone",
"success": false
}
Sync token expired
{
"details": {
"success": false,
"error": {
"code": "sync_token_expired",
"message": "The sync token has expired."
}
},
"message": "The sync token has expired.",
"type": "gone",
"success": false
}
The request was rate limited by the public API Gateway. Retry after the communicated interval.
Schema
Possible values: [false]
details object
The upstream service error body, when the failure came from a service.
The upstream service error body, when the failure came from a service.
{
"message": "string",
"type": "string",
"success": false,
"details": {}
}
Client rate limited
{
"message": "Too many requests, please try again later",
"type": "rate_limit_exceeded",
"success": false
}
An unexpected server or database failure prevented the request from completing.
Schema
Possible values: [false]
details object
The upstream service error body, when the failure came from a service.
The upstream service error body, when the failure came from a service.
{
"message": "string",
"type": "string",
"success": false,
"details": {}
}
Unexpected server error
{
"details": {
"success": false,
"error": {
"code": "ServerError",
"message": "Something went wrong"
}
},
"message": "Something went wrong",
"type": "internal_server_error",
"success": false
}
App State policy or stream state could not be resolved. Retry with backoff.
Schema
Possible values: [false]
details object
The upstream service error body, when the failure came from a service.
The upstream service error body, when the failure came from a service.
{
"message": "string",
"type": "string",
"success": false,
"details": {}
}
Namespace resolution unavailable
{
"details": {
"success": false,
"error": {
"code": "namespace_resolution_unavailable",
"message": "App State namespace resolution is temporarily unavailable."
}
},
"message": "App State namespace resolution is temporarily unavailable.",
"type": "service_unavailable",
"success": false
}
App State unavailable
{
"details": {
"success": false,
"error": {
"code": "app_state_unavailable",
"message": "The App State stream or document is temporarily unavailable."
}
},
"message": "The App State stream or document is temporarily unavailable.",
"type": "service_unavailable",
"success": false
}