---
title: "Change page data settings"
method: PATCH
path: "/api/{ns}/{id}/state"
tags: ["Page data"]
---

# Change page data settings

`PATCH /api/{ns}/{id}/state`

## Request

- Base URL: `https://brewpage.app`
- URL: `https://brewpage.app/api/{ns}/{id}/state`
- Auth: one of:
  - API key in header `X-Owner-Token`
  - API key in header `X-Manage-Key`

The body replaces the whole settings object (at most 16 KB), same shape as `state` on publish: an absent list is removed (its entries stay, it becomes private), an absent top-level key returns to its default, a named list keeps the rule keys the body omits. `{}` = on with defaults, `null` = off (entries stay).

## Path parameters

- `ns` string, required
- `id` string, required

## Headers

- `X-Owner-Token` unknown
- `X-Manage-Key` unknown

## Request body

- StateSettingsRequest, nullable
  - `collections` object, nullable: Declared lists by name; lists absent here are removed (their entries stay); a list set to null takes the default rule
  - `captcha` 'auto' | 'always', nullable: Human check for new visitors who save: auto (default) or always
  - `maxDocBytes` integer, nullable: Largest entry in bytes; absent or null = default
  - `maxDocsPerVisitor` integer, nullable: Entries one visitor may keep on this publication; absent or null = default
  - `maxBytesPerVisitor` integer, nullable: Bytes one visitor may keep on this publication; absent or null = default
  - `accountOffer` boolean, nullable: false: no offer to sign in to BrewPage on this page; absent or null = true

## Response `200`

Settings saved; same answer as the read

- StateConfigResponse
  - `declared` boolean, required: True when page data is turned on for this publication
  - `config` StateSettings, required: Settings in effect, every key spelled out (defaults when not turned on); a valid PATCH body as is
    - `collections` object, required: Declared lists by name
    - `captcha` 'auto' | 'always', required: Human check for new visitors who save: auto or always
    - `maxDocBytes` integer, required: Largest entry in bytes
    - `maxDocsPerVisitor` integer, required: Entries one visitor may keep on this publication
    - `maxBytesPerVisitor` integer, required: Bytes one visitor may keep on this publication
    - `accountOffer` boolean: false: visitors see no offer to sign in to BrewPage on this page; absent = the offer shows
  - `collections` StateCollectionUsage[], required: Every declared list and every other list holding entries or files, by name
    - `name` string, required
    - `declared` boolean, required: False for a list the page saves into without declaring it; such a list is private
    - `mode` 'private' | 'shared', required
    - `write` 'visitors' | 'author' | 'accounts', required
    - `docs` integer, required: Entries in this list
    - `bytes` integer, required: Bytes of this list's entries
    - `files` integer, required: Visitor files in this list
    - `fileBytes` integer, required: Bytes of this list's visitor files
  - `usage` StateAmount, required: Entries, files and their bytes stored on this publication
    - `docs` integer, required: Entries
    - `bytes` integer, required: Bytes of entries
    - `files` integer, required: Visitor files
    - `fileBytes` integer, required: Bytes of visitor files
  - `tier` 'anonymous' | 'account', required: Quota tier: account (publication of an active profile) or anonymous
  - `caps` StateAmount, required: Quota of this tier: at most this many entries, entry bytes, files and file bytes
    - `docs` integer, required: Entries
    - `bytes` integer, required: Bytes of entries
    - `files` integer, required: Visitor files
    - `fileBytes` integer, required: Bytes of visitor files
  - `alert` boolean, required: True at 80% or more of the entry, entry size, file or file size quota
  - `notices` PublishNotice[], required: Advisories about the request or the settings; empty when none
    - `code` string, required: Kebab-case, e.g. ttl-clamped, namespace-defaulted, secret-detected, visibility-not-listable, extend-needs-profile, rotate-still-listed, private-domain-detached, badge-hide-needs-profile, owner-token-new (save the new ownerToken, reuse it), credential-published (token or manage link in public content: remove it, reset it), archive-unverified (archive: check contents before opening).
    - `message` string, required
  - `pageDataHint` 'form' | 'local' | 'game' | 'relay': Page data would help this page or site: form (answers not saved), local (saves only in the visitor's browser), game (saved progress) or relay (sends input to an outside service); absent while page data is on or nothing suggests it

## Other responses

- `400`: STATE_INVALID: the settings have a mistake; nothing was changed
- `403`: Owner token revoked or expired; or OWNER_AUTHORIZATION_FAILED: a public publication you do not own
- `404`: PUBLICATION_UNAVAILABLE: no such HTML page or site, not yours, hidden or expired
- `409`: STATE_MODE_WIDENING: a private list with visitors' entries cannot become shared; or OLD_PUBLICATION_READ_ONLY
- `413`: Settings larger than 16 KB
- `429`: Rate limited: wait Retry-After (= retryAfterSeconds); no account: accountUrl, free sign-up with higher limits
- `503`: STATE_UNAVAILABLE: page data is switched off for now; wait Retry-After

## Changes

- **2026-12-01** `4f27cbc70df3`: 1 warning
  - added the new `relay` enum value to the `pageDataHint` response property for the response status `200`
- **2026-11-28** `317aa79e07ee`: 2 warning, 4 info
  - added the new `accounts` enum value to the `collections/items/write` response property for the response status `200`
  - added the new `accounts` enum value to the `config/collections/additionalProperties/write` response property for the response status `200`
  - added the new optional request property `oneOf[#/components/schemas/StateSettingsRequest]/accountOffer`
  - added the new `accounts` enum value to the request property `oneOf[#/components/schemas/StateSettingsRequest]/collections/additionalProperties/write`
  - …2 more
- **2026-11-21** `19a6c5561e70`: 7 info
  - added the optional property `level` to the response with the `400` status
  - added the optional property `level` to the response with the `403` status
  - added the optional property `level` to the response with the `404` status
  - added the optional property `level` to the response with the `409` status
  - …3 more
- …earlier changes not shown

[Operation history](https://skmtc.dev/brewpage/apis/brewpage-api/changes/api/:ns/:id/state/patch.md)

---

[API](https://skmtc.dev/brewpage/apis/brewpage-api.md) - [All operations](https://skmtc.dev/brewpage/apis/brewpage-api/llms.txt) - [OpenAPI document](https://skmtc.dev/brewpage/apis/brewpage-api/revisions/78d2720a18a9?raw)
