openapi: 3.1.0
info:
  title: BrewPage API
  description: "Free instant hosting for HTML, Markdown, JSON, key-value stores, files\
    \ and sites. Send ns=public to be found: gallery + Google, Bing & AI search. Omitted\
    \ ns: private (MCP: a generated private namespace). Password or listed=false:\
    \ unlisted. A private link is not a lock: anyone with it can open it; add a password\
    \ to restrict. Secrets allowed; likely ones are flagged in notices. For a secret:\
    \ private namespace + password. Retain returned links. Give the user link and\
    \ manageUrl; manageUrl is private (anyone who has it can edit or delete the publication):\
    \ never post it publicly. Keep ownerToken; send it as X-Owner-Token on later publishes\
    \ and updates; show it to the user on request. How BrewPage compares with GitHub\
    \ Pages, GitHub Gist, Netlify Drop, Cloudflare Drop, Tiiny Host and Static.app:\
    \ https://brewpage.app/compare. Agents: remote MCP at https://brewpage.app/mcp\
    \ (no auth). HTML pages and sites show a small BrewPage badge; page code must\
    \ not hide or alter it. A profile can turn it off on up to 5 pages (setBadge)."
  termsOfService: https://brewpage.app/terms
  contact:
    name: BrewPage
    url: https://brewpage.app
    email: info@brewpage.app
  license:
    name: Apache-2.0
    url: https://www.apache.org/licenses/LICENSE-2.0
  version: 2.58.1
externalDocs:
  description: BrewPage API documentation (Scalar)
  url: https://kochetkov-ma.github.io/brewpage-openapi/
servers:
- url: https://brewpage.app
  description: Generated server url
tags:
- name: KV
  description: Key-Value store with up to 1000 keys per store
- name: Owner Token
  description: "Get a new owner token (stateless); with an admin token, manage profile\
    \ tokens."
- name: Gallery
  description: Browse public content from the 'public' namespace without password
    protection; mine=true lists the caller's own publications
- name: Short Links
  description: Short URL resolver for sharing
- name: Owner Check
  description: Lightweight owner-token probe; never increments views or returns content
- name: HTML
  description: HTML page hosting with markdown support
- name: Limits
  description: "User-facing upload limits: one source for the UI, agents and docs"
- name: Templates
  description: "Official BrewPage templates: ready pages to copy and publish instead\
    \ of writing one from scratch"
- name: Sites
  description: Multi-file HTML site hosting via ZIP or folder upload
- name: Publications
  description: Owner list and stats
- name: Custom Domains
  description: "Serve an HTML page or a site on your own domain, free with a BrewPage\
    \ profile. Set the hostname, create the DNS records the answer lists, call check\
    \ once, then read the domain until the status is active."
- name: Page data
  description: "What visitors saved on your HTML page or site: settings, entries,\
    \ files, totals, CSV export, author entries, deletes. Visitors save through the\
    \ page itself, not through this API: the page loads https://brewpage.app/js/state.js\
    \ and calls bp.state(), which uses the host API /_bp/state/v1 on the page's own\
    \ address (https://<label>.brewpage.app). That host API serves only its own page;\
    \ its contract is a separate document: https://kochetkov-ma.github.io/brewpage-openapi/page-data-host.json.\
    \ Turn page data on with `state` when you publish, or with PATCH /api/{ns}/{id}/state.\
    \ Each visitor reads and writes only their own entries unless a list is shared;\
    \ you, the author, read them all."
- name: preview
  description: "Social previews: per-content OpenGraph image (1200×630 JPEG; .png\
    \ is a legacy URL alias) and OG meta stub for social bots"
- name: SEO
  description: Search engine optimization endpoints
- name: JSON
  description: "JSON document store with up to 10,000 docs per collection"
- name: Stats
  description: Platform-wide usage statistics
- name: Namespace
  description: "Fresh, collision-free namespace suggestions"
- name: Files
  description: "File hosting up to 5 MB per file (video 20 MB), 1000 files per namespace"
- name: Notifications
  description: "Your profile's notifications: notices (pages expiring, removed or\
    \ full, new entries) and activity (pages published or updated). Send X-Owner-Token\
    \ with a token added to exactly one BrewPage profile; any such token reads, marks\
    \ read and switches a page, changing the settings needs an admin token."
- name: Hosting Management
  description: Owner-only publication delivery settings
- name: Reports
  description: Abuse reports for hosted content
paths:
  /api/{ns}/{id}/state/{col}/{key}:
    put:
      tags:
      - Page data
      summary: Write an author entry
      description: "Creates or replaces your own entry `key` in a list (for example\
        \ a menu in a list with write author); visitors' entries stay untouched. The\
        \ body is the entry's value, any one JSON value (object, array, string, number,\
        \ true, false or null) stored as sent, at most the page's entry size (16 KB\
        \ by default). If-Match: <version> replaces only that version. A page that\
        \ has not turned page data on answers 404 STATE_UNAVAILABLE: turn it on first\
        \ (PATCH .../state with {}, or publish with state)."
      operationId: writePageDataEntry
      parameters:
      - name: ns
        in: path
        required: true
        schema:
          type: string
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: col
        in: path
        description: List name
        required: true
        schema:
          type: string
      - name: key
        in: path
        description: "Entry name: 1-128 letters, digits, '.', - or _, not starting\
          \ with _"
        required: true
        schema:
          type: string
      - name: If-Match
        in: header
        description: "Version last read: 3 or \"3\""
        required: false
        schema:
          type: string
      - name: X-Owner-Token
        in: header
        description: Owner token returned at creation
      - name: X-Manage-Key
        in: header
        description: Management key of this publication
      requestBody:
        description: "The entry's value: any one JSON value, object, array, string,\
          \ number, true, false or null"
        content:
          application/json:
            schema: {}
        required: true
      responses:
        "200":
          description: Saved
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/StateWriteResponse"
        "400":
          description: "STATE_INVALID: list name, entry name, If-Match or value has\
            \ a mistake"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "403":
          description: "Owner token revoked or expired; or OWNER_AUTHORIZATION_FAILED:\
            \ a public publication you do not own"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: "PUBLICATION_UNAVAILABLE: no such HTML page or site, not yours,\
            \ hidden or expired; or STATE_UNAVAILABLE: page data is not turned on"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "409":
          description: "STATE_CONFLICT: the entry changed since that version, or is\
            \ absent; or OLD_PUBLICATION_READ_ONLY"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "413":
          description: "STATE_TOO_LARGE: larger than the entry size; or STATE_QUOTA:\
            \ no room left on this page"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "503":
          description: "STATE_UNAVAILABLE: page data is switched off for now; wait\
            \ Retry-After"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "429":
          description: "Rate limited: wait Retry-After (= retryAfterSeconds); no account:\
            \ accountUrl, free sign-up with higher limits"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - OwnerToken: []
      - ManageKey: []
  /api/sites/{ns}/{id}:
    get:
      tags:
      - Sites
      summary: Get site info
      description: Returns site metadata and file list. Requires owner token
      operationId: getSiteInfo
      parameters:
      - name: ns
        in: path
        required: true
        schema:
          type: string
          pattern: "^[a-z0-9-]{1,32}$"
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: X-Owner-Token
        in: header
        description: Owner token returned at creation
      - name: X-Manage-Key
        in: header
        description: Management key of this site
      responses:
        "200":
          description: Site info
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SiteInfoResponse"
        "403":
          description: Missing or wrong owner token
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: Site not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "410":
          description: Public publication deleted or expired
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - {}
      - OwnerToken: []
      - ManageKey: []
    put:
      tags:
      - Sites
      summary: Update site
      description: Replaces the multi-file site bundle (ZIP archive or individual
        files with paths). Requires the owner token returned at creation. Password
        is preserved as-is (not changed in this operation).
      operationId: republishSite
      parameters:
      - name: ns
        in: path
        required: true
        schema:
          type: string
          pattern: "^[a-z0-9-]{1,32}$"
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: tags
        in: query
        description: Comma-separated tags; replace the stored tags (empty clears).
          Omit to keep them
        required: false
        schema:
          type: string
        example: "demo,portfolio"
      - name: ttl
        in: query
        description: "Not part of the update contract: updates keep the original expiry."
        required: false
        schema:
          type: string
      - name: User-Agent
        in: header
        required: false
        schema:
          type: string
      - name: X-Delivery-Mode
        in: header
        description: "Ignored on update: republishing keeps the address mode (reported\
          \ in deliveryNotice); sites always stay on their own subdomain"
        required: false
        schema:
          type: string
      - name: X-Owner-Token
        in: header
        description: Owner token returned at creation
      - name: X-Manage-Key
        in: header
        description: Management key of this site
      - name: entry
        in: query
        description: "Entry HTML file path (.html or .htm). Default: index.html, else\
          \ the shallowest HTML file; a missing or non-HTML entry falls back to it\
          \ and is reported in notices"
        schema:
          type: string
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              anyOf:
              - type: object
                required:
                - archive
              - type: object
                required:
                - files
              properties:
                archive:
                  type: string
                  format: binary
                  description: ZIP archive; takes precedence over individual files.
                files:
                  type: array
                  items:
                    type: string
                    format: binary
                  minItems: 1
                paths:
                  type: array
                  description: Optional paths aligned with files; omitted paths use
                    original filenames.
                  items:
                    type: string
                state:
                  type: string
                  description: "Page data settings as JSON text, sent as a text field\
                    \ or a file. Omit to keep them; an object updates the lists it\
                    \ names and the limits it sends, other lists keep theirs; null\
                    \ turns page data off (saved entries are kept). Page data works\
                    \ on the site's own address https://<label>.brewpage.app. Invalid\
                    \ settings answer 400 and the site is not changed."
        required: true
      responses:
        "200":
          description: Site updated
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SiteUpdateResponse"
        "400":
          description: "Invalid request, empty bundle or limits exceeded; see GET\
            \ /api/limits; or PDF/Office file unreadable or password-protected"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "413":
          description: "Request over the per-request size, too many files and form\
            \ fields, or a file path too long; see GET /api/limits"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "403":
          description: "Missing or wrong owner token, or upload refused"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: "Site not found or expired; body has createUrl: POST the content\
            \ there to publish anew"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "410":
          description: Site is no longer available
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "409":
          description: "Old publication is read-only (code: OLD_PUBLICATION_READ_ONLY);\
            \ publish anew via createUrl"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "422":
          description: "No servable file left: every file has an unsupported or missing\
            \ extension"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "429":
          description: "Rate limited: wait Retry-After (= retryAfterSeconds); no account:\
            \ accountUrl, free sign-up with higher limits"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "503":
          description: Busy; retry after Retry-After seconds
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - OwnerToken: []
      - ManageKey: []
    delete:
      tags:
      - Sites
      summary: Delete site
      description: Permanently removes the site and all its files from storage
      operationId: deleteSite
      parameters:
      - name: ns
        in: path
        required: true
        schema:
          type: string
          pattern: "^[a-z0-9-]{1,32}$"
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: X-Owner-Token
        in: header
        description: Owner token returned at creation
      - name: X-Manage-Key
        in: header
        description: Management key of this site
      responses:
        "204":
          description: Site deleted
        "403":
          description: Missing or wrong owner token
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: Site not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "429":
          description: "Rate limited: wait Retry-After (= retryAfterSeconds)"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - OwnerToken: []
      - ManageKey: []
  /api/publications/{type}/{ns}/{id}/domain:
    get:
      tags:
      - Custom Domains
      summary: Custom domain of this publication
      description: "Reads the custom domain your profile holds on this publication:\
        \ status, problem and the DNS `records[]` with their state from the last check."
      operationId: getPublicationDomain
      parameters:
      - name: type
        in: path
        description: html (pages of format html) or site; only these take a custom
          domain
        required: true
        schema:
          type: string
          enum:
          - html
          - site
      - name: ns
        in: path
        required: true
        schema:
          type: string
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: X-Owner-Token
        in: header
        description: "Owner token in a free BrewPage profile: the publication's own\
          \ token added to the profile, or a profile token that reaches the publication"
        required: true
      responses:
        "200":
          description: The custom domain
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DomainItem"
        "403":
          description: "OWNER_AUTHORIZATION_FAILED: wrong token; OWNER_TOKEN_REVOKED\
            \ or OWNER_TOKEN_EXPIRED; DOMAIN_NEEDS_ACCOUNT: custom domains need a\
            \ free BrewPage profile: sign in at https://account.brewpage.app/tokens,\
            \ press Add existing token and paste this owner token, then set the domain\
            \ again"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: "DOMAIN_NOT_FOUND: no custom domain on this publication; PUBLICATION_UNAVAILABLE:\
            \ missing or expired publication (outside public also for a wrong token);\
            \ FEATURE_DISABLED: custom domains are not available right now"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "409":
          description: "DOMAIN_PROFILE_AMBIGUOUS: the token is in several profiles;\
            \ set the domain with a profile token of the profile that should hold\
            \ it"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "410":
          description: Publication unavailable; owner credentials valid
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - OwnerToken: []
    put:
      tags:
      - Custom Domains
      summary: Set a custom domain on this publication
      description: "Connects a hostname you own (www.example.com or example.com) to\
        \ this HTML page or site: adds it to your profile, or moves it here when your\
        \ profile already holds it. Works for HTML pages of format html and for sites,\
        \ without a password; a page on a BrewPage path address moves to its own subdomain\
        \ (`deliveryModeChanged`), and its BrewPage link keeps working. A hostname\
        \ that was on this publication before stays in your profile, unattached (`detached`).\
        \ A new hostname whose domain is not registered is refused (400 DOMAIN_NOT_REGISTERED).\
        \ For an added hostname the first automatic DNS check runs about 15 minutes\
        \ later (`nextCheckAt`). Next: create exactly the DNS records in `records[]`,\
        \ then call POST /api/publications/{type}/{ns}/{id}/domain/check once. BrewPage\
        \ keeps checking on its own (`nextCheckAt`): read GET /api/publications/{type}/{ns}/{id}/domain\
        \ until `status` is `active`; check again only after changing DNS. Every custom-domain\
        \ object (the domain answers and `customDomain`) names its next step in `nextStep`."
      operationId: setPublicationDomain
      parameters:
      - name: type
        in: path
        description: html (pages of format html) or site; only these take a custom
          domain
        required: true
        schema:
          type: string
          enum:
          - html
          - site
      - name: ns
        in: path
        required: true
        schema:
          type: string
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: X-Owner-Token
        in: header
        description: "Owner token in a free BrewPage profile: the publication's own\
          \ token added to the profile, or a profile token that reaches the publication"
        required: true
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/SetDomainRequest"
      responses:
        "200":
          description: Moved here or already set; same body as 201
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DomainItem"
        "201":
          description: Added to the profile and set on this publication
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DomainItem"
        "400":
          description: "INVALID_HOSTNAME: not a valid hostname; DOMAIN_NOT_ALLOWED:\
            \ this hostname cannot be used; DOMAIN_NOT_REGISTERED: the domain is not\
            \ registered yet; register it with a domain registrar first"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "403":
          description: "OWNER_AUTHORIZATION_FAILED: wrong token; OWNER_TOKEN_REVOKED\
            \ or OWNER_TOKEN_EXPIRED; DOMAIN_NEEDS_ACCOUNT: custom domains need a\
            \ free BrewPage profile: sign in at https://account.brewpage.app/tokens,\
            \ press Add existing token and paste this owner token, then set the domain\
            \ again; ACCOUNT_RESTRICTED or ACCOUNT_BLOCKED: this profile cannot add\
            \ domains now"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: "PUBLICATION_UNAVAILABLE: missing or expired publication (outside\
            \ public also for a wrong token); FEATURE_DISABLED: custom domains are\
            \ not available right now"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "409":
          description: "NOT_ELIGIBLE: the publication cannot take a custom domain\
            \ (`reason`); DOMAIN_LIMIT: the profile already holds all its custom domains\
            \ (`limit`, `used`); remove or move one; DOMAIN_SUSPENDED: BrewPage suspended\
            \ this domain; write to info@brewpage.app; DOMAIN_PROFILE_AMBIGUOUS: the\
            \ token is in several profiles; set the domain with a profile token of\
            \ the profile that should hold it"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "503":
          description: "DOMAIN_INTAKE_PAUSED: adding custom domains is paused; try\
            \ again later; HOSTING_CREATION_PAUSED: address changes are briefly unavailable;\
            \ retry after Retry-After"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "429":
          description: "Rate limited: wait Retry-After (= retryAfterSeconds)"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - OwnerToken: []
    delete:
      tags:
      - Custom Domains
      summary: Remove this publication's custom domain
      description: Removes the custom domain your profile holds on this publication
        from the profile; the slot is free at once and the BrewPage link keeps working.
        204 also when none is set.
      operationId: removePublicationDomain
      parameters:
      - name: type
        in: path
        description: html (pages of format html) or site; only these take a custom
          domain
        required: true
        schema:
          type: string
          enum:
          - html
          - site
      - name: ns
        in: path
        required: true
        schema:
          type: string
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: X-Owner-Token
        in: header
        description: "Owner token in a free BrewPage profile: the publication's own\
          \ token added to the profile, or a profile token that reaches the publication"
        required: true
      responses:
        "204":
          description: "Removed, or none was set"
        "403":
          description: "OWNER_AUTHORIZATION_FAILED: wrong token; OWNER_TOKEN_REVOKED\
            \ or OWNER_TOKEN_EXPIRED; DOMAIN_NEEDS_ACCOUNT: custom domains need a\
            \ free BrewPage profile: sign in at https://account.brewpage.app/tokens,\
            \ press Add existing token and paste this owner token, then set the domain\
            \ again; ACCOUNT_RESTRICTED or ACCOUNT_BLOCKED: this profile cannot add\
            \ domains now"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: "PUBLICATION_UNAVAILABLE: missing or expired publication (outside\
            \ public also for a wrong token); FEATURE_DISABLED: custom domains are\
            \ not available right now"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "409":
          description: "DOMAIN_SUSPENDED: BrewPage suspended this domain; write to\
            \ info@brewpage.app; DOMAIN_PROFILE_AMBIGUOUS: the token is in several\
            \ profiles; set the domain with a profile token of the profile that should\
            \ hold it"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "429":
          description: "Rate limited: wait Retry-After (= retryAfterSeconds)"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - OwnerToken: []
  /api/profile/notifications/settings:
    get:
      tags:
      - Notifications
      summary: Read notification settings
      description: "Notifications on or off, where they go and which groups are on;\
        \ canEdit tells whether this token may change them."
      operationId: getNotificationSettings
      parameters:
      - name: X-Owner-Token
        in: header
        description: Owner token added to exactly one BrewPage profile
        required: true
      responses:
        "200":
          description: Settings
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/NotificationSettingsResponse"
        "403":
          description: "PROFILE_TOKEN_REQUIRED: no token, or a token not added to\
            \ exactly one profile; or the token is revoked or expired"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: Profiles are not available
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "429":
          description: "Rate limited: wait Retry-After (= retryAfterSeconds)"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - OwnerToken: []
    put:
      tags:
      - Notifications
      summary: Change notification settings
      description: Send only the keys to change; absent keys keep their value. Needs
        an admin token. Answers the settings.
      operationId: updateNotificationSettings
      parameters:
      - name: X-Owner-Token
        in: header
        description: Owner token added to exactly one BrewPage profile
        required: true
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/NotificationSettingsRequest"
        required: true
      responses:
        "200":
          description: Settings saved
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/NotificationSettingsResponse"
        "400":
          description: "Unknown channel or group, or a malformed body"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "403":
          description: "PROFILE_TOKEN_REQUIRED: no token, or a token not added to\
            \ exactly one profile; or the token is revoked or expired; or ADMIN_TOKEN_REQUIRED:\
            \ changing settings needs an admin token"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: Profiles are not available
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "429":
          description: "Rate limited: wait Retry-After (= retryAfterSeconds)"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - OwnerToken: []
  /api/profile/notifications/pages/{type}/{ns}/{id}:
    get:
      tags:
      - Notifications
      summary: Read a page's new-entry switch
      description: Whether new entries on one HTML page or site of this profile notify.
      operationId: getNotificationPageSwitch
      parameters:
      - name: type
        in: path
        description: "html or sites: the only kinds that hold page data"
        required: true
        schema:
          type: string
          enum:
          - html
          - sites
      - name: ns
        in: path
        required: true
        schema:
          type: string
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: X-Owner-Token
        in: header
        description: Owner token added to exactly one BrewPage profile
        required: true
      responses:
        "200":
          description: The switch
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/NotificationPageSwitchResponse"
        "403":
          description: "PROFILE_TOKEN_REQUIRED: no token, or a token not added to\
            \ exactly one profile; or the token is revoked or expired"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: No such HTML page or site in this profile
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "429":
          description: "Rate limited: wait Retry-After (= retryAfterSeconds)"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - OwnerToken: []
    put:
      tags:
      - Notifications
      summary: Set a page's new-entry switch
      description: "{entries: true} or false turns notifications of new entries on\
        \ this page on or off; null returns to the default."
      operationId: setNotificationPageSwitch
      parameters:
      - name: type
        in: path
        description: "html or sites: the only kinds that hold page data"
        required: true
        schema:
          type: string
          enum:
          - html
          - sites
      - name: ns
        in: path
        required: true
        schema:
          type: string
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: X-Owner-Token
        in: header
        description: Owner token added to exactly one BrewPage profile
        required: true
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/NotificationPageSwitchRequest"
        required: true
      responses:
        "200":
          description: The switch
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/NotificationPageSwitchResponse"
        "400":
          description: Malformed body
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "403":
          description: "PROFILE_TOKEN_REQUIRED: no token, or a token not added to\
            \ exactly one profile; or the token is revoked or expired"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: No such HTML page or site in this profile
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "429":
          description: "Rate limited: wait Retry-After (= retryAfterSeconds)"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - OwnerToken: []
  /api/kv/{ns}/{id}/{key}:
    get:
      tags:
      - KV
      summary: Get key value
      description: Returns the value and last update timestamp for a specific key
      operationId: getKey
      parameters:
      - name: ns
        in: path
        required: true
        schema:
          type: string
          pattern: "^[a-z0-9-]{1,32}$"
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: key
        in: path
        required: true
        schema:
          type: string
      - name: X-Password
        in: header
        description: Access password via header
        required: false
        schema:
          type: string
      - name: p
        in: query
        description: Legacy-only query password; ignored for NEW publications. Programmatic
          access uses X-Password or the owner token.
        required: false
        schema:
          type: string
      - name: User-Agent
        in: header
        required: false
        schema:
          type: string
      - name: X-Owner-Token
        in: header
        description: Owner token to bypass password protection when no password supplied
        required: false
        schema:
          type: string
      responses:
        "200":
          description: Key value
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/KvGetResponse"
        "403":
          description: Wrong password
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: Store or key not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "410":
          description: Public publication deleted or expired
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - {}
      - OwnerToken: []
      - Password: []
    put:
      tags:
      - KV
      summary: Upsert key
      description: Creates or updates a key in the store; max 1000 keys per store
      operationId: upsertKey
      parameters:
      - name: ns
        in: path
        required: true
        schema:
          type: string
          pattern: "^[a-z0-9-]{1,32}$"
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: key
        in: path
        required: true
        schema:
          type: string
      - name: X-Delivery-Mode
        in: header
        required: false
        schema:
          type: string
      - name: X-Owner-Token
        in: header
        description: Owner token returned at creation
      - name: X-Manage-Key
        in: header
        description: Management key of this store
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/KvUpsertKeyRequest"
        required: true
      responses:
        "200":
          description: Key upserted
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/KvUpsertKeyResponse"
        "400":
          description: Invalid key or value; key name `hosting` is reserved
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "403":
          description: Missing or wrong owner token or management key
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: Store not found or expired
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "409":
          description: "Key limit exceeded, or old publication is read-only (code:\
            \ OLD_PUBLICATION_READ_ONLY; publish anew via createUrl)"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "429":
          description: "Rate limited: wait Retry-After (= retryAfterSeconds); no account:\
            \ accountUrl, free sign-up with higher limits"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - OwnerToken: []
      - ManageKey: []
    delete:
      tags:
      - KV
      summary: Delete key
      description: Removes a single key from the store; deleting the last key removes
        the store
      operationId: deleteKey
      parameters:
      - name: ns
        in: path
        required: true
        schema:
          type: string
          pattern: "^[a-z0-9-]{1,32}$"
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: key
        in: path
        required: true
        schema:
          type: string
      - name: X-Owner-Token
        in: header
        description: Owner token returned at creation
      - name: X-Manage-Key
        in: header
        description: Management key of this store
      responses:
        "204":
          description: Key deleted
        "403":
          description: Missing or wrong owner token or management key
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: Store or key not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "429":
          description: "Rate limited: wait Retry-After (= retryAfterSeconds)"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - OwnerToken: []
      - ManageKey: []
  /api/json/{ns}/{id}:
    get:
      tags:
      - JSON
      summary: Get JSON document
      description: Returns raw JSON content with application/json content type
      operationId: getById
      parameters:
      - name: ns
        in: path
        required: true
        schema:
          type: string
          pattern: "^[a-z0-9-]{1,32}$"
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: X-Password
        in: header
        description: Access password via header
        required: false
        schema:
          type: string
      - name: p
        in: query
        description: Legacy-only query password; ignored for NEW publications. Programmatic
          access uses X-Password or the owner token.
        required: false
        schema:
          type: string
      - name: User-Agent
        in: header
        required: false
        schema:
          type: string
      - name: X-Owner-Token
        in: header
        description: Owner token to bypass password protection when no password supplied
        required: false
        schema:
          type: string
      responses:
        "200":
          description: JSON content
          content:
            application/json:
              schema: {}
        "403":
          description: Wrong password
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: Document not found or expired
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "410":
          description: Public publication deleted or expired
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - {}
      - OwnerToken: []
      - Password: []
    put:
      tags:
      - JSON
      summary: Update JSON document
      description: Replaces document content; requires the owner token returned at
        creation or the management key
      operationId: update
      parameters:
      - name: ns
        in: path
        required: true
        schema:
          type: string
          pattern: "^[a-z0-9-]{1,32}$"
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: X-Delivery-Mode
        in: header
        description: "Ignored on update: republishing keeps the address mode (reported\
          \ in deliveryNotice); change it with the hosting operation"
        required: false
        schema:
          type: string
      - name: X-Owner-Token
        in: header
        description: Owner token returned at creation
      - name: X-Manage-Key
        in: header
        description: Management key of this document
      requestBody:
        content:
          application/json:
            schema: {}
        required: true
      responses:
        "200":
          description: Document updated
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/JsonUpdateResponse"
        "403":
          description: Missing or wrong owner token or management key
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: "Document not found or expired; body has createUrl: POST the\
            \ content there to publish anew"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "409":
          description: "Old publication is read-only (code: OLD_PUBLICATION_READ_ONLY);\
            \ publish anew via createUrl"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "429":
          description: "Rate limited: wait Retry-After (= retryAfterSeconds); no account:\
            \ accountUrl, free sign-up with higher limits"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - OwnerToken: []
      - ManageKey: []
    delete:
      tags:
      - JSON
      summary: Delete JSON document
      description: Permanently removes the document
      operationId: delete
      parameters:
      - name: ns
        in: path
        required: true
        schema:
          type: string
          pattern: "^[a-z0-9-]{1,32}$"
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: X-Owner-Token
        in: header
        description: Owner token returned at creation
      - name: X-Manage-Key
        in: header
        description: Management key of this document
      responses:
        "204":
          description: Document deleted
        "403":
          description: Missing or wrong owner token or management key
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: Document not found or expired
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "429":
          description: "Rate limited: wait Retry-After (= retryAfterSeconds)"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - OwnerToken: []
      - ManageKey: []
  /api/html/{ns}/{id}:
    get:
      tags:
      - HTML
      summary: Get HTML page
      description: Returns rendered HTML content. Protected OLD pages accept X-Password
        or ?p=; NEW pages use X-Password or a reader access cookie. The owner token
        bypasses password protection when no password is supplied.
      operationId: getById_1
      parameters:
      - name: ns
        in: path
        required: true
        schema:
          type: string
          pattern: "^[a-z0-9-]{1,32}$"
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: X-Password
        in: header
        description: Access password via header
        required: false
        schema:
          type: string
      - name: p
        in: query
        description: Legacy-only query password; ignored for NEW publications. Programmatic
          access uses X-Password or the owner token.
        required: false
        schema:
          type: string
      - name: User-Agent
        in: header
        required: false
        schema:
          type: string
      - name: X-Owner-Token
        in: header
        description: Owner token to bypass password protection when no password supplied
        required: false
        schema:
          type: string
      - name: dl
        in: query
        description: "Download instead of view: an HTML or Markdown page's source,\
          \ or a code page's content, as an attachment named after its stored format"
        schema:
          type: string
          enum:
          - "1"
          - "true"
      responses:
        "200":
          description: HTML content
          content:
            text/html:
              schema:
                type: string
            text/plain:
              schema:
                type: string
            text/csv:
              schema:
                type: string
            text/tab-separated-values:
              schema:
                type: string
            application/json:
              schema:
                type: string
            text/xml:
              schema:
                type: string
        "403":
          description: Wrong password
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: Page not found or expired
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "410":
          description: Public publication deleted or expired
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - {}
      - OwnerToken: []
      - Password: []
    put:
      tags:
      - HTML
      summary: Update HTML page
      description: "Replaces page content; requires the owner token returned at creation\
        \ or the management key. Also accepts raw text/* (HTML, Markdown, YAML, XML,\
        \ CSV, code) bodies — see /llms-full.txt."
      operationId: update_1
      parameters:
      - name: ns
        in: path
        required: true
        schema:
          type: string
          pattern: "^[a-z0-9-]{1,32}$"
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: format
        in: query
        description: "Optional new content format on republish. Accepts 'html', 'markdown'/'md',\
          \ or any code format (yaml, json, xml, csv, tsv, log, toml, ini, sql, sh,\
          \ bat, env, javascript, typescript, tsx, jsx, css, properties, docker, txt).\
          \ When omitted, the row's stored format is preserved, except that a whole\
          \ HTML document makes a Markdown page an HTML page. Body field 'format'\
          \ on HtmlUpdateRequest takes precedence over the query param when both are\
          \ present."
        required: false
        schema:
          type: string
      - name: tags
        in: query
        description: Comma-separated tags; replace the stored tags (empty clears).
          Omit to keep them
        required: false
        schema:
          type: string
        example: "demo,test"
      - name: User-Agent
        in: header
        required: false
        schema:
          type: string
      - name: X-Owner-Token
        in: header
        description: Owner token returned at creation
      - name: X-Manage-Key
        in: header
        description: Management key of this publication
      - name: verbatim
        in: query
        description: "Store the content exactly as sent. By default a whole HTML page\
          \ pasted from a chat (wrapped in a code block, surrounded by chat text,\
          \ or entity-escaped) is restored and a notice is returned; 'true' keeps\
          \ the text as is."
        schema:
          type: boolean
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/HtmlUpdateRequest"
          text/html:
            schema:
              type: string
          text/plain:
            schema:
              type: string
          text/markdown:
            schema:
              type: string
          text/csv:
            schema:
              type: string
          text/yaml:
            schema:
              type: string
          text/css:
            schema:
              type: string
          text/javascript:
            schema:
              type: string
          text/x-toml:
            schema:
              type: string
          text/xml:
            schema:
              type: string
          application/xml:
            schema:
              type: string
          application/yaml:
            schema:
              type: string
          application/x-yaml:
            schema:
              type: string
          application/javascript:
            schema:
              type: string
          application/toml:
            schema:
              type: string
        required: true
      responses:
        "200":
          description: Page updated
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/HtmlUpdateResponse"
        "403":
          description: "Missing or wrong owner token or management key, or upload\
            \ refused"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: "Page not found or expired; body has createUrl: POST the content\
            \ there to publish anew"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "409":
          description: "Old publication is read-only (code: OLD_PUBLICATION_READ_ONLY);\
            \ publish anew via createUrl (API) or republishUrl (browser)"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "429":
          description: "Rate limited: wait Retry-After (= retryAfterSeconds); no account:\
            \ accountUrl, free sign-up with higher limits"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - OwnerToken: []
      - ManageKey: []
    delete:
      tags:
      - HTML
      summary: Delete HTML page
      description: Permanently removes page and frees the short URL
      operationId: delete_1
      parameters:
      - name: ns
        in: path
        required: true
        schema:
          type: string
          pattern: "^[a-z0-9-]{1,32}$"
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: X-Owner-Token
        in: header
        description: Owner token returned at creation
      - name: X-Manage-Key
        in: header
        description: Management key of this publication
      responses:
        "204":
          description: Page deleted
        "403":
          description: Missing or wrong owner token or management key
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: Page not found or expired
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "429":
          description: "Rate limited: wait Retry-After (= retryAfterSeconds)"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - OwnerToken: []
      - ManageKey: []
  /api/files/{ns}/{id}:
    get:
      tags:
      - Files
      summary: Download file
      description: "Returns file inline for previewable types (images, PDF, media)\
        \ or as attachment. Add ?dl=1 to force download. An HTML or Markdown file\
        \ published as a page redirects to GET /api/html/{ns}/{id}."
      operationId: download
      parameters:
      - name: ns
        in: path
        required: true
        schema:
          type: string
          pattern: "^[a-z0-9-]{1,32}$"
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: X-Password
        in: header
        description: Access password via header
        required: false
        schema:
          type: string
      - name: p
        in: query
        description: Legacy-only query password; ignored for NEW publications. Programmatic
          access uses X-Password or the owner token.
        required: false
        schema:
          type: string
      - name: dl
        in: query
        description: Force download as attachment
        required: false
        schema:
          type: boolean
      - name: Range
        in: header
        required: false
        schema:
          type: string
      - name: User-Agent
        in: header
        required: false
        schema:
          type: string
      - name: X-Owner-Token
        in: header
        description: Owner token to bypass password protection when no password supplied
        required: false
        schema:
          type: string
      responses:
        "200":
          description: File content
          headers:
            X-BrewPage-Notice:
              description: "Archives only: contents unverified; check before opening."
              schema:
                type: string
                enum:
                - archive-unverified
          content:
            '*/*':
              schema:
                type: object
        "308":
          description: "HTML or Markdown file published as a page; Location: /api/html/{ns}/{id}\
            \ (query string kept)"
          content:
            '*/*':
              schema:
                type: object
        "403":
          description: Wrong password
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: File not found or expired
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "410":
          description: Public publication deleted or expired
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - {}
      - OwnerToken: []
      - Password: []
    put:
      tags:
      - Files
      summary: Replace file
      description: "Replaces the file content (multipart 'file'); same type rules\
        \ and limits as upload. Keeps link, password, TTL and tags. For an HTML or\
        \ Markdown file published as a page, replaces that page (same rules as PUT\
        \ /api/html). HTML or Markdown over an existing file makes it a page at the\
        \ same address, keeping owner, password, TTL, tags and views."
      operationId: replaceFile
      parameters:
      - name: ns
        in: path
        required: true
        schema:
          type: string
          pattern: "^[a-z0-9-]{1,32}$"
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: ttl
        in: query
        description: "Not part of the update contract: updates keep the original expiry."
        required: false
        schema:
          type: string
      - name: format
        in: query
        description: "Format of a page published from this file: decides over the\
          \ file name. Unknown values are ignored."
        required: false
        schema:
          type: string
      - name: X-Owner-Token
        in: header
        description: Owner token returned at creation
      - name: X-Manage-Key
        in: header
        description: Management key of this publication
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                file:
                  type: string
                  format: binary
                  description: File part; any single file part is accepted when 'file'
                    is absent
        required: true
      responses:
        "200":
          description: File replaced
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/FileUpdateResponse"
        "400":
          description: Invalid request or file too large; or PDF/Office file unreadable
            or password-protected
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "403":
          description: "Missing or wrong owner token or management key, or upload\
            \ refused"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: "File not found or expired; body has createUrl: POST the content\
            \ there to publish anew"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "409":
          description: "Old publication is read-only (code: OLD_PUBLICATION_READ_ONLY;\
            \ publish anew via createUrl), or the same content is another file of\
            \ this owner"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "422":
          description: Unsupported file type or content of no supported type
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "429":
          description: "Rate limited: wait Retry-After (= retryAfterSeconds); no account:\
            \ accountUrl, free sign-up with higher limits"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "503":
          description: Busy; retry after Retry-After seconds
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - OwnerToken: []
      - ManageKey: []
    delete:
      tags:
      - Files
      summary: Delete file
      description: "Permanently removes the file from storage. For an HTML or Markdown\
        \ file published as a page, deletes that page (same owner token or management\
        \ key)"
      operationId: delete_2
      parameters:
      - name: ns
        in: path
        required: true
        schema:
          type: string
          pattern: "^[a-z0-9-]{1,32}$"
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: X-Owner-Token
        in: header
        description: Owner token returned at creation
      - name: X-Manage-Key
        in: header
        description: Management key of this publication
      responses:
        "204":
          description: File deleted
        "403":
          description: Missing or wrong owner token or management key
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: File not found or expired
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "429":
          description: "Rate limited: wait Retry-After (= retryAfterSeconds)"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - OwnerToken: []
      - ManageKey: []
  /api/domains/{hostname}/attachment:
    put:
      tags:
      - Custom Domains
      summary: Show a publication on this hostname
      description: "Shows an HTML page or site of yours on this hostname; body `{type,\
        \ ns, id}`. The hostname is added to the profile when it is not there yet\
        \ (201) or moved from its current publication (200). The publication must\
        \ be in this profile (its owner token added to the profile). Same rules and\
        \ next steps as PUT /api/publications/{type}/{ns}/{id}/domain."
      operationId: attachDomain
      parameters:
      - name: hostname
        in: path
        description: "Hostname, e.g. www.example.com (Unicode or ASCII form)"
        required: true
        schema:
          type: string
      - name: X-Owner-Token
        in: header
        description: Admin token of your BrewPage profile
        required: true
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/AttachDomainRequest"
      responses:
        "200":
          description: Moved here or already shown; same body as 201
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DomainItem"
        "201":
          description: Added to the profile and shown on this publication
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DomainItem"
        "400":
          description: "Missing type, ns or id; INVALID_HOSTNAME: not a valid hostname;\
            \ DOMAIN_NOT_ALLOWED: this hostname cannot be used; DOMAIN_NOT_REGISTERED:\
            \ the domain is not registered yet; register it with a domain registrar\
            \ first"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "403":
          description: "Missing token, or ADMIN_TOKEN_REQUIRED: not an admin token\
            \ of a profile; OWNER_TOKEN_REVOKED or OWNER_TOKEN_EXPIRED; OWNER_AUTHORIZATION_FAILED:\
            \ wrong token; OWNER_TOKEN_REVOKED or OWNER_TOKEN_EXPIRED; ACCOUNT_RESTRICTED\
            \ or ACCOUNT_BLOCKED: this profile cannot add domains now"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: "PUBLICATION_UNAVAILABLE: missing or expired publication (outside\
            \ public also for a wrong token); FEATURE_DISABLED: custom domains are\
            \ not available right now"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "409":
          description: "NOT_ELIGIBLE: the publication cannot take a custom domain\
            \ (`reason`); DOMAIN_LIMIT: the profile already holds all its custom domains\
            \ (`limit`, `used`); remove or move one; DOMAIN_SUSPENDED: BrewPage suspended\
            \ this domain; write to info@brewpage.app"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "503":
          description: "DOMAIN_INTAKE_PAUSED: adding custom domains is paused; try\
            \ again later; HOSTING_CREATION_PAUSED: address changes are briefly unavailable;\
            \ retry after Retry-After"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "429":
          description: "Rate limited: wait Retry-After (= retryAfterSeconds)"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - OwnerToken: []
    delete:
      tags:
      - Custom Domains
      summary: Detach the publication
      description: "Stops showing the publication on this hostname; the hostname stays\
        \ in the profile with its slot and DNS state, ready to attach another one."
      operationId: detachDomain
      parameters:
      - name: hostname
        in: path
        description: "Hostname, e.g. www.example.com (Unicode or ASCII form)"
        required: true
        schema:
          type: string
      - name: X-Owner-Token
        in: header
        description: Admin token of your BrewPage profile
        required: true
      responses:
        "204":
          description: "Detached, or nothing was attached"
        "403":
          description: "Missing token, or ADMIN_TOKEN_REQUIRED: not an admin token\
            \ of a profile; OWNER_TOKEN_REVOKED or OWNER_TOKEN_EXPIRED"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: "DOMAIN_NOT_FOUND: the hostname is not in this profile; FEATURE_DISABLED:\
            \ custom domains are not available right now"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "429":
          description: "Rate limited: wait Retry-After (= retryAfterSeconds)"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - OwnerToken: []
  /api/{type}/{ns}/{id}/title:
    post:
      tags:
      - Hosting Management
      summary: Rename an html page or site (profile owners); empty title restores
        the one from the content
      operationId: setTitle
      parameters:
      - name: type
        in: path
        required: true
        schema:
          type: string
          enum:
          - html
          - sites
      - name: ns
        in: path
        required: true
        schema:
          type: string
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: X-Owner-Token
        in: header
        description: Owner token returned at creation
      - name: X-Manage-Key
        in: header
        description: Management key of this publication
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/TitleRequest"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TitleResponse"
        "403":
          description: Missing or wrong owner token or management key; token revoked
            or expired; no profile owns the publication; or content refused
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: Publication unavailable (outside public also for wrong credentials)
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "400":
          description: "Title too long, not one line or not a string (code: TITLE_INVALID)"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "409":
          description: "Old publication is read-only (code: OLD_PUBLICATION_READ_ONLY);\
            \ publish anew via createUrl"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "503":
          description: Busy; retry after Retry-After seconds
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "429":
          description: "Rate limited: wait Retry-After (= retryAfterSeconds); no account:\
            \ accountUrl, free sign-up with higher limits"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - OwnerToken: []
      - ManageKey: []
  /api/{type}/{ns}/{id}/password:
    post:
      tags:
      - Hosting Management
      summary: "Set, change or remove the reader password"
      operationId: setPassword
      parameters:
      - name: type
        in: path
        required: true
        schema:
          type: string
          enum:
          - html
          - files
          - sites
      - name: ns
        in: path
        required: true
        schema:
          type: string
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: X-Owner-Token
        in: header
        description: Owner token returned at creation
      - name: X-Manage-Key
        in: header
        description: Management key of this publication
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/PasswordRequest"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PasswordResponse"
        "403":
          description: Missing or wrong owner token or management key; token revoked
            or expired
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: Publication unavailable (outside public also for wrong credentials)
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "400":
          description: Password too short
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "409":
          description: "Old publication is read-only (code: OLD_PUBLICATION_READ_ONLY);\
            \ publish anew via createUrl"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "429":
          description: "Rate limited: wait Retry-After (= retryAfterSeconds); no account:\
            \ accountUrl, free sign-up with higher limits"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - OwnerToken: []
      - ManageKey: []
  /api/{type}/{ns}/{id}/visibility:
    post:
      tags:
      - Hosting Management
      summary: List or unlist a public publication in gallery & search. Link unchanged
      operationId: setVisibility
      parameters:
      - name: type
        in: path
        required: true
        schema:
          type: string
          enum:
          - html
          - files
          - json
          - kv
          - sites
      - name: ns
        in: path
        required: true
        schema:
          type: string
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: X-Owner-Token
        in: header
        description: Owner token returned at creation
      - name: X-Manage-Key
        in: header
        description: Management key of this publication
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/VisibilityRequest"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/VisibilityResponse"
        "403":
          description: Missing or wrong owner token or management key; token revoked
            or expired
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: Publication unavailable (outside public also for wrong credentials)
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "429":
          description: "Rate limited: wait Retry-After (= retryAfterSeconds); no account:\
            \ accountUrl, free sign-up with higher limits"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - OwnerToken: []
      - ManageKey: []
  /api/{type}/{ns}/{id}/rotate:
    post:
      tags:
      - Hosting Management
      summary: "Change link: new id, the old link stops working"
      operationId: rotatePublicationLink
      parameters:
      - name: type
        in: path
        required: true
        schema:
          type: string
          enum:
          - html
          - files
          - json
          - kv
          - sites
      - name: ns
        in: path
        required: true
        schema:
          type: string
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: X-Owner-Token
        in: header
        description: Owner token
        required: false
        schema:
          type: string
      - name: X-Manage-Key
        in: header
        description: Management key
        required: false
        schema:
          type: string
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PublicationRotateResponse"
        "403":
          description: Missing or wrong owner token or management key; token revoked
            or expired
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: Publication unavailable (outside public also for wrong credentials)
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "409":
          description: "Old publication is read-only (code: OLD_PUBLICATION_READ_ONLY);\
            \ publish anew via createUrl"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "503":
          description: Link changes temporarily unavailable
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "429":
          description: "Rate limited: wait Retry-After (= retryAfterSeconds); no account:\
            \ accountUrl, free sign-up with higher limits; or ROTATE_LIMITED: at most\
            \ 3 link changes a day"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - OwnerToken: []
      - ManageKey: []
  /api/{type}/{ns}/{id}/private:
    post:
      tags:
      - Hosting Management
      summary: "Make a public publication private: new private link, the public link\
        \ answers 410. One-way"
      operationId: makePrivate
      parameters:
      - name: type
        in: path
        required: true
        schema:
          type: string
          enum:
          - html
          - files
          - json
          - kv
          - sites
      - name: ns
        in: path
        required: true
        schema:
          type: string
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: X-Owner-Token
        in: header
        description: Owner token
        required: false
        schema:
          type: string
      - name: X-Manage-Key
        in: header
        description: Management key
        required: false
        schema:
          type: string
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PublicationRotateResponse"
        "403":
          description: Missing or wrong owner token or management key; token revoked
            or expired
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: Publication unavailable (outside public also for wrong credentials)
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "409":
          description: "NOT_PUBLIC: only a public publication can be made private;\
            \ Old publication is read-only (code: OLD_PUBLICATION_READ_ONLY); publish\
            \ anew via createUrl; or the namespace file or document limit is reached"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "503":
          description: Link changes temporarily unavailable
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "429":
          description: "Rate limited: wait Retry-After (= retryAfterSeconds); no account:\
            \ accountUrl, free sign-up with higher limits; or ROTATE_LIMITED: at most\
            \ 3 link changes a day"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - OwnerToken: []
      - ManageKey: []
  /api/{type}/{ns}/{id}/manage-key:
    post:
      tags:
      - Hosting Management
      summary: Mint or reset the management link; the old link stops working
      operationId: resetManageKey
      parameters:
      - name: type
        in: path
        required: true
        schema:
          type: string
          enum:
          - html
          - files
          - json
          - kv
          - sites
      - name: ns
        in: path
        required: true
        schema:
          type: string
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: X-Owner-Token
        in: header
        description: Owner token returned at creation
      - name: X-Manage-Key
        in: header
        description: Management key of this publication
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ManageKeyResponse"
        "403":
          description: Missing or wrong owner token or management key; token revoked
            or expired
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: Publication unavailable (outside public also for wrong credentials)
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "409":
          description: "Old publication is read-only (code: OLD_PUBLICATION_READ_ONLY);\
            \ publish anew via createUrl"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "429":
          description: "Rate limited: wait Retry-After (= retryAfterSeconds); no account:\
            \ accountUrl, free sign-up with higher limits"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - OwnerToken: []
      - ManageKey: []
  /api/{type}/{ns}/{id}/extend:
    post:
      tags:
      - Hosting Management
      summary: Extend storage to 90 days from now (profile owners); never shortens
      operationId: extendPublication
      parameters:
      - name: type
        in: path
        required: true
        schema:
          type: string
          enum:
          - html
          - files
          - json
          - kv
          - sites
      - name: ns
        in: path
        required: true
        schema:
          type: string
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: X-Owner-Token
        in: header
        description: Owner token returned at creation
      - name: X-Manage-Key
        in: header
        description: Management key of this publication
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ExtendResponse"
        "403":
          description: Missing or wrong owner token or management key; token revoked
            or expired
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: Publication unavailable (outside public also for wrong credentials)
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "409":
          description: "Old publication is read-only (code: OLD_PUBLICATION_READ_ONLY);\
            \ publish anew via createUrl"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "429":
          description: "Rate limited: wait Retry-After (= retryAfterSeconds); no account:\
            \ accountUrl, free sign-up with higher limits"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - OwnerToken: []
      - ManageKey: []
  /api/{type}/{ns}/{id}/badge:
    post:
      tags:
      - Hosting Management
      summary: Hide or show the BrewPage badge on your publication (profile owners)
      operationId: setBadge
      parameters:
      - name: type
        in: path
        required: true
        schema:
          type: string
          enum:
          - html
          - files
          - json
          - kv
          - sites
      - name: ns
        in: path
        required: true
        schema:
          type: string
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: X-Owner-Token
        in: header
        description: Owner token returned at creation
      - name: X-Manage-Key
        in: header
        description: Management key of this publication
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/BadgeRequest"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/BadgeResponse"
        "403":
          description: Missing or wrong owner token or management key; token revoked
            or expired
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: Publication unavailable (outside public also for wrong credentials)
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "409":
          description: "BADGE_HIDDEN_LIMIT: badge already hidden on 5 publications\
            \ of the profile; show it on one first"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "429":
          description: "Rate limited: wait Retry-After (= retryAfterSeconds); no account:\
            \ accountUrl, free sign-up with higher limits"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - OwnerToken: []
      - ManageKey: []
  /api/{type}/{ns}/{id}/access/revoke:
    post:
      tags:
      - Hosting Management
      summary: Revoke reader access to a new protected publication
      operationId: revokeReaderAccess
      parameters:
      - name: type
        in: path
        required: true
        schema:
          type: string
          enum:
          - html
          - files
          - json
          - kv
          - sites
      - name: ns
        in: path
        required: true
        schema:
          type: string
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: X-Owner-Token
        in: header
        description: Owner token returned at creation
      - name: X-Manage-Key
        in: header
        description: Management key of this publication
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AccessRevokeResponse"
        "400":
          description: Reader access revocation requires a NEW protected publication
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "403":
          description: Missing or wrong owner token
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: Publication unavailable
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "429":
          description: "Rate limited: wait Retry-After (= retryAfterSeconds); no account:\
            \ accountUrl, free sign-up with higher limits"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - OwnerToken: []
      - ManageKey: []
  /api/sites:
    post:
      tags:
      - Sites
      summary: Upload site
      description: "Upload a multi-file HTML site as a ZIP archive or as individual\
        \ files with paths. Returns a link to the published site. Secrets allowed;\
        \ likely ones are flagged in notices. For a secret: private namespace + password."
      operationId: uploadSite
      parameters:
      - name: ns
        in: query
        description: "Send ns=public for anything meant to be found or shared (docs,\
          \ guides, demos, portfolios, reports, landing pages): listed in the public\
          \ gallery and sitemap, so Google, Bing and AI search index it and people\
          \ discover it. A site always gets its own subdomain. Anyone can find and\
          \ read a public page: never put secrets, tokens or personal data there.\
          \ No ns (default): private. Unlisted and not indexed; anyone who has the\
          \ link can still open it. Lowercase only."
        required: false
        schema:
          type: string
          pattern: "^$|^[a-z0-9-]{1,32}$"
      - name: tags
        in: query
        description: Comma-separated tags
        required: false
        schema:
          type: string
        example: "demo,portfolio"
      - name: ttl
        in: query
        description: "TTL in days: up to 30 days without an account, up to 90 with\
          \ a free profile (send its X-Owner-Token); a default applies when `ttl`\
          \ is omitted. Accepts whole days: 15, 15d, 15 days."
        required: false
        schema:
          type: string
      - name: X-Password
        in: header
        description: Access password
        required: false
        schema:
          type: string
      - name: User-Agent
        in: header
        required: false
        schema:
          type: string
      - name: X-Delivery-Mode
        in: header
        required: false
        schema:
          type: string
      - name: X-Owner-Token
        in: header
        description: Reuse existing owner token to group entities under one owner
      - name: entry
        in: query
        description: "Entry HTML file path (.html or .htm). Default: index.html, else\
          \ the shallowest HTML file; a missing or non-HTML entry falls back to it\
          \ and is reported in notices"
        schema:
          type: string
      - name: domain
        in: query
        description: "Custom domain to connect to the new publication, e.g. www.example.com\
          \ or example.com (query parameter or form/multipart field). Needs an X-Owner-Token\
          \ added to a free BrewPage profile; works for HTML pages of format html\
          \ and for sites, without a password. The publication is always created;\
          \ on success the answer carries `customDomain` with the DNS `records[]`\
          \ to create; then call POST /api/publications/{type}/{ns}/{id}/domain/check\
          \ once and read GET /api/publications/{type}/{ns}/{id}/domain until `status`\
          \ is `active`. Otherwise one notice says why it was not set: domain-needs-account,\
          \ domain-limit-reached, domain-not-eligible, domain-invalid, domain-not-registered,\
          \ domain-account-restricted, domain-profile-ambiguous or domain-unavailable.\
          \ Updates ignore it (notice domain-ignored): use PUT /api/publications/{type}/{ns}/{id}/domain."
        schema:
          type: string
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              anyOf:
              - type: object
                required:
                - archive
              - type: object
                required:
                - files
              properties:
                archive:
                  type: string
                  format: binary
                  description: ZIP archive; takes precedence over individual files.
                files:
                  type: array
                  items:
                    type: string
                    format: binary
                  minItems: 1
                paths:
                  type: array
                  description: Optional paths aligned with files; omitted paths use
                    original filenames.
                  items:
                    type: string
                state:
                  type: string
                  description: "Page data: lets visitors save entries on this site.\
                    \ Optional JSON text of the settings object, sent as a text field\
                    \ or a file: it declares the lists and limits (e.g. {\"collections\"\
                    :{\"answers\":{}}}; {} turns it on with defaults). Page data works\
                    \ on the site's own address https://<label>.brewpage.app. null\
                    \ or no state field changes no page data settings, also when this\
                    \ upload updates your existing site. Invalid settings answer 400\
                    \ and nothing is published."
        required: true
      responses:
        "201":
          description: Site uploaded
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SiteUploadResponse"
        "400":
          description: "Invalid request, no HTML files, or limits exceeded; see GET\
            \ /api/limits; or PDF/Office file unreadable or password-protected"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "413":
          description: "Request over the per-request size, too many files and form\
            \ fields, or a file path too long; see GET /api/limits"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "403":
          description: Upload refused
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "422":
          description: "No servable file left: every file has an unsupported or missing\
            \ extension"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "429":
          description: "Rate limited: wait Retry-After (= retryAfterSeconds); no account:\
            \ accountUrl, free sign-up with higher limits"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "503":
          description: Busy; retry after Retry-After seconds
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - {}
      - OwnerToken: []
  /api/reports:
    post:
      tags:
      - Reports
      summary: Submit abuse report
      description: Records a public report about a resource hosted on brewpage.app
        for moderator review
      operationId: submitReport
      parameters:
      - name: User-Agent
        in: header
        required: false
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ReportRequest"
        required: true
      responses:
        "201":
          description: Report accepted
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ReportResponse"
        "400":
          description: Invalid request parameters
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "429":
          description: Too many reports from this address today
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - {}
  /api/publications/{type}/{ns}/{id}/domain/check:
    post:
      tags:
      - Custom Domains
      summary: Check DNS of this publication's custom domain now
      description: "Runs a DNS check now and returns the updated state; call it after\
        \ creating the records in `records[]`. BrewPage also checks on its own (`nextCheckAt`)\
        \ and resumes paused checks (CHECK_PAUSED) on this call. Checks are spaced:\
        \ a repeat too soon answers 429 DOMAIN_CHECK_TOO_SOON; wait Retry-After."
      operationId: checkPublicationDomain
      parameters:
      - name: type
        in: path
        description: html (pages of format html) or site; only these take a custom
          domain
        required: true
        schema:
          type: string
          enum:
          - html
          - site
      - name: ns
        in: path
        required: true
        schema:
          type: string
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: X-Owner-Token
        in: header
        description: "Owner token in a free BrewPage profile: the publication's own\
          \ token added to the profile, or a profile token that reaches the publication"
        required: true
      responses:
        "200":
          description: Checked; the updated custom domain
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DomainItem"
        "403":
          description: "OWNER_AUTHORIZATION_FAILED: wrong token; OWNER_TOKEN_REVOKED\
            \ or OWNER_TOKEN_EXPIRED; DOMAIN_NEEDS_ACCOUNT: custom domains need a\
            \ free BrewPage profile: sign in at https://account.brewpage.app/tokens,\
            \ press Add existing token and paste this owner token, then set the domain\
            \ again; ACCOUNT_RESTRICTED or ACCOUNT_BLOCKED: this profile cannot add\
            \ domains now"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: "DOMAIN_NOT_FOUND: no custom domain on this publication; PUBLICATION_UNAVAILABLE:\
            \ missing or expired publication (outside public also for a wrong token);\
            \ FEATURE_DISABLED: custom domains are not available right now"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "409":
          description: "DOMAIN_SUSPENDED: BrewPage suspended this domain; write to\
            \ info@brewpage.app; DOMAIN_PROFILE_AMBIGUOUS: the token is in several\
            \ profiles; set the domain with a profile token of the profile that should\
            \ hold it"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "429":
          description: "Rate limited: wait Retry-After (= retryAfterSeconds); or DOMAIN_CHECK_TOO_SOON:\
            \ checked a moment ago, wait Retry-After"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - OwnerToken: []
  /api/profile/notifications/read:
    post:
      tags:
      - Notifications
      summary: Mark notifications read
      description: "Send {ids: [...]} (1-100 ids) or {all: true}. Answers the unread\
        \ count."
      operationId: markNotificationsRead
      parameters:
      - name: X-Owner-Token
        in: header
        description: Owner token added to exactly one BrewPage profile
        required: true
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/NotificationReadRequest"
        required: true
      responses:
        "200":
          description: Unread count after the change
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/NotificationUnreadResponse"
        "400":
          description: "Neither ids nor all: true, more than 100 ids, or a malformed\
            \ body"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "403":
          description: "PROFILE_TOKEN_REQUIRED: no token, or a token not added to\
            \ exactly one profile; or the token is revoked or expired"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: Profiles are not available
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "429":
          description: "Rate limited: wait Retry-After (= retryAfterSeconds)"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - OwnerToken: []
  /api/owner-token/revoke:
    post:
      tags:
      - Owner Token
      summary: "Delete a profile token by id or token; it stops working everywhere,\
        \ its publications stay"
      operationId: revokeOwnerToken
      parameters:
      - name: X-Owner-Token
        in: header
        description: Admin token of the profile
        required: true
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/RevokeRequest"
      responses:
        "200":
          description: Revoked (false = already revoked)
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RevokeResponse"
        "403":
          description: "Header token not admin, not in a profile, revoked or expired"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: Not a token of this profile
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "429":
          description: "Rate limited: wait Retry-After (= retryAfterSeconds); no account:\
            \ accountUrl, free sign-up with higher limits"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - OwnerToken: []
  /api/owner-token/revoke-others:
    post:
      tags:
      - Owner Token
      summary: Delete every other active profile token
      operationId: revokeOtherOwnerTokens
      parameters:
      - name: X-Owner-Token
        in: header
        description: Admin token of the profile
        required: true
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/RevokeOthersRequest"
      responses:
        "200":
          description: Number of tokens deleted
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RevokeOthersResponse"
        "403":
          description: "Header token not admin, not in a profile, revoked or expired"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "429":
          description: "Rate limited: wait Retry-After (= retryAfterSeconds); no account:\
            \ accountUrl, free sign-up with higher limits"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - OwnerToken: []
  /api/owner-token/mint:
    post:
      tags:
      - Owner Token
      summary: Mint a profile token with scope and expiry; the token is shown once
      operationId: mintOwnerToken
      parameters:
      - name: X-Owner-Token
        in: header
        description: Admin token of the profile
        required: true
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/MintRequest"
      responses:
        "201":
          description: Minted
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MintResponse"
        "400":
          description: "Invalid label, scope or expiresIn"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "403":
          description: "Header token not admin, not in a profile, revoked or expired"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "409":
          description: Active token limit
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "429":
          description: "Rate limited: wait Retry-After (= retryAfterSeconds); no account:\
            \ accountUrl, free sign-up with higher limits"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - OwnerToken: []
  /api/owner-token/bind:
    post:
      tags:
      - Owner Token
      summary: Add a token to your profile (as publish)
      operationId: bindOwnerToken
      parameters:
      - name: X-Owner-Token
        in: header
        description: Admin token of the profile
        required: true
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/BindRequest"
      responses:
        "200":
          description: Bound (also when already in the profile)
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/BindResponse"
        "400":
          description: Invalid token
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "403":
          description: "Header token not admin, not in a profile, revoked or expired;\
            \ or body token revoked"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "409":
          description: Active token limit
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "429":
          description: "Rate limited: wait Retry-After (= retryAfterSeconds); no account:\
            \ accountUrl, free sign-up with higher limits"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - OwnerToken: []
  /api/kv:
    get:
      tags:
      - KV
      summary: List KV stores
      description: Returns all KV stores owned by the given token in the namespace.
        Returns empty list without token
      operationId: listStores
      parameters:
      - name: ns
        in: query
        description: "Namespace. Omitted: private. `public` = gallery & search. Lowercase\
          \ only."
        required: false
        schema:
          type: string
          pattern: "^$|^[a-z0-9-]{1,32}$"
      - name: X-Owner-Token
        in: header
        description: Owner token to filter by ownership. Without token returns empty
          list
      responses:
        "200":
          description: Store list
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/KvStoreListResponse"
        "403":
          description: Owner token revoked or expired
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - {}
      - OwnerToken: []
    post:
      tags:
      - KV
      summary: Create KV store
      description: "Creates a new store with an initial key-value pair and returns\
        \ a shareable link. Reuse existing owner token to group entities under one\
        \ owner. Secrets allowed; likely ones are flagged in notices. For a secret:\
        \ private namespace + password."
      operationId: createStore
      parameters:
      - name: ns
        in: query
        description: "No ns (default): private. ns=public: the shared public namespace.\
          \ JSON and KV are never listed in the gallery or indexed, in any namespace;\
          \ anyone who has the link can open it. Lowercase only."
        required: false
        schema:
          type: string
          pattern: "^$|^[a-z0-9-]{1,32}$"
      - name: tags
        in: query
        description: Comma-separated tags
        required: false
        schema:
          type: string
        example: "demo,test"
      - name: ttl
        in: query
        description: "TTL in days: up to 30 days without an account, up to 90 with\
          \ a free profile (send its X-Owner-Token); a default applies when `ttl`\
          \ is omitted. Accepts whole days: 15, 15d, 15 days."
        required: false
        schema:
          type: string
      - name: X-Password
        in: header
        description: Access password; protected stores are unlisted. NEW browser links
          use trusted unlock; programmatic reads use X-Password
        required: false
        schema:
          type: string
      - name: X-Delivery-Mode
        in: header
        description: "Delivery mode for a new store: path or subdomain"
        required: false
        schema:
          type: string
      - name: X-Owner-Token
        in: header
        description: "Reuse existing owner token to group entities under one owner.\
          \ If omitted, a new token is generated"
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/KvCreateStoreRequest"
        required: true
      responses:
        "201":
          description: Store created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/KvCreateStoreResponse"
        "400":
          description: Invalid request parameters
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "403":
          description: Owner token revoked or expired
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "429":
          description: "Rate limited: wait Retry-After (= retryAfterSeconds); no account:\
            \ accountUrl, free sign-up with higher limits"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - {}
      - OwnerToken: []
  /api/json:
    get:
      tags:
      - JSON
      summary: List JSON documents
      description: Returns documents owned by the given token. Empty list without
        token
      operationId: list
      parameters:
      - name: ns
        in: query
        description: "Namespace. Omitted: private. `public` = gallery & search. Lowercase\
          \ only."
        required: false
        schema:
          type: string
          pattern: "^$|^[a-z0-9-]{1,32}$"
      - name: X-Owner-Token
        in: header
        description: Owner token to filter by ownership. Without token returns empty
          list
      responses:
        "200":
          description: Document list
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/JsonListResponse"
        "403":
          description: Owner token revoked or expired
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - {}
      - OwnerToken: []
    post:
      tags:
      - JSON
      summary: Create JSON document
      description: "Stores any valid JSON and returns a shareable link. Reuse existing\
        \ owner token to group entities under one owner. Secrets allowed; likely ones\
        \ are flagged in notices. For a secret: private namespace + password."
      operationId: create
      parameters:
      - name: ns
        in: query
        description: "No ns (default): private. ns=public: the shared public namespace.\
          \ JSON and KV are never listed in the gallery or indexed, in any namespace;\
          \ anyone who has the link can open it. Lowercase only."
        required: false
        schema:
          type: string
          pattern: "^$|^[a-z0-9-]{1,32}$"
      - name: tags
        in: query
        description: Comma-separated tags
        required: false
        schema:
          type: string
        example: "demo,test"
      - name: ttl
        in: query
        description: "TTL in days: up to 30 days without an account, up to 90 with\
          \ a free profile (send its X-Owner-Token); a default applies when `ttl`\
          \ is omitted. Accepts whole days: 15, 15d, 15 days."
        required: false
        schema:
          type: string
      - name: X-Password
        in: header
        description: Access password; protected documents are unlisted. NEW browser
          links use trusted unlock; programmatic reads accept X-Password
        required: false
        schema:
          type: string
      - name: X-Delivery-Mode
        in: header
        description: "Delivery mode for a new document: path or subdomain"
        required: false
        schema:
          type: string
      - name: X-Owner-Token
        in: header
        description: "Reuse existing owner token to group entities under one owner.\
          \ If omitted, a new token is generated"
      requestBody:
        content:
          application/json:
            schema: {}
        required: true
      responses:
        "201":
          description: Document created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/JsonCreateResponse"
        "400":
          description: Invalid JSON or request parameters
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "403":
          description: Owner token revoked or expired
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "429":
          description: "Rate limited: wait Retry-After (= retryAfterSeconds); no account:\
            \ accountUrl, free sign-up with higher limits"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - {}
      - OwnerToken: []
  /api/html:
    post:
      tags:
      - HTML
      summary: Create HTML page
      description: "Stores HTML or markdown content and returns a shareable link.\
        \ Reuse existing owner token to group entities under one owner. Also accepts\
        \ raw text/* (HTML, Markdown, YAML, XML, CSV, code) and application/octet-stream\
        \ bodies — see /llms-full.txt. Secrets allowed; likely ones are flagged in\
        \ notices. For a secret: private namespace + password."
      operationId: create_1
      parameters:
      - name: ns
        in: query
        description: "Send ns=public for anything meant to be found or shared (docs,\
          \ guides, demos, portfolios, reports, landing pages): listed in the public\
          \ gallery and sitemap, so Google, Bing and AI search index it and people\
          \ discover it. Public pages are served on the brewpage.app domain itself,\
          \ for the strongest search reach; code that needs its own origin (cookies,\
          \ storage) gets its own subdomain automatically. Anyone can find and read\
          \ a public page: never put secrets, tokens or personal data there. No ns\
          \ (default): private. Unlisted and not indexed; anyone who has the link\
          \ can still open it. Lowercase only."
        required: false
        schema:
          type: string
          pattern: "^$|^[a-z0-9-]{1,32}$"
      - name: tags
        in: query
        description: Comma-separated tags
        required: false
        schema:
          type: string
        example: "demo,test"
      - name: ttl
        in: query
        description: "TTL in days: up to 30 days without an account, up to 90 with\
          \ a free profile (send its X-Owner-Token); a default applies when `ttl`\
          \ is omitted. Accepts whole days: 15, 15d, 15 days."
        required: false
        schema:
          type: string
      - name: format
        in: query
        description: "Content format. 'html' (default) — stored as sent, except a\
          \ whole page pasted from a chat is repaired (see 'verbatim'); omitted, source\
          \ code or JSON is saved as its code format (notice format-detected). 'markdown'\
          \ / 'md' — rendered to styled HTML via github-markdown-css. Code/text languages\
          \ stored and served raw with format-specific MIME (text/csv, application/json,\
          \ text/plain) plus X-Content-Type-Options: nosniff; raw reads of xml answer\
          \ text/plain, downloads keep text/xml: yaml, json, xml, csv, tsv, log, toml,\
          \ ini, sql, sh, bat, env, javascript, typescript, tsx, jsx, css, properties,\
          \ docker, txt. Decides over a filename extension; unknown values are ignored.\
          \ A whole HTML document sent as 'markdown' is published as an HTML page."
        required: false
        schema:
          type: string
          default: html
      - name: X-Password
        in: header
        description: Access password. Empty means no password restriction. Protected
          pages are never listed in the gallery or sitemap. OLD links accept ?p=;
          NEW access uses X-Password or a reader access cookie after password entry.
        required: false
        schema:
          type: string
      - name: User-Agent
        in: header
        required: false
        schema:
          type: string
      - name: verbatim
        in: query
        description: "Store the content exactly as sent. By default a whole HTML page\
          \ pasted from a chat (wrapped in a code block, surrounded by chat text,\
          \ or entity-escaped) is restored and a notice is returned; 'true' keeps\
          \ the text as is."
        schema:
          type: boolean
      - name: domain
        in: query
        description: "Custom domain to connect to the new publication, e.g. www.example.com\
          \ or example.com (query parameter or form/multipart field). Needs an X-Owner-Token\
          \ added to a free BrewPage profile; works for HTML pages of format html\
          \ and for sites, without a password. The publication is always created;\
          \ on success the answer carries `customDomain` with the DNS `records[]`\
          \ to create; then call POST /api/publications/{type}/{ns}/{id}/domain/check\
          \ once and read GET /api/publications/{type}/{ns}/{id}/domain until `status`\
          \ is `active`. Otherwise one notice says why it was not set: domain-needs-account,\
          \ domain-limit-reached, domain-not-eligible, domain-invalid, domain-not-registered,\
          \ domain-account-restricted, domain-profile-ambiguous or domain-unavailable.\
          \ Updates ignore it (notice domain-ignored): use PUT /api/publications/{type}/{ns}/{id}/domain."
        schema:
          type: string
      - name: template
        in: query
        description: Slug of the official template this page was made from (the `slug`
          of a `GET /api/templates` item).
        schema:
          type: string
      - name: X-Owner-Token
        in: header
        description: "Reuse existing owner token to group entities under one owner.\
          \ If omitted, a new token is generated"
      - name: X-Delivery-Mode
        in: header
        description: "Delivery mode: path or subdomain. Sites and non-public HTML\
          \ pages are always subdomain. The answer states the mode in effect (effectiveDeliveryMode,\
          \ deliveryNotice). Omit it for the default."
        required: false
        schema:
          type: string
          enum:
          - path
          - subdomain
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/HtmlUploadRequest"
          text/html:
            schema:
              type: string
          text/plain:
            schema:
              type: string
          text/markdown:
            schema:
              type: string
          text/csv:
            schema:
              type: string
          text/yaml:
            schema:
              type: string
          text/css:
            schema:
              type: string
          text/javascript:
            schema:
              type: string
          text/x-toml:
            schema:
              type: string
          text/xml:
            schema:
              type: string
          application/xml:
            schema:
              type: string
          application/yaml:
            schema:
              type: string
          application/x-yaml:
            schema:
              type: string
          application/javascript:
            schema:
              type: string
          application/toml:
            schema:
              type: string
          application/octet-stream:
            schema:
              type: string
              format: binary
        required: true
      responses:
        "201":
          description: Page created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/HtmlUploadResponse"
        "400":
          description: Invalid request parameters; or PDF/Office file unreadable or
            password-protected
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "403":
          description: Upload refused
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "429":
          description: "Rate limited: wait Retry-After (= retryAfterSeconds); no account:\
            \ accountUrl, free sign-up with higher limits"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "503":
          description: Busy; retry after Retry-After seconds
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - {}
      - OwnerToken: []
  /api/files:
    get:
      tags:
      - Files
      summary: List files
      description: Returns files owned by the given token. Empty list without token.
        Files published as pages are listed by GET /api/publications
      operationId: list_1
      parameters:
      - name: ns
        in: query
        description: "Namespace. Omitted: private. `public` = gallery & search. Lowercase\
          \ only."
        required: false
        schema:
          type: string
          pattern: "^$|^[a-z0-9-]{1,32}$"
      - name: X-Owner-Token
        in: header
        description: Owner token to filter by ownership. Without token returns empty
          list
      responses:
        "200":
          description: File list
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/FileListResponse"
        "403":
          description: Owner token revoked or expired
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - {}
      - OwnerToken: []
    post:
      tags:
      - Files
      summary: Upload file
      description: "Stores a file via multipart upload and returns a download link.\
        \ Only safe file types accepted; a missing or wrong extension is corrected\
        \ from the content and reported in notices. Reuse existing owner token to\
        \ group entities under one owner. An HTML or Markdown file is published as\
        \ a page in any namespace, with or without a password (same rules and limits\
        \ as POST /api/html). 'format' decides; without one a known extension, then\
        \ a specific declared part type (text/html, text/markdown, application/json,\
        \ text/csv), then a content guess; otherwise it stays an inert file. '.txt'\
        \ without 'format' stays a text file. A whole HTML document sent as 'markdown'\
        \ is an HTML page. Any readable encoding is stored as UTF-8, notice 'charset-guessed'\
        \ when no usable charset was named. link and ownerLink point to the page,\
        \ notice 'html-file-as-page' or 'markdown-file-as-page'; a code format chosen\
        \ by 'format' or the declared type is published the same way, notice 'file-format-applied'.\
        \ An HTML file over the page size limit or that no encoding reads is stored\
        \ as a file and shown as source, notice 'html-file-as-source'. A JSON file\
        \ in the public namespace is stored as sent, notice 'json-file-not-listed';\
        \ JSON data belongs in POST /api/json. Secrets allowed; likely ones are flagged\
        \ in notices. For a secret: private namespace + password."
      operationId: upload
      parameters:
      - name: ns
        in: query
        description: "Send ns=public for anything meant to be found or shared (docs,\
          \ guides, demos, portfolios, reports, landing pages): listed in the public\
          \ gallery and sitemap, so Google, Bing and AI search index it and people\
          \ discover it. Public pages are served on the brewpage.app domain itself,\
          \ for the strongest search reach; code that needs its own origin (cookies,\
          \ storage) gets its own subdomain automatically. Anyone can find and read\
          \ a public page: never put secrets, tokens or personal data there. No ns\
          \ (default): private. Unlisted and not indexed; anyone who has the link\
          \ can still open it. Lowercase only."
        required: false
        schema:
          type: string
          pattern: "^$|^[a-z0-9-]{1,32}$"
      - name: tags
        in: query
        description: Comma-separated tags
        required: false
        schema:
          type: string
        example: "demo,test"
      - name: format
        in: query
        description: "Format of a page published from this file: decides over the\
          \ file name. Unknown values are ignored."
        required: false
        schema:
          type: string
      - name: ttl
        in: query
        description: "TTL in days: up to 30 days without an account, up to 90 with\
          \ a free profile (send its X-Owner-Token); a default applies when `ttl`\
          \ is omitted. Accepts whole days: 15, 15d, 15 days."
        required: false
        schema:
          type: string
      - name: X-Password
        in: header
        description: Access password. Empty = public file visible in gallery. With
          password = hidden from gallery; readers unlock the publication or use X-Password
          for API access
        required: false
        schema:
          type: string
      - name: X-Delivery-Mode
        in: header
        required: false
        schema:
          type: string
      - name: verbatim
        in: query
        description: "For an HTML file published as a page: store it exactly as sent.\
          \ By default a whole HTML page pasted from a chat (wrapped in a code block,\
          \ surrounded by chat text, or entity-escaped) is restored and a notice is\
          \ returned; 'true' keeps the text as is."
        schema:
          type: boolean
      - name: X-Owner-Token
        in: header
        description: "Reuse existing owner token to group entities under one owner.\
          \ If omitted, a new token is generated"
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                file:
                  type: string
                  format: binary
                  description: File part; any single file part is accepted when 'file'
                    is absent
        required: true
      responses:
        "201":
          description: "File uploaded, or HTML or Markdown file published as a page.\
            \ Header X-Existing-Resource: 1 when an existing publication with the\
            \ same content was returned"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/FileUploadResponse"
        "400":
          description: Invalid request or file too large; or PDF/Office file unreadable
            or password-protected
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "403":
          description: Upload refused
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "422":
          description: Unsupported file type or content of no supported type
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "429":
          description: "Rate limited: wait Retry-After (= retryAfterSeconds); no account:\
            \ accountUrl, free sign-up with higher limits"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "503":
          description: Busy; retry after Retry-After seconds
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - {}
      - OwnerToken: []
  /api/domains:
    get:
      tags:
      - Custom Domains
      summary: Custom domains of the profile
      description: Lists every custom domain of the profile with `limit` and `used`.
      operationId: listDomains
      parameters:
      - name: X-Owner-Token
        in: header
        description: Admin token of your BrewPage profile
        required: true
      responses:
        "200":
          description: The profile's custom domains
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DomainListResponse"
        "403":
          description: "Missing token, or ADMIN_TOKEN_REQUIRED: not an admin token\
            \ of a profile; OWNER_TOKEN_REVOKED or OWNER_TOKEN_EXPIRED"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: "FEATURE_DISABLED: custom domains are not available right now"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - OwnerToken: []
    post:
      tags:
      - Custom Domains
      summary: Add a hostname to the profile
      description: "Adds a hostname to the profile without showing a publication yet\
        \ (attach one later with PUT /api/domains/{hostname}/attachment). A new hostname\
        \ whose domain is not registered is refused (400 DOMAIN_NOT_REGISTERED). For\
        \ an added hostname the first automatic DNS check runs about 15 minutes later\
        \ (`nextCheckAt`). Create the DNS `records[]` of the answer, then call POST\
        \ /api/domains/{hostname}/check once; BrewPage keeps checking on its own:\
        \ read GET /api/domains/{hostname} until `status` is `active`."
      operationId: addDomain
      parameters:
      - name: X-Owner-Token
        in: header
        description: Admin token of your BrewPage profile
        required: true
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/AddDomainRequest"
      responses:
        "200":
          description: Already in the profile; same body as 201
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DomainItem"
        "201":
          description: Added to the profile
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DomainItem"
        "400":
          description: "INVALID_HOSTNAME: not a valid hostname; DOMAIN_NOT_ALLOWED:\
            \ this hostname cannot be used; DOMAIN_NOT_REGISTERED: the domain is not\
            \ registered yet; register it with a domain registrar first"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "403":
          description: "Missing token, or ADMIN_TOKEN_REQUIRED: not an admin token\
            \ of a profile; OWNER_TOKEN_REVOKED or OWNER_TOKEN_EXPIRED; ACCOUNT_RESTRICTED\
            \ or ACCOUNT_BLOCKED: this profile cannot add domains now"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: "FEATURE_DISABLED: custom domains are not available right now"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "409":
          description: "DOMAIN_LIMIT: the profile already holds all its custom domains\
            \ (`limit`, `used`); remove or move one"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "503":
          description: "DOMAIN_INTAKE_PAUSED: adding custom domains is paused; try\
            \ again later"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "429":
          description: "Rate limited: wait Retry-After (= retryAfterSeconds)"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - OwnerToken: []
  /api/domains/{hostname}/check:
    post:
      tags:
      - Custom Domains
      summary: Check DNS of a custom domain now
      description: "Runs a DNS check now and returns the updated state; call it after\
        \ creating the records in `records[]`. BrewPage also checks on its own (`nextCheckAt`)\
        \ and resumes paused checks (CHECK_PAUSED) on this call. Checks are spaced:\
        \ a repeat too soon answers 429 DOMAIN_CHECK_TOO_SOON; wait Retry-After."
      operationId: checkDomain
      parameters:
      - name: hostname
        in: path
        description: "Hostname, e.g. www.example.com (Unicode or ASCII form)"
        required: true
        schema:
          type: string
      - name: X-Owner-Token
        in: header
        description: Admin token of your BrewPage profile
        required: true
      responses:
        "200":
          description: Checked; the updated custom domain
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DomainItem"
        "403":
          description: "Missing token, or ADMIN_TOKEN_REQUIRED: not an admin token\
            \ of a profile; OWNER_TOKEN_REVOKED or OWNER_TOKEN_EXPIRED; ACCOUNT_RESTRICTED\
            \ or ACCOUNT_BLOCKED: this profile cannot add domains now"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: "DOMAIN_NOT_FOUND: the hostname is not in this profile; FEATURE_DISABLED:\
            \ custom domains are not available right now"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "409":
          description: "DOMAIN_SUSPENDED: BrewPage suspended this domain; write to\
            \ info@brewpage.app"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "429":
          description: "Rate limited: wait Retry-After (= retryAfterSeconds); or DOMAIN_CHECK_TOO_SOON:\
            \ checked a moment ago, wait Retry-After"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - OwnerToken: []
  /api/{type}/{ns}/{id}/hosting:
    get:
      tags:
      - Hosting Management
      summary: Read owner-only publication delivery settings
      operationId: getHosting
      parameters:
      - name: type
        in: path
        required: true
        schema:
          type: string
          enum:
          - html
          - files
          - json
          - kv
          - sites
      - name: ns
        in: path
        required: true
        schema:
          type: string
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: X-Owner-Token
        in: header
        description: Owner token returned at creation
      - name: X-Manage-Key
        in: header
        description: Management key of this publication
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/HostingReadResponse"
        "403":
          description: Missing or wrong owner token
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: Publication unavailable
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "410":
          description: Publication unavailable; owner credentials valid
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - OwnerToken: []
      - ManageKey: []
    patch:
      tags:
      - Hosting Management
      summary: Change delivery mode for a new publication. Sites and non-public HTML
        pages are always on subdomain; the answer states the mode in effect
      operationId: updateHosting
      parameters:
      - name: type
        in: path
        required: true
        schema:
          type: string
          enum:
          - html
          - files
          - json
          - kv
          - sites
      - name: ns
        in: path
        required: true
        schema:
          type: string
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: X-Owner-Token
        in: header
        description: Owner token returned at creation
      - name: X-Manage-Key
        in: header
        description: Management key of this publication
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/HostingUpdateRequest"
        required: true
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/HostingProjection"
        "400":
          description: Unknown delivery mode or malformed expectedVersion
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "403":
          description: Missing or wrong owner token
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: Publication unavailable
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "503":
          description: Hosting changes temporarily unavailable
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "429":
          description: "Rate limited: wait Retry-After (= retryAfterSeconds); no account:\
            \ accountUrl, free sign-up with higher limits"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - OwnerToken: []
      - ManageKey: []
  /api/{ns}/{id}/state:
    get:
      tags:
      - Page data
      summary: Read page data settings and usage
      description: "Settings in effect, each list with its entry count and size, quota\
        \ tier and usage. A publication that has not turned page data on answers declared:false\
        \ with the default settings. notices: state-needs-subdomain while the page\
        \ is on a brewpage.app/... address (give it its own address: PATCH /api/{type}/{ns}/{id}/hosting),\
        \ state-needs-html while the page is not HTML."
      operationId: readPageDataSettings
      parameters:
      - name: ns
        in: path
        required: true
        schema:
          type: string
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: X-Owner-Token
        in: header
        description: Owner token returned at creation
      - name: X-Manage-Key
        in: header
        description: Management key of this publication
      responses:
        "200":
          description: Settings and usage
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/StateConfigResponse"
        "403":
          description: "Owner token revoked or expired; or OWNER_AUTHORIZATION_FAILED:\
            \ a public publication you do not own"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: "PUBLICATION_UNAVAILABLE: no such HTML page or site, not yours,\
            \ hidden or expired"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "503":
          description: "STATE_UNAVAILABLE: page data is switched off for now; wait\
            \ Retry-After"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - OwnerToken: []
      - ManageKey: []
    patch:
      tags:
      - Page data
      summary: Change page data settings
      description: "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)."
      operationId: changePageDataSettings
      parameters:
      - name: ns
        in: path
        required: true
        schema:
          type: string
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: X-Owner-Token
        in: header
        description: Owner token returned at creation
      - name: X-Manage-Key
        in: header
        description: Management key of this publication
      requestBody:
        description: "Page data settings JSON, or null to turn page data off"
        content:
          application/json:
            schema:
              oneOf:
              - $ref: "#/components/schemas/StateSettingsRequest"
              - type: "null"
        required: true
      responses:
        "200":
          description: Settings saved; same answer as the read
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/StateConfigResponse"
        "400":
          description: "STATE_INVALID: the settings have a mistake; nothing was changed"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "403":
          description: "Owner token revoked or expired; or OWNER_AUTHORIZATION_FAILED:\
            \ a public publication you do not own"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: "PUBLICATION_UNAVAILABLE: no such HTML page or site, not yours,\
            \ hidden or expired"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "409":
          description: "STATE_MODE_WIDENING: a private list with visitors' entries\
            \ cannot become shared; or OLD_PUBLICATION_READ_ONLY"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "413":
          description: Settings larger than 16 KB
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "503":
          description: "STATE_UNAVAILABLE: page data is switched off for now; wait\
            \ Retry-After"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "429":
          description: "Rate limited: wait Retry-After (= retryAfterSeconds); no account:\
            \ accountUrl, free sign-up with higher limits"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - OwnerToken: []
      - ManageKey: []
  /{ns}/{id}:
    get:
      tags:
      - Short Links
      summary: Open short link
      description: "Serves the publication behind the link: page, site, file, JSON\
        \ or KV. 410 for a deleted public publication; otherwise 404."
      operationId: resolve
      parameters:
      - name: ns
        in: path
        required: true
        schema:
          type: string
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: X-Password
        in: header
        description: Access password for protected resources
        required: false
        schema:
          type: string
      - name: p
        in: query
        description: Legacy-only query password; ignored for NEW publications. Programmatic
          access uses X-Password or the owner token.
        required: false
        schema:
          type: string
      - name: dl
        in: query
        description: Force download as attachment
        required: false
        schema:
          type: boolean
      - name: raw
        in: query
        description: "Bypass SPA: stream raw bytes directly (used by <video src>,\
          \ <iframe src> for PDF, embed cases)"
        required: false
        schema:
          type: boolean
      - name: inline
        in: query
        description: Legacy site wrapper bypass; NEW publications retain stored hosting
          and protection policies
        required: false
        schema:
          type: boolean
      - name: Range
        in: header
        required: false
        schema:
          type: string
      - name: X-Resolve
        in: header
        required: false
        schema:
          type: string
      - name: User-Agent
        in: header
        required: false
        schema:
          type: string
      - name: Accept
        in: header
        required: false
        schema:
          type: string
      - name: X-Owner-Token
        in: header
        description: "Owner token; when supplied, response carries X-Is-Owner: true\
          \ on match"
        schema:
          type: string
      responses:
        "200":
          description: OK
          content:
            '*/*':
              schema:
                type: object
      security:
      - {}
      - OwnerToken: []
      - Password: []
  /{ns}/{id}/{sub}:
    get:
      tags:
      - Short Links
      summary: Open short-link sub-path
      description: Serves a site file or KV value under the link. Any miss is 404.
      operationId: resolveWithSub
      parameters:
      - name: ns
        in: path
        required: true
        schema:
          type: string
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: sub
        in: path
        required: true
        schema:
          type: string
      - name: X-Password
        in: header
        description: Access password for protected resources
        required: false
        schema:
          type: string
      - name: p
        in: query
        description: Legacy-only query password; ignored for NEW publications. Programmatic
          access uses X-Password or the owner token.
        required: false
        schema:
          type: string
      - name: dl
        in: query
        description: Force download as attachment
        required: false
        schema:
          type: boolean
      - name: Range
        in: header
        required: false
        schema:
          type: string
      - name: X-Resolve
        in: header
        required: false
        schema:
          type: string
      - name: User-Agent
        in: header
        required: false
        schema:
          type: string
      - name: X-Owner-Token
        in: header
        description: "Owner token; when supplied, response carries X-Is-Owner: true\
          \ on match"
        schema:
          type: string
      responses:
        "200":
          description: OK
          content:
            '*/*':
              schema:
                type: object
      security:
      - {}
      - OwnerToken: []
      - Password: []
  /{key}.txt:
    get:
      tags:
      - SEO
      summary: IndexNow key verification
      description: Serves the IndexNow verification key file for search engine crawlers
      operationId: serveKeyFile
      parameters:
      - name: key
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: Key file content
          content:
            text/plain:
              schema:
                type: string
        "404":
          description: Unknown key
      security:
      - {}
  /preview/{ns}/{id}/{variant}.webp:
    get:
      tags:
      - preview
      summary: WebP preview
      description: "thumb-d 800x373, thumb-m 320x149, full (page top, else the 1200\
        \ px card); same gates as the card"
      operationId: previewWebp
      parameters:
      - name: ns
        in: path
        required: true
        schema:
          type: string
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: variant
        in: path
        required: true
        schema:
          type: string
          enum:
          - thumb-d
          - thumb-m
          - full
      - name: v
        in: query
        description: Version from a server-built URL
        required: false
        schema:
          type: string
      - name: If-None-Match
        in: header
        required: false
        schema:
          type: string
      responses:
        "200":
          description: WebP bytes
          content:
            image/webp:
              schema:
                type: string
                format: binary
        "304":
          description: Not modified
        "404":
          description: No preview
        "429":
          description: Per-IP rate limit exceeded
      security:
      - {}
  /preview/{ns}/{id}.png:
    get:
      tags:
      - preview
      summary: Per-content OG image (legacy URL)
      description: "Legacy alias of /preview/{ns}/{id}.jpg for links shared earlier:\
        \ serves the same JPEG card with identical bytes, headers and fallbacks"
      operationId: preview
      parameters:
      - name: ns
        in: path
        required: true
        schema:
          type: string
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: If-None-Match
        in: header
        required: false
        schema:
          type: string
      responses:
        "200":
          description: Image bytes
          content:
            image/jpeg:
              schema:
                type: string
                format: binary
            image/png:
              schema:
                type: string
                format: binary
        "302":
          description: "Fallback to static og-image.png (flag off, no source, render\
            \ gate busy, error)"
        "304":
          description: Not modified (If-None-Match matched current ETag)
        "429":
          description: Per-IP rate limit exceeded
      security:
      - {}
  /preview/{ns}/{id}.jpg:
    get:
      tags:
      - preview
      summary: Per-content OG image
      description: "Canonical og:image URL. Returns the 1200×630 JPEG card, cached,\
        \ with ETag/If-None-Match support; non-public namespaces and protected content\
        \ add X-Robots-Tag: noindex; falls back to /og-image.png?v=3 on any failure"
      operationId: previewJpeg
      parameters:
      - name: ns
        in: path
        required: true
        schema:
          type: string
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: If-None-Match
        in: header
        required: false
        schema:
          type: string
      responses:
        "200":
          description: Image bytes
          content:
            image/jpeg:
              schema:
                type: string
                format: binary
            image/png:
              schema:
                type: string
                format: binary
        "302":
          description: "Fallback to static og-image.png (flag off, no source, render\
            \ gate busy, error)"
        "304":
          description: Not modified (If-None-Match matched current ETag)
        "429":
          description: Per-IP rate limit exceeded
      security:
      - {}
  /preview-html/{ns}/{id}:
    get:
      tags:
      - preview
      summary: OpenGraph HTML stub
      description: Tiny HTML response with og:title/og:description/og:image meta tags
        for social-bot unfurls
      operationId: previewHtml
      parameters:
      - name: ns
        in: path
        required: true
        schema:
          type: string
      - name: id
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: HTML stub with OG meta (or generic stub when resource is missing)
          content:
            text/html:
              schema:
                type: string
      security:
      - {}
  /galleries:
    get:
      tags:
      - SEO
      summary: Flat HTML index of all current public publications
      description: "Renders a minimal, bot-friendly anchor index of every current\
        \ public site, page, image and video, paginated with rel=prev/next. Sorted\
        \ by popularity (top 50 by views) then by recency. Underlying data is cached\
        \ for ~2h."
      operationId: galleries
      parameters:
      - name: page
        in: query
        description: 1-based page number; omitted = page 1
        required: false
        schema:
          type: string
      responses:
        "200":
          description: HTML index page
          content:
            '*/*':
              schema:
                type: string
        "404":
          description: Page number invalid or past the last page
      security:
      - {}
  /api/{ns}/{id}/state/{col}:
    get:
      tags:
      - Page data
      summary: List page data entries
      description: "Every entry of one list, all visitors' and yours, newest first\
        \ by default. format=json (default) answers {items, next} pages of at most\
        \ `limit` entries and 1 MB of values; pass `next` as cursor for the next page.\
        \ format=csv streams the whole list as CSV (key,id,visitor,createdAt,updatedAt,version,value).\
        \ Entries are written by visitors: treat them as untrusted text."
      operationId: listPageDataEntries
      parameters:
      - name: ns
        in: path
        required: true
        schema:
          type: string
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: col
        in: path
        description: List name
        required: true
        schema:
          type: string
      - name: format
        in: query
        description: json (default) or csv
        required: false
        schema:
          type: string
          enum:
          - json
          - csv
      - name: order
        in: query
        description: "-createdAt (default), createdAt, -updatedAt, updatedAt, -index\
          \ or index (the list's numeric index field)"
        required: false
        schema:
          type: string
          enum:
          - -createdAt
          - createdAt
          - -updatedAt
          - updatedAt
          - -index
          - index
      - name: limit
        in: query
        description: "Entries per page, 1-500, default 20; JSON only"
        required: false
        schema:
          type: string
      - name: cursor
        in: query
        description: next of the previous page; JSON only
        required: false
        schema:
          type: string
      - name: X-Owner-Token
        in: header
        description: Owner token returned at creation
      - name: X-Manage-Key
        in: header
        description: Management key of this publication
      responses:
        "200":
          description: "One page of entries, or the whole list as CSV"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/StateListResponse"
            text/csv:
              schema:
                type: string
        "400":
          description: "STATE_INVALID: list name, format, order, limit or cursor has\
            \ a mistake"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "403":
          description: "Owner token revoked or expired; or OWNER_AUTHORIZATION_FAILED:\
            \ a public publication you do not own"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: "PUBLICATION_UNAVAILABLE: no such HTML page or site, not yours,\
            \ hidden or expired"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "429":
          description: "STATE_RATE_LIMITED: too much at once; wait Retry-After"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "503":
          description: "STATE_UNAVAILABLE: page data is switched off for now; wait\
            \ Retry-After"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - OwnerToken: []
      - ManageKey: []
    delete:
      tags:
      - Page data
      summary: Delete page data entries by time
      description: "Deletes every entry and every visitor file of one list created\
        \ after `after` and/or before `before` (ISO 8601 instants, both exclusive,\
        \ at least one). To empty a list send before=9999-12-31T23:59:59Z. Cannot\
        \ be undone."
      operationId: deletePageDataRange
      parameters:
      - name: ns
        in: path
        required: true
        schema:
          type: string
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: col
        in: path
        description: List name
        required: true
        schema:
          type: string
      - name: after
        in: query
        description: "Delete entries and files created after this instant, e.g. 2026-11-10T12:00:00Z"
        required: false
        schema:
          type: string
      - name: before
        in: query
        description: Delete entries and files created before this instant
        required: false
        schema:
          type: string
      - name: X-Owner-Token
        in: header
        description: Owner token returned at creation
      - name: X-Manage-Key
        in: header
        description: Management key of this publication
      responses:
        "200":
          description: "Deleted: {deleted: n}, entries and files together"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/StateDeleteResponse"
        "400":
          description: "STATE_INVALID: list name or time has a mistake, or neither\
            \ bound was sent"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "403":
          description: "Owner token revoked or expired; or OWNER_AUTHORIZATION_FAILED:\
            \ a public publication you do not own"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: "PUBLICATION_UNAVAILABLE: no such HTML page or site, not yours,\
            \ hidden or expired"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "503":
          description: "STATE_UNAVAILABLE: page data is switched off for now; wait\
            \ Retry-After"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "429":
          description: "Rate limited: wait Retry-After (= retryAfterSeconds); no account:\
            \ accountUrl, free sign-up with higher limits"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - OwnerToken: []
      - ManageKey: []
  /api/{ns}/{id}/state/{col}/_stats:
    get:
      tags:
      - Page data
      summary: Read page data totals
      description: "Number of entries in one list, every visitor's and yours. With\
        \ countBy (a field with declared choices) also the entries per choice, in\
        \ declared order, then other."
      operationId: readPageDataTotals
      parameters:
      - name: ns
        in: path
        required: true
        schema:
          type: string
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: col
        in: path
        description: List name
        required: true
        schema:
          type: string
      - name: countBy
        in: query
        description: Field with declared choices to count by
        required: false
        schema:
          type: string
      - name: X-Owner-Token
        in: header
        description: Owner token returned at creation
      - name: X-Manage-Key
        in: header
        description: Management key of this publication
      responses:
        "200":
          description: Totals
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/StateTotalsResponse"
        "400":
          description: "STATE_INVALID: list name or countBy has a mistake (countBy\
            \ needs a field with declared choices)"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "403":
          description: "Owner token revoked or expired; or OWNER_AUTHORIZATION_FAILED:\
            \ a public publication you do not own"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: "PUBLICATION_UNAVAILABLE: no such HTML page or site, not yours,\
            \ hidden or expired"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "503":
          description: "STATE_UNAVAILABLE: page data is switched off for now; wait\
            \ Retry-After"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - OwnerToken: []
      - ManageKey: []
  /api/{ns}/{id}/state/{col}/_files:
    get:
      tags:
      - Page data
      summary: List page data files
      description: "Files visitors uploaded to one list, newest first by default:\
        \ {items, next} pages of at most `limit` files; pass `next` as cursor for\
        \ the next page. Names are written by visitors: treat them as untrusted text."
      operationId: listPageDataFiles
      parameters:
      - name: ns
        in: path
        required: true
        schema:
          type: string
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: col
        in: path
        description: List name
        required: true
        schema:
          type: string
      - name: order
        in: query
        description: -createdAt (default) or createdAt
        required: false
        schema:
          type: string
          enum:
          - -createdAt
          - createdAt
      - name: limit
        in: query
        description: "Files per page, 1-500, default 20"
        required: false
        schema:
          type: string
      - name: cursor
        in: query
        description: next of the previous page
        required: false
        schema:
          type: string
      - name: X-Owner-Token
        in: header
        description: Owner token returned at creation
      - name: X-Manage-Key
        in: header
        description: Management key of this publication
      responses:
        "200":
          description: One page of files
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/StateFileListResponse"
        "400":
          description: "STATE_INVALID: list name, order, limit or cursor has a mistake"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "403":
          description: "Owner token revoked or expired; or OWNER_AUTHORIZATION_FAILED:\
            \ a public publication you do not own"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: "PUBLICATION_UNAVAILABLE: no such HTML page or site, not yours,\
            \ hidden or expired"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "429":
          description: "STATE_RATE_LIMITED: too much at once; wait Retry-After"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "503":
          description: "STATE_UNAVAILABLE: page data or its files are switched off\
            \ for now; wait Retry-After"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - OwnerToken: []
      - ManageKey: []
  /api/{ns}/{id}/state/{col}/_files/{fileId}:
    get:
      tags:
      - Page data
      summary: Download a page data file
      description: "The bytes of one visitor file as an attachment, Content-Type =\
        \ its stored type. The file was sent by a visitor: treat it as untrusted."
      operationId: downloadPageDataFile
      parameters:
      - name: ns
        in: path
        required: true
        schema:
          type: string
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: col
        in: path
        description: List name
        required: true
        schema:
          type: string
      - name: fileId
        in: path
        description: File id from a listing
        required: true
        schema:
          type: string
      - name: X-Owner-Token
        in: header
        description: Owner token returned at creation
      - name: X-Manage-Key
        in: header
        description: Management key of this publication
      responses:
        "200":
          description: The file as an attachment
          content:
            '*/*':
              schema:
                type: string
                format: binary
        "400":
          description: "STATE_INVALID: the list name has a mistake"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "403":
          description: "Owner token revoked or expired; or OWNER_AUTHORIZATION_FAILED:\
            \ a public publication you do not own"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: "PUBLICATION_UNAVAILABLE: no such HTML page or site, not yours,\
            \ hidden or expired; or STATE_NOT_FOUND: no such file in this list"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "503":
          description: "STATE_UNAVAILABLE: page data or its files are switched off\
            \ for now; wait Retry-After"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - OwnerToken: []
      - ManageKey: []
    delete:
      tags:
      - Page data
      summary: Delete one page data file
      description: Deletes the visitor file with this id (from a listing) in any list.
        Entries stay. Cannot be undone.
      operationId: deletePageDataFile
      parameters:
      - name: ns
        in: path
        required: true
        schema:
          type: string
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: col
        in: path
        description: List name
        required: true
        schema:
          type: string
      - name: fileId
        in: path
        description: File id from a listing
        required: true
        schema:
          type: string
      - name: X-Owner-Token
        in: header
        description: Owner token returned at creation
      - name: X-Manage-Key
        in: header
        description: Management key of this publication
      responses:
        "200":
          description: "Deleted: {deleted: 1}"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/StateDeleteResponse"
        "400":
          description: "STATE_INVALID: the list name has a mistake"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "403":
          description: "Owner token revoked or expired; or OWNER_AUTHORIZATION_FAILED:\
            \ a public publication you do not own"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: "PUBLICATION_UNAVAILABLE: no such HTML page or site, not yours,\
            \ hidden or expired; or STATE_NOT_FOUND: no such file in this list"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "503":
          description: "STATE_UNAVAILABLE: page data or its files are switched off\
            \ for now; wait Retry-After"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "429":
          description: "Rate limited: wait Retry-After (= retryAfterSeconds); no account:\
            \ accountUrl, free sign-up with higher limits"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - OwnerToken: []
      - ManageKey: []
  /api/{ns}/{id}/owner-check:
    get:
      tags:
      - Owner Check
      summary: Verify whether the supplied X-Owner-Token or X-Manage-Key owns the
        resource
      description: "Returns `{isOwner, type}`, plus `format` for an `html`-type resource.\
        \ 404 or 410 exactly as reading the resource would answer. 200 with `isOwner:false`\
        \ when no credential is sent or it does not own the resource."
      operationId: ownerCheck
      parameters:
      - name: ns
        in: path
        required: true
        schema:
          type: string
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: X-Owner-Token
        in: header
        description: Owner token to verify
      - name: X-Manage-Key
        in: header
        description: Management key to verify
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/OwnerCheckResponse"
      security:
      - {}
      - OwnerToken: []
      - ManageKey: []
  /api/templates:
    get:
      tags:
      - Templates
      summary: Find a template
      description: "Lists the official templates that are published now. With `q`,\
        \ returns the best matches (at most 3, `matched: true`); without `q` or when\
        \ nothing matches, returns every template with `matched: false`. Each item\
        \ gives `sourceUrl` (the HTML source as plain text), `demoUrl`, `pageUrl`,\
        \ `data` (what it saves and who sees it), `useWhen`, `copies` (pages published\
        \ from it) and the `state` its copy needs. To publish a copy, follow `publish`:\
        \ change the source as the user asks, POST it to the item's `publishUrl` with\
        \ the item's `state`, then give the user `link` and `manageUrl` (private)."
      operationId: templates
      parameters:
      - name: q
        in: query
        description: "Free text, percent-encoded: a few English words for the page\
          \ the user wants, e.g. `wedding rsvp`. At most 200 characters; the first\
          \ 12 words count. An invalid percent escape answers 400."
        required: false
        schema:
          type: string
        example: wedding rsvp
      responses:
        "200":
          description: Templates and the publish recipe
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TemplateCatalogResponse"
      security:
      - {}
  /api/stats:
    get:
      tags:
      - Stats
      summary: Get platform stats
      description: Returns today's and all-time creation/view counts with per-type
        breakdown. Optional 'tz' query param (IANA id) controls the boundary of 'today';
        defaults to UTC.
      operationId: getStats
      parameters:
      - name: tz
        in: query
        description: "IANA timezone id for the 'today' boundary. Defaults to UTC.\
          \ Example: Europe/Lisbon"
        required: false
        schema:
          type: string
      responses:
        "200":
          description: Platform statistics
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/StatsResponse"
      security:
      - {}
  /api/sitemap.xml:
    get:
      tags:
      - SEO
      summary: Sitemap index
      description: "sitemaps.org 0.9 sitemapindex, byte-equal to /sitemap-index.xml:\
        \ lists /sitemap-pages.xml, /sitemap-publications.xml and /sitemap-images.xml.\
        \ Advertised in robots.txt. Caddy should route /sitemap.xml to this endpoint."
      operationId: sitemap
      responses:
        "200":
          description: Sitemap index XML
          content:
            application/xml:
              schema:
                type: string
      security:
      - {}
  /api/sitemap-publications.xml:
    get:
      tags:
      - SEO
      summary: Public publications sitemap
      description: "Every qualifying public publication at its primary link, with\
        \ lastmod = last content change when known. Caddy should route /sitemap-publications.xml\
        \ to this endpoint."
      operationId: sitemapPublications
      responses:
        "200":
          description: Sitemap XML
          content:
            application/xml:
              schema:
                type: string
      security:
      - {}
  /api/sitemap-pages.xml:
    get:
      tags:
      - SEO
      summary: Site pages sitemap
      description: "BrewPage's own pages: home, guides, comparisons, templates, landing\
        \ pages, llms files and, while public publications are listed, /galleries.\
        \ Caddy should route /sitemap-pages.xml to this endpoint."
      operationId: sitemapPages
      responses:
        "200":
          description: Sitemap XML
          content:
            application/xml:
              schema:
                type: string
      security:
      - {}
  /api/sitemap-index.xml:
    get:
      tags:
      - SEO
      summary: Top-level sitemap index
      description: "sitemaps.org 0.9 sitemapindex, byte-equal to /sitemap.xml: lists\
        \ /sitemap-pages.xml, /sitemap-publications.xml and /sitemap-images.xml. Caddy\
        \ should route /sitemap-index.xml to this endpoint."
      operationId: sitemapIndex
      responses:
        "200":
          description: Sitemap index XML
          content:
            application/xml:
              schema:
                type: string
      security:
      - {}
  /api/sitemap-images.xml:
    get:
      tags:
      - SEO
      summary: Google image-sitemap
      description: Per-content OG preview URLs (sitemap-image/1.1) for every qualifying
        public HTML/site publication. Reuses the publishable-items Caffeine cache
        slot shared with /sitemap-publications.xml. Caddy should route /sitemap-images.xml
        to this endpoint.
      operationId: sitemapImages
      responses:
        "200":
          description: Image sitemap XML
          content:
            application/xml:
              schema:
                type: string
      security:
      - {}
  /api/publications:
    get:
      tags:
      - Publications
      summary: List my publications
      description: Rows of the owner token; a profile token lists the whole profile.
        Newest first.
      operationId: listPublications
      parameters:
      - name: type
        in: query
        description: "html, site, file, json or kv"
        required: false
        schema:
          type: string
          enum:
          - html
          - site
          - file
          - json
          - kv
      - name: status
        in: query
        description: "public, hidden, private, password or unavailable"
        required: false
        schema:
          type: string
          enum:
          - public
          - hidden
          - private
          - password
          - unavailable
      - name: q
        in: query
        description: Title search
        required: false
        schema:
          type: string
      - name: expiring
        in: query
        description: Only rows expiring within 7 days
        required: false
        schema:
          type: boolean
          default: false
      - name: cursor
        in: query
        description: nextCursor of the previous page
        required: false
        schema:
          type: string
      - name: limit
        in: query
        description: "Page size, 1-24 (default 24)"
        required: false
        schema:
          type: integer
          format: int32
      - name: X-Owner-Token
        in: header
        description: Owner token
        required: true
      responses:
        "200":
          description: One page
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PublicationListResponse"
        "400":
          description: Invalid filter or cursor
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "403":
          description: Owner token revoked or expired
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - OwnerToken: []
  /api/publications/{type}/{ns}/{id}/preview/{variant}.webp:
    get:
      tags:
      - preview
      summary: Owner WebP preview
      description: Real content of password rows for the owner (X-Owner-Token or X-Manage-Key);
        others get the public variant
      operationId: ownerPreviewWebp
      parameters:
      - name: type
        in: path
        required: true
        schema:
          type: string
          enum:
          - html
          - site
          - file
          - json
          - kv
      - name: ns
        in: path
        required: true
        schema:
          type: string
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: variant
        in: path
        required: true
        schema:
          type: string
          enum:
          - thumb-d
          - thumb-m
          - full
      - name: v
        in: query
        description: Version from a server-built URL
        required: false
        schema:
          type: string
      - name: If-None-Match
        in: header
        required: false
        schema:
          type: string
      - name: X-Owner-Token
        in: header
        description: Owner token
        required: false
        schema:
          type: string
      - name: X-Manage-Key
        in: header
        description: Management key
        required: false
        schema:
          type: string
      responses:
        "200":
          description: WebP bytes
          content:
            image/webp:
              schema:
                type: string
                format: binary
        "304":
          description: Not modified
        "404":
          description: No preview or not the owner
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "429":
          description: Owner rate limit exceeded
      security:
      - OwnerToken: []
      - ManageKey: []
  /api/publications/{type}/{ns}/{id}/stats:
    get:
      tags:
      - Publications
      summary: Publication stats
      description: "Daily humans/automated, visitors, hours, devices, link previews,\
        \ countries, referrer hosts"
      operationId: getPublicationStats
      parameters:
      - name: type
        in: path
        required: true
        schema:
          type: string
          enum:
          - html
          - site
          - file
          - json
          - kv
      - name: ns
        in: path
        required: true
        schema:
          type: string
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: range
        in: query
        description: "Days: 7, 30 or 90"
        required: false
        schema:
          type: integer
          format: int32
          default: 30
      - name: tz
        in: query
        description: IANA time zone for hours (default UTC)
        required: false
        schema:
          type: string
      - name: X-Owner-Token
        in: header
        description: Owner token
      - name: X-Manage-Key
        in: header
        description: Management key
      responses:
        "200":
          description: Stats for the range
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PublicationStatsReport"
        "400":
          description: Invalid range or tz
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: Not found or not the owner
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - OwnerToken: []
      - ManageKey: []
  /api/profile/notifications:
    get:
      tags:
      - Notifications
      summary: List notifications
      description: "Newest first, {items, nextCursor, unread} pages of at most `limit`\
        \ items; pass nextCursor as cursor for the next page."
      operationId: listNotifications
      parameters:
      - name: section
        in: query
        description: notices or activity; absent = both
        required: false
        schema:
          type: string
          enum:
          - notices
          - activity
      - name: unread
        in: query
        description: "true: unread items only"
        required: false
        schema:
          type: boolean
          default: false
      - name: cursor
        in: query
        description: nextCursor of the previous page
        required: false
        schema:
          type: string
      - name: limit
        in: query
        description: "Items per page, 1-50, default 20"
        required: false
        schema:
          type: integer
          format: int32
          default: 20
      - name: X-Owner-Token
        in: header
        description: Owner token added to exactly one BrewPage profile
        required: true
      responses:
        "200":
          description: One page
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/NotificationListResponse"
        "400":
          description: "section, limit or cursor has a mistake"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "403":
          description: "PROFILE_TOKEN_REQUIRED: no token, or a token not added to\
            \ exactly one profile; or the token is revoked or expired"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: Profiles are not available
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "429":
          description: "Rate limited: wait Retry-After (= retryAfterSeconds)"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - OwnerToken: []
  /api/profile/notifications/unread-count:
    get:
      tags:
      - Notifications
      summary: Count unread notifications
      description: "Unread notices, at most 99."
      operationId: countUnreadNotifications
      parameters:
      - name: X-Owner-Token
        in: header
        description: Owner token added to exactly one BrewPage profile
        required: true
      responses:
        "200":
          description: Unread count
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/NotificationUnreadResponse"
        "403":
          description: "PROFILE_TOKEN_REQUIRED: no token, or a token not added to\
            \ exactly one profile; or the token is revoked or expired"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: Profiles are not available
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "429":
          description: "Rate limited: wait Retry-After (= retryAfterSeconds)"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - OwnerToken: []
  /api/owner-token:
    get:
      tags:
      - Owner Token
      summary: Mint a fresh owner token and its derived owner id
      description: "Returns `{token, ownerId}` where `token` is a 32-char base62 owner\
        \ token and `ownerId` is its 64-char lowercase SHA-256 hex. Stateless: nothing\
        \ is persisted. Send the returned token as `X-Owner-Token` when publishing\
        \ to claim ownership."
      operationId: generateOwnerToken
      responses:
        "200":
          description: Fresh owner token minted
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/OwnerTokenResponse"
        "429":
          description: Rate limit exceeded for this IP
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - {}
  /api/namespace/random:
    get:
      tags:
      - Namespace
      summary: Suggest a random namespace
      description: Returns a fresh `<word>-<word>-NN` namespace from the EFF Short
        Wordlist that does not collide with any existing resource. Pure read; no resource
        is allocated.
      operationId: randomNamespace
      responses:
        "200":
          description: Namespace suggested
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RandomNamespaceResponse"
        "503":
          description: Namespace pool exhausted — retry budget hit consecutive collisions
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - {}
  /api/limits:
    get:
      tags:
      - Limits
      summary: Upload limits per type
      description: "Returns the size, count, TTL and file-type limits for HTML, JSON,\
        \ KV, files and sites. Sizes are bytes; `maxTotalBytes` counts uncompressed\
        \ files, `maxArchiveExpansionBytes` every inflated ZIP byte including skipped\
        \ system files (`skippedFileNames`, `skippedRootFolders`), which never count\
        \ toward the limits. `reach` is always sent: `profile` only for an `X-Owner-Token`\
        \ active in a profile, else `token`; `ownerMaxTtlDays` only for a usable `X-Owner-Token`;\
        \ an unusable token gets the anonymous answer."
      operationId: getLimits
      parameters:
      - name: X-Owner-Token
        in: header
        description: Optional owner token
      responses:
        "200":
          description: Current upload limits
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LimitsResponse"
        "429":
          description: Rate limit exceeded for this IP
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - {}
      - OwnerToken: []
  /api/kv/{ns}/{id}:
    get:
      tags:
      - KV
      summary: List keys
      description: Returns all key names and total count for a store
      operationId: listKeys
      parameters:
      - name: ns
        in: path
        required: true
        schema:
          type: string
          pattern: "^[a-z0-9-]{1,32}$"
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: X-Password
        in: header
        description: Access password via header
        required: false
        schema:
          type: string
      - name: p
        in: query
        description: Legacy-only query password; ignored for NEW publications. Programmatic
          access uses X-Password or the owner token.
        required: false
        schema:
          type: string
      - name: User-Agent
        in: header
        required: false
        schema:
          type: string
      - name: X-Owner-Token
        in: header
        description: Owner token to bypass password protection when no password supplied
        required: false
        schema:
          type: string
      responses:
        "200":
          description: Key list
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/KvListKeysResponse"
        "403":
          description: Wrong password
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: Store not found or expired
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "410":
          description: Public publication deleted or expired
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - {}
      - OwnerToken: []
      - Password: []
    delete:
      tags:
      - KV
      summary: Delete entire KV bucket (all keys under ns/id)
      description: Permanently removes all keys in the store; requires the owner token
        returned at creation or the management key
      operationId: deleteKvStore
      parameters:
      - name: ns
        in: path
        required: true
        schema:
          type: string
          pattern: "^[a-z0-9-]{1,32}$"
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: X-Owner-Token
        in: header
        description: Owner token returned at creation
      - name: X-Manage-Key
        in: header
        description: Management key of this store
      responses:
        "204":
          description: Bucket deleted
        "403":
          description: Missing or wrong owner token or management key
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: Store not found or expired
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "429":
          description: "Rate limited: wait Retry-After (= retryAfterSeconds)"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - OwnerToken: []
      - ManageKey: []
  /api/html/{ns}/{id}/source:
    get:
      tags:
      - HTML
      summary: Get HTML page raw source
      description: "Returns the stored source content (pre-render, pre-sanitize; a\
        \ chat-pasted page as repaired at publish unless sent with verbatim=true)\
        \ plus metadata for republish. Owner-only: the owner token or the management\
        \ key."
      operationId: getHtmlSource
      parameters:
      - name: ns
        in: path
        required: true
        schema:
          type: string
          pattern: "^[a-z0-9-]{1,32}$"
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: X-Owner-Token
        in: header
        description: Owner token returned at creation
      - name: X-Manage-Key
        in: header
        description: Management key of this publication
      responses:
        "200":
          description: Raw source body and metadata
          content:
            '*/*':
              schema:
                type: object
        "400":
          description: "No owner token or management key (code: OWNER_TOKEN_REQUIRED)"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "403":
          description: Wrong owner token (public namespace)
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: "Page unavailable: missing, expired, or not proven outside\
            \ public"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - OwnerToken: []
      - ManageKey: []
  /api/html/{ns}/{id}/settings:
    get:
      tags:
      - HTML
      summary: Get HTML page settings
      description: "Returns republish-prefill settings (namespace, ttlDays, hasPassword,\
        \ showTopBar, format, title, filename, createdAt, expiresAt, readOnly) without\
        \ the content body. Owner-only: the owner token or the management key."
      operationId: getHtmlSettings
      parameters:
      - name: ns
        in: path
        required: true
        schema:
          type: string
          pattern: "^[a-z0-9-]{1,32}$"
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: X-Owner-Token
        in: header
        description: Owner token returned at creation
      - name: X-Manage-Key
        in: header
        description: Management key of this publication
      responses:
        "200":
          description: Settings projection
          content:
            '*/*':
              schema:
                type: object
        "400":
          description: "No owner token or management key (code: OWNER_TOKEN_REQUIRED)"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "403":
          description: Wrong owner token (public namespace)
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: "Page unavailable: missing, expired, or not proven outside\
            \ public"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - OwnerToken: []
      - ManageKey: []
  /api/hosts/{host}/owner-check:
    get:
      tags:
      - Owner Check
      summary: Verify whether the supplied X-Owner-Token or X-Manage-Key owns the
        publication on a host
      description: "200 `{isOwner:false}` alike for unknown, retired, hidden and not-owned\
        \ hosts; an owner gets `{isOwner:true, type, namespace, id}`."
      operationId: hostOwnerCheck
      parameters:
      - name: host
        in: path
        required: true
        schema:
          type: string
      - name: X-Owner-Token
        in: header
        description: Owner token to verify
      - name: X-Manage-Key
        in: header
        description: Management key to verify
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/HostOwnerCheckResponse"
      security:
      - {}
      - OwnerToken: []
      - ManageKey: []
  /api/gallery:
    get:
      tags:
      - Gallery
      summary: Browse gallery
      description: "Lists live public publications (pages, files, sites; public namespace,\
        \ no password, not hidden by the owner) with optional case-insensitive search\
        \ by title (filename for files, id when untitled). When `mine=true` and `X-Owner-Token`\
        \ is supplied, returns all of the caller's live pages, files and sites in\
        \ any namespace, including password-protected ones (a token active in a profile\
        \ lists the profile's rows; `scope` says which); each item carries its real\
        \ `namespace`, a `visibility` of my_public, my_public_password or my_private,\
        \ and `listed`. Key-value and JSON stores, JSON pages and files, and HTML\
        \ files kept as source are never listed."
      operationId: getGallery
      parameters:
      - name: q
        in: query
        description: "Case-insensitive substring search by title (filename for files,\
          \ id when untitled)"
        required: false
        schema:
          type: string
      - name: page
        in: query
        description: Page number (1-based)
        required: false
        schema:
          type: integer
          format: int32
          default: 1
        example: 1
      - name: size
        in: query
        description: Items per page (max 100)
        required: false
        schema:
          type: integer
          format: int32
          default: 20
        example: 20
      - name: sort
        in: query
        description: "Sort order: 'date' (newest first, default) or 'views' (most\
          \ viewed first)"
        required: false
        schema:
          type: string
          default: date
        example: date
      - name: mine
        in: query
        description: "When true, list the caller's own publications in any namespace\
          \ instead of the public gallery (requires X-Owner-Token)"
        required: false
        schema:
          type: boolean
      - name: X-Owner-Token
        in: header
        description: "Owner token; required when mine=true, which without it returns\
          \ an empty page"
      responses:
        "200":
          description: Paginated gallery items
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/GalleryResponse"
      security:
      - {}
      - OwnerToken: []
  /api/gallery/promo:
    get:
      tags:
      - Gallery
      summary: Pinned examples
      description: "BrewPage's own example publications shown above and below the\
        \ public gallery: captions, the current period, a default set of slugs for\
        \ the top and bottom blocks (also the block shape), and every live item with\
        \ its weight. Clients draw the cards by weight on every page load. Empty slots\
        \ and items when no example is configured."
      operationId: getPromo
      responses:
        "200":
          description: Example blocks of the current period
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/GalleryPromoResponse"
      security:
      - {}
  /api/domains/{hostname}:
    get:
      tags:
      - Custom Domains
      summary: One custom domain of the profile
      description: "Reads one custom domain of the profile as last checked; POST /api/domains/{hostname}/check\
        \ refreshes it."
      operationId: getDomain
      parameters:
      - name: hostname
        in: path
        description: "Hostname, e.g. www.example.com (Unicode or ASCII form)"
        required: true
        schema:
          type: string
      - name: X-Owner-Token
        in: header
        description: Admin token of your BrewPage profile
        required: true
      responses:
        "200":
          description: The custom domain
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DomainItem"
        "403":
          description: "Missing token, or ADMIN_TOKEN_REQUIRED: not an admin token\
            \ of a profile; OWNER_TOKEN_REVOKED or OWNER_TOKEN_EXPIRED"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: "DOMAIN_NOT_FOUND: the hostname is not in this profile; FEATURE_DISABLED:\
            \ custom domains are not available right now"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - OwnerToken: []
    delete:
      tags:
      - Custom Domains
      summary: Remove a hostname from the profile
      description: Removes the hostname from the profile; the slot is free at once.
        Remove its DNS records afterwards if you no longer need them.
      operationId: removeDomain
      parameters:
      - name: hostname
        in: path
        description: "Hostname, e.g. www.example.com (Unicode or ASCII form)"
        required: true
        schema:
          type: string
      - name: X-Owner-Token
        in: header
        description: Admin token of your BrewPage profile
        required: true
      responses:
        "204":
          description: Removed
        "403":
          description: "Missing token, or ADMIN_TOKEN_REQUIRED: not an admin token\
            \ of a profile; OWNER_TOKEN_REVOKED or OWNER_TOKEN_EXPIRED; ACCOUNT_RESTRICTED\
            \ or ACCOUNT_BLOCKED: this profile cannot add domains now"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: "DOMAIN_NOT_FOUND: the hostname is not in this profile; FEATURE_DISABLED:\
            \ custom domains are not available right now"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "409":
          description: "DOMAIN_SUSPENDED: BrewPage suspended this domain; write to\
            \ info@brewpage.app"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "429":
          description: "Rate limited: wait Retry-After (= retryAfterSeconds)"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - OwnerToken: []
  /api/{ns}/{id}/state/{col}/docs/{docId}:
    delete:
      tags:
      - Page data
      summary: Delete one page data entry
      description: "Deletes the entry with this id (from a listing) in any list, visitors'\
        \ private entries included. Cannot be undone."
      operationId: deletePageDataEntry
      parameters:
      - name: ns
        in: path
        required: true
        schema:
          type: string
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: col
        in: path
        description: List name
        required: true
        schema:
          type: string
      - name: docId
        in: path
        description: Entry id from a listing
        required: true
        schema:
          type: string
      - name: X-Owner-Token
        in: header
        description: Owner token returned at creation
      - name: X-Manage-Key
        in: header
        description: Management key of this publication
      responses:
        "200":
          description: "Deleted: {deleted: 1}"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/StateDeleteResponse"
        "400":
          description: "STATE_INVALID: the list name has a mistake"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "403":
          description: "Owner token revoked or expired; or OWNER_AUTHORIZATION_FAILED:\
            \ a public publication you do not own"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: "PUBLICATION_UNAVAILABLE: no such HTML page or site, not yours,\
            \ hidden or expired; or STATE_NOT_FOUND: no such entry in this list"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "503":
          description: "STATE_UNAVAILABLE: page data is switched off for now; wait\
            \ Retry-After"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "429":
          description: "Rate limited: wait Retry-After (= retryAfterSeconds); no account:\
            \ accountUrl, free sign-up with higher limits"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - OwnerToken: []
      - ManageKey: []
  /api/sites/{ns}/{id}/files/{filePath}:
    get:
      tags:
      - Sites
      summary: Serve site file
      description: Serves an individual file from the site with correct content type
      operationId: serveSiteFile
      parameters:
      - name: ns
        in: path
        required: true
        schema:
          type: string
          pattern: "^[a-z0-9-]{1,32}$"
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: X-Password
        in: header
        description: Access password via header
        required: false
        schema:
          type: string
      - name: p
        in: query
        description: Legacy-only query password; ignored for NEW publications. Programmatic
          access uses X-Password or the owner token.
        required: false
        schema:
          type: string
      - name: User-Agent
        in: header
        required: false
        schema:
          type: string
      - name: X-Owner-Token
        in: header
        description: Owner token to bypass password protection when no password supplied
        required: false
        schema:
          type: string
      - name: Range
        in: header
        required: false
        schema:
          type: string
      - name: filePath
        in: path
        description: "Relative file path, including nested directories; encode each\
          \ segment and retain slash separators."
        required: true
        schema:
          type: string
      responses:
        "200":
          description: File content
          content:
            '*/*':
              schema:
                type: object
        "403":
          description: Wrong password
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: Site or file not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "410":
          description: Public publication deleted or expired
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
      - {}
      - OwnerToken: []
      - Password: []
components:
  schemas:
    StateWriteResponse:
      type: object
      properties:
        key:
          type: string
        id:
          type: string
        version:
          type: integer
          format: int32
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
      required:
      - createdAt
      - id
      - key
      - updatedAt
      - version
    PublicationResult:
      type: object
      description: "Publication outcome: code, action and optional reason. Action\
        \ merged means an existing publication was returned instead of a new one."
      properties:
        code:
          type: string
          enum:
          - success
          - duplicate
          - failed
        action:
          type: string
          enum:
          - created
          - created_missing_assets
          - updated
          - merged
          - unavailable
          - rate_limited
          - rejected
        reason:
          type: string
        extras:
          type: object
          additionalProperties: {}
      required:
      - action
      - code
    SiteUpdateResponse:
      type: object
      properties:
        id:
          type: string
          description: Unique 10-character alphanumeric site ID
        namespace:
          type: string
        link:
          type: string
          description: Primary URL returned for browser viewing and sharing
        ownerLink:
          type: string
          description: "API URL for programmatic access (info, update, delete)"
        entryFile:
          type: string
          description: Entry HTML file resolved from the upload (e.g. index.html)
        title:
          type: string
          description: "Entry page title: <title>, else first heading or text; absent\
            \ if none."
        fileCount:
          type: integer
          format: int32
        totalSizeBytes:
          type: integer
          format: int64
        expiresAt:
          type: string
          format: date-time
        tags:
          type: array
          items:
            type: string
        result:
          description: "Publication outcome: code + action + optional reason."
          oneOf:
          - $ref: "#/components/schemas/PublicationResult"
        visibilityNotice:
          type: string
          description: "Link access in words, e.g. 'Public: listed in the gallery\
            \ and sitemap; search engines can index it.' (public html, site and file\
            \ add an unlist hint), 'Public: anyone with the link. Not listed.' (public\
            \ json, kv, json pages, json and html files), 'Private: not listed. Only\
            \ via your unique private link.' or 'Password: link + password.'"
        listed:
          type: boolean
          description: "true = listed in the gallery and sitemap now (public, no password,\
            \ not hidden)."
        managementLink:
          type:
          - string
          - "null"
        routingCohort:
          type: string
        deliveryMode:
          type:
          - string
          - "null"
        requestedDeliveryMode:
          type:
          - string
          - "null"
        effectiveDeliveryMode:
          type:
          - string
          - "null"
        deliveryModeMatched:
          type:
          - boolean
          - "null"
        access:
          type: string
          description: "public: html, site and file listed in gallery and sitemap.\
            \ unlisted: private, not listed. protected: link + password."
          enum:
          - public
          - unlisted
          - protected
        modeLocked:
          type: boolean
        hostingVersion:
          type:
          - integer
          - "null"
          format: int64
        deliveryModeReason:
          type: string
          description: "Why this mode is in effect:'policy:subdomain-required', 'policy:mode-locked',\
            \ 'policy:classic-link', 'policy:version-stale', 'policy:republish-keeps-mode',\
            \ 'policy:custom-domain-attached' or 'policy:state-declared'. Absent when\
            \ nothing applies."
        deliveryNotice:
          type: string
          description: Human-readable explanation of deliveryModeReason. Absent whenever
            deliveryModeReason is absent.
        notices:
          type: array
          description: Advisories about the request or its result; omitted when none.
          items:
            $ref: "#/components/schemas/PublishNotice"
      required:
      - access
      - deliveryMode
      - deliveryModeMatched
      - effectiveDeliveryMode
      - entryFile
      - expiresAt
      - fileCount
      - hostingVersion
      - id
      - link
      - listed
      - managementLink
      - modeLocked
      - namespace
      - ownerLink
      - requestedDeliveryMode
      - routingCohort
      - tags
      - totalSizeBytes
    SetDomainRequest:
      type: object
      description: Set a hostname on this publication (adds it to the profile or moves
        an own one).
      properties:
        hostname:
          type: string
          description: "Hostname to connect, e.g. www.example.com or example.com;\
            \ Unicode names accepted"
      required:
      - hostname
    DomainAttachedTo:
      type: object
      description: Publication a custom domain shows.
      properties:
        type:
          type: string
          description: html or site
        namespace:
          type: string
        id:
          type: string
        link:
          type: string
          description: BrewPage link of the publication; keeps working next to the
            custom domain
        title:
          type: string
      required:
      - id
      - link
      - namespace
      - type
    DomainItem:
      type: object
      description: "A custom domain of a profile and what to do next (`nextStep`):\
        \ create the `records[]` in DNS, call the check route once, then read the\
        \ domain until `status` is `active`."
      properties:
        hostname:
          type: string
          description: "Hostname in ASCII (A-label), lowercase, e.g. www.example.com"
        displayHostname:
          type: string
          description: Unicode form for display
        apex:
          type: boolean
          description: "true when the hostname is the registered domain itself (example.com):\
            \ routing uses an A or ALIAS record instead of CNAME"
        status:
          type: string
          description: "pending_dns (create the records), verifying (DNS found, certificate\
            \ being issued), active (serving) or lost (records broke after activation;\
            \ still served until graceEndsAt, then disconnected: restore the records\
            \ and check again)"
          enum:
          - pending_dns
          - verifying
          - active
          - lost
        suspended:
          type: boolean
          description: "true when BrewPage suspended this domain: it does not serve\
            \ and cannot be checked, moved or removed; write to info@brewpage.app"
        problem:
          type: string
          description: "What blocks progress now, absent when nothing does: DOMAIN_NOT_REGISTERED\
            \ (the domain does not exist yet; register it with a domain registrar,\
            \ then create the records), TXT_MISSING, TXT_WRONG, ROUTING_MISSING, ROUTING_WRONG,\
            \ FOREIGN_AAAA, CAA_BLOCKS (fix the matching row of records[]), DOMAIN_TAKEN\
            \ (this hostname is not available: use another hostname or write to info@brewpage.app),\
            \ QUEUE_FULL (DNS is right, verification waits its turn; retried automatically),\
            \ CERT_PENDING (certificate on its way), CERT_FAILED (certificate could\
            \ not be issued; check DNS, then check again), DNS_LOST (records stayed\
            \ broken past graceEndsAt, so the domain was disconnected; restore them\
            \ and check again), CHECK_PAUSED (checks paused after long failure; the\
            \ check route resumes them), RESOLVER_UNAVAILABLE (DNS did not answer;\
            \ retried), PUBLICATION_GONE (attach another publication), NOT_ELIGIBLE_<reason>\
            \ (the publication cannot take a custom domain; reasons as ErrorResponse.reason)"
        nextStep:
          type: string
          description: "What to do next, in plain English (one to three sentences)\
            \ with the exact routes of this domain, e.g. create the records[] at the\
            \ DNS provider, then POST the check route once and GET this domain until\
            \ `status` is `active`. Follow it and relay it to the user; always present"
        records:
          type: array
          description: "DNS records to create, in order: TXT for ownership, then CNAME\
            \ (subdomain) or A plus optional ALIAS (apex)"
          items:
            $ref: "#/components/schemas/DomainRecord"
        provider:
          type: string
          description: "DNS provider once known: cloudflare, godaddy, namecheap, porkbun,\
            \ squarespace, ionos, hostinger, ovh, route53, dnspod, other"
        attachedTo:
          description: Publication shown on this hostname; absent when none is attached
            or it is gone
          oneOf:
          - $ref: "#/components/schemas/DomainAttachedTo"
        serving:
          type: boolean
          description: true when visitors see the publication on this hostname now
        url:
          type: string
          description: https://<hostname>/ while serving
        checkedAt:
          type: string
          format: date-time
          description: Last DNS check
        nextCheckAt:
          type: string
          format: date-time
          description: Next automatic DNS check; absent while checks are paused
        graceEndsAt:
          type: string
          format: date-time
          description: "While lost: served until this time, then disconnected unless\
            \ the records are restored"
        createdAt:
          type: string
          format: date-time
        deliveryModeChanged:
          type: boolean
          description: "Set answers only: true when the publication moved from its\
            \ BrewPage path address to its own subdomain (required for a custom domain)"
        detached:
          type: string
          description: "Set answers only: hostname that was on this publication before;\
            \ it stays in the profile, unattached"
      required:
      - apex
      - createdAt
      - displayHostname
      - hostname
      - nextStep
      - records
      - serving
      - status
      - suspended
    DomainRecord:
      type: object
      description: "One DNS record to create at your DNS provider exactly as given;\
        \ AAAA and CAA rows appear only when they need fixing. Always take values\
        \ from here, never hard-code them."
      properties:
        type:
          type: string
          description: "TXT (ownership), CNAME, A or ALIAS (routing), AAAA (delete\
            \ it) or CAA (add it where your existing CAA records are)"
          enum:
          - TXT
          - CNAME
          - A
          - ALIAS
          - AAAA
          - CAA
        name:
          type: string
          description: "Full DNS name, e.g. _brewpage.www.example.com"
        host:
          type: string
          description: "Name as DNS panels ask for it, relative to the registered\
            \ domain: www, _brewpage.www or @"
        value:
          type: string
          description: "Value to publish (AAAA: the record found, to delete). The\
            \ apex A value is absent for a few minutes while BrewPage resolves its\
            \ address: create the optional ALIAS row instead, or read the domain again\
            \ later"
        state:
          type: string
          description: "From the last check: ok, missing, wrong (another value found),\
            \ foreign (AAAA record pointing elsewhere: delete it), blocked (CAA record\
            \ forbids the certificate: add this one) or unknown (not checked yet,\
            \ or DNS did not answer)"
          enum:
          - ok
          - missing
          - wrong
          - foreign
          - blocked
          - unknown
        optional:
          type: boolean
          description: "true on the ALIAS (flattened CNAME) alternative to the apex\
            \ A record: create one of the two"
      required:
      - host
      - name
      - state
      - type
    NotificationSettingsRequest:
      type: object
      properties:
        enabled:
          type:
          - boolean
          - "null"
          description: Notifications on or off; absent keeps it
        channel:
          type:
          - string
          - "null"
          description: site or site_email; absent keeps it
          enum:
          - site
          - site_email
        groups:
          type:
          - object
          - "null"
          additionalProperties:
            type: boolean
          description: "Groups to turn on or off: pages, entries; absent keeps them"
    NotificationSettingsResponse:
      type: object
      properties:
        enabled:
          type: boolean
          description: "false: no notifications except system messages, which still\
            \ show in the list; no email at all"
        channel:
          type: string
          description: "site: in the list only; site_email: in the list and by email"
          enum:
          - site
          - site_email
        groups:
          type: object
          additionalProperties:
            type: boolean
          description: "Notice groups on or off: pages (expiring, removed, full) and\
            \ entries (new entries)"
        emailAddress:
          type: boolean
          description: True when the profile has an email address to send to
        canEdit:
          type: boolean
          description: True when this token may change the settings (an admin token)
      required:
      - canEdit
      - channel
      - emailAddress
      - enabled
      - groups
    NotificationPageSwitchRequest:
      type: object
      properties:
        entries:
          type:
          - boolean
          - "null"
          description: "true or false: new entries on this page notify or not; null:\
            \ back to the default"
    NotificationPageSwitchResponse:
      type: object
      properties:
        entries:
          type:
          - boolean
          - "null"
          description: "Your choice for this page; null: the default (private lists\
            \ notify, shared lists do not)"
        effective:
          type: boolean
          description: True when a new entry on this page notifies now
      required:
      - effective
      - entries
    KvUpsertKeyRequest:
      type: object
      properties:
        value:
          type: string
          description: New value for the key (max 1 MB)
      required:
      - value
    KvUpsertKeyResponse:
      type: object
      properties:
        id:
          type: string
        namespace:
          type: string
        key:
          type: string
        sizeBytes:
          type: integer
          format: int64
        link:
          type: string
          description: Primary URL returned for browser viewing and sharing of this
            key
        ownerLink:
          type: string
          description: API URL for programmatic access
        visibilityNotice:
          type: string
          description: "Link access in words, e.g. 'Public: listed in the gallery\
            \ and sitemap; search engines can index it.' (public html, site and file\
            \ add an unlist hint), 'Public: anyone with the link. Not listed.' (public\
            \ json, kv, json pages, json and html files), 'Private: not listed. Only\
            \ via your unique private link.' or 'Password: link + password.'"
        listed:
          type: boolean
          description: "Always false: KV is never listed in the gallery or sitemap."
        managementLink:
          type:
          - string
          - "null"
        routingCohort:
          type: string
        deliveryMode:
          type:
          - string
          - "null"
        requestedDeliveryMode:
          type:
          - string
          - "null"
        effectiveDeliveryMode:
          type:
          - string
          - "null"
        deliveryModeMatched:
          type:
          - boolean
          - "null"
        access:
          type: string
          description: "public: html, site and file listed in gallery and sitemap.\
            \ unlisted: private, not listed. protected: link + password."
          enum:
          - public
          - unlisted
          - protected
        modeLocked:
          type: boolean
        hostingVersion:
          type:
          - integer
          - "null"
          format: int64
        deliveryModeReason:
          type: string
          description: "Why this mode is in effect:'policy:subdomain-required', 'policy:mode-locked',\
            \ 'policy:classic-link', 'policy:version-stale', 'policy:republish-keeps-mode',\
            \ 'policy:custom-domain-attached' or 'policy:state-declared'. Absent when\
            \ nothing applies."
        deliveryNotice:
          type: string
          description: Human-readable explanation of deliveryModeReason. Absent whenever
            deliveryModeReason is absent.
        notices:
          type: array
          description: Advisories about the request or its result; omitted when none.
          items:
            $ref: "#/components/schemas/PublishNotice"
      required:
      - access
      - deliveryMode
      - deliveryModeMatched
      - effectiveDeliveryMode
      - hostingVersion
      - id
      - key
      - link
      - listed
      - managementLink
      - modeLocked
      - namespace
      - ownerLink
      - requestedDeliveryMode
      - routingCohort
      - sizeBytes
    JsonUpdateResponse:
      type: object
      properties:
        id:
          type: string
        namespace:
          type: string
        link:
          type: string
          description: Primary URL returned for browser viewing and sharing
        ownerLink:
          type: string
          description: API URL for programmatic access
        sizeBytes:
          type: integer
          format: int64
        updatedAt:
          type: string
          format: date-time
        visibilityNotice:
          type: string
          description: "Link access in words, e.g. 'Public: listed in the gallery\
            \ and sitemap; search engines can index it.' (public html, site and file\
            \ add an unlist hint), 'Public: anyone with the link. Not listed.' (public\
            \ json, kv, json pages, json and html files), 'Private: not listed. Only\
            \ via your unique private link.' or 'Password: link + password.'"
        listed:
          type: boolean
          description: "Always false: JSON is never listed in the gallery or sitemap."
        managementLink:
          type:
          - string
          - "null"
        routingCohort:
          type: string
        deliveryMode:
          type:
          - string
          - "null"
        requestedDeliveryMode:
          type:
          - string
          - "null"
        effectiveDeliveryMode:
          type:
          - string
          - "null"
        deliveryModeMatched:
          type:
          - boolean
          - "null"
        access:
          type: string
          description: "public: html, site and file listed in gallery and sitemap.\
            \ unlisted: private, not listed. protected: link + password."
          enum:
          - public
          - unlisted
          - protected
        modeLocked:
          type: boolean
        hostingVersion:
          type:
          - integer
          - "null"
          format: int64
        deliveryModeReason:
          type: string
          description: "Why this mode is in effect:'policy:subdomain-required', 'policy:mode-locked',\
            \ 'policy:classic-link', 'policy:version-stale', 'policy:republish-keeps-mode',\
            \ 'policy:custom-domain-attached' or 'policy:state-declared'. Absent when\
            \ nothing applies."
        deliveryNotice:
          type: string
          description: Human-readable explanation of deliveryModeReason. Absent whenever
            deliveryModeReason is absent.
        notices:
          type: array
          description: Advisories about the request or its result; omitted when none.
          items:
            $ref: "#/components/schemas/PublishNotice"
      required:
      - access
      - deliveryMode
      - deliveryModeMatched
      - effectiveDeliveryMode
      - hostingVersion
      - id
      - link
      - listed
      - managementLink
      - modeLocked
      - namespace
      - ownerLink
      - requestedDeliveryMode
      - routingCohort
      - sizeBytes
      - updatedAt
    HtmlUpdateRequest:
      type: object
      properties:
        content:
          type: string
          description: New HTML content to replace existing page
        format:
          type:
          - string
          - "null"
          description: "Optional new content format on republish. Accepts 'html',\
            \ 'markdown'/'md', or any code format (yaml, json, xml, csv, tsv, log,\
            \ toml, ini, sql, sh, bat, env, javascript, typescript, tsx, jsx, css,\
            \ properties, docker, txt). When omitted, the row's stored format is preserved.\
            \ Takes precedence over the 'format' query param when both are present."
        state:
          type:
          - object
          - "null"
          description: "Page data settings. Omit to keep them; an object updates the\
            \ lists it names and the limits it sends, other lists keep theirs; null\
            \ turns page data off (saved entries are kept). Page data works on the\
            \ page's own address https://<label>.brewpage.app. JSON body only; invalid\
            \ settings answer 400 and the page is not changed."
      required:
      - content
    HtmlUpdateResponse:
      type: object
      description: HTML update result. NEW publications include hosting metadata;
        OLD publications omit it.
      properties:
        id:
          type: string
        namespace:
          type: string
        link:
          type: string
          description: Primary URL returned for browser viewing and sharing
        ownerLink:
          type: string
          description: API URL for programmatic access
        format:
          type: string
          description: "Stored format after auto-detect: html, markdown or a code\
            \ format; may differ from the requested one. Absent when unknown."
        expiresAt:
          type: string
          format: date-time
        sizeBytes:
          type: integer
          format: int64
        result:
          description: "Publication outcome: code + action + optional reason."
          oneOf:
          - $ref: "#/components/schemas/PublicationResult"
        visibilityNotice:
          type: string
          description: "Link access in words, e.g. 'Public: listed in the gallery\
            \ and sitemap; search engines can index it.' (public html, site and file\
            \ add an unlist hint), 'Public: anyone with the link. Not listed.' (public\
            \ json, kv, json pages, json and html files), 'Private: not listed. Only\
            \ via your unique private link.' or 'Password: link + password.'"
        deliveryModeReason:
          type: string
          description: "Why the delivery mode changed or was flagged. 'policy:subdomain-required'\
            \ -- the update turned a private-namespace page into HTML, so it moved\
            \ to its own subdomain (link is the new address; the old link redirects).\
            \ 'policy:republish-keeps-mode' -- X-Delivery-Mode was ignored; change\
            \ the mode with the hosting operation. 'advisory:<codes>' -- the page\
            \ stays on a BrewPage link but uses browser features that may not work\
            \ fully there. Codes are comma-separated in a fixed order: storage, cookies,\
            \ history, downloads, top-navigation, media-capture, pointer-lock, embeds,\
            \ fullscreen. Absent when nothing applies."
        deliveryNotice:
          type: string
          description: Human-readable explanation of deliveryModeReason. Absent whenever
            deliveryModeReason is absent.
        listed:
          type: boolean
          description: "true = listed in the gallery and sitemap now (public, no password,\
            \ not hidden)."
        listable:
          type: boolean
          description: "false = never listed in the gallery whatever the namespace\
            \ (JSON and KV, JSON pages, HTML and JSON files); listing does not apply"
        managementLink:
          type:
          - string
          - "null"
        routingCohort:
          type: string
        deliveryMode:
          type:
          - string
          - "null"
        requestedDeliveryMode:
          type:
          - string
          - "null"
        effectiveDeliveryMode:
          type:
          - string
          - "null"
        deliveryModeMatched:
          type:
          - boolean
          - "null"
        access:
          type: string
          description: "public: html, site and file listed in gallery and sitemap.\
            \ unlisted: private, not listed. protected: link + password."
          enum:
          - public
          - unlisted
          - protected
        modeLocked:
          type: boolean
        hostingVersion:
          type:
          - integer
          - "null"
          format: int64
        notices:
          type: array
          description: Advisories about the request or its result; omitted when none.
          items:
            $ref: "#/components/schemas/PublishNotice"
      required:
      - expiresAt
      - id
      - link
      - listable
      - listed
      - namespace
      - ownerLink
      - sizeBytes
    FileUpdateResponse:
      type: object
      description: "Replace result. For a file published as a page (notice 'html-file-as-page',\
        \ 'markdown-file-as-page' or 'file-format-applied') the page was replaced"
      properties:
        id:
          type: string
        namespace:
          type: string
        filename:
          type: string
          description: Stored name of the new content
        contentType:
          type: string
          description: Detected MIME type of the new content
        sizeBytes:
          type: integer
          format: int64
        link:
          type: string
        ownerLink:
          type: string
        expiresAt:
          type: string
          format: date-time
          description: "Unchanged: updates keep the original expiry"
        listed:
          type: boolean
          description: "true = listed in the gallery and sitemap now (public, no password,\
            \ not hidden)."
        listable:
          type: boolean
          description: "false = never listed in the gallery whatever the namespace\
            \ (JSON and KV, JSON pages, HTML and JSON files); listing does not apply"
        notices:
          type: array
          description: Advisories about the request or its result; omitted when none.
          items:
            $ref: "#/components/schemas/PublishNotice"
      required:
      - expiresAt
      - filename
      - id
      - link
      - listable
      - listed
      - namespace
      - ownerLink
      - sizeBytes
    AttachDomainRequest:
      type: object
      description: Publication to show on a profile hostname.
      properties:
        type:
          type: string
          description: html or site
          enum:
          - html
          - site
        ns:
          type: string
          description: Namespace of the publication
        id:
          type: string
          description: Id of the publication
      required:
      - id
      - ns
      - type
    TitleRequest:
      type: object
      properties:
        title:
          type: string
          description: "New title, one line; empty restores the title from the content;\
            \ omitted reports it."
          maxLength: 200
    TitleResponse:
      type: object
      properties:
        title:
          type: string
          description: "Title shown in gallery, profile, search and link cards"
        custom:
          type: boolean
          description: true = set by the owner and kept on republish; false = taken
            from the content
        notices:
          type: array
          description: Advisories about the request or its result; omitted when none.
          items:
            $ref: "#/components/schemas/PublishNotice"
      required:
      - custom
      - title
    PasswordRequest:
      type: object
      properties:
        password:
          type:
          - string
          - "null"
          description: New reader password; null or blank removes it
    PasswordResponse:
      type: object
      properties:
        access:
          type: string
          description: "public: html, site and file listed in gallery and sitemap.\
            \ unlisted: private, not listed. protected: link + password."
          enum:
          - public
          - unlisted
          - protected
        listed:
          type: boolean
        notices:
          type: array
          description: Advisories about the request or its result; omitted when none.
          items:
            $ref: "#/components/schemas/PublishNotice"
      required:
      - access
      - listed
    VisibilityRequest:
      type: object
      properties:
        listed:
          type: boolean
          description: "true = listed in gallery & search, false = unlisted. Link\
            \ unchanged; omitted reports the state."
    VisibilityResponse:
      type: object
      properties:
        listed:
          type: boolean
        access:
          type: string
          description: "public: html, site and file listed in gallery and sitemap.\
            \ unlisted: private, not listed. protected: link + password."
          enum:
          - public
          - unlisted
          - protected
        link:
          type: string
        notices:
          type: array
          description: Advisories about the request or its result; omitted when none.
          items:
            $ref: "#/components/schemas/PublishNotice"
      required:
      - access
      - link
      - listed
    PublicationRotateResponse:
      type: object
      properties:
        type:
          type: string
        namespace:
          type: string
        id:
          type: string
        link:
          type: string
        ownerLink:
          type: string
        managementLink:
          type: string
          description: Management page of the new id; null for classic links
        manageUrl:
          type: string
          description: "New management link with its key, shown once; null when the\
            \ row has none"
        listed:
          type: boolean
        notices:
          type: array
          description: rotate-still-listed while the row is listed in gallery and
            search; private-domain-detached when Make private detached a custom domain
          items:
            $ref: "#/components/schemas/RotateNotice"
      required:
      - id
      - link
      - listed
      - namespace
      - notices
      - ownerLink
      - type
    RotateNotice:
      type: object
      properties:
        code:
          type: string
        message:
          type: string
      required:
      - code
      - message
    ManageKeyResponse:
      type: object
      properties:
        manageUrl:
          type: string
          description: "Management link with its key, shown once"
        notices:
          type: array
          description: Advisories about the request or its result; omitted when none.
          items:
            $ref: "#/components/schemas/PublishNotice"
      required:
      - manageUrl
    ExtendResponse:
      type: object
      properties:
        expiresAt:
          type: string
          format: date-time
        notices:
          type: array
          description: Advisories about the request or its result; omitted when none.
          items:
            $ref: "#/components/schemas/PublishNotice"
      required:
      - expiresAt
    BadgeRequest:
      type: object
      properties:
        hidden:
          type: boolean
          description: "true = hide the BrewPage badge (profile owners, up to 5 publications),\
            \ false = show it; omitted reports the state."
    BadgeResponse:
      type: object
      properties:
        hidden:
          type: boolean
          description: true = the BrewPage badge is not shown on this publication
        used:
          type: integer
          format: int32
          description: Publications of your profile with the badge hidden
        limit:
          type: integer
          format: int32
          description: Most publications a profile may hide the badge on
        notices:
          type: array
          description: Advisories about the request or its result; omitted when none.
          items:
            $ref: "#/components/schemas/PublishNotice"
      required:
      - hidden
      - limit
      - used
    AccessRevokeResponse:
      type: object
      properties:
        revoked:
          type: boolean
    SiteUploadResponse:
      type: object
      properties:
        id:
          type: string
          description: Unique 10-character alphanumeric site ID
        namespace:
          type: string
        entryFile:
          type: string
          description: Entry HTML file resolved from the upload (e.g. index.html)
        title:
          type: string
          description: "Entry page title: <title>, else first heading or text; absent\
            \ if none."
        link:
          type: string
          description: Primary URL returned for browser viewing and sharing
        ownerLink:
          type: string
          description: "API URL for programmatic access (info, delete)"
        fileCount:
          type: integer
          format: int32
        totalSizeBytes:
          type: integer
          format: int64
        expiresAt:
          type: string
          format: date-time
        tags:
          type: array
          items:
            type: string
        ownerToken:
          type: string
          description: "Owner token: keep it (cannot be recovered; show it to the\
            \ user on request); send it as X-Owner-Token on later publishes and updates"
        result:
          description: "Publication outcome: code + action + optional reason. Present\
            \ on every POST/PUT response."
          oneOf:
          - $ref: "#/components/schemas/PublicationResult"
        visibilityNotice:
          type: string
          description: "Link access in words, e.g. 'Public: listed in the gallery\
            \ and sitemap; search engines can index it.' (public html, site and file\
            \ add an unlist hint), 'Public: anyone with the link. Not listed.' (public\
            \ json, kv, json pages, json and html files), 'Private: not listed. Only\
            \ via your unique private link.' or 'Password: link + password.'"
        listed:
          type: boolean
          description: "true = listed in the gallery and sitemap now (public, no password,\
            \ not hidden)."
        visibilityUrl:
          type: string
          description: "Owner: POST {\"listed\":false|true} here to unlist or list.\
            \ Link unchanged. Absent when result.extras.isOwner is false."
        manageUrl:
          type: string
          description: "Management link, shown once: give it to the user with the\
            \ link; private, never post it publicly. Absent: old publication, or result.extras.isOwner\
            \ is false."
        updated:
          type: boolean
          description: "Owner only: true if this upload replaced your stored site;\
            \ else absent."
        customDomain:
          description: "With `domain`: the custom domain set on the new publication;\
            \ create its `records[]` in DNS and follow its `nextStep`. Absent otherwise."
          oneOf:
          - $ref: "#/components/schemas/DomainItem"
        managementLink:
          type:
          - string
          - "null"
        routingCohort:
          type: string
        deliveryMode:
          type:
          - string
          - "null"
        requestedDeliveryMode:
          type:
          - string
          - "null"
        effectiveDeliveryMode:
          type:
          - string
          - "null"
        deliveryModeMatched:
          type:
          - boolean
          - "null"
        access:
          type: string
          description: "public: html, site and file listed in gallery and sitemap.\
            \ unlisted: private, not listed. protected: link + password."
          enum:
          - public
          - unlisted
          - protected
        modeLocked:
          type: boolean
        hostingVersion:
          type:
          - integer
          - "null"
          format: int64
        deliveryModeReason:
          type: string
          description: "Why this mode is in effect:'policy:subdomain-required', 'policy:mode-locked',\
            \ 'policy:classic-link', 'policy:version-stale', 'policy:republish-keeps-mode',\
            \ 'policy:custom-domain-attached' or 'policy:state-declared'. Absent when\
            \ nothing applies."
        deliveryNotice:
          type: string
          description: Human-readable explanation of deliveryModeReason. Absent whenever
            deliveryModeReason is absent.
        notices:
          type: array
          description: Advisories about the request or its result; omitted when none.
          items:
            $ref: "#/components/schemas/PublishNotice"
      required:
      - access
      - deliveryMode
      - deliveryModeMatched
      - effectiveDeliveryMode
      - entryFile
      - expiresAt
      - fileCount
      - hostingVersion
      - id
      - link
      - listed
      - managementLink
      - modeLocked
      - namespace
      - ownerLink
      - ownerToken
      - requestedDeliveryMode
      - routingCohort
      - tags
      - totalSizeBytes
    ReportRequest:
      type: object
      properties:
        reportedUrl:
          type: string
          description: Full URL of the reported resource on brewpage.app or brewdata.app
        category:
          type: string
          description: Abuse category
          enum:
          - cannot_delete
          - spam
          - phishing
          - malware
          - copyright
          - harassment
          - illegal
          - other
        description:
          type: string
          description: Reporter description (10..5000 chars)
        reporterEmail:
          type:
          - string
          - "null"
          description: Optional reporter email for follow-up
        resourceNamespace:
          type:
          - string
          - "null"
          description: Optional namespace of the reported resource (e.g. 'public').
            When supplied with resourceId takes priority over URL parsing.
        resourceId:
          type:
          - string
          - "null"
          description: Optional 10-character short ID of the reported resource. When
            supplied with resourceNamespace takes priority over URL parsing.
    ReportResponse:
      type: object
      properties:
        reportId:
          type: string
          description: Unique 10-character alphanumeric report ID
        receivedAt:
          type: string
          format: date-time
          description: Server timestamp when the report was accepted
    NotificationReadRequest:
      type: object
      properties:
        ids:
          type:
          - array
          - "null"
          description: "Ids to mark read, 1-100"
          items:
            type: integer
            format: int64
        all:
          type: boolean
          description: "true: mark every notification read"
    NotificationUnreadResponse:
      type: object
      properties:
        unread:
          type: integer
          format: int32
          description: "Unread notices, at most 99"
      required:
      - unread
    RevokeRequest:
      type: object
      properties:
        id:
          type:
          - string
          - "null"
        token:
          type:
          - string
          - "null"
    RevokeResponse:
      type: object
      properties:
        revoked:
          type: boolean
      required:
      - revoked
    RevokeOthersRequest:
      type: object
      properties:
        keep:
          type:
          - array
          - "null"
          description: Token ids to keep; the header token is always kept
          items:
            type: string
    RevokeOthersResponse:
      type: object
      properties:
        revoked:
          type: integer
          format: int32
      required:
      - revoked
    MintRequest:
      type: object
      properties:
        label:
          type:
          - string
          - "null"
        scope:
          type:
          - string
          - "null"
          default: publish
          enum:
          - publish
          - admin
        expiresIn:
          type:
          - string
          - "null"
          description: "Default: admin 90d, publish never"
          enum:
          - 30d
          - 90d
          - 1y
          - never
    MintResponse:
      type: object
      properties:
        token:
          type: string
          description: Shown once
        id:
          type: string
          format: uuid
        scope:
          type: string
        expiresAt:
          type: string
          format: date-time
      required:
      - id
      - scope
      - token
    BindRequest:
      type: object
      properties:
        token:
          type:
          - string
          - "null"
          description: Owner token to add to the profile
    BindResponse:
      type: object
      properties:
        bound:
          type: boolean
        id:
          type: string
          format: uuid
        active:
          type: integer
          format: int32
        max:
          type: integer
          format: int32
      required:
      - active
      - bound
      - id
      - max
    KvCreateStoreRequest:
      type: object
      properties:
        key:
          type: string
          description: Initial key name
        value:
          type: string
          description: Value for the initial key (max 1 MB)
      required:
      - key
      - value
    KvCreateStoreResponse:
      type: object
      properties:
        id:
          type: string
          description: Unique 10-character alphanumeric store ID
        namespace:
          type: string
        key:
          type: string
        sizeBytes:
          type: integer
          format: int64
        link:
          type: string
          description: Primary URL returned for browser viewing and sharing of the
            initial key
        ownerLink:
          type: string
          description: API URL for programmatic access (upsert/delete)
        expiresAt:
          type: string
          format: date-time
        tags:
          type: array
          items:
            type: string
        ownerToken:
          type: string
          description: "Owner token: keep it (cannot be recovered; show it to the\
            \ user on request); send it as X-Owner-Token on later publishes and updates"
        visibilityNotice:
          type: string
          description: "Link access in words, e.g. 'Public: listed in the gallery\
            \ and sitemap; search engines can index it.' (public html, site and file\
            \ add an unlist hint), 'Public: anyone with the link. Not listed.' (public\
            \ json, kv, json pages, json and html files), 'Private: not listed. Only\
            \ via your unique private link.' or 'Password: link + password.'"
        manageUrl:
          type: string
          description: "Management link, full control of this one store. Give it to\
            \ the user with the link; it is private, never post it publicly. Present\
            \ only when minted."
        listed:
          type: boolean
          description: "Always false: KV is never listed in the gallery or sitemap."
        visibilityUrl:
          type: string
          description: "Owner: POST {\"listed\":false|true} here to unlist or list.\
            \ Link unchanged."
        managementLink:
          type:
          - string
          - "null"
        routingCohort:
          type: string
        deliveryMode:
          type:
          - string
          - "null"
        requestedDeliveryMode:
          type:
          - string
          - "null"
        effectiveDeliveryMode:
          type:
          - string
          - "null"
        deliveryModeMatched:
          type:
          - boolean
          - "null"
        access:
          type: string
          description: "public: html, site and file listed in gallery and sitemap.\
            \ unlisted: private, not listed. protected: link + password."
          enum:
          - public
          - unlisted
          - protected
        modeLocked:
          type: boolean
        hostingVersion:
          type:
          - integer
          - "null"
          format: int64
        deliveryModeReason:
          type: string
          description: "Why this mode is in effect:'policy:subdomain-required', 'policy:mode-locked',\
            \ 'policy:classic-link', 'policy:version-stale', 'policy:republish-keeps-mode',\
            \ 'policy:custom-domain-attached' or 'policy:state-declared'. Absent when\
            \ nothing applies."
        deliveryNotice:
          type: string
          description: Human-readable explanation of deliveryModeReason. Absent whenever
            deliveryModeReason is absent.
        notices:
          type: array
          description: Advisories about the request or its result; omitted when none.
          items:
            $ref: "#/components/schemas/PublishNotice"
      required:
      - access
      - deliveryMode
      - deliveryModeMatched
      - effectiveDeliveryMode
      - expiresAt
      - hostingVersion
      - id
      - key
      - link
      - listed
      - managementLink
      - modeLocked
      - namespace
      - ownerLink
      - ownerToken
      - requestedDeliveryMode
      - routingCohort
      - sizeBytes
      - tags
    JsonCreateResponse:
      type: object
      properties:
        id:
          type: string
          description: Unique 10-character alphanumeric document ID
        namespace:
          type: string
        link:
          type: string
          description: Primary URL returned for browser viewing and sharing
        ownerLink:
          type: string
          description: API URL for programmatic access (update/delete)
        sizeBytes:
          type: integer
          format: int64
        expiresAt:
          type: string
          format: date-time
        createdAt:
          type: string
          format: date-time
        tags:
          type: array
          items:
            type: string
        ownerToken:
          type: string
          description: "Owner token: keep it (cannot be recovered; show it to the\
            \ user on request); send it as X-Owner-Token on later publishes and updates"
        visibilityNotice:
          type: string
          description: "Link access in words, e.g. 'Public: listed in the gallery\
            \ and sitemap; search engines can index it.' (public html, site and file\
            \ add an unlist hint), 'Public: anyone with the link. Not listed.' (public\
            \ json, kv, json pages, json and html files), 'Private: not listed. Only\
            \ via your unique private link.' or 'Password: link + password.'"
        manageUrl:
          type: string
          description: "Management link, full control of this one document. Give it\
            \ to the user with the link; it is private, never post it publicly. Present\
            \ only when minted."
        listed:
          type: boolean
          description: "Always false: JSON is never listed in the gallery or sitemap."
        visibilityUrl:
          type: string
          description: "Owner: POST {\"listed\":false|true} here to unlist or list.\
            \ Link unchanged."
        managementLink:
          type:
          - string
          - "null"
        routingCohort:
          type: string
        deliveryMode:
          type:
          - string
          - "null"
        requestedDeliveryMode:
          type:
          - string
          - "null"
        effectiveDeliveryMode:
          type:
          - string
          - "null"
        deliveryModeMatched:
          type:
          - boolean
          - "null"
        access:
          type: string
          description: "public: html, site and file listed in gallery and sitemap.\
            \ unlisted: private, not listed. protected: link + password."
          enum:
          - public
          - unlisted
          - protected
        modeLocked:
          type: boolean
        hostingVersion:
          type:
          - integer
          - "null"
          format: int64
        deliveryModeReason:
          type: string
          description: "Why this mode is in effect:'policy:subdomain-required', 'policy:mode-locked',\
            \ 'policy:classic-link', 'policy:version-stale', 'policy:republish-keeps-mode',\
            \ 'policy:custom-domain-attached' or 'policy:state-declared'. Absent when\
            \ nothing applies."
        deliveryNotice:
          type: string
          description: Human-readable explanation of deliveryModeReason. Absent whenever
            deliveryModeReason is absent.
        notices:
          type: array
          description: Advisories about the request or its result; omitted when none.
          items:
            $ref: "#/components/schemas/PublishNotice"
      required:
      - access
      - createdAt
      - deliveryMode
      - deliveryModeMatched
      - effectiveDeliveryMode
      - expiresAt
      - hostingVersion
      - id
      - link
      - listed
      - managementLink
      - modeLocked
      - namespace
      - ownerLink
      - ownerToken
      - requestedDeliveryMode
      - routingCohort
      - sizeBytes
      - tags
    HtmlUploadRequest:
      type: object
      properties:
        content:
          type: string
          description: HTML or markdown content to publish
        filename:
          type:
          - string
          - "null"
          description: "Optional original filename used as the tab title fallback\
            \ and download basename; without 'format' a known extension decides the\
            \ format. Trimmed; rejected if it contains path separators or control\
            \ characters, length > 200, or bare name shorter than 4 chars"
        showTopBar:
          type:
          - boolean
          - "null"
          description: Per-content toggle for the frontend top toolbar. null = use
            global default (app.ui.show-top-bar-default)
        format:
          type:
          - string
          - "null"
          description: "Optional content format, same values as the 'format' query\
            \ param. Takes precedence over the query param when both are present."
        state:
          type:
          - object
          - "null"
          description: "Page data: lets visitors save entries on this HTML page. An\
            \ object declares its lists and limits (e.g. {\"collections\":{\"answers\"\
            :{}}}; {} turns it on with defaults). The page gets its own address https://<label>.brewpage.app.\
            \ null or no state field changes no page data settings, also when this\
            \ upload updates your existing page. JSON body only; invalid settings\
            \ answer 400 and nothing is published."
      required:
      - content
    HtmlUploadResponse:
      type: object
      properties:
        id:
          type: string
          description: Unique 10-character alphanumeric page ID
        namespace:
          type: string
        link:
          type: string
          description: Primary URL returned for browser viewing and sharing
        ownerLink:
          type: string
          description: API URL for programmatic access (update/delete)
        format:
          type: string
          description: "Stored format after auto-detect: html, markdown or a code\
            \ format; may differ from the requested one. Absent when unknown."
        title:
          type: string
          description: "Stored title: <title>, else first heading or text; JSON: root\
            \ title or name; code: filename or e.g. 'JS snippet'. Absent if none."
        expiresAt:
          type: string
          format: date-time
        sizeBytes:
          type: integer
          format: int64
        tags:
          type: array
          items:
            type: string
        ownerToken:
          type: string
          description: "Owner token: keep it (cannot be recovered; show it to the\
            \ user on request); send it as X-Owner-Token on later publishes and updates"
        result:
          description: "Publication outcome: code + action + optional reason. Present\
            \ on every POST/PUT response."
          oneOf:
          - $ref: "#/components/schemas/PublicationResult"
        visibilityNotice:
          type: string
          description: "Link access in words, e.g. 'Public: listed in the gallery\
            \ and sitemap; search engines can index it.' (public html, site and file\
            \ add an unlist hint), 'Public: anyone with the link. Not listed.' (public\
            \ json, kv, json pages, json and html files), 'Private: not listed. Only\
            \ via your unique private link.' or 'Password: link + password.'"
        deliveryModeReason:
          type: string
          description: "Why the delivery mode was chosen or flagged. 'policy:subdomain-required'\
            \ -- HTML pages in a private namespace always get their own subdomain.\
            \ 'policy:state-declared' -- the request turned on page data ('state'),\
            \ so the HTML page got its own subdomain whatever mode was asked. 'auto:<codes>'\
            \ -- the page was published in subdomain mode automatically because it\
            \ uses browser features a BrewPage link does not provide. 'advisory:<codes>'\
            \ -- the mode was kept, but those features may not work fully on a BrewPage\
            \ link. Codes are comma-separated in a fixed order: storage, cookies,\
            \ history, downloads, top-navigation, media-capture, pointer-lock, embeds,\
            \ fullscreen. Absent when nothing applies."
        deliveryNotice:
          type: string
          description: "Human-readable explanation of deliveryModeReason, including\
            \ how to change the delivery mode. Absent whenever deliveryModeReason\
            \ is absent."
        manageUrl:
          type: string
          description: "Management link, full control of this one publication. Give\
            \ it to the user with the link; it is private, never post it publicly.\
            \ Present only when minted."
        listed:
          type: boolean
          description: "true = listed in the gallery and sitemap now (public, no password,\
            \ not hidden)."
        listable:
          type: boolean
          description: "false = never listed in the gallery whatever the namespace\
            \ (JSON and KV, JSON pages, HTML and JSON files); listing does not apply"
        visibilityUrl:
          type: string
          description: "Owner: POST {\"listed\":false|true} here to unlist or list.\
            \ Link unchanged."
        updated:
          type: boolean
          description: "Owner only: true if this upload replaced your stored page;\
            \ else absent."
        customDomain:
          description: "With `domain`: the custom domain set on the new publication;\
            \ create its `records[]` in DNS and follow its `nextStep`. Absent otherwise."
          oneOf:
          - $ref: "#/components/schemas/DomainItem"
        managementLink:
          type:
          - string
          - "null"
        routingCohort:
          type: string
        deliveryMode:
          type:
          - string
          - "null"
        requestedDeliveryMode:
          type:
          - string
          - "null"
        effectiveDeliveryMode:
          type:
          - string
          - "null"
        deliveryModeMatched:
          type:
          - boolean
          - "null"
        access:
          type: string
          description: "public: html, site and file listed in gallery and sitemap.\
            \ unlisted: private, not listed. protected: link + password."
          enum:
          - public
          - unlisted
          - protected
        modeLocked:
          type: boolean
        hostingVersion:
          type:
          - integer
          - "null"
          format: int64
        notices:
          type: array
          description: Advisories about the request or its result; omitted when none.
          items:
            $ref: "#/components/schemas/PublishNotice"
      required:
      - access
      - deliveryMode
      - deliveryModeMatched
      - effectiveDeliveryMode
      - expiresAt
      - hostingVersion
      - id
      - link
      - listable
      - listed
      - managementLink
      - modeLocked
      - namespace
      - ownerLink
      - ownerToken
      - requestedDeliveryMode
      - routingCohort
      - sizeBytes
      - tags
    FileUploadResponse:
      type: object
      description: "Upload result. For a file published as a page (notice 'html-file-as-page',\
        \ 'markdown-file-as-page' or 'file-format-applied') id, link and ownerLink\
        \ belong to that page; manage it via /api/html"
      properties:
        id:
          type: string
          description: "Unique 10-character alphanumeric file ID, or the page ID when\
            \ the HTML file was published as a page"
        namespace:
          type: string
        filename:
          type: string
          description: Original filename as uploaded
        contentType:
          type: string
          description: "Detected MIME type (e.g. image/png); the page type (text/html,\
            \ text/markdown) for a file published as a page"
        sizeBytes:
          type: integer
          format: int64
          description: Stored size in bytes; for a published page the page size (UTF-8
            BOM removed)
        link:
          type: string
          description: Primary URL returned for browser download and sharing
        ownerLink:
          type: string
          description: "API URL for programmatic access (delete); /api/html/{ns}/{id}\
            \ for a published page"
        expiresAt:
          type: string
          format: date-time
        tags:
          type: array
          items:
            type: string
        ownerToken:
          type: string
          description: "Owner token: keep it (cannot be recovered; show it to the\
            \ user on request); send it as X-Owner-Token on later publishes and updates.\
            \ Absent when result.extras.isOwner is false"
        result:
          description: "Present when an existing publication was returned: action\
            \ merged, extras.isOwner says if ownerToken manages it"
          oneOf:
          - $ref: "#/components/schemas/PublicationResult"
        visibilityNotice:
          type: string
          description: "Link access in words, e.g. 'Public: listed in the gallery\
            \ and sitemap; search engines can index it.' (public html, site and file\
            \ add an unlist hint), 'Public: anyone with the link. Not listed.' (public\
            \ json, kv, json pages, json and html files), 'Private: not listed. Only\
            \ via your unique private link.' or 'Password: link + password.'"
        manageUrl:
          type: string
          description: "Management link, full control of this one publication. Give\
            \ it to the user with the link; it is private, never post it publicly.\
            \ Present only when minted."
        listed:
          type: boolean
          description: "true = listed in the gallery and sitemap now (public, no password,\
            \ not hidden)."
        listable:
          type: boolean
          description: "false = never listed in the gallery whatever the namespace\
            \ (JSON and KV, JSON pages, HTML and JSON files); listing does not apply"
        visibilityUrl:
          type: string
          description: "Owner: POST {\"listed\":false|true} here to unlist or list.\
            \ Link unchanged."
        updated:
          type: boolean
          description: "Owner only: true if this upload replaced your stored page;\
            \ else absent."
        managementLink:
          type:
          - string
          - "null"
        routingCohort:
          type: string
        deliveryMode:
          type:
          - string
          - "null"
        requestedDeliveryMode:
          type:
          - string
          - "null"
        effectiveDeliveryMode:
          type:
          - string
          - "null"
        deliveryModeMatched:
          type:
          - boolean
          - "null"
        access:
          type: string
          description: "public: html, site and file listed in gallery and sitemap.\
            \ unlisted: private, not listed. protected: link + password."
          enum:
          - public
          - unlisted
          - protected
        modeLocked:
          type: boolean
        hostingVersion:
          type:
          - integer
          - "null"
          format: int64
        deliveryModeReason:
          type: string
          description: "Why this mode is in effect:'policy:subdomain-required', 'policy:mode-locked',\
            \ 'policy:classic-link', 'policy:version-stale', 'policy:republish-keeps-mode',\
            \ 'policy:custom-domain-attached' or 'policy:state-declared'. Absent when\
            \ nothing applies."
        deliveryNotice:
          type: string
          description: Human-readable explanation of deliveryModeReason. Absent whenever
            deliveryModeReason is absent.
        notices:
          type: array
          description: Advisories about the request or its result; omitted when none.
          items:
            $ref: "#/components/schemas/PublishNotice"
      required:
      - access
      - deliveryMode
      - deliveryModeMatched
      - effectiveDeliveryMode
      - expiresAt
      - filename
      - hostingVersion
      - id
      - link
      - listable
      - listed
      - managementLink
      - modeLocked
      - namespace
      - ownerLink
      - requestedDeliveryMode
      - routingCohort
      - sizeBytes
      - tags
    AddDomainRequest:
      type: object
      description: Add a hostname to the profile without a publication.
      properties:
        hostname:
          type: string
          description: "Hostname to add, e.g. www.example.com or example.com; Unicode\
            \ names accepted"
      required:
      - hostname
    HostingUpdateRequest:
      type: object
      properties:
        deliveryMode:
          type: string
          enum:
          - path
          - subdomain
        expectedVersion:
          type: integer
          format: int64
          maximum: 9223372036854775807
          minimum: 1
      required:
      - deliveryMode
    HostingProjection:
      type: object
      properties:
        link:
          type: string
        ownerLink:
          type: string
        managementLink:
          type:
          - string
          - "null"
        routingCohort:
          type: string
        deliveryMode:
          type:
          - string
          - "null"
        requestedDeliveryMode:
          type:
          - string
          - "null"
        effectiveDeliveryMode:
          type:
          - string
          - "null"
        deliveryModeMatched:
          type:
          - boolean
          - "null"
        namespace:
          type: string
        access:
          type: string
          description: "public: html, site and file listed in gallery and sitemap.\
            \ unlisted: private, not listed. protected: link + password."
          enum:
          - public
          - unlisted
          - protected
        modeLocked:
          type: boolean
        hostingVersion:
          type:
          - integer
          - "null"
          format: int64
        deliveryModeReason:
          type: string
          description: "Why this mode is in effect:'policy:subdomain-required', 'policy:mode-locked',\
            \ 'policy:classic-link', 'policy:version-stale', 'policy:republish-keeps-mode',\
            \ 'policy:custom-domain-attached' or 'policy:state-declared'. Absent when\
            \ nothing applies."
        deliveryNotice:
          type: string
          description: Human-readable explanation of deliveryModeReason. Absent whenever
            deliveryModeReason is absent.
      required:
      - access
      - deliveryMode
      - deliveryModeMatched
      - effectiveDeliveryMode
      - hostingVersion
      - link
      - managementLink
      - modeLocked
      - namespace
      - ownerLink
      - requestedDeliveryMode
      - routingCohort
    StateListSettingsRequest:
      type: object
      properties:
        mode:
          type:
          - string
          - "null"
          description: "private: each visitor sees only their own entries; shared:\
            \ everyone reads all"
          enum:
          - private
          - shared
        write:
          type:
          - string
          - "null"
          description: "visitors: each visitor writes their own entries; author: only\
            \ you write (needs mode shared)"
          enum:
          - visitors
          - author
        ownerView:
          type:
          - boolean
          - "null"
          description: "Optional flag, stored as sent"
        choices:
          type:
          - object
          - "null"
          additionalProperties:
            type: array
            items:
              type: string
          description: "Fields with a fixed set of values that can be counted, field\
            \ -> values"
        index:
          type:
          - string
          - "null"
          description: Numeric field the list can be ordered by; null = none
        maxDocsPerVisitor:
          type:
          - integer
          - "null"
          format: int32
          description: Entries one visitor may keep in this list; null = the publication
            value
        files:
          type:
          - boolean
          - "null"
          description: "true: visitors may upload files to this list; null = false"
    StateSettingsRequest:
      type: object
      properties:
        collections:
          type:
          - object
          - "null"
          additionalProperties:
            $ref: "#/components/schemas/StateListSettingsRequest"
          description: Declared lists by name; lists absent here are removed (their
            entries stay); a list set to null takes the default rule
        captcha:
          type:
          - string
          - "null"
          description: "Human check for new visitors who save: auto (default) or always"
          enum:
          - auto
          - always
        maxDocBytes:
          type:
          - integer
          - "null"
          format: int32
          description: Largest entry in bytes; absent or null = default
        maxDocsPerVisitor:
          type:
          - integer
          - "null"
          format: int32
          description: Entries one visitor may keep on this publication; absent or
            null = default
        maxBytesPerVisitor:
          type:
          - integer
          - "null"
          format: int32
          description: Bytes one visitor may keep on this publication; absent or null
            = default
    PublishNotice:
      type: object
      properties:
        code:
          type: string
          description: "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:
          type: string
      required:
      - code
      - message
    StateAmount:
      type: object
      properties:
        docs:
          type: integer
          format: int32
          description: Entries
        bytes:
          type: integer
          format: int64
          description: Bytes of entries
        files:
          type: integer
          format: int32
          description: Visitor files
        fileBytes:
          type: integer
          format: int64
          description: Bytes of visitor files
      required:
      - bytes
      - docs
      - fileBytes
      - files
    StateCollectionUsage:
      type: object
      properties:
        name:
          type: string
        declared:
          type: boolean
          description: False for a list the page saves into without declaring it;
            such a list is private
        mode:
          type: string
          enum:
          - private
          - shared
        write:
          type: string
          enum:
          - visitors
          - author
        docs:
          type: integer
          format: int32
          description: Entries in this list
        bytes:
          type: integer
          format: int64
          description: Bytes of this list's entries
        files:
          type: integer
          format: int32
          description: Visitor files in this list
        fileBytes:
          type: integer
          format: int64
          description: Bytes of this list's visitor files
      required:
      - bytes
      - declared
      - docs
      - fileBytes
      - files
      - mode
      - name
      - write
    StateConfigResponse:
      type: object
      properties:
        declared:
          type: boolean
          description: True when page data is turned on for this publication
        config:
          $ref: "#/components/schemas/StateSettings"
          description: "Settings in effect, every key spelled out (defaults when not\
            \ turned on); a valid PATCH body as is"
        collections:
          type: array
          description: "Every declared list and every other list holding entries or\
            \ files, by name"
          items:
            $ref: "#/components/schemas/StateCollectionUsage"
        usage:
          $ref: "#/components/schemas/StateAmount"
          description: "Entries, files and their bytes stored on this publication"
        tier:
          type: string
          description: "Quota tier: account (publication of an active profile) or\
            \ anonymous"
          enum:
          - anonymous
          - account
        caps:
          $ref: "#/components/schemas/StateAmount"
          description: "Quota of this tier: at most this many entries, entry bytes,\
            \ files and file bytes"
        alert:
          type: boolean
          description: "True at 80% or more of the entry, entry size, file or file\
            \ size quota"
        notices:
          type: array
          description: Advisories about the request or the settings; empty when none
          items:
            $ref: "#/components/schemas/PublishNotice"
      required:
      - alert
      - caps
      - collections
      - config
      - declared
      - notices
      - tier
      - usage
    StateListSettings:
      type: object
      properties:
        mode:
          type: string
          description: "private: each visitor sees only their own entries; shared:\
            \ everyone reads all"
          enum:
          - private
          - shared
        write:
          type: string
          description: "visitors: each visitor writes their own entries; author: only\
            \ you write"
          enum:
          - visitors
          - author
        ownerView:
          type: boolean
          description: The flag as stored
        choices:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
          description: "Fields with a fixed set of values that can be counted, field\
            \ -> values"
        index:
          type:
          - string
          - "null"
          description: Numeric field the list can be ordered by; null when none
        maxDocsPerVisitor:
          type:
          - integer
          - "null"
          format: int32
          description: Entries one visitor may keep in this list; null = the publication
            value
        files:
          type: boolean
          description: True when visitors may upload files to this list
      required:
      - choices
      - files
      - index
      - maxDocsPerVisitor
      - mode
      - ownerView
      - write
    StateSettings:
      type: object
      properties:
        collections:
          type: object
          additionalProperties:
            $ref: "#/components/schemas/StateListSettings"
          description: Declared lists by name
        captcha:
          type: string
          description: "Human check for new visitors who save: auto or always"
          enum:
          - auto
          - always
        maxDocBytes:
          type: integer
          format: int32
          description: Largest entry in bytes
        maxDocsPerVisitor:
          type: integer
          format: int32
          description: Entries one visitor may keep on this publication
        maxBytesPerVisitor:
          type: integer
          format: int32
          description: Bytes one visitor may keep on this publication
      required:
      - captcha
      - collections
      - maxBytesPerVisitor
      - maxDocBytes
      - maxDocsPerVisitor
    CustomDomainsBlock:
      type: object
      description: Custom domains for this caller; present only when custom domains
        are available
      properties:
        enabled:
          type: boolean
          description: Always true when present
        limit:
          type: integer
          format: int32
          description: Hostnames the caller's profile may hold (profile grant or the
            default)
        used:
          type: integer
          format: int32
          description: Hostnames the profile holds; absent when no profile resolves
            and on /api/limits
      required:
      - enabled
      - limit
    HostingCustomDomain:
      type: object
      description: Custom domain on the hosting answer of a publication.
      properties:
        hostname:
          type: string
          description: "Hostname in ASCII (A-label), lowercase"
        displayHostname:
          type: string
          description: Unicode form for display
        status:
          type: string
          description: "pending_dns, verifying, active or lost (as DomainItem.status)"
          enum:
          - pending_dns
          - verifying
          - active
          - lost
        serving:
          type: boolean
          description: true when visitors see the publication on this hostname now
        url:
          type: string
          description: https://<hostname>/ while serving
      required:
      - displayHostname
      - hostname
      - serving
      - status
    HostingReadResponse:
      type: object
      properties:
        link:
          type: string
        ownerLink:
          type: string
        managementLink:
          type:
          - string
          - "null"
        routingCohort:
          type: string
        deliveryMode:
          type:
          - string
          - "null"
        requestedDeliveryMode:
          type:
          - string
          - "null"
        effectiveDeliveryMode:
          type:
          - string
          - "null"
        deliveryModeMatched:
          type:
          - boolean
          - "null"
        namespace:
          type: string
        access:
          type: string
          description: "public: html, site and file listed in gallery and sitemap.\
            \ unlisted: private, not listed. protected: link + password."
          enum:
          - public
          - unlisted
          - protected
        modeLocked:
          type: boolean
        hostingVersion:
          type:
          - integer
          - "null"
          format: int64
        deliveryModeReason:
          type:
          - string
          - "null"
          description: "Why this mode is in effect:'policy:subdomain-required', 'policy:mode-locked',\
            \ 'policy:classic-link', 'policy:version-stale', 'policy:republish-keeps-mode',\
            \ 'policy:custom-domain-attached' or 'policy:state-declared'. Absent when\
            \ nothing applies."
        deliveryNotice:
          type:
          - string
          - "null"
          description: Human-readable explanation of deliveryModeReason. Absent whenever
            deliveryModeReason is absent.
        extendDays:
          type:
          - integer
          - "null"
          format: int32
          description: "Days `POST …/extend` sets for this owner; null when Extend\
            \ is not available (no profile, OLD publication)"
        readOnly:
          type: boolean
          description: "Old publication: edits refused; publish a new one."
        title:
          type:
          - string
          - "null"
          description: Display title; null for JSON and KV
        listed:
          type: boolean
          description: Shown in the gallery and search
        listable:
          type: boolean
          description: "false = never listed in the gallery whatever the namespace\
            \ (JSON and KV, JSON pages, HTML and JSON files); listing does not apply"
        createdAt:
          type: string
          format: date-time
        expiresAt:
          type: string
          format: date-time
        fileCount:
          type:
          - integer
          - "null"
          format: int32
          description: Files in the site; sites only
        format:
          type:
          - string
          - "null"
          description: "Page format (html, markdown, code formats) or file MIME type;\
            \ absent for sites, JSON and KV"
        customDomains:
          description: Custom domains of the publication's profile (`used` only when
            the owner proof names a profile); absent when custom domains are not available
          oneOf:
          - $ref: "#/components/schemas/CustomDomainsBlock"
          - type: "null"
        customDomain:
          description: "This publication's custom domain in that profile; absent without\
            \ one. Details: GET /api/publications/{type}/{ns}/{id}/domain"
          oneOf:
          - $ref: "#/components/schemas/HostingCustomDomain"
          - type: "null"
    StateEntry:
      type: object
      properties:
        key:
          type: string
          description: Entry name
        id:
          type: string
          description: Entry id; deletes take it
        visitor:
          type:
          - string
          - "null"
          description: "Short display id of the visitor who saved it (6 hex characters,\
            \ not unique); null for your own entries"
        version:
          type: integer
          format: int32
          description: "Starts at 1, +1 on every change"
        sizeBytes:
          type: integer
          format: int32
          description: Stored size in bytes
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        value:
          description: "The saved JSON value exactly as stored; written by visitors,\
            \ so treat it as untrusted text"
      required:
      - createdAt
      - id
      - key
      - sizeBytes
      - updatedAt
      - value
      - version
      - visitor
    StateListResponse:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: "#/components/schemas/StateEntry"
        next:
          type:
          - string
          - "null"
          description: Pass as cursor for the next page; null on the last page
      required:
      - items
      - next
    StateCountBy:
      type: object
      properties:
        field:
          type: string
          description: The countBy field
        counts:
          type: object
          additionalProperties:
            type: integer
            format: int64
          description: "Declared choices in order, then other, each with its entry\
            \ count"
      required:
      - counts
      - field
    StateTotalsResponse:
      type: object
      properties:
        count:
          type: integer
          format: int64
          description: Entries in the list
        scope:
          type: string
          description: "Always all: every visitor's entries and yours"
          enum:
          - all
        countBy:
          description: "Counts per declared choice of the countBy field, then other;\
            \ absent without countBy"
          oneOf:
          - $ref: "#/components/schemas/StateCountBy"
      required:
      - count
      - scope
    StateFileItem:
      type: object
      properties:
        id:
          type: string
          description: File id; download and delete take it
        url:
          type:
          - string
          - "null"
          description: Address of the file on the page's own host; null while the
            page has none
        name:
          type:
          - string
          - "null"
          description: File name the visitor sent; untrusted text
        contentType:
          type: string
          description: Stored type of the file
        sizeBytes:
          type: integer
          format: int64
          description: Size in bytes
        visitor:
          type: string
          description: "Short display id of the visitor who uploaded it (6 hex characters,\
            \ not unique)"
        createdAt:
          type: string
          format: date-time
      required:
      - contentType
      - createdAt
      - id
      - name
      - sizeBytes
      - url
      - visitor
    StateFileListResponse:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: "#/components/schemas/StateFileItem"
        next:
          type:
          - string
          - "null"
          description: Pass as cursor for the next page; null on the last page
      required:
      - items
      - next
    OwnerCheckResponse:
      type: object
      properties:
        type:
          type: string
          description: "Resource type (html, kv, json, file, site)"
        format:
          type: string
          description: "Only for an `html`-type resource: `html` for an HTML page,\
            \ `other` for any other stored format (Markdown, code or text). Absent\
            \ for every other type"
          enum:
          - html
          - other
        isOwner:
          type: boolean
      required:
      - isOwner
      - type
    TemplateCatalogItem:
      type: object
      properties:
        slug:
          type: string
          description: Template slug
        name:
          type: string
          description: Template name
        purpose:
          type: string
          description: "What the page does, one sentence"
        useWhen:
          type: array
          description: English keywords for requests this template fits
          items:
            type: string
        data:
          type: string
          description: "What the page saves, in which list, and who sees what"
        sourceUrl:
          type: string
          description: "The template's HTML source as plain text: start the copy from\
            \ it"
        demoUrl:
          type: string
          description: Live published example of the template
        pageUrl:
          type: string
          description: The template's page on BrewPage
        publishUrl:
          type: string
          description: "Create endpoint for a copy of this template (POST, see `publish`)"
        copies:
          type: integer
          format: int64
          description: Pages published as copies of this template
        state:
          type:
          - object
          - "null"
          description: The `state` to send with the copy (the JSON of the source's
            `bp-template-state` block); absent when the page saves nothing
        customize:
          type:
          - string
          - "null"
          description: What else changes when the page's options change; absent when
            nothing does
    TemplateCatalogResponse:
      type: object
      description: "Official BrewPage templates for a request, each with its source\
        \ and the `state` its copy needs, plus one publish recipe"
      properties:
        query:
          type:
          - string
          - "null"
          description: The searched `q`; absent without a non-blank `q`
        matched:
          type: boolean
          description: "true: `items` are the best matches for `q`, at most 3, best\
            \ first; false: no `q` or no match, `items` lists every template"
        items:
          type: array
          description: Templates; empty only while no template is published
          items:
            $ref: "#/components/schemas/TemplateCatalogItem"
        publish:
          $ref: "#/components/schemas/TemplatePublishRecipe"
          description: How to publish a copy of any item
    TemplatePublishBody:
      type: object
      properties:
        content:
          type: string
          description: "Placeholder: the item's source, changed as the user asks"
        format:
          type: string
          description: Always `html`
        state:
          type: string
          description: "Placeholder: the item's `state` object"
    TemplatePublishRecipe:
      type: object
      properties:
        method:
          type: string
          description: HTTP method
          enum:
          - POST
        url:
          type: string
          description: "Placeholder: the item's `publishUrl`"
        contentType:
          type: string
          description: Request body type
          enum:
          - application/json
        body:
          $ref: "#/components/schemas/TemplatePublishBody"
          description: Request body members; the placeholders name what goes in each
        giveUser:
          type: array
          description: Answer fields to give the user
          items:
            type: string
        note:
          type: string
          description: Steps and rules for the copy
    StatsResponse:
      type: object
      properties:
        createdToday:
          type: integer
          format: int64
          description: Resources created in the last 24 hours
        totalCreated:
          type: integer
          format: int64
          description: All-time resource count
        viewsToday:
          type: integer
          format: int64
          description: Views in the last 24 hours
        totalViews:
          type: integer
          format: int64
          description: All-time view count
        breakdown:
          type: array
          description: "Per-type breakdown (html, json, kv, file, site)"
          items:
            $ref: "#/components/schemas/TypeBreakdown"
        createdTodayPublic:
          type:
          - integer
          - "null"
          format: int64
          description: Resources created today in the public namespace
        createdTodayPrivate:
          type:
          - integer
          - "null"
          format: int64
          description: Resources created today in private namespaces
        viewsTodayPublic:
          type:
          - integer
          - "null"
          format: int64
          description: Views today on resources in the public namespace
        viewsTodayPrivate:
          type:
          - integer
          - "null"
          format: int64
          description: Views today on resources in private namespaces
        totalCreatedPublic:
          type:
          - integer
          - "null"
          format: int64
          description: All-time resources created in the public namespace
        totalCreatedPrivate:
          type:
          - integer
          - "null"
          format: int64
          description: All-time resources created in private namespaces
        totalViewsPublic:
          type:
          - integer
          - "null"
          format: int64
          description: All-time views on resources in the public namespace
        totalViewsPrivate:
          type:
          - integer
          - "null"
          format: int64
          description: All-time views on resources in private namespaces
        deletedToday:
          type:
          - integer
          - "null"
          format: int64
          description: Resources deleted in the last 24 hours
        deletedTodayPublic:
          type:
          - integer
          - "null"
          format: int64
          description: Resources deleted today in the public namespace
        deletedTodayPrivate:
          type:
          - integer
          - "null"
          format: int64
          description: Resources deleted today in private namespaces
        totalDeleted:
          type:
          - integer
          - "null"
          format: int64
          description: All-time deleted resource count
        totalDeletedPublic:
          type:
          - integer
          - "null"
          format: int64
          description: All-time deleted resources in the public namespace
        totalDeletedPrivate:
          type:
          - integer
          - "null"
          format: int64
          description: All-time deleted resources in private namespaces
        accountsToday:
          type:
          - integer
          - "null"
          format: int64
          description: "Accounts created today, deleted ones excluded"
        totalAccounts:
          type:
          - integer
          - "null"
          format: int64
          description: "Current account count, deleted ones excluded"
        pageDataPages:
          type:
          - integer
          - "null"
          format: int64
          description: "Pages and sites published with Page data (saving what visitors\
            \ enter) so far, BrewPage's own pages excluded"
    TypeBreakdown:
      type: object
      properties:
        type:
          type: string
          description: "Resource type: html, json, kv, file, or site"
        today:
          type: integer
          format: int64
          description: Created in the last 24 hours
        total:
          type: integer
          format: int64
          description: All-time count
        todayPublic:
          type:
          - integer
          - "null"
          format: int64
          description: Created today in the public namespace
        todayPrivate:
          type:
          - integer
          - "null"
          format: int64
          description: Created today in private namespaces
        totalPublic:
          type:
          - integer
          - "null"
          format: int64
          description: All-time count in the public namespace
        totalPrivate:
          type:
          - integer
          - "null"
          format: int64
          description: All-time count in private namespaces
        todayDeleted:
          type:
          - integer
          - "null"
          format: int64
          description: Deleted in the last 24 hours
        todayDeletedPublic:
          type:
          - integer
          - "null"
          format: int64
          description: Deleted today in the public namespace
        todayDeletedPrivate:
          type:
          - integer
          - "null"
          format: int64
          description: Deleted today in private namespaces
        totalDeleted:
          type:
          - integer
          - "null"
          format: int64
          description: All-time deleted count
        totalDeletedPublic:
          type:
          - integer
          - "null"
          format: int64
          description: All-time deleted in the public namespace
        totalDeletedPrivate:
          type:
          - integer
          - "null"
          format: int64
          description: All-time deleted in private namespaces
    SiteFileInfo:
      type: object
      properties:
        path:
          type: string
          description: Relative file path within the site
        contentType:
          type: string
          description: Detected MIME type
        sizeBytes:
          type: integer
          format: int64
      required:
      - path
      - sizeBytes
    SiteInfoResponse:
      type: object
      properties:
        id:
          type: string
          description: Unique 10-character alphanumeric site ID
        namespace:
          type: string
        entryFile:
          type: string
          description: Entry HTML file resolved from the upload
        fileCount:
          type: integer
          format: int32
        totalSizeBytes:
          type: integer
          format: int64
        files:
          type: array
          description: List of all files in the site
          items:
            $ref: "#/components/schemas/SiteFileInfo"
        createdAt:
          type: string
          format: date-time
        expiresAt:
          type: string
          format: date-time
        views:
          type: integer
          format: int64
        tags:
          type: array
          items:
            type: string
      required:
      - createdAt
      - entryFile
      - expiresAt
      - fileCount
      - files
      - id
      - namespace
      - tags
      - totalSizeBytes
      - views
    PublicationDomain:
      type: object
      description: Custom domain on a publication list item.
      properties:
        hostname:
          type: string
          description: "Hostname in ASCII (A-label), lowercase"
        displayHostname:
          type: string
          description: Unicode form for display
        status:
          type: string
          description: "pending_dns, verifying, active or lost (as DomainItem.status)"
          enum:
          - pending_dns
          - verifying
          - active
          - lost
        problem:
          type: string
          description: As DomainItem.problem; absent when nothing blocks progress
        suspended:
          type: boolean
          description: true when BrewPage suspended this domain; write to info@brewpage.app
      required:
      - displayHostname
      - hostname
      - status
      - suspended
    PublicationListItemResponse:
      type: object
      properties:
        type:
          type: string
        namespace:
          type: string
        id:
          type: string
        title:
          type: string
        format:
          type: string
          description: "Page content format (html, markdown, code formats) or file\
            \ MIME type; absent for sites, JSON and KV"
        link:
          type: string
        createdAt:
          type: string
          format: date-time
        expiresAt:
          type: string
          format: date-time
        views:
          type: integer
          format: int64
        status:
          type: string
          description: "public, hidden, private, password or unavailable"
        listed:
          type: boolean
        listable:
          type: boolean
          description: "false = never listed in the gallery whatever the namespace\
            \ (JSON and KV, JSON pages, HTML and JSON files); listing does not apply"
        extendDays:
          type: integer
          format: int32
          description: Days `POST …/extend` sets; null when not offered
        readOnly:
          type: boolean
          description: "Old publication: edits refused; publish a new one."
        preview:
          oneOf:
          - $ref: "#/components/schemas/PublicationPreviewResponse"
        claimed:
          type: boolean
          description: Added by management link
        customDomain:
          description: Custom domain of this publication in the caller's profile;
            absent without one
          oneOf:
          - $ref: "#/components/schemas/PublicationDomain"
        pageData:
          description: Page data of this page or site; absent when page data is off
            and for other types
          oneOf:
          - $ref: "#/components/schemas/PublicationPageData"
        badgeHidden:
          type: boolean
          description: true = your profile hid the BrewPage badge on this publication;
            absent otherwise
      required:
      - claimed
      - createdAt
      - expiresAt
      - id
      - listable
      - listed
      - namespace
      - readOnly
      - status
      - type
      - views
    PublicationListResponse:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: "#/components/schemas/PublicationListItemResponse"
        nextCursor:
          type: string
          description: Pass as `cursor` for the next page; null on the last page
        total:
          type: integer
          format: int64
        customDomains:
          description: Custom domains of the caller's profile (`used` only when a
            profile resolves); absent when custom domains are not available
          oneOf:
          - $ref: "#/components/schemas/CustomDomainsBlock"
      required:
      - items
      - total
    PublicationPageData:
      type: object
      description: "Page data on a page or site: what visitors saved there"
      properties:
        docs:
          type: integer
          format: int32
          description: Stored entries
        usedPercent:
          type: integer
          format: int32
          description: "Highest share of the entry, entry size, file and file size\
            \ quotas in use, percent from 0 to 100"
      required:
      - docs
      - usedPercent
    PublicationPreviewResponse:
      type: object
      description: "WebP previews: thumbD 800x373, thumbM 320x149, full: page top\
        \ (pages, sites) or the 1200 px card"
      properties:
        thumbD:
          type: string
        thumbM:
          type: string
        full:
          type: string
        branded:
          type: boolean
          description: "true = type card, not a page or content render; absent when\
            \ false"
      required:
      - thumbD
      - thumbM
    PublicationStatsReport:
      type: object
      properties:
        range:
          type: integer
          format: int32
        from:
          type: string
          format: date
        through:
          type: string
          format: date
        updatedAt:
          type:
          - string
          - "null"
          format: date-time
        todayPartial:
          type: boolean
        views:
          type: integer
          format: int64
        days:
          type: array
          items:
            $ref: "#/components/schemas/StatsDay"
        totals:
          $ref: "#/components/schemas/StatsTotals"
        hours:
          type:
          - array
          - "null"
          items:
            type: integer
            format: int32
        devices:
          $ref: "#/components/schemas/StatsDevices"
        previews:
          type: object
          additionalProperties:
            type: integer
            format: int32
        countries:
          type:
          - array
          - "null"
          items:
            $ref: "#/components/schemas/StatsCountry"
        refHosts:
          type:
          - array
          - "null"
          items:
            $ref: "#/components/schemas/StatsHost"
        geoAttribution:
          type: string
    StatsCountry:
      type: object
      properties:
        cc:
          type: string
        "n":
          type: integer
          format: int32
    StatsDay:
      type: object
      properties:
        d:
          type: string
          format: date
        humans:
          type: integer
          format: int32
        automated:
          type: integer
          format: int32
        visitors:
          type: integer
          format: int32
    StatsDevices:
      type: object
      properties:
        mobile:
          type: integer
          format: int32
        tablet:
          type: integer
          format: int32
        desktop:
          type: integer
          format: int32
    StatsHost:
      type: object
      properties:
        host:
          type: string
        "n":
          type: integer
          format: int32
    StatsTotals:
      type: object
      properties:
        humans:
          type: integer
          format: int32
        automated:
          type: integer
          format: int32
    NotificationAction:
      type: object
      properties:
        kind:
          type: string
          description: "extend: POST /api/{type}/{ns}/{id}/extend keeps the publication\
            \ longer"
          enum:
          - extend
        type:
          type: string
          description: API segment of the publication type
          enum:
          - html
          - sites
          - files
          - json
        ns:
          type: string
          description: Namespace
        id:
          type: string
          description: Publication id
      required:
      - id
      - kind
      - ns
      - type
    NotificationItem:
      type: object
      properties:
        id:
          type: integer
          format: int64
          description: Notification id; mark read takes it
        type:
          type: string
          description: What happened
          enum:
          - page_expiring
          - page_removed
          - entries_new
          - quota_close
          - quota_reached
          - published
          - updated
        kind:
          type: string
          description: "notice: something to act on or know; activity: a log line\
            \ of your pages"
          enum:
          - notice
          - activity
        group:
          type:
          - string
          - "null"
          description: Settings group of a notice; null for activity
          enum:
          - pages
          - entries
        read:
          type: boolean
          description: True once read; activity is born read
        count:
          type: integer
          format: int32
          description: "How many events this item stands for, e.g. new entries"
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
          description: "Last change; the list is ordered by it, newest first"
        message:
          type: string
          description: "One line for people, e.g. 3 new entries on a page"
        nextStep:
          type: string
          description: "What to do next, one line; absent when nothing"
        links:
          type: array
          description: Links for this item
          items:
            $ref: "#/components/schemas/NotificationLink"
        pages:
          type: array
          description: Publications this item is about; absent when it names none
          items:
            $ref: "#/components/schemas/NotificationPage"
        actions:
          type: array
          description: Actions you can take now; absent when none
          items:
            $ref: "#/components/schemas/NotificationAction"
      required:
      - count
      - createdAt
      - group
      - id
      - kind
      - links
      - message
      - read
      - type
      - updatedAt
    NotificationLink:
      type: object
      properties:
        rel:
          type: string
          description: "page: the page itself; data: its Data tab; manage: its management\
            \ page; settings: notification settings"
          enum:
          - page
          - data
          - manage
          - settings
        url:
          type: string
          description: Address on the account site; opening it needs the profile's
            sign-in
      required:
      - rel
      - url
    NotificationListResponse:
      type: object
      properties:
        items:
          type: array
          description: Newest first
          items:
            $ref: "#/components/schemas/NotificationItem"
        nextCursor:
          type:
          - string
          - "null"
          description: Pass as cursor for the next page; null on the last page
        unread:
          type: integer
          format: int32
          description: "Unread notices, at most 99"
      required:
      - items
      - nextCursor
      - unread
    NotificationPage:
      type: object
      properties:
        type:
          type: string
          description: API segment of the publication type
          enum:
          - html
          - sites
          - files
          - json
        ns:
          type: string
          description: Namespace
        id:
          type: string
          description: Publication id
        title:
          type: string
          description: Title of the publication; the owner's own text
        expiresAt:
          type:
          - string
          - "null"
          format: date-time
          description: When the publication expires; null when it does not
        state:
          type: string
          description: "due: expires soon; extended: kept longer since; gone: removed"
          enum:
          - due
          - extended
          - gone
      required:
      - expiresAt
      - id
      - ns
      - state
      - title
      - type
    OwnerTokenResponse:
      type: object
      properties:
        token:
          type: string
        ownerId:
          type: string
    RandomNamespaceResponse:
      type: object
      properties:
        namespace:
          type: string
    FileLimitsResponse:
      type: object
      description: File upload; maxFiles per namespace
      properties:
        maxFileBytes:
          type: integer
          format: int64
        maxVideoBytes:
          type: integer
          format: int64
        maxAudioBytes:
          type: integer
          format: int64
        maxFiles:
          type: integer
          format: int32
        defaultTtlDays:
          type: integer
          format: int32
        maxTtlDays:
          type: integer
          format: int32
      required:
      - defaultTtlDays
      - maxAudioBytes
      - maxFileBytes
      - maxFiles
      - maxTtlDays
      - maxVideoBytes
    HtmlLimitsResponse:
      type: object
      description: "HTML, Markdown, code or JSON page (`POST /api/html`); maxBytes\
        \ counts UTF-8 bytes"
      properties:
        maxBytes:
          type: integer
          format: int64
        defaultTtlDays:
          type: integer
          format: int32
        maxTtlDays:
          type: integer
          format: int32
      required:
      - defaultTtlDays
      - maxBytes
      - maxTtlDays
    JsonLimitsResponse:
      type: object
      description: JSON document; maxDocs per namespace
      properties:
        maxBytes:
          type: integer
          format: int64
        maxDocs:
          type: integer
          format: int32
        defaultTtlDays:
          type: integer
          format: int32
        maxTtlDays:
          type: integer
          format: int32
      required:
      - defaultTtlDays
      - maxBytes
      - maxDocs
      - maxTtlDays
    KvLimitsResponse:
      type: object
      description: KV store; maxKeys per store
      properties:
        maxValueBytes:
          type: integer
          format: int64
        maxKeys:
          type: integer
          format: int32
        defaultTtlDays:
          type: integer
          format: int32
        maxTtlDays:
          type: integer
          format: int32
      required:
      - defaultTtlDays
      - maxKeys
      - maxTtlDays
      - maxValueBytes
    LimitsResponse:
      type: object
      properties:
        requestMaxBytes:
          type: integer
          format: int64
        sites:
          $ref: "#/components/schemas/SiteLimitsResponse"
        html:
          $ref: "#/components/schemas/HtmlLimitsResponse"
        json:
          $ref: "#/components/schemas/JsonLimitsResponse"
        kv:
          $ref: "#/components/schemas/KvLimitsResponse"
        files:
          $ref: "#/components/schemas/FileLimitsResponse"
        profileMaxTtlDays:
          type: integer
          format: int32
          description: "TTL cap in days for an X-Owner-Token in a profile, every type"
        reach:
          type: string
          description: "`profile` only for an X-Owner-Token active in a profile; else\
            \ `token`, also without a token"
          enum:
          - token
          - profile
        ownerMaxTtlDays:
          type: integer
          format: int32
          description: Per-owner TTL cap in days for this token; absent = per-type
            maximum
        customDomains:
          description: "Custom domains: `limit` of the token's profile when `reach`\
            \ is `profile`, else the default; absent when custom domains are not available"
          oneOf:
          - $ref: "#/components/schemas/CustomDomainsBlock"
      required:
      - files
      - html
      - json
      - kv
      - profileMaxTtlDays
      - reach
      - requestMaxBytes
      - sites
    SiteLimitsResponse:
      type: object
      properties:
        maxFiles:
          type: integer
          format: int32
        maxFileBytes:
          type: integer
          format: int64
        maxTotalBytes:
          type: integer
          format: int64
        maxArchiveExpansionBytes:
          type: integer
          format: int64
        maxPathChars:
          type: integer
          format: int32
        maxPathBytes:
          type: integer
          format: int32
        maxNameBytes:
          type: integer
          format: int32
        defaultTtlDays:
          type: integer
          format: int32
        maxTtlDays:
          type: integer
          format: int32
        allowedExtensions:
          type: array
          items:
            type: string
        skippedFileNames:
          type: array
          items:
            type: string
        skippedRootFolders:
          type: array
          items:
            type: string
      required:
      - allowedExtensions
      - defaultTtlDays
      - maxArchiveExpansionBytes
      - maxFileBytes
      - maxFiles
      - maxNameBytes
      - maxPathBytes
      - maxPathChars
      - maxTotalBytes
      - maxTtlDays
      - skippedFileNames
      - skippedRootFolders
    KvStoreListResponse:
      type: object
      properties:
        id:
          type: string
          description: Unique 10-character alphanumeric store ID
        keyCount:
          type: integer
          format: int32
          description: Number of keys in the store
        createdAt:
          type: string
          format: date-time
          description: When the first key in the store was created
      required:
      - createdAt
      - id
      - keyCount
    KvListKeysResponse:
      type: object
      properties:
        keys:
          type: array
          description: All key names in the store
          items:
            type: string
        count:
          type: integer
          format: int32
          description: Total number of keys
        expiresAt:
          type: string
          format: date-time
          description: When the store expires
        views:
          type: integer
          format: int64
          description: Aggregated views across all keys in this store
      required:
      - count
      - expiresAt
      - keys
      - views
    KvGetResponse:
      type: object
      properties:
        value:
          type: string
        updatedAt:
          type: string
          format: date-time
          description: When the value was last written or updated
        expiresAt:
          type: string
          format: date-time
          description: When the value expires
        views:
          type: integer
          format: int64
          description: Total number of reads for this key (post-increment)
      required:
      - expiresAt
      - updatedAt
      - value
      - views
    JsonListResponse:
      type: object
      properties:
        id:
          type: string
          description: Unique 10-character alphanumeric document ID
        content:
          type: string
        size:
          type: integer
          format: int64
        createdAt:
          type: string
          format: date-time
      required:
      - content
      - createdAt
      - id
      - size
    HostOwnerCheckResponse:
      type: object
      properties:
        type:
          type: string
          description: "Resource type (html, kv, json, file, site); owners only"
        namespace:
          type: string
          description: Publication namespace; owners only
        id:
          type: string
          description: Publication id; owners only
        isOwner:
          type: boolean
      required:
      - isOwner
    GalleryItem:
      type: object
      properties:
        id:
          type: string
        type:
          type: string
          description: "Publication type: a page's stored format ('html', 'markdown'\
            \ or a code format such as 'json', 'yaml', 'txt'), 'file', or 'site'"
        title:
          type: string
          description: Display title derived from content or filename
        createdAt:
          type: string
          format: date-time
        views:
          type: integer
          format: int64
          description: Total view count
        visibility:
          type:
          - string
          - "null"
          description: Per-item visibility classification — public on default responses;
            my_public/my_public_password/my_private on mine=true
          enum:
          - public
          - my_public
          - my_public_password
          - my_private
        namespace:
          type:
          - string
          - "null"
          description: "Namespace the item lives in — 'public' on default responses;\
            \ mine=true returns the real namespace (e.g. 'public', 'secret-ns') so\
            \ the frontend can build correct /{ns}/{id} links"
        listed:
          type:
          - boolean
          - "null"
          description: "mine=true only: false for private, password or unlisted items\
            \ (unlisted by the owner = public + false + listable)"
        listable:
          type:
          - boolean
          - "null"
          description: "mine=true only: false = never listed in the gallery whatever\
            \ the namespace (JSON and KV, JSON pages, HTML and JSON files); listing\
            \ does not apply"
        link:
          type:
          - string
          - "null"
        managementLink:
          type:
          - string
          - "null"
        routingCohort:
          type: string
        deliveryMode:
          type:
          - string
          - "null"
        hostingVersion:
          type:
          - integer
          - "null"
          format: int64
        expiresAt:
          type:
          - string
          - "null"
          format: date-time
          description: "mine=true only: when the publication expires"
        preview:
          description: WebP previews; null while previews are off and on password
            rows
          oneOf:
          - $ref: "#/components/schemas/PublicationPreviewResponse"
          - type: "null"
        format:
          type:
          - string
          - "null"
          description: "type=file: lowercase extension, else null"
        chips:
          type: array
          description: "Feature chips: 'page-data', 'custom-domain'; empty when none"
          items:
            type: string
    GalleryResponse:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: "#/components/schemas/GalleryItem"
        total:
          type: integer
          format: int64
          description: Total number of matching items across all pages
        page:
          type: integer
          format: int32
          description: Current page number (1-based)
        size:
          type: integer
          format: int32
          description: Items per page
        scope:
          type:
          - string
          - "null"
          description: "mine=true only: `profile` when the token is active in a profile\
            \ (its rows are listed), else `token`"
          enum:
          - token
          - profile
    GalleryPromoCaptions:
      type: object
      properties:
        top:
          type: string
          description: Caption of the block above the gallery
        bottom:
          type: string
          description: Caption of the block below the gallery
    GalleryPromoItem:
      type: object
      properties:
        kind:
          type: string
          description: Item kind
          enum:
          - template
          - video
        slug:
          type: string
        title:
          type: string
        id:
          type: string
          description: Publication id in the public namespace
        namespace:
          type: string
        tier:
          type:
          - string
          - "null"
          description: "kind=template: 'basic' or 'more'; absent for video"
          enum:
          - basic
          - more
        chips:
          type: array
          description: "Feature chips: 'page-data', 'custom-domain', 'api'; empty\
            \ for video"
          items:
            type: string
        pageUrl:
          type:
          - string
          - "null"
          description: "kind=template: its template page; absent for video"
        sourceUrl:
          type:
          - string
          - "null"
          description: "kind=template: its clean source as plain text; absent for\
            \ video"
        link:
          type: string
          description: Live address of the publication
        views:
          type: integer
          format: int64
          description: Total view count
        copies:
          type:
          - integer
          - "null"
          format: int64
          description: "kind=template: pages published as copies of this template;\
            \ absent for video"
        preview:
          description: WebP previews (the poster's when the item has one); null while
            previews are off
          oneOf:
          - $ref: "#/components/schemas/PublicationPreviewResponse"
          - type: "null"
        mediaUrl:
          type:
          - string
          - "null"
          description: "kind=video: the playable file; absent otherwise"
        durationSeconds:
          type:
          - integer
          - "null"
          format: int32
          description: "kind=video: length in seconds; absent otherwise"
        weight:
          type: integer
          format: int32
          description: Relative chance of being shown; clients draw cards by it
          minimum: 1
        isNew:
          type: boolean
    GalleryPromoPeriod:
      type: object
      properties:
        index:
          type: integer
          format: int64
          description: Period number; the answer is the same for every client within
            one period
        endsAt:
          type: string
          format: date-time
          description: When the next period starts
    GalleryPromoResponse:
      type: object
      description: BrewPage examples shown above and below the public gallery; clients
        draw the cards by item weight
      properties:
        sectionUrl:
          type: string
          description: Page listing every template
        captions:
          $ref: "#/components/schemas/GalleryPromoCaptions"
        period:
          $ref: "#/components/schemas/GalleryPromoPeriod"
        slots:
          $ref: "#/components/schemas/GalleryPromoSlots"
          description: "This period's default set and the block shape: cards per block\
            \ and the slot that holds a video"
        items:
          type: array
          description: Every live item in registry order; slots name items by slug
          items:
            $ref: "#/components/schemas/GalleryPromoItem"
    GalleryPromoSlots:
      type: object
      properties:
        top:
          type: array
          description: Slugs of the top block in card order; phones show the first
          items:
            type: string
        bottom:
          type: array
          description: Slugs of the bottom block in card order; phones show the first
          items:
            type: string
    FileListResponse:
      type: object
      properties:
        id:
          type: string
          description: Unique 10-character alphanumeric file ID
        filename:
          type: string
          description: Original filename as uploaded
        contentType:
          type: string
          description: Detected MIME type (e.g. image/png)
        size:
          type: integer
          format: int64
        link:
          type: string
          description: Public short URL for browser download
        createdAt:
          type: string
          format: date-time
      required:
      - createdAt
      - filename
      - id
      - link
      - size
    DomainListResponse:
      type: object
      description: Custom domains of a profile.
      properties:
        limit:
          type: integer
          format: int32
          description: Hostnames the profile may hold
        used:
          type: integer
          format: int32
          description: Hostnames the profile holds
        items:
          type: array
          items:
            $ref: "#/components/schemas/DomainItem"
      required:
      - items
      - limit
      - used
    StateDeleteResponse:
      type: object
      properties:
        deleted:
          type: integer
          format: int32
          description: Entries and files deleted
      required:
      - deleted
    ErrorResponse:
      type: object
      properties:
        status:
          type: integer
          format: int32
        error:
          type: string
        message:
          type: string
        timestamp:
          type: string
          format: date-time
        supportedTypes:
          type: array
          items:
            type: string
        retryAfterSeconds:
          type: integer
          format: int64
          description: Seconds to wait; same as Retry-After
        limit:
          type: integer
          format: int32
        result:
          oneOf:
          - $ref: "#/components/schemas/PublicationResult"
        code:
          type: string
          description: "Machine-readable reason, e.g. OWNER_AUTHORIZATION_FAILED,\
            \ OWNER_TOKEN_REVOKED, OWNER_TOKEN_EXPIRED, ADMIN_TOKEN_REQUIRED, OLD_PUBLICATION_READ_ONLY,\
            \ WRONG_RESOURCE_TYPE, PUBLICATION_UNAVAILABLE, ROTATE_LIMITED, TITLE_INVALID,\
            \ BADGE_HIDDEN_LIMIT, NOT_PUBLIC."
        republishUrl:
          type: string
          description: "With OLD_PUBLICATION_READ_ONLY on an HTML page: browser composer\
            \ to publish it anew."
        createUrl:
          type: string
          description: "With OLD_PUBLICATION_READ_ONLY or a write 404: create endpoint\
            \ (same namespace); POST the content there to publish it anew."
        resourceUrl:
          type: string
          description: "With WRONG_RESOURCE_TYPE: API URL of this id's real type;\
            \ repeat the write there."
        accountUrl:
          type: string
          description: "Write 429 without an account: free account with higher limits"
        used:
          type: integer
          format: int32
          description: "With DOMAIN_LIMIT or BADGE_HIDDEN_LIMIT: custom domains or\
            \ hidden badges the profile already uses (`limit` = how many it may hold)"
        reason:
          type: string
          description: "With NOT_ELIGIBLE: why the publication cannot take a custom\
            \ domain: OWNERSHIP (add its owner token to the profile), OLD (publish\
            \ it again), RETIRED (its address was retired; set the domain on a live\
            \ publication), TYPE (only HTML pages and sites), FORMAT (only format\
            \ html), PASSWORD (remove the password), EXPIRED (it cannot come back:\
            \ attach another publication) or MODE (it is not on its own subdomain;\
            \ set the domain on it again)"
        siteKey:
          type: string
          description: "With STATE_CHALLENGE: Turnstile site key for the human check\
            \ (action state_write)"
        challengeUrl:
          type: string
          description: "With STATE_CHALLENGE on a custom domain only: https address\
            \ of the check page to frame"
      required:
      - error
      - message
      - status
      - timestamp
  securitySchemes:
    OwnerToken:
      type: apiKey
      name: X-Owner-Token
      in: header
    Password:
      type: apiKey
      name: X-Password
      in: header
    ManageKey:
      type: apiKey
      description: "Key from manageUrl (#k=…): private, full control of one publication."
      name: X-Manage-Key
      in: header
