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.
Create or replace an App State document
Stores value as a complete replacement; no JSON merge is performed. Idempotency-Key is required. Strict data groups also require exactly one precondition header. Requires a user-delegated access token with app_state or app_state.write. Client-credentials tokens are rejected because App State is always scoped to a real user.
Path Parameters
Possible values: Value must match regular expression ^[a-z0-9][a-z0-9._-]{0,79}$
Enabled data-group name returned by GET /v1/app-state:config.
Possible values: non-empty and <= 512 characters, Value must match regular expression ^(?=(?:(?:[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF])){1,512}$)[^\u0000-\u001f\u007f/\\]+$
Application-defined document key of 1-512 Unicode scalar values. Keys are compared by exact code points without Unicode normalization, so canonically equivalent spellings are distinct keys. It cannot contain slashes, backslashes, or control characters.
Header Parameters
Possible values: >= 16 characters and <= 256 characters
High-entropy key retained for 24 hours and scoped to the user and App State namespace. The fingerprint covers the method, route, body, and preconditions. An exact retry replays the original status, body, and ETag only after current authorization and current App State policy validation succeed. A current authorization or policy validation failure is returned instead of the stored replay. Reusing the key with a different method, route, body, or precondition returns 409.
Possible values: Value must match regular expression ^((?:W\/)?"[A-Za-z0-9_-]{43}"|\*)$
Mutate only when the current quoted ETag matches. Send weak validators returned by an intermediary unchanged. Use * to require an existing live document.
Possible values: Value must match regular expression ^((?:W\/)?"[A-Za-z0-9_-]{43}"|\*)$
Mutate only when the supplied ETag does not match. Send weak validators returned by an intermediary unchanged. Use * to require no live document.
Request Body required
Complete replacement document. No generic JSON merge is performed.
Application-owned JSON value stored as the complete document.
Possible values: >= 1 and <= 2147483647
Application-owned schema version for value.
- 200
- 201
- 400
- 401
- 403
- 409
- 412
- 413
- 422
- 428
- 429
- 500
- 503
The existing document was replaced, or an exact retry replayed its result.
Response Headers
ETag string
Example: "s_6UYAfR2WOsf0gHaRMUXBw2kP1S-kRXyCmbCl6yZpk"Opaque quoted document validator. An intermediary may add W/. Store it and send it unchanged in If-Match; never construct it from version.
Schema
Possible values: [true]
data 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.
{
"success": true,
"data": {
"collection": "settings",
"key": "theme",
"schemaVersion": 1,
"version": 3,
"updatedAt": "2026-08-27T00:15:00.000Z"
}
}
Setting updated
{
"success": true,
"data": {
"collection": "settings",
"key": "theme",
"schemaVersion": 1,
"version": 3,
"updatedAt": "2026-08-27T00:15:00.000Z"
}
}
A new document was created.
Response Headers
ETag string
Example: "s_6UYAfR2WOsf0gHaRMUXBw2kP1S-kRXyCmbCl6yZpk"Opaque quoted document validator. An intermediary may add W/. Store it and send it unchanged in If-Match; never construct it from version.
Schema
Possible values: [true]
data 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.
{
"success": true,
"data": {
"collection": "settings",
"key": "theme",
"schemaVersion": 1,
"version": 3,
"updatedAt": "2026-08-27T00:15:00.000Z"
}
}
Setting created
{
"success": true,
"data": {
"collection": "settings",
"key": "theme",
"schemaVersion": 1,
"version": 1,
"updatedAt": "2026-08-27T00:15:00.000Z"
}
}
The API Gateway rejects missing authentication headers. The App State service can also return this status: The body, document path, idempotency key, or precondition is invalid.
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
}
Missing value
{
"details": {
"success": false,
"error": {
"code": "invalid_json",
"message": "PUT requires the value property."
}
},
"message": "PUT requires the value property.",
"type": "invalid_request",
"success": false
}
Invalid schema version
{
"details": {
"success": false,
"error": {
"code": "invalid_json",
"message": "PUT requires schemaVersion to be an integer between 1 and 2147483647."
}
},
"message": "PUT requires schemaVersion to be an integer between 1 and 2147483647.",
"type": "invalid_request",
"success": false
}
Invalid idempotency key
{
"details": {
"success": false,
"error": {
"code": "invalid_idempotency_key",
"message": "A high-entropy Idempotency-Key is required."
}
},
"message": "A high-entropy Idempotency-Key is required.",
"type": "invalid_request",
"success": false
}
Invalid ETag
{
"details": {
"success": false,
"error": {
"code": "invalid_etag",
"message": "The ETag is invalid."
}
},
"message": "The ETag is invalid.",
"type": "invalid_request",
"success": false
}
Conflicting preconditions
{
"details": {
"success": false,
"error": {
"code": "invalid_precondition",
"message": "Only one precondition header may be sent."
}
},
"message": "Only one precondition header may be sent.",
"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
}
Data group not enabled
{
"details": {
"success": false,
"error": {
"code": "collection_not_allowed",
"message": "The collection is not approved."
}
},
"message": "The collection is not approved.",
"type": "forbidden",
"success": false
}
The idempotency key was reused with a different method, route, body, or precondition, policy changed, or lifecycle deletion won the race.
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": {}
}
Idempotency key reused
{
"details": {
"success": false,
"error": {
"code": "idempotency_key_reused",
"message": "The idempotency key was reused for a different request."
}
},
"message": "The idempotency key was reused for a different request.",
"type": "service_error",
"success": false
}
App State policy changed
{
"details": {
"success": false,
"error": {
"code": "app_state_policy_changed",
"message": "App State policy changed while this request was in progress. Retry the request."
}
},
"message": "App State policy changed while this request was in progress. Retry the request.",
"type": "service_error",
"success": false
}
App State data deleted
{
"details": {
"success": false,
"error": {
"code": "app_state_data_deleted",
"message": "App State data was deleted while this request was in progress. Retry if access is still authorized."
}
},
"message": "App State data was deleted while this request was in progress. Retry if access is still authorized.",
"type": "service_error",
"success": false
}
A supplied ETag precondition does not match current document state.
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": {}
}
ETag conflict
{
"details": {
"success": false,
"error": {
"code": "precondition_failed",
"message": "The document changed after the supplied ETag.",
"details": {
"currentETag": "\"s_6UYAfR2WOsf0gHaRMUXBw2kP1S-kRXyCmbCl6yZpk\""
}
}
},
"message": "The document changed after the supplied ETag.",
"type": "precondition_failed",
"success": false
}
The serialized document exceeds the per-document limit.
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": {}
}
Document too large
{
"details": {
"success": false,
"error": {
"code": "document_too_large",
"message": "The document is too large."
}
},
"message": "The document is too large.",
"type": "payload_too_large",
"success": false
}
Creating or growing the document would exceed an App State quota.
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": {}
}
Quota exceeded
{
"details": {
"success": false,
"error": {
"code": "quota_exceeded",
"message": "The App State quota has been exceeded.",
"details": {
"bytesUsed": 1100000,
"quotaBytesPerUser": 1048576
}
}
},
"message": "The App State quota has been exceeded.",
"type": "unprocessable_entity",
"success": false
}
This strict data group requires a precondition.
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": {}
}
Precondition required
{
"details": {
"success": false,
"error": {
"code": "precondition_required",
"message": "This collection requires a precondition."
}
},
"message": "This collection requires a precondition.",
"type": "precondition_required",
"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
}