{
  "openapi": "3.1.0",
  "info": {
    "title": "Spillway CMS API",
    "version": "0.1.24",
    "summary": "The JSON API behind the Spillway admin and the MCP server.",
    "description": "Everything the admin does goes through this API, so anything the admin can do, a script can do. Bodies are JSON unless noted; errors are `{ \"error\": { \"code\", \"message\", \"details?\" } }` with a 4xx or 5xx status.\n\n**Authentication.** A browser session is an httpOnly cookie `spillway_session` set by `POST /api/auth/login` (or the setup wizard); every request with a method other than GET, HEAD or OPTIONS must then send `X-Requested-With: spillway` or it fails with 403 `csrf`. Scripts and agents use a bearer token instead: `Authorization: Bearer spw_<prefix>_<secret>`, minted under API tokens in the admin, whose effective permissions are the intersection of the token's set and its owner's current roles; bearer requests need no CSRF header. `POST /mcp` accepts bearer tokens only.\n\n**Permissions.** Each operation lists the permission it checks under `x-permission` (see the roles and permissions reference). **Pagination.** List endpoints take `page` (default 1) and `limit` (default 20, max 100) and answer `{ items, total, page, limit }`. **Site scope.** Every request belongs to one site, picked by the `Host` header, `?__site=<id|key>` or `X-Spillway-Site`.\n\nThis document is generated from the route handlers in `packages/core/src/routes` by `pnpm docs:build` and may lag the hand-written [api.md](https://github.com/kwall-llc/spillway-cms/blob/main/docs/api.md) in prose; where a request body shows `x-zod` the generator could not read the schema and the contract comment is the reference.",
    "license": {
      "name": "Proprietary (private beta)",
      "url": "https://spillwaycms.com/docs/dev/licensing"
    },
    "contact": {
      "name": "Spillway CMS",
      "url": "https://spillwaycms.com"
    }
  },
  "externalDocs": {
    "description": "Spillway documentation",
    "url": "https://spillwaycms.com/docs"
  },
  "servers": [
    {
      "url": "https://{host}",
      "description": "Your Spillway site",
      "variables": {
        "host": {
          "default": "cms.example.org"
        }
      }
    },
    {
      "url": "http://localhost:3000",
      "description": "Local development"
    }
  ],
  "tags": [
    {
      "name": "Accounts",
      "description": "Handlers in packages/core/src/routes/accounts.ts"
    },
    {
      "name": "Agent attachments",
      "description": "Handlers in packages/core/src/routes/agent-attachments.ts"
    },
    {
      "name": "Agents",
      "description": "Handlers in packages/core/src/routes/agents.ts"
    },
    {
      "name": "AI",
      "description": "Handlers in packages/core/src/routes/ai.ts"
    },
    {
      "name": "Alerts",
      "description": "Handlers in packages/core/src/routes/alerts.ts"
    },
    {
      "name": "Analytics",
      "description": "Handlers in packages/core/src/routes/analytics.ts"
    },
    {
      "name": "Auth",
      "description": "Handlers in packages/core/src/routes/auth.ts"
    },
    {
      "name": "Brand",
      "description": "Handlers in packages/core/src/routes/brand.ts"
    },
    {
      "name": "Brand import",
      "description": "Handlers in packages/core/src/routes/brand-import.ts"
    },
    {
      "name": "Builder",
      "description": "Handlers in packages/core/src/routes/builder.ts"
    },
    {
      "name": "Bulk actions",
      "description": "Handlers in packages/core/src/routes/bulk.ts"
    },
    {
      "name": "Cdn",
      "description": "Handlers in packages/core/src/routes/cdn.ts"
    },
    {
      "name": "Collections",
      "description": "Handlers in packages/core/src/routes/collections.ts"
    },
    {
      "name": "Components",
      "description": "Handlers in packages/core/src/routes/components.ts"
    },
    {
      "name": "Dam",
      "description": "Handlers in packages/core/src/routes/dam.ts"
    },
    {
      "name": "Editorial",
      "description": "Handlers in packages/core/src/routes/editorial.ts"
    },
    {
      "name": "Enterprise sign-in (SSO)",
      "description": "Handlers in packages/core/src/routes/sso.ts"
    },
    {
      "name": "Entities",
      "description": "Handlers in packages/core/src/routes/entities.ts"
    },
    {
      "name": "Feeds",
      "description": "Handlers in packages/core/src/routes/feeds.ts"
    },
    {
      "name": "Fonts",
      "description": "Handlers in packages/core/src/routes/fonts.ts"
    },
    {
      "name": "Forms",
      "description": "Handlers in packages/core/src/routes/forms.ts"
    },
    {
      "name": "Free media",
      "description": "Handlers in packages/core/src/routes/free-media.ts"
    },
    {
      "name": "Generated modules",
      "description": "Handlers in packages/core/src/routes/generated-modules.ts"
    },
    {
      "name": "Google",
      "description": "Handlers in packages/core/src/routes/google.ts"
    },
    {
      "name": "Health",
      "description": "Handlers in packages/core/src/routes/health.ts"
    },
    {
      "name": "Hosting sign in",
      "description": "Handlers in packages/core/src/routes/hosting-sign-in.ts"
    },
    {
      "name": "Hosting usage",
      "description": "Handlers in packages/core/src/routes/hosting-usage.ts"
    },
    {
      "name": "I18n tms",
      "description": "Handlers in packages/core/src/routes/i18n-tms.ts"
    },
    {
      "name": "Imports",
      "description": "Handlers in packages/core/src/routes/imports.ts"
    },
    {
      "name": "Imports plan",
      "description": "Handlers in packages/core/src/routes/imports-plan.ts"
    },
    {
      "name": "Imports theme",
      "description": "Handlers in packages/core/src/routes/imports-theme.ts"
    },
    {
      "name": "Kits and structure",
      "description": "Handlers in packages/core/src/routes/kits.ts"
    },
    {
      "name": "Mail",
      "description": "Handlers in packages/core/src/routes/mail.ts"
    },
    {
      "name": "MCP",
      "description": "Handlers in packages/core/src/routes/mcp.ts"
    },
    {
      "name": "Media",
      "description": "Handlers in packages/core/src/routes/media.ts"
    },
    {
      "name": "Member profiles",
      "description": "Handlers in packages/core/src/routes/member-profiles.ts"
    },
    {
      "name": "Menus",
      "description": "Handlers in packages/core/src/routes/menus.ts"
    },
    {
      "name": "Migrations",
      "description": "Handlers in packages/core/src/routes/migrations.ts"
    },
    {
      "name": "Modules",
      "description": "Handlers in packages/core/src/routes/modules.ts"
    },
    {
      "name": "Oauth",
      "description": "Handlers in packages/core/src/routes/oauth.ts"
    },
    {
      "name": "Onboarding",
      "description": "Handlers in packages/core/src/routes/onboarding.ts"
    },
    {
      "name": "Password",
      "description": "Handlers in packages/core/src/routes/password.ts"
    },
    {
      "name": "Patterns",
      "description": "Handlers in packages/core/src/routes/patterns.ts"
    },
    {
      "name": "Personalization",
      "description": "Handlers in packages/core/src/routes/personalization.ts"
    },
    {
      "name": "Personalization islands",
      "description": "Handlers in packages/core/src/routes/islands.ts"
    },
    {
      "name": "Placements",
      "description": "Handlers in packages/core/src/routes/placements.ts"
    },
    {
      "name": "Players",
      "description": "Handlers in packages/core/src/routes/players.ts"
    },
    {
      "name": "Preferences",
      "description": "Handlers in packages/core/src/routes/preferences.ts"
    },
    {
      "name": "Public render",
      "description": "Handlers in packages/core/src/routes/public-render.ts"
    },
    {
      "name": "Redirects",
      "description": "Handlers in packages/core/src/routes/redirects.ts"
    },
    {
      "name": "Registry",
      "description": "Handlers in packages/core/src/routes/registry.ts"
    },
    {
      "name": "Review",
      "description": "Handlers in packages/core/src/routes/review.ts"
    },
    {
      "name": "Review links",
      "description": "Handlers in packages/core/src/routes/review-links.ts"
    },
    {
      "name": "Rich text",
      "description": "Handlers in packages/core/src/routes/richtext.ts"
    },
    {
      "name": "Roles",
      "description": "Handlers in packages/core/src/routes/roles.ts"
    },
    {
      "name": "Scenes",
      "description": "Handlers in packages/core/src/routes/scenes.ts"
    },
    {
      "name": "Scim",
      "description": "Handlers in packages/core/src/routes/scim.ts"
    },
    {
      "name": "Search",
      "description": "Handlers in packages/core/src/routes/search.ts"
    },
    {
      "name": "Sections",
      "description": "Handlers in packages/core/src/routes/sections.ts"
    },
    {
      "name": "SEO files",
      "description": "Handlers in packages/core/src/routes/seo.ts"
    },
    {
      "name": "Setup",
      "description": "Handlers in packages/core/src/routes/setup.ts"
    },
    {
      "name": "Shared blocks",
      "description": "Handlers in packages/core/src/routes/shared-blocks.ts"
    },
    {
      "name": "Site components",
      "description": "Handlers in packages/core/src/routes/site-components.ts"
    },
    {
      "name": "Site settings",
      "description": "Handlers in packages/core/src/routes/site.ts"
    },
    {
      "name": "Sites (multisite)",
      "description": "Handlers in packages/core/src/routes/sites.ts"
    },
    {
      "name": "Stripe",
      "description": "Handlers in packages/core/src/routes/stripe.ts"
    },
    {
      "name": "Suggestions",
      "description": "Handlers in packages/core/src/routes/suggestions.ts"
    },
    {
      "name": "System",
      "description": "Handlers in packages/core/src/routes/system.ts"
    },
    {
      "name": "Theme",
      "description": "Handlers in packages/core/src/routes/theme.ts"
    },
    {
      "name": "Tokens",
      "description": "Handlers in packages/core/src/routes/tokens.ts"
    },
    {
      "name": "Translations",
      "description": "Handlers in packages/core/src/routes/translations.ts"
    },
    {
      "name": "Two step",
      "description": "Handlers in packages/core/src/routes/two-step.ts"
    },
    {
      "name": "Types",
      "description": "Handlers in packages/core/src/routes/types.ts"
    },
    {
      "name": "Updates",
      "description": "Handlers in packages/core/src/routes/updates.ts"
    },
    {
      "name": "Users",
      "description": "Handlers in packages/core/src/routes/users.ts"
    },
    {
      "name": "Views",
      "description": "Handlers in packages/core/src/routes/views.ts"
    },
    {
      "name": "Vocabularies",
      "description": "Handlers in packages/core/src/routes/vocabularies.ts"
    },
    {
      "name": "Workflows",
      "description": "Handlers in packages/core/src/routes/workflows.ts"
    },
    {
      "name": "Workstreams",
      "description": "Handlers in packages/core/src/routes/workstreams.ts"
    }
  ],
  "paths": {
    "/.well-known/oauth-authorization-server": {
      "get": {
        "operationId": "getWellKnownOauthAuthorizationServer",
        "tags": [
          "Oauth"
        ],
        "summary": "GET /.well-known/oauth-authorization-server (RFC 8414) → issuer, authorization_endpoint (/oauth/authorize), to",
        "description": "Contract: GET /.well-known/oauth-authorization-server (RFC 8414) → issuer, authorization_endpoint (/oauth/authorize), token_endpoint\n\nPublic, or checks access itself (see the description).",
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/.well-known/oauth-protected-resource": {
      "get": {
        "operationId": "getWellKnownOauthProtectedResource",
        "tags": [
          "Oauth"
        ],
        "summary": "GET /.well-known/oauth-protected-resource[/mcp] (RFC 9728) → { resource: <origin>/mcp, authorization_servers: ",
        "description": "Contract: GET /.well-known/oauth-protected-resource[/mcp] (RFC 9728) → { resource: <origin>/mcp, authorization_servers: [<origin>],\n\nPublic, or checks access itself (see the description).",
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/.well-known/oauth-protected-resource/mcp": {
      "get": {
        "operationId": "getWellKnownOauthProtectedResourceMcp",
        "tags": [
          "Oauth"
        ],
        "summary": "GET /.well-known/oauth-protected-resource/mcp",
        "description": "Public, or checks access itself (see the description).",
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/.well-known/security.txt": {
      "get": {
        "operationId": "getWellKnownSecurityTxt",
        "tags": [
          "SEO files"
        ],
        "summary": "RFC 9116: where to report a vulnerability",
        "description": "RFC 9116: where to report a vulnerability. Served as the site wrote it; no default, because only the operator knows the contact.\n\nContract: GET /.well-known/security.txt   SiteSettings.seo.securityTxt as written (RFC 9116: Contact, Expires, Policy...); 404 when empty\n\nPublic, or checks access itself (see the description).",
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/.well-known/{name}": {
      "get": {
        "operationId": "getWellKnownName",
        "tags": [
          "SEO files"
        ],
        "summary": "GET /.well-known/{name}",
        "description": "Public, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/_alerts": {
      "get": {
        "operationId": "getAlerts",
        "tags": [
          "Alerts"
        ],
        "summary": "mount plus a 1 KB inline script that fetches GET /_alerts (public JSON { alerts: PublicSiteAlert[] }, Cache-Co",
        "description": "Contract: mount plus a 1 KB inline script that fetches GET /_alerts (public JSON { alerts: PublicSiteAlert[] }, Cache-Control: no-store, honours the dismiss cookies)\n\nPublic, or checks access itself (see the description).",
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/_beacon": {
      "post": {
        "operationId": "postBeacon",
        "tags": [
          "Analytics"
        ],
        "summary": "once per view; conversions are recorded server-side on form submissions and `path` goals, plus POST /_beacon {",
        "description": "Contract: once per view; conversions are recorded server-side on form submissions and `path` goals, plus POST /_beacon { e: 'click', x: <expKey> } for click goals.\n\nPublic, or checks access itself (see the description).",
        "security": [],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/_island/{entityId}/{blockId}": {
      "get": {
        "operationId": "getIslandEntityIdBlockId",
        "tags": [
          "Personalization islands"
        ],
        "summary": "one inline script calls GET /_island/:entityId/:blockId?u=<page url>&r=<document.referrer> → { html, exposure?",
        "description": "Contract: one inline script calls GET /_island/:entityId/:blockId?u=<page url>&r=<document.referrer> → { html, exposure?, goal? } for the visitor (no-store,\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "entityId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "blockId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "u",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "r",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/_motion/{name}": {
      "get": {
        "operationId": "getMotionName",
        "tags": [
          "Players"
        ],
        "summary": "GET /_motion/{name}",
        "description": "Public, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/_placeholder/{size}": {
      "get": {
        "operationId": "getPlaceholderSize",
        "tags": [
          "Components"
        ],
        "summary": "GET /_placeholder/{size}",
        "description": "Public, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "size",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/_scene/{slug}/files/{path}": {
      "get": {
        "operationId": "getSceneSlugFilesPath",
        "tags": [
          "Scenes"
        ],
        "summary": "GET /_scene/{slug}/files/{path}",
        "description": "Public, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "path",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/_scene/{slug}/frame/{key}": {
      "get": {
        "operationId": "getSceneSlugFrameKey",
        "tags": [
          "Scenes"
        ],
        "summary": "GET /_scene/{slug}/frame/{key}",
        "description": "Public, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/_video-thumbs/{provider}/{file}": {
      "get": {
        "operationId": "getVideoThumbsProviderFile",
        "tags": [
          "Players"
        ],
        "summary": "GET /_video-thumbs/{provider}/{file}",
        "description": "Public, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "provider",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "file",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/accounts/groups": {
      "get": {
        "operationId": "getApiAccountsGroups",
        "tags": [
          "Accounts"
        ],
        "summary": "Member groups: named groups of the site's accounts that pages and files can be limited to (accounts/groups.ts)",
        "description": "Member groups: named groups of the site's accounts that pages and files can be limited to (accounts/groups.ts).\n\nThe names are also for whoever chooses who can see content: editors (Publish), section and content model managers.\n\nContract: `account.groups_set`): GET /api/accounts/groups → MemberGroup[]; POST /api/accounts/groups MemberGroupInput → MemberGroup (201;\n\nPermission: `users.manage`.",
        "x-permission": [
          "users.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "operationId": "postApiAccountsGroups",
        "tags": [
          "Accounts"
        ],
        "summary": "`account.groups_set`): GET /api/accounts/groups → MemberGroup[]; POST /api/accounts/groups MemberGroupInput → ",
        "description": "Contract: `account.groups_set`): GET /api/accounts/groups → MemberGroup[]; POST /api/accounts/groups MemberGroupInput → MemberGroup (201;\n\nPermission: `users.manage`.",
        "x-permission": [
          "users.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "slug": {
                    "type": "string",
                    "maxLength": 64
                  },
                  "description": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 1000
                  }
                },
                "required": [
                  "name"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/accounts/groups/{id}": {
      "get": {
        "operationId": "getApiAccountsGroupsId",
        "tags": [
          "Accounts"
        ],
        "summary": "GET /api/accounts/groups/{id}",
        "description": "Permission: `users.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "users.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "operationId": "putApiAccountsGroupsId",
        "tags": [
          "Accounts"
        ],
        "summary": "PUT /api/accounts/groups/{id}",
        "description": "Permission: `users.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "users.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "slug": {
                    "type": "string",
                    "maxLength": 64
                  },
                  "description": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 1000
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "operationId": "deleteApiAccountsGroupsId",
        "tags": [
          "Accounts"
        ],
        "summary": "409 `slug_taken`); PUT/DELETE /api/accounts/groups/:id (id or slug; deleting removes its memberships, and page",
        "description": "Contract: 409 `slug_taken`); PUT/DELETE /api/accounts/groups/:id (id or slug; deleting removes its memberships, and pages limited to it\n\nPermission: `users.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "users.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/accounts/groups/{id}/members": {
      "get": {
        "operationId": "getApiAccountsGroupsIdMembers",
        "tags": [
          "Accounts"
        ],
        "summary": "are then visible to staff only); GET /api/accounts/groups/:id/members → { items: AccountMember[], total }; POS",
        "description": "Contract: are then visible to staff only); GET /api/accounts/groups/:id/members → { items: AccountMember[], total }; POST\n\nPermission: `users.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "x-coerce": true,
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          }
        ],
        "x-permission": [
          "users.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "operationId": "postApiAccountsGroupsIdMembers",
        "tags": [
          "Accounts"
        ],
        "summary": "POST /api/accounts/groups/{id}/members",
        "description": "Permission: `users.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "users.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "userIds": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 100
                    },
                    "minItems": 1,
                    "maxItems": 500
                  }
                },
                "required": [
                  "userIds"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/accounts/groups/{id}/members/{userId}": {
      "delete": {
        "operationId": "deleteApiAccountsGroupsIdMembersUserId",
        "tags": [
          "Accounts"
        ],
        "summary": "/api/accounts/groups/:id/members { userIds } adds site accounts; DELETE /api/accounts/groups/:id/members/:user",
        "description": "Contract: /api/accounts/groups/:id/members { userIds } adds site accounts; DELETE /api/accounts/groups/:id/members/:userId; PUT\n\nPermission: `users.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "userId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "users.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/accounts/invites": {
      "get": {
        "operationId": "getApiAccountsInvites",
        "tags": [
          "Accounts"
        ],
        "summary": "Account invitations: an email with a single-use link to register with that address (accounts/invites.ts).",
        "description": "Account invitations: an email with a single-use link to register with that address (accounts/invites.ts).\n\nContract: the same address is replaced; 409 `already_member` for an address that already has an account here); GET /api/accounts/invites\n\nPermission: `users.manage`.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "x-coerce": true,
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "pending",
                "accepted",
                "revoked",
                "expired"
              ]
            }
          }
        ],
        "x-permission": [
          "users.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "operationId": "postApiAccountsInvites",
        "tags": [
          "Accounts"
        ],
        "summary": "`account.invite_accept`): POST /api/accounts/invites AccountInviteRequest → AccountInviteResult (201; a pendin",
        "description": "Contract: `account.invite_accept`): POST /api/accounts/invites AccountInviteRequest → AccountInviteResult (201; a pending invitation for\n\nPermission: `users.manage`.",
        "x-permission": [
          "users.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string",
                    "format": "email",
                    "maxLength": 254
                  },
                  "message": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 1000
                  },
                  "groups": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 100
                    },
                    "maxItems": 50
                  }
                },
                "required": [
                  "email"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/accounts/invites/{id}": {
      "delete": {
        "operationId": "deleteApiAccountsInvitesId",
        "tags": [
          "Accounts"
        ],
        "summary": "AccountInviteResult (a new link, valid ACCOUNT_INVITE_TTL_DAYS days again); DELETE /api/accounts/invites/:id r",
        "description": "Contract: AccountInviteResult (a new link, valid ACCOUNT_INVITE_TTL_DAYS days again); DELETE /api/accounts/invites/:id revokes it. The email\n\nPermission: `users.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "users.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/accounts/invites/{id}/resend": {
      "post": {
        "operationId": "postApiAccountsInvitesIdResend",
        "tags": [
          "Accounts"
        ],
        "summary": "?status=pending|accepted|revoked|expired → { items: AccountInvite[], total }; POST /api/accounts/invites/:id/r",
        "description": "Contract: ?status=pending|accepted|revoked|expired → { items: AccountInvite[], total }; POST /api/accounts/invites/:id/resend →\n\nPermission: `users.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "users.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/accounts/members": {
      "get": {
        "operationId": "getApiAccountsMembers",
        "tags": [
          "Accounts"
        ],
        "summary": "GET /api/accounts/members?status=active|pending → { items: AccountMember[], total } (users.manage); DELETE /ap",
        "description": "Contract: GET /api/accounts/members?status=active|pending → { items: AccountMember[], total } (users.manage); DELETE /api/accounts/members/:userId\n\nPermission: `users.manage`.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "x-coerce": true,
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "active",
                "pending"
              ]
            }
          }
        ],
        "x-permission": [
          "users.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/accounts/members/{userId}": {
      "delete": {
        "operationId": "deleteApiAccountsMembersUserId",
        "tags": [
          "Accounts"
        ],
        "summary": "GET /api/accounts/members?status=active|pending → { items: AccountMember[], total } (users.manage); DELETE /ap",
        "description": "Contract: GET /api/accounts/members?status=active|pending → { items: AccountMember[], total } (users.manage); DELETE /api/accounts/members/:userId\n\nPermission: `users.manage`.",
        "parameters": [
          {
            "name": "userId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "users.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/accounts/members/{userId}/approve": {
      "post": {
        "operationId": "postApiAccountsMembersUserIdApprove",
        "tags": [
          "Accounts"
        ],
        "summary": "A request waiting for approval (registration in approval mode): approve lets the person sign in; reject remove",
        "description": "A request waiting for approval (registration in approval mode): approve lets the person sign in; reject removes the request\n\n(and the account, when it belongs to no other site). Either way the person is emailed.\n\nContract: removes the account from the site (and deletes the user when it belongs to no other site). POST /api/accounts/members/:userId/approve\n\nPermission: `users.manage`.",
        "parameters": [
          {
            "name": "userId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "users.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/accounts/members/{userId}/groups": {
      "put": {
        "operationId": "putApiAccountsMembersUserIdGroups",
        "tags": [
          "Accounts"
        ],
        "summary": "PUT /api/accounts/members/{userId}/groups",
        "description": "Permission: `users.manage`.",
        "parameters": [
          {
            "name": "userId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "users.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "groups": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 100
                    },
                    "maxItems": 100
                  }
                },
                "required": [
                  "groups"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/accounts/members/{userId}/profile": {
      "get": {
        "operationId": "getApiAccountsMembersUserIdProfile",
        "tags": [
          "Accounts"
        ],
        "summary": "A member's profile as staff see it (Site settings → Accounts → Members → Profile); its photo is served to user",
        "description": "A member's profile as staff see it (Site settings → Accounts → Members → Profile); its photo is served to users.manage too.\n\nContract: GET /api/accounts/members/:userId/profile → MemberProfileView (users.manage). POST /api/accounts/members/:userId/profile/hide\n\nPermission: `users.manage`.",
        "parameters": [
          {
            "name": "userId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "users.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/accounts/members/{userId}/profile/hide": {
      "post": {
        "operationId": "postApiAccountsMembersUserIdProfileHide",
        "tags": [
          "Accounts"
        ],
        "summary": "Moderation: turn a member's public profile off (they can turn it on again; the site setting turns every profil",
        "description": "Moderation: turn a member's public profile off (they can turn it on again; the site setting turns every profile off).\n\nContract: GET /api/accounts/members/:userId/profile → MemberProfileView (users.manage). POST /api/accounts/members/:userId/profile/hide\n\nPermission: `users.manage`.",
        "parameters": [
          {
            "name": "userId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "users.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/accounts/members/{userId}/reject": {
      "post": {
        "operationId": "postApiAccountsMembersUserIdReject",
        "tags": [
          "Accounts"
        ],
        "summary": "POST /api/accounts/members/{userId}/reject",
        "description": "Permission: `users.manage`.",
        "parameters": [
          {
            "name": "userId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "users.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/accounts/sign-in-providers": {
      "get": {
        "operationId": "getApiAccountsSignInProviders",
        "tags": [
          "Accounts"
        ],
        "summary": "Where each provider's sign-in on the account pages would come from (the instance's own provider, or the hostin",
        "description": "Where each provider's sign-in on the account pages would come from (the instance's own provider, or the hosting platform's\n\nsign-in service), for the labels of the toggles in Site settings → Accounts.\n\nContract: are linked under the same provider and subject either way. GET /api/accounts/sign-in-providers → AccountSignInSources\n\nPermission: `site.settings`.",
        "x-permission": [
          "site.settings"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/agent-attachments/{id}": {
      "delete": {
        "operationId": "deleteApiAgentAttachmentsId",
        "tags": [
          "Agent attachments"
        ],
        "summary": "DELETE /api/agent-attachments/:id → 204 (the person who uploaded it)",
        "description": "Contract: DELETE /api/agent-attachments/:id → 204 (the person who uploaded it). Audited as agent.attachment.delete.\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/agent-attachments/{id}/file": {
      "get": {
        "operationId": "getApiAgentAttachmentsIdFile",
        "tags": [
          "Agent attachments"
        ],
        "summary": "GET /api/agent-attachments/:id/file → the file as uploaded (only the person who uploaded it; `Cache-Control: p",
        "description": "Contract: GET /api/agent-attachments/:id/file → the file as uploaded (only the person who uploaded it; `Cache-Control: private, no-store`,\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/agent-inbox": {
      "get": {
        "operationId": "getApiAgentInbox",
        "tags": [
          "Agents"
        ],
        "summary": "GET /api/agent-inbox → AgentRun[]: finished task runs of the last seven days delivered to the caller (owner or",
        "description": "Contract: GET /api/agent-inbox → AgentRun[]: finished task runs of the last seven days delivered to the caller (owner or recipient), for the bell.\n\nPermission: `agents.use`.",
        "x-permission": [
          "agents.use"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/agent-proposals/{runId}/{proposalId}/accept": {
      "post": {
        "operationId": "postApiAgentProposalsRunIdProposalIdAccept",
        "tags": [
          "Agents"
        ],
        "summary": "POST /api/agent-proposals/:runId/:proposalId/accept ({ task?: AgentTaskInput }) → AgentTask (the run's author;",
        "description": "Contract: POST /api/agent-proposals/:runId/:proposalId/accept ({ task?: AgentTaskInput }) → AgentTask (the run's author; `task` replaces the\n\nPermission: `agents.use`.",
        "parameters": [
          {
            "name": "runId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "proposalId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "agents.use"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/agent-proposals/{runId}/{proposalId}/decline": {
      "post": {
        "operationId": "postApiAgentProposalsRunIdProposalIdDecline",
        "tags": [
          "Agents"
        ],
        "summary": "POST /api/agent-proposals/{runId}/{proposalId}/decline",
        "description": "Permission: `agents.use`.",
        "parameters": [
          {
            "name": "runId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "proposalId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "agents.use"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/agent-runs/{id}": {
      "get": {
        "operationId": "getApiAgentRunsId",
        "tags": [
          "Agents"
        ],
        "summary": "GET /api/agent-runs/:id → AgentRunDetail (its author, or agents.manage); POST /api/agent-runs/:id/stop → Agent",
        "description": "Contract: GET /api/agent-runs/:id → AgentRunDetail (its author, or agents.manage); POST /api/agent-runs/:id/stop → AgentRun (the same)\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/agent-runs/{id}/stop": {
      "post": {
        "operationId": "postApiAgentRunsIdStop",
        "tags": [
          "Agents"
        ],
        "summary": "GET /api/agent-runs/:id → AgentRunDetail (its author, or agents.manage); POST /api/agent-runs/:id/stop → Agent",
        "description": "Contract: GET /api/agent-runs/:id → AgentRunDetail (its author, or agents.manage); POST /api/agent-runs/:id/stop → AgentRun (the same)\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/agent-tasks/{id}": {
      "get": {
        "operationId": "getApiAgentTasksId",
        "tags": [
          "Agents"
        ],
        "summary": "GET /api/agent-tasks/{id}",
        "description": "Public, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "operationId": "putApiAgentTasksId",
        "tags": [
          "Agents"
        ],
        "summary": "PUT /api/agent-tasks/{id}",
        "description": "Public, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "operationId": "deleteApiAgentTasksId",
        "tags": [
          "Agents"
        ],
        "summary": "GET/PUT/DELETE /api/agent-tasks/:id (its owner, or agents.manage)",
        "description": "Contract: GET/PUT/DELETE /api/agent-tasks/:id (its owner, or agents.manage). PUT takes a partial AgentTaskInput. A paused task keeps its runs.\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/agent-tasks/{id}/run": {
      "post": {
        "operationId": "postApiAgentTasksIdRun",
        "tags": [
          "Agents"
        ],
        "summary": "POST /api/agent-tasks/:id/run → 202 { runId } (runs it now, whatever its schedule)",
        "description": "Contract: POST /api/agent-tasks/:id/run → 202 { runId } (runs it now, whatever its schedule)\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "202": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/agent-tasks/{id}/runs": {
      "get": {
        "operationId": "getApiAgentTasksIdRuns",
        "tags": [
          "Agents"
        ],
        "summary": "GET /api/agent-tasks/:id/runs → AgentRun[] (newest first, 50)",
        "description": "Contract: GET /api/agent-tasks/:id/runs → AgentRun[] (newest first, 50)\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/agent-threads/{id}": {
      "get": {
        "operationId": "getApiAgentThreadsId",
        "tags": [
          "Agents"
        ],
        "summary": "GET /api/agent-threads/:id → AgentRun[], oldest first (its author, or users.manage); DELETE /api/agent-threads",
        "description": "Contract: GET /api/agent-threads/:id → AgentRun[], oldest first (its author, or users.manage); DELETE /api/agent-threads/:id → 204 (the same;\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "operationId": "deleteApiAgentThreadsId",
        "tags": [
          "Agents"
        ],
        "summary": "Files are deleted with their conversation (DELETE /api/agent-threads/:id), after Site settings → AI's days to ",
        "description": "Contract: Files are deleted with their conversation (DELETE /api/agent-threads/:id), after Site settings → AI's days to keep them, and a day\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/agents": {
      "get": {
        "operationId": "getApiAgents",
        "tags": [
          "Agents"
        ],
        "summary": "GET /api/agents → AgentsResponse (agents.use)",
        "description": "Contract: GET /api/agents → AgentsResponse (agents.use)\n\nPermission: `agents.use`.",
        "x-permission": [
          "agents.use"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/agents/{id}": {
      "get": {
        "operationId": "getApiAgentsId",
        "tags": [
          "Agents"
        ],
        "summary": "GET /api/agents/:id → Agent (agents.use); PUT /api/agents/:id (AgentInput) → Agent (agents.manage; turning `pu",
        "description": "Contract: GET /api/agents/:id → Agent (agents.use); PUT /api/agents/:id (AgentInput) → Agent (agents.manage; turning `publish` on, or role\n\nPermission: `agents.use`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "agents.use"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "operationId": "putApiAgentsId",
        "tags": [
          "Agents"
        ],
        "summary": "GET /api/agents/:id → Agent (agents.use); PUT /api/agents/:id (AgentInput) → Agent (agents.manage; turning `pu",
        "description": "Contract: GET /api/agents/:id → Agent (agents.use); PUT /api/agents/:id (AgentInput) → Agent (agents.manage; turning `publish` on, or role\n\nPermission: `agents.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "agents.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80
                  },
                  "description": {
                    "type": "string",
                    "maxLength": 500
                  },
                  "instructions": {
                    "type": "string",
                    "maxLength": 8000
                  },
                  "allowedActions": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "x-enum": "AGENT_ACTIONS.map((a) => a.key) as [string, ...string[]]"
                    }
                  },
                  "role": {
                    "type": "string",
                    "enum": [
                      "author",
                      "editor",
                      "manager"
                    ]
                  },
                  "model": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 200
                  },
                  "budget": {
                    "type": "object",
                    "properties": {
                      "tokensPerRun": {
                        "type": [
                          "integer",
                          "null"
                        ],
                        "minimum": 1000,
                        "maximum": 5000000
                      },
                      "toolCallsPerRun": {
                        "type": [
                          "integer",
                          "null"
                        ],
                        "minimum": 1,
                        "maximum": 200
                      },
                      "tokensPerMonth": {
                        "type": [
                          "integer",
                          "null"
                        ],
                        "minimum": 1000,
                        "maximum": 1000000000
                      }
                    }
                  },
                  "enabled": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/agents/{id}/attachments": {
      "post": {
        "operationId": "postApiAgentsIdAttachments",
        "tags": [
          "Agent attachments"
        ],
        "summary": "Files to give the agent with this message: ids from POST /api/agents/:id/attachments, uploaded by the caller a",
        "description": "Contract: Files to give the agent with this message: ids from POST /api/agents/:id/attachments, uploaded by the caller and not yet sent,\n\nPermission: `agents.use`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "agents.use"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/agents/{id}/chat": {
      "post": {
        "operationId": "postApiAgentsIdChat",
        "tags": [
          "Agents"
        ],
        "summary": "POST /api/agents/:id/chat with `attachments`: each must be the caller's, not yet sent, on this site; 413 over ",
        "description": "Contract: POST /api/agents/:id/chat with `attachments`: each must be the caller's, not yet sent, on this site; 413 over the size per message,\n\nPermission: `agents.use`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "agents.use"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "message": {
                    "type": "string",
                    "maxLength": 8000,
                    "default": ""
                  },
                  "threadId": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "context": {
                    "type": "object",
                    "properties": {
                      "path": {
                        "type": "string",
                        "maxLength": 500
                      },
                      "timeZone": {
                        "type": "string",
                        "maxLength": 64
                      },
                      "screen": {
                        "type": "string",
                        "maxLength": 200
                      },
                      "entityId": {
                        "type": "string",
                        "maxLength": 100
                      },
                      "entityType": {
                        "type": "string",
                        "maxLength": 64
                      }
                    },
                    "required": [
                      "path"
                    ]
                  },
                  "work": {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "const": "comments"
                      },
                      "entityId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 100
                      }
                    },
                    "required": [
                      "kind",
                      "entityId"
                    ]
                  },
                  "attachments": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "uuid"
                    }
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/agents/{id}/runs": {
      "get": {
        "operationId": "getApiAgentsIdRuns",
        "tags": [
          "Agents"
        ],
        "summary": "GET /api/agents/:id/runs?page&limit&status → Paginated<AgentRun> (agents.manage sees every run; others their o",
        "description": "Contract: GET /api/agents/:id/runs?page&limit&status → Paginated<AgentRun> (agents.manage sees every run; others their own)\n\nPermission: `agents.use`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "agents.use"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/agents/{id}/tasks": {
      "get": {
        "operationId": "getApiAgentsIdTasks",
        "tags": [
          "Agents"
        ],
        "summary": "GET /api/agents/:id/tasks → AgentTask[] (agents.use; agents.manage sees everyone's, others their own)",
        "description": "Contract: GET /api/agents/:id/tasks → AgentTask[] (agents.use; agents.manage sees everyone's, others their own)\n\nPermission: `agents.use`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "agents.use"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "operationId": "postApiAgentsIdTasks",
        "tags": [
          "Agents"
        ],
        "summary": "POST /api/agents/:id/tasks (AgentTaskInput) → AgentTask (agents.use; `recipients.emails` needs users.manage)",
        "description": "Contract: POST /api/agents/:id/tasks (AgentTaskInput) → AgentTask (agents.use; `recipients.emails` needs users.manage). Audited as agent.task.create.\n\nPermission: `agents.use`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "agents.use"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/agents/{id}/threads": {
      "get": {
        "operationId": "getApiAgentsIdThreads",
        "tags": [
          "Agents"
        ],
        "summary": "GET /api/agents/:id/threads → AgentThread[], the caller's own, newest first (agents.use)",
        "description": "Contract: GET /api/agents/:id/threads → AgentThread[], the caller's own, newest first (agents.use)\n\nPermission: `agents.use`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "agents.use"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/ai/alt": {
      "post": {
        "operationId": "postApiAiAlt",
        "tags": [
          "AI"
        ],
        "summary": "POST /api/ai/alt ({ mediaId }) → { alt: string; usage } (media.upload)",
        "description": "Contract: POST /api/ai/alt ({ mediaId }) → { alt: string; usage } (media.upload). Sends the image to a vision-capable model.\n\nPublic, or checks access itself (see the description).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "mediaId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  }
                },
                "required": [
                  "mediaId"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/ai/assist": {
      "post": {
        "operationId": "postApiAiAssist",
        "tags": [
          "AI"
        ],
        "summary": "POST /api/ai/assist (AiAssistRequest) → { text: string; usage: AiUsage }",
        "description": "Contract: POST /api/ai/assist (AiAssistRequest) → { text: string; usage: AiUsage }. content.create. Applies the brand profile.\n\nPublic, or checks access itself (see the description).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "action": {
                    "type": "string",
                    "enum": [
                      "write",
                      "rewrite",
                      "shorten",
                      "expand",
                      "tone",
                      "fix",
                      "translate",
                      "summarize"
                    ]
                  },
                  "text": {
                    "type": "string",
                    "maxLength": 60000
                  },
                  "instruction": {
                    "type": "string",
                    "maxLength": 2000
                  },
                  "locale": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 20
                  },
                  "field": {
                    "type": "object",
                    "properties": {
                      "key": {
                        "type": "string",
                        "maxLength": 64
                      },
                      "label": {
                        "type": "string",
                        "maxLength": 200
                      },
                      "aiHint": {
                        "type": "string",
                        "maxLength": 2000
                      },
                      "type": {
                        "type": "string",
                        "x-enum": "fieldTypes"
                      }
                    },
                    "required": [
                      "key",
                      "label"
                    ]
                  },
                  "context": {
                    "type": "object",
                    "properties": {
                      "title": {
                        "type": "string",
                        "maxLength": 500
                      },
                      "typeLabel": {
                        "type": "string",
                        "maxLength": 200
                      }
                    }
                  }
                },
                "required": [
                  "action"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/ai/component": {
      "post": {
        "operationId": "postApiAiComponent",
        "tags": [
          "AI"
        ],
        "summary": "A site component drafted from a description or a screenshot (component library phase 4b): saved as a draft, ne",
        "description": "A site component drafted from a description or a screenshot (component library phase 4b): saved as a draft, never published.\n\nContract: StorybookDraftResponse (components.manage and ai.use): for each component, the site-component AI draft (POST /api/ai/component,\n\nRequires a signed-in user (cookie session or bearer token).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "description": {
                    "type": "string",
                    "maxLength": 4000
                  },
                  "image": {
                    "type": "object",
                    "properties": {
                      "mime": {
                        "type": "string",
                        "maxLength": 60
                      },
                      "base64": {
                        "type": "string",
                        "minLength": 16
                      }
                    },
                    "required": [
                      "mime",
                      "base64"
                    ]
                  },
                  "mediaId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "key": {
                    "type": "string",
                    "x-pattern": "SITE_COMPONENT_KEY_RE"
                  },
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/ai/page": {
      "post": {
        "operationId": "postApiAiPage",
        "tags": [
          "AI"
        ],
        "summary": "POST /api/ai/page (AiPageRequest) → AiPageResponse",
        "description": "Contract: POST /api/ai/page (AiPageRequest) → AiPageResponse. content.create. Uses only registered blocks (from @spillway-cms/blocks config and blockMeta),\n\nRequires a signed-in user (cookie session or bearer token).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "brief": {
                    "type": "string",
                    "minLength": 10,
                    "maxLength": 8000
                  },
                  "typeKey": {
                    "type": "string",
                    "maxLength": 64
                  },
                  "goal": {
                    "type": "string",
                    "maxLength": 500
                  },
                  "audience": {
                    "type": "string",
                    "maxLength": 500
                  },
                  "findImages": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "brief"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/ai/settings": {
      "get": {
        "operationId": "getApiAiSettings",
        "tags": [
          "AI"
        ],
        "summary": "GET /api/ai/settings → AiSettings; PUT /api/ai/settings (AiSettingsInput) → AiSettings",
        "description": "Contract: GET /api/ai/settings → AiSettings; PUT /api/ai/settings (AiSettingsInput) → AiSettings. Permission: site.settings. Keys are encrypted at rest with a\n\nPermission: `ai.settings`.",
        "x-permission": [
          "ai.settings"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "operationId": "putApiAiSettings",
        "tags": [
          "AI"
        ],
        "summary": "GET /api/ai/settings → AiSettings; PUT /api/ai/settings (AiSettingsInput) → AiSettings",
        "description": "Contract: GET /api/ai/settings → AiSettings; PUT /api/ai/settings (AiSettingsInput) → AiSettings. Permission: site.settings. Keys are encrypted at rest with a\n\nPermission: `ai.settings`.",
        "x-permission": [
          "ai.settings"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "enabled": {
                    "type": "boolean"
                  },
                  "monthlyTokenCap": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 0,
                    "maximum": 1000000000000
                  },
                  "agentBudget": {
                    "type": "object",
                    "properties": {
                      "tokensPerRun": {
                        "type": "integer",
                        "minimum": 1000,
                        "maximum": 5000000
                      },
                      "toolCallsPerRun": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 200
                      },
                      "tokensPerMonth": {
                        "type": [
                          "integer",
                          "null"
                        ],
                        "minimum": 1000,
                        "maximum": 1000000000
                      }
                    }
                  },
                  "agentAttachments": {
                    "type": "object",
                    "properties": {
                      "maxFileMb": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 25
                      },
                      "maxMessageMb": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 100
                      },
                      "keepDays": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 365
                      }
                    }
                  },
                  "providers": {
                    "type": "object",
                    "additionalProperties": {
                      "type": "object",
                      "properties": {
                        "model": {
                          "type": "string",
                          "maxLength": 200
                        },
                        "baseUrl": {
                          "type": "string",
                          "maxLength": 500
                        },
                        "apiKey": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "maxLength": 2000
                        }
                      }
                    }
                  },
                  "tasks": {
                    "type": "object",
                    "additionalProperties": {
                      "type": "object",
                      "properties": {
                        "provider": {
                          "type": "string",
                          "x-enum": "AI_PROVIDERS as [string, ...string[]]"
                        },
                        "model": {
                          "type": "string",
                          "maxLength": 200
                        }
                      },
                      "required": [
                        "provider"
                      ]
                    }
                  },
                  "migrationPrices": {
                    "type": [
                      "object",
                      "null"
                    ],
                    "properties": {
                      "input": {
                        "type": "number",
                        "minimum": 0,
                        "maximum": 10000
                      },
                      "output": {
                        "type": "number",
                        "minimum": 0,
                        "maximum": 10000
                      },
                      "currency": {
                        "type": "string",
                        "pattern": "^[A-Z]{3}$",
                        "default": "USD"
                      }
                    },
                    "required": [
                      "input",
                      "output"
                    ]
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/ai/status": {
      "get": {
        "operationId": "getApiAiStatus",
        "tags": [
          "AI"
        ],
        "summary": "Any signed-in user: is AI on and usable? Lets the admin disable its buttons with a reason.",
        "description": "Any signed-in user: is AI on and usable? Lets the admin disable its buttons with a reason.\n\nRequires a signed-in user (cookie session or bearer token).",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/ai/type": {
      "post": {
        "operationId": "postApiAiType",
        "tags": [
          "AI"
        ],
        "summary": "POST /api/ai/type ({ description }) → { type: ContentTypeInput; rationale: string; usage } (types.manage)",
        "description": "Contract: POST /api/ai/type ({ description }) → { type: ContentTypeInput; rationale: string; usage } (types.manage). Does not create the type.\n\nPublic, or checks access itself (see the description).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "description": {
                    "type": "string",
                    "minLength": 5,
                    "maxLength": 4000
                  }
                },
                "required": [
                  "description"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/ai/usage": {
      "get": {
        "operationId": "getApiAiUsage",
        "tags": [
          "AI"
        ],
        "summary": "GET /api/ai/usage?month=YYYY-MM → AiUsageReport (site.settings).",
        "description": "Contract: GET /api/ai/usage?month=YYYY-MM → AiUsageReport (site.settings).\n\nPermission: `ai.settings`.",
        "parameters": [
          {
            "name": "month",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}$"
            }
          }
        ],
        "x-permission": [
          "ai.settings"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/alerts": {
      "get": {
        "operationId": "getApiAlerts",
        "tags": [
          "Alerts"
        ],
        "summary": "GET /api/alerts → SiteAlert[]; POST /api/alerts (SiteAlertInput); PUT /api/alerts/:id (Partial<SiteAlertInput>",
        "description": "Contract: GET /api/alerts → SiteAlert[]; POST /api/alerts (SiteAlertInput); PUT /api/alerts/:id (Partial<SiteAlertInput>); DELETE /api/alerts/:id. Permission: content.publish.\n\nPermission: `content.publish`.",
        "x-permission": [
          "content.publish"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "operationId": "postApiAlerts",
        "tags": [
          "Alerts"
        ],
        "summary": "GET /api/alerts → SiteAlert[]; POST /api/alerts (SiteAlertInput); PUT /api/alerts/:id (Partial<SiteAlertInput>",
        "description": "Contract: GET /api/alerts → SiteAlert[]; POST /api/alerts (SiteAlertInput); PUT /api/alerts/:id (Partial<SiteAlertInput>); DELETE /api/alerts/:id. Permission: content.publish.\n\nPermission: `content.publish`.",
        "x-permission": [
          "content.publish"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "level": {
                    "type": "string",
                    "x-enum": "ALERT_LEVELS as [string, ...string[]]",
                    "default": "info"
                  },
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "body": {
                    "type": "string",
                    "maxLength": 5000
                  },
                  "bodyHtml": {
                    "type": "string",
                    "maxLength": 20000
                  },
                  "href": {
                    "type": "string",
                    "maxLength": 500
                  },
                  "startsAt": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "endsAt": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "dismissible": {
                    "type": "boolean",
                    "default": true
                  },
                  "enabled": {
                    "type": "boolean",
                    "default": true
                  }
                },
                "required": [
                  "title"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/alerts/{id}": {
      "put": {
        "operationId": "putApiAlertsId",
        "tags": [
          "Alerts"
        ],
        "summary": "GET /api/alerts → SiteAlert[]; POST /api/alerts (SiteAlertInput); PUT /api/alerts/:id (Partial<SiteAlertInput>",
        "description": "Contract: GET /api/alerts → SiteAlert[]; POST /api/alerts (SiteAlertInput); PUT /api/alerts/:id (Partial<SiteAlertInput>); DELETE /api/alerts/:id. Permission: content.publish.\n\nPermission: `content.publish`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "content.publish"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "level": {
                    "type": "string",
                    "x-enum": "ALERT_LEVELS as [string, ...string[]]",
                    "default": "info"
                  },
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "body": {
                    "type": "string",
                    "maxLength": 5000
                  },
                  "bodyHtml": {
                    "type": "string",
                    "maxLength": 20000
                  },
                  "href": {
                    "type": "string",
                    "maxLength": 500
                  },
                  "startsAt": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "endsAt": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "dismissible": {
                    "type": "boolean",
                    "default": true
                  },
                  "enabled": {
                    "type": "boolean",
                    "default": true
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "operationId": "deleteApiAlertsId",
        "tags": [
          "Alerts"
        ],
        "summary": "DELETE /api/alerts/{id}",
        "description": "Permission: `content.publish`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "content.publish"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/analytics/google": {
      "get": {
        "operationId": "getApiAnalyticsGoogle",
        "tags": [
          "Google"
        ],
        "summary": "GET /api/analytics/google?from&to → GoogleReport (site.settings or content.publish): GA4 users, sessions and v",
        "description": "Contract: GET /api/analytics/google?from&to → GoogleReport (site.settings or content.publish): GA4 users, sessions and views by day, top pages and\n\nRequires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "refresh",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/analytics/overview": {
      "get": {
        "operationId": "getApiAnalyticsOverview",
        "tags": [
          "Analytics"
        ],
        "summary": "GET /api/analytics/overview?from=&to= → AnalyticsOverview (site.settings or content.publish); GET /api/analyti",
        "description": "Contract: GET /api/analytics/overview?from=&to= → AnalyticsOverview (site.settings or content.publish); GET /api/analytics/pages/:path → AnalyticsPage.\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/analytics/pages/{path}": {
      "get": {
        "operationId": "getApiAnalyticsPagesPath",
        "tags": [
          "Analytics"
        ],
        "summary": "GET /api/analytics/overview?from=&to= → AnalyticsOverview (site.settings or content.publish); GET /api/analyti",
        "description": "Contract: GET /api/analytics/overview?from=&to= → AnalyticsOverview (site.settings or content.publish); GET /api/analytics/pages/:path → AnalyticsPage.\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "path",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/analytics/search": {
      "get": {
        "operationId": "getApiAnalyticsSearch",
        "tags": [
          "Analytics"
        ],
        "summary": "What visitors searched for, what found nothing and what nobody clicked (Analytics → Search).",
        "description": "What visitors searched for, what found nothing and what nobody clicked (Analytics → Search).\n\nContract: GET /api/analytics/search?from=&to= (site.settings or content.publish) → what visitors searched for. Counted from the\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/audiences": {
      "get": {
        "operationId": "getApiAudiences",
        "tags": [
          "Personalization"
        ],
        "summary": "GET /api/audiences",
        "description": "Permission: `personalization.manage`.",
        "x-permission": [
          "personalization.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "operationId": "postApiAudiences",
        "tags": [
          "Personalization"
        ],
        "summary": "Admin (site.settings): GET/POST /api/audiences, GET/PUT/DELETE /api/audiences/:id; GET/POST /api/experiments, ",
        "description": "Contract: Admin (site.settings): GET/POST /api/audiences, GET/PUT/DELETE /api/audiences/:id; GET/POST /api/experiments, GET/PUT/DELETE /api/experiments/:id,\n\nPermission: `personalization.manage`.",
        "x-permission": [
          "personalization.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "label": {
                    "x-zod": "text(200)",
                    "minimum": 1
                  },
                  "rules": {
                    "type": "array",
                    "items": {
                      "x-zod": "z.discriminatedUnion('kind', [\n  z.object({ kind: z.literal('utm'), param: z.enum(['utm_source', 'utm_medium', 'utm_campaign', 'utm_content', 'utm_term']), equa"
                    },
                    "maxItems": 20,
                    "default": []
                  },
                  "match": {
                    "type": "string",
                    "enum": [
                      "all",
                      "any"
                    ],
                    "default": "all"
                  }
                },
                "required": [
                  "label"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/audiences/{id}": {
      "get": {
        "operationId": "getApiAudiencesId",
        "tags": [
          "Personalization"
        ],
        "summary": "GET /api/audiences/{id}",
        "description": "Permission: `personalization.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "personalization.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "operationId": "putApiAudiencesId",
        "tags": [
          "Personalization"
        ],
        "summary": "PUT /api/audiences/{id}",
        "description": "Permission: `personalization.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "personalization.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "label": {
                    "x-zod": "text(200)",
                    "minimum": 1
                  },
                  "rules": {
                    "type": "array",
                    "items": {
                      "x-zod": "z.discriminatedUnion('kind', [\n  z.object({ kind: z.literal('utm'), param: z.enum(['utm_source', 'utm_medium', 'utm_campaign', 'utm_content', 'utm_term']), equa"
                    },
                    "maxItems": 20,
                    "default": []
                  },
                  "match": {
                    "type": "string",
                    "enum": [
                      "all",
                      "any"
                    ],
                    "default": "all"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "operationId": "deleteApiAudiencesId",
        "tags": [
          "Personalization"
        ],
        "summary": "Admin (site.settings): GET/POST /api/audiences, GET/PUT/DELETE /api/audiences/:id; GET/POST /api/experiments, ",
        "description": "Contract: Admin (site.settings): GET/POST /api/audiences, GET/PUT/DELETE /api/audiences/:id; GET/POST /api/experiments, GET/PUT/DELETE /api/experiments/:id,\n\nPermission: `personalization.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "personalization.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/auth/forgot-password": {
      "get": {
        "operationId": "getApiAuthForgotPassword",
        "tags": [
          "Password"
        ],
        "summary": "GET  /api/auth/forgot-password → PasswordResetAvailability: whether \"Forgot your password?\" can email a link h",
        "description": "Contract: GET  /api/auth/forgot-password → PasswordResetAvailability: whether \"Forgot your password?\" can email a link here.\n\nPublic, or checks access itself (see the description).",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "operationId": "postApiAuthForgotPassword",
        "tags": [
          "Password"
        ],
        "summary": "POST /api/auth/forgot-password (ForgotPasswordRequest) → ForgotPasswordResponse, always 200 with the same body",
        "description": "Contract: POST /api/auth/forgot-password (ForgotPasswordRequest) → ForgotPasswordResponse, always 200 with the same body whether or not\n\nPublic, or checks access itself (see the description).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string",
                    "format": "email",
                    "maxLength": 200
                  }
                },
                "required": [
                  "email"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/auth/login": {
      "post": {
        "operationId": "postApiAuthLogin",
        "tags": [
          "Auth"
        ],
        "summary": "POST /api/auth/login */",
        "description": "Contract: POST /api/auth/login */\n\nPublic, or checks access itself (see the description).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string",
                    "format": "email"
                  },
                  "password": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "email",
                  "password"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/auth/logout": {
      "post": {
        "operationId": "postApiAuthLogout",
        "tags": [
          "Auth"
        ],
        "summary": "POST /api/auth/logout",
        "description": "Public, or checks access itself (see the description).",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/auth/me": {
      "get": {
        "operationId": "getApiAuthMe",
        "tags": [
          "Auth"
        ],
        "summary": "GET /api/auth/me → { user: User | null; permissions: Permission[] } */",
        "description": "Contract: GET /api/auth/me → { user: User | null; permissions: Permission[] } */\n\nPublic, or checks access itself (see the description).",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "operationId": "putApiAuthMe",
        "tags": [
          "Editorial"
        ],
        "summary": "booleans on their profile; PUT /api/auth/me ({ name?, notifyOnReview?, notifyOnComment? }) → MeResponse).",
        "description": "Contract: booleans on their profile; PUT /api/auth/me ({ name?, notifyOnReview?, notifyOnComment? }) → MeResponse).\n\nRequires a signed-in user (cookie session or bearer token).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "notifyOnReview": {
                    "type": "boolean"
                  },
                  "notifyOnComment": {
                    "type": "boolean"
                  },
                  "uiLocale": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 35
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/auth/password-token": {
      "get": {
        "operationId": "getApiAuthPasswordToken",
        "tags": [
          "Password"
        ],
        "summary": "GET  /api/auth/password-token?token= → PasswordTokenInfo",
        "description": "Contract: GET  /api/auth/password-token?token= → PasswordTokenInfo. 404 `token_invalid` (unknown, malformed or replaced by a newer\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/auth/set-password": {
      "post": {
        "operationId": "postApiAuthSetPassword",
        "tags": [
          "Password"
        ],
        "summary": "POST /api/auth/set-password (SetPasswordRequest) → { user: User }: sets the password (8 to 200 characters), us",
        "description": "Contract: POST /api/auth/set-password (SetPasswordRequest) → { user: User }: sets the password (8 to 200 characters), uses up the\n\nPublic, or checks access itself (see the description).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "token": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "password": {
                    "type": "string"
                  }
                },
                "required": [
                  "token",
                  "password"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/auth/two-step": {
      "get": {
        "operationId": "getApiAuthTwoStep",
        "tags": [
          "Two step"
        ],
        "summary": "GET    /api/auth/two-step → TwoStepStatus",
        "description": "Contract: GET    /api/auth/two-step → TwoStepStatus\n\nRequires a signed-in user (cookie session or bearer token).",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/auth/two-step/disable": {
      "post": {
        "operationId": "postApiAuthTwoStepDisable",
        "tags": [
          "Two step"
        ],
        "summary": "POST   /api/auth/two-step/disable { code } → 204: a current code or a recovery code turns it off",
        "description": "Contract: POST   /api/auth/two-step/disable { code } → 204: a current code or a recovery code turns it off. 409 `two_step_required` when\n\nRequires a signed-in user (cookie session or bearer token).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 6,
                    "maxLength": 40
                  }
                },
                "required": [
                  "code"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/auth/two-step/enable": {
      "post": {
        "operationId": "postApiAuthTwoStepEnable",
        "tags": [
          "Two step"
        ],
        "summary": "POST   /api/auth/two-step/enable { code } → TwoStepCodes: turns it on with a code from the new secret; the ten",
        "description": "Contract: POST   /api/auth/two-step/enable { code } → TwoStepCodes: turns it on with a code from the new secret; the ten recovery codes are\n\nRequires a signed-in user (cookie session or bearer token).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 6,
                    "maxLength": 40
                  }
                },
                "required": [
                  "code"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/auth/two-step/recovery-codes": {
      "post": {
        "operationId": "postApiAuthTwoStepRecoveryCodes",
        "tags": [
          "Two step"
        ],
        "summary": "POST   /api/auth/two-step/recovery-codes { code } → TwoStepCodes: ten new recovery codes (the old ones stop wo",
        "description": "Contract: POST   /api/auth/two-step/recovery-codes { code } → TwoStepCodes: ten new recovery codes (the old ones stop working); needs a\n\nRequires a signed-in user (cookie session or bearer token).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 6,
                    "maxLength": 40
                  }
                },
                "required": [
                  "code"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/auth/two-step/setup": {
      "post": {
        "operationId": "postApiAuthTwoStepSetup",
        "tags": [
          "Two step"
        ],
        "summary": "POST   /api/auth/two-step/setup → TwoStepSetup: a new secret, not yet on (409 `two_step_on` when it already is",
        "description": "Contract: POST   /api/auth/two-step/setup → TwoStepSetup: a new secret, not yet on (409 `two_step_on` when it already is). Audited\n\nRequires a signed-in user (cookie session or bearer token).",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/auth/two-step/verify": {
      "post": {
        "operationId": "postApiAuthTwoStepVerify",
        "tags": [
          "Two step"
        ],
        "summary": "The second step of an admin sign-in: the pending cookie from POST /auth/login (or set-password, or a GitHub si",
        "description": "The second step of an admin sign-in: the pending cookie from POST /auth/login (or set-password, or a GitHub sign-in) and a code.\n\nContract: POST   /api/auth/two-step/verify { code } → TwoStepVerified: a code from the app (one step either side is accepted, a code\n\nPublic, or checks access itself (see the description).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 6,
                    "maxLength": 40
                  }
                },
                "required": [
                  "code"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/brand": {
      "get": {
        "operationId": "getApiBrand",
        "tags": [
          "Brand"
        ],
        "summary": "GET /api/brand → BrandProfile; PUT /api/brand → BrandProfile (site.settings)",
        "description": "Contract: GET /api/brand → BrandProfile; PUT /api/brand → BrandProfile (site.settings). GET is any authenticated user.\n\nRequires a signed-in user (cookie session or bearer token).",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "operationId": "putApiBrand",
        "tags": [
          "Brand"
        ],
        "summary": "The published profile, written directly (scripts)",
        "description": "The published profile, written directly (scripts). A draft keeps the same profile, so publishing it later does not undo this.\n\nContract: GET /api/brand → BrandProfile; PUT /api/brand → BrandProfile (site.settings). GET is any authenticated user.\n\nPermission: `brand.manage`.",
        "x-permission": [
          "brand.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "voice": {
                    "type": "string",
                    "maxLength": 4000
                  },
                  "tone": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "maxItems": 200
                  },
                  "audience": {
                    "type": "string",
                    "maxLength": 2000
                  },
                  "terminology": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "maxItems": 200
                  },
                  "bannedWords": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "maxItems": 200
                  },
                  "boilerplate": {
                    "type": "string",
                    "maxLength": 4000
                  },
                  "examples": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "maxLength": 2000
                    },
                    "maxItems": 50
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/brand/draft": {
      "get": {
        "operationId": "getApiBrandDraft",
        "tags": [
          "Brand"
        ],
        "summary": "The draft as GET /api/brand/draft returns it",
        "description": "Contract: The draft as GET /api/brand/draft returns it. `updatedBy` is a user id (null for a draft written without a user). `styles` is the\n\nPermission: `brand.manage`.",
        "x-permission": [
          "brand.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "operationId": "putApiBrandDraft",
        "tags": [
          "Brand"
        ],
        "summary": "PUT /api/brand/draft body: merged onto the current draft (or onto the published brand when there is none)",
        "description": "Contract: PUT /api/brand/draft body: merged onto the current draft (or onto the published brand when there is none). `styles`, when\n\nPermission: `brand.manage`.",
        "x-permission": [
          "brand.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "theme": {
                    "x-schema": "draftThemeSchema"
                  },
                  "identity": {
                    "x-schema": "identitySchema"
                  },
                  "styles": {
                    "x-schema": "styleListSchema"
                  },
                  "guide": {
                    "type": "object",
                    "properties": {
                      "public": {
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "public"
                    ],
                    "additionalProperties": false
                  },
                  "profile": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string",
                        "maxLength": 200
                      },
                      "voice": {
                        "type": "string",
                        "maxLength": 4000
                      },
                      "tone": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "maxLength": 500
                        },
                        "maxItems": 200
                      },
                      "audience": {
                        "type": "string",
                        "maxLength": 2000
                      },
                      "terminology": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "maxLength": 500
                        },
                        "maxItems": 200
                      },
                      "bannedWords": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "maxLength": 500
                        },
                        "maxItems": 200
                      },
                      "boilerplate": {
                        "type": "string",
                        "maxLength": 4000
                      },
                      "examples": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "maxLength": 2000
                        },
                        "maxItems": 50
                      },
                      "updatedAt": {
                        "type": "string",
                        "maxLength": 40
                      }
                    },
                    "additionalProperties": false
                  },
                  "locks": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "x-enum": "BRAND_PARTS as [BrandPart, ...BrandPart[]]"
                    }
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "operationId": "deleteApiBrandDraft",
        "tags": [
          "Brand"
        ],
        "summary": "DELETE /api/brand/draft → 204 (site.settings): discards the draft",
        "description": "Contract: DELETE /api/brand/draft → 204 (site.settings): discards the draft. Audited as brand.draft_discard.\n\nPermission: `brand.manage`.",
        "x-permission": [
          "brand.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/brand/draft/publish": {
      "post": {
        "operationId": "postApiBrandDraftPublish",
        "tags": [
          "Brand"
        ],
        "summary": "POST /api/brand/draft/publish → BrandPublishResult (site.settings): copies the draft to the site's theme, iden",
        "description": "Contract: POST /api/brand/draft/publish → BrandPublishResult (site.settings): copies the draft to the site's theme, identity and block\n\nPermission: `brand.manage`.",
        "x-permission": [
          "brand.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/brand/draft/reset": {
      "post": {
        "operationId": "postApiBrandDraftReset",
        "tags": [
          "Brand"
        ],
        "summary": "POST /api/brand/draft/reset ({ part: BrandPart }) → BrandDraft (site.settings, child sites only): the part fol",
        "description": "Contract: POST /api/brand/draft/reset ({ part: BrandPart }) → BrandDraft (site.settings, child sites only): the part follows the parent\n\nPermission: `brand.manage`.",
        "x-permission": [
          "brand.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "part": {
                    "type": "string",
                    "x-enum": "BRAND_PARTS as [BrandPart, ...BrandPart[]]"
                  }
                },
                "required": [
                  "part"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/brand/draft/styles": {
      "put": {
        "operationId": "putApiBrandDraftStyles",
        "tags": [
          "Brand"
        ],
        "summary": "PUT /api/brand/draft/styles (BlockStyleInput) → BrandDraft (site.settings): adds or replaces one style in the ",
        "description": "Contract: PUT /api/brand/draft/styles (BlockStyleInput) → BrandDraft (site.settings): adds or replaces one style in the draft.\n\nPermission: `brand.manage`.",
        "x-permission": [
          "brand.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "x-schema": "styleInputSchema"
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "operationId": "deleteApiBrandDraftStyles",
        "tags": [
          "Brand"
        ],
        "summary": "with it into SiteSettings.brandLocks",
        "description": "Contract: with it into SiteSettings.brandLocks. On a child, PUT /api/brand/draft, PUT and DELETE /api/brand/draft/styles, POST\n\nPermission: `brand.manage`.",
        "parameters": [
          {
            "name": "block",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "key",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "x-permission": [
          "brand.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/brand/export": {
      "get": {
        "operationId": "getApiBrandExport",
        "tags": [
          "Brand"
        ],
        "summary": "GET /api/brand/export → KitManifest (site.settings; attachment <key>.kit.json): the published brand (on a chil",
        "description": "Contract: GET /api/brand/export → KitManifest (site.settings; attachment <key>.kit.json): the published brand (on a child site, the\n\nPermission: `brand.manage`.",
        "parameters": [
          {
            "name": "key",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9_]{1,62}$"
            }
          },
          {
            "name": "label",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "version",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\\d+\\.\\d+\\.\\d+(-[0-9A-Za-z.-]+)?$"
            }
          }
        ],
        "x-permission": [
          "brand.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/brand/fonts/google": {
      "post": {
        "operationId": "postApiBrandFontsGoogle",
        "tags": [
          "Fonts"
        ],
        "summary": "(POST /api/brand/fonts/google), so visitors never contact Google",
        "description": "Contract: (POST /api/brand/fonts/google), so visitors never contact Google. `upload`: font files uploaded to the media library. `stylesheet`:\n\nPermission: `brand.manage`.",
        "x-permission": [
          "brand.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "family": {
                    "type": "string",
                    "x-pattern": "FONT_FAMILY_RE"
                  },
                  "weights": {
                    "type": "array",
                    "items": {
                      "type": "integer",
                      "minimum": 100,
                      "maximum": 900
                    },
                    "maxItems": 9
                  },
                  "italic": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "family"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/brand/guide": {
      "get": {
        "operationId": "getApiBrandGuide",
        "tags": [
          "Brand"
        ],
        "summary": "GET /api/brand/guide → BrandGuide",
        "description": "Contract: GET /api/brand/guide → BrandGuide. `html` is a standalone HTML document (theme tokens, the block stylesheet and the rules of\n\nPermission: `brand.manage`.",
        "parameters": [
          {
            "name": "draft",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "0",
                "1"
              ]
            }
          }
        ],
        "x-permission": [
          "brand.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/brand/imports": {
      "post": {
        "operationId": "postApiBrandImports",
        "tags": [
          "Brand import"
        ],
        "summary": "Installing a brand kit never touches the live brand: POST /api/brand/imports { source: 'kit', content } (the k",
        "description": "Contract: Installing a brand kit never touches the live brand: POST /api/brand/imports { source: 'kit', content } (the kit.json text), POST\n\nPermission: `brand.manage`.",
        "x-permission": [
          "brand.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "source": {
                        "const": "tokens"
                      },
                      "format": {
                        "type": "string",
                        "enum": [
                          "w3c",
                          "figma",
                          "css",
                          "tailwind-json",
                          "auto"
                        ],
                        "default": "auto"
                      },
                      "content": {
                        "type": "string",
                        "minLength": 1
                      }
                    },
                    "required": [
                      "source",
                      "content"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "source": {
                        "const": "website"
                      },
                      "url": {
                        "type": "string",
                        "maxLength": 2000
                      }
                    },
                    "required": [
                      "source",
                      "url"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "source": {
                        "const": "kit"
                      },
                      "content": {
                        "type": "string",
                        "minLength": 1
                      }
                    },
                    "required": [
                      "source",
                      "content"
                    ],
                    "additionalProperties": false
                  }
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/brand/imports/pdf": {
      "post": {
        "operationId": "postApiBrandImportsPdf",
        "tags": [
          "Brand import"
        ],
        "summary": "POST /api/brand/imports/pdf (multipart: `file` a PDF of at most BRAND_IMPORT_PDF_MAX_BYTES, `logos` up to BRAN",
        "description": "Contract: POST /api/brand/imports/pdf (multipart: `file` a PDF of at most BRAND_IMPORT_PDF_MAX_BYTES, `logos` up to BRAND_IMPORT_MAX_LOGOS\n\nPermission: `brand.manage`.",
        "x-permission": [
          "brand.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/brand/imports/{id}": {
      "get": {
        "operationId": "getApiBrandImportsId",
        "tags": [
          "Brand import"
        ],
        "summary": "GET /api/brand/imports/:id → BrandImportResult (site.settings); 404 once applied or expired.",
        "description": "Contract: GET /api/brand/imports/:id → BrandImportResult (site.settings); 404 once applied or expired.\n\nPermission: `brand.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "brand.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/brand/imports/{id}/apply": {
      "post": {
        "operationId": "postApiBrandImportsIdApply",
        "tags": [
          "Brand import"
        ],
        "summary": "POST /api/brand/imports/:id/apply (BrandImportApplyRequest) → BrandImportApplyResult (site.settings): writes t",
        "description": "Contract: POST /api/brand/imports/:id/apply (BrandImportApplyRequest) → BrandImportApplyResult (site.settings): writes the checked rows\n\nPermission: `brand.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "brand.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "rows": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "maxItems": 1000
                  }
                },
                "required": [
                  "rows"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/brand/inheritance": {
      "get": {
        "operationId": "getApiBrandInheritance",
        "tags": [
          "Brand"
        ],
        "summary": "GET /api/brand/inheritance → BrandInheritance (site.settings).",
        "description": "Contract: GET /api/brand/inheritance → BrandInheritance (site.settings).\n\nPermission: `brand.manage`.",
        "x-permission": [
          "brand.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/brand/revisions": {
      "get": {
        "operationId": "getApiBrandRevisions",
        "tags": [
          "Brand"
        ],
        "summary": "GET /api/brand/revisions → BrandRevision[] (site.settings): the last BRAND_REVISIONS_KEPT published versions, ",
        "description": "Contract: GET /api/brand/revisions → BrandRevision[] (site.settings): the last BRAND_REVISIONS_KEPT published versions, newest first.\n\nPermission: `brand.manage`.",
        "x-permission": [
          "brand.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/brand/revisions/{id}/restore": {
      "post": {
        "operationId": "postApiBrandRevisionsIdRestore",
        "tags": [
          "Brand"
        ],
        "summary": "POST /api/brand/revisions/:id/restore → BrandDraft (site.settings): replaces the draft with that version; publ",
        "description": "Contract: POST /api/brand/revisions/:id/restore → BrandDraft (site.settings): replaces the draft with that version; publish to make it live.\n\nPermission: `brand.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "brand.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/brand/styles": {
      "get": {
        "operationId": "getApiBrandStyles",
        "tags": [
          "Brand"
        ],
        "summary": "GET /api/brand/styles → the published styles and the slots of every styled block (core blocks and loaded modul",
        "description": "Contract: GET /api/brand/styles → the published styles and the slots of every styled block (core blocks and loaded module blocks). */\n\nPermission: `brand.manage`.",
        "parameters": [
          {
            "name": "draft",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "0",
                "1"
              ]
            }
          }
        ],
        "x-permission": [
          "brand.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/builder/config": {
      "get": {
        "operationId": "getApiBuilderConfig",
        "tags": [
          "Builder"
        ],
        "summary": "GET /api/builder/config carries the published components as `components`; the blocks panel lists each under it",
        "description": "Contract: GET /api/builder/config carries the published components as `components`; the blocks panel lists each under its own name.\n\nRequires a signed-in user (cookie session or bearer token).",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/builder/resolve": {
      "post": {
        "operationId": "postApiBuilderResolve",
        "tags": [
          "Builder"
        ],
        "summary": "POST /api/builder/resolve ({ type: PreviewResolvedBlock, props, path?, locale? }) → BlockPreviewResult (conten",
        "description": "Contract: POST /api/builder/resolve ({ type: PreviewResolvedBlock, props, path?, locale? }) → BlockPreviewResult (content.view_drafts): the props\n\nPermission: `content.view_drafts`.",
        "x-permission": [
          "content.view_drafts"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "x-enum": "PREVIEW_RESOLVED_BLOCKS"
                  },
                  "props": {
                    "type": "object",
                    "additionalProperties": {},
                    "default": {}
                  },
                  "path": {
                    "type": "string",
                    "maxLength": 2000
                  },
                  "locale": {
                    "type": "string",
                    "maxLength": 20
                  }
                },
                "required": [
                  "type"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/collections": {
      "get": {
        "operationId": "getApiCollections",
        "tags": [
          "Collections"
        ],
        "summary": "GET /api/collections → Collection[]; POST; GET/PUT/DELETE /api/collections/:id (types.manage for writes, any u",
        "description": "Contract: GET /api/collections → Collection[]; POST; GET/PUT/DELETE /api/collections/:id (types.manage for writes, any user for reads)\n\nRequires a signed-in user (cookie session or bearer token).",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "operationId": "postApiCollections",
        "tags": [
          "Collections"
        ],
        "summary": "POST /api/collections",
        "description": "Permission: `types.manage`.",
        "x-permission": [
          "types.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "x-pattern": "CONTENT_TYPE_KEY_RE"
                  },
                  "types": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "x-pattern": "CONTENT_TYPE_KEY_RE"
                    },
                    "maxItems": 10
                  },
                  "filters": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "field": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64
                        },
                        "op": {
                          "type": "string",
                          "enum": [
                            "eq",
                            "neq",
                            "in",
                            "contains",
                            "gt",
                            "gte",
                            "lt",
                            "lte",
                            "exists",
                            "has_term"
                          ]
                        },
                        "value": {}
                      },
                      "required": [
                        "field",
                        "op"
                      ]
                    },
                    "maxItems": 20,
                    "default": []
                  },
                  "sort": {
                    "type": "object",
                    "properties": {
                      "field": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      "dir": {
                        "type": "string",
                        "enum": [
                          "asc",
                          "desc"
                        ]
                      }
                    },
                    "required": [
                      "field",
                      "dir"
                    ],
                    "default": {
                      "field": "publishedAt",
                      "dir": "desc"
                    }
                  },
                  "limit": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100,
                    "default": 10
                  },
                  "expand": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "enum": [
                      "occurrences"
                    ]
                  },
                  "key": {
                    "type": "string",
                    "x-pattern": "CONTENT_TYPE_KEY_RE"
                  },
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  }
                },
                "required": [
                  "type",
                  "key",
                  "label"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/collections/preview": {
      "post": {
        "operationId": "postApiCollectionsPreview",
        "tags": [
          "Collections"
        ],
        "summary": "Before /collections/:id so \"preview\" is never read as an id.",
        "description": "Before /collections/:id so \"preview\" is never read as an id.\n\nContract: POST /api/collections/preview ({ type, filters, sort, limit }) → CollectionItem[] (any authenticated user) for the admin builder.\n\nRequires a signed-in user (cookie session or bearer token).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "x-pattern": "CONTENT_TYPE_KEY_RE"
                  },
                  "types": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "x-pattern": "CONTENT_TYPE_KEY_RE"
                    },
                    "maxItems": 10
                  },
                  "filters": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "field": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64
                        },
                        "op": {
                          "type": "string",
                          "enum": [
                            "eq",
                            "neq",
                            "in",
                            "contains",
                            "gt",
                            "gte",
                            "lt",
                            "lte",
                            "exists",
                            "has_term"
                          ]
                        },
                        "value": {}
                      },
                      "required": [
                        "field",
                        "op"
                      ]
                    },
                    "maxItems": 20,
                    "default": []
                  },
                  "sort": {
                    "type": "object",
                    "properties": {
                      "field": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      "dir": {
                        "type": "string",
                        "enum": [
                          "asc",
                          "desc"
                        ]
                      }
                    },
                    "required": [
                      "field",
                      "dir"
                    ],
                    "default": {
                      "field": "publishedAt",
                      "dir": "desc"
                    }
                  },
                  "limit": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100,
                    "default": 10
                  },
                  "expand": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "enum": [
                      "occurrences"
                    ]
                  }
                },
                "required": [
                  "type"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/collections/{id}": {
      "get": {
        "operationId": "getApiCollectionsId",
        "tags": [
          "Collections"
        ],
        "summary": "GET /api/collections/{id}",
        "description": "Requires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "operationId": "putApiCollectionsId",
        "tags": [
          "Collections"
        ],
        "summary": "PUT /api/collections/{id}",
        "description": "Permission: `types.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "types.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "x-pattern": "CONTENT_TYPE_KEY_RE"
                  },
                  "types": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "x-pattern": "CONTENT_TYPE_KEY_RE"
                    },
                    "maxItems": 10
                  },
                  "filters": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "field": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64
                        },
                        "op": {
                          "type": "string",
                          "enum": [
                            "eq",
                            "neq",
                            "in",
                            "contains",
                            "gt",
                            "gte",
                            "lt",
                            "lte",
                            "exists",
                            "has_term"
                          ]
                        },
                        "value": {}
                      },
                      "required": [
                        "field",
                        "op"
                      ]
                    },
                    "maxItems": 20,
                    "default": []
                  },
                  "sort": {
                    "type": "object",
                    "properties": {
                      "field": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      "dir": {
                        "type": "string",
                        "enum": [
                          "asc",
                          "desc"
                        ]
                      }
                    },
                    "required": [
                      "field",
                      "dir"
                    ],
                    "default": {
                      "field": "publishedAt",
                      "dir": "desc"
                    }
                  },
                  "limit": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100,
                    "default": 10
                  },
                  "expand": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "enum": [
                      "occurrences"
                    ]
                  },
                  "key": {
                    "type": "string",
                    "x-pattern": "CONTENT_TYPE_KEY_RE"
                  },
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "operationId": "deleteApiCollectionsId",
        "tags": [
          "Collections"
        ],
        "summary": "GET /api/collections → Collection[]; POST; GET/PUT/DELETE /api/collections/:id (types.manage for writes, any u",
        "description": "Contract: GET /api/collections → Collection[]; POST; GET/PUT/DELETE /api/collections/:id (types.manage for writes, any user for reads)\n\nPermission: `types.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "types.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/collections/{id}/export.csv": {
      "get": {
        "operationId": "getApiCollectionsIdExportCsv",
        "tags": [
          "Collections"
        ],
        "summary": "GET /api/collections/:id/export.csv and /export.xlsx?fields=&sort=&dir=&x=&context=&locale= → the file (publis",
        "description": "Contract: GET /api/collections/:id/export.csv and /export.xlsx?fields=&sort=&dir=&x=&context=&locale= → the file (published items, at\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/collections/{id}/export.xlsx": {
      "get": {
        "operationId": "getApiCollectionsIdExportXlsx",
        "tags": [
          "Collections"
        ],
        "summary": "GET /api/collections/{id}/export.xlsx",
        "description": "Public, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/collections/{id}/items": {
      "get": {
        "operationId": "getApiCollectionsIdItems",
        "tags": [
          "Collections"
        ],
        "summary": "Public: the data behind a Collection block, for client-side use or headless front ends.",
        "description": "Public: the data behind a Collection block, for client-side use or headless front ends.\n\nContract: GET /api/collections/:id/items?page=&limit= → Paginated<CollectionItem> (published entities only for anonymous; public, no auth)\n\nRequires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "locale",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 2,
              "maxLength": 35
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/comments/mentions": {
      "get": {
        "operationId": "getApiCommentsMentions",
        "tags": [
          "Review"
        ],
        "summary": "Open threads on this site that mention the signed-in user, newest first (the bell).",
        "description": "Open threads on this site that mention the signed-in user, newest first (the bell).\n\nContract: GET /api/comments/mentions → CommentMention[]: open threads' comments that mention the signed-in user, newest first (the bell).\n\nPublic, or checks access itself (see the description).",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/comments/{id}": {
      "put": {
        "operationId": "putApiCommentsId",
        "tags": [
          "Review"
        ],
        "summary": "`revisionId`, an earlier main-line revision of the item (a comment on a past revision, made in its preview)",
        "description": "Contract: `revisionId`, an earlier main-line revision of the item (a comment on a past revision, made in its preview). PUT /api/comments/:id\n\nRequires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "resolved": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "resolved"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "operationId": "deleteApiCommentsId",
        "tags": [
          "Review"
        ],
        "summary": "or content.edit_any on the item",
        "description": "Contract: or content.edit_any on the item. DELETE /api/comments/:id (own or content.edit_any; a thread's first comment takes its replies).\n\nRequires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/components": {
      "get": {
        "operationId": "getApiComponents",
        "tags": [
          "Components"
        ],
        "summary": "GET /api/components → ComponentsResponse (content.create or site.settings): every block the site has, core and",
        "description": "Contract: GET /api/components → ComponentsResponse (content.create or site.settings): every block the site has, core and module, with its\n\nPublic, or checks access itself (see the description).",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/components/catalog/export": {
      "get": {
        "operationId": "getApiComponentsCatalogExport",
        "tags": [
          "Components"
        ],
        "summary": "The static export of the catalog (phase 3): a zip of HTML files, for a web server or a design handoff.",
        "description": "The static export of the catalog (phase 3): a zip of HTML files, for a web server or a design handoff.\n\nContract: GET /api/components/catalog/export (content.create or site.settings) → application/zip, `<site key>-components.zip`: the same\n\nPublic, or checks access itself (see the description).",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/components/export": {
      "post": {
        "operationId": "postApiComponentsExport",
        "tags": [
          "Site components"
        ],
        "summary": "Import and export (Components → Patterns and Site components): one file of patterns and components with their ",
        "description": "Import and export (Components → Patterns and Site components): one file of patterns and components with their styles and media.\n\nContract: POST /api/components/export (ComponentsExportRequest) → ComponentsFile (content.create or components.manage; components need\n\nRequires a signed-in user (cookie session or bearer token).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "patterns": {
                    "oneOf": [
                      {
                        "const": "all"
                      },
                      {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        }
                      }
                    ]
                  },
                  "components": {
                    "oneOf": [
                      {
                        "const": "all"
                      },
                      {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 100
                        }
                      }
                    ]
                  },
                  "media": {
                    "type": "string",
                    "enum": [
                      "bundle",
                      "urls"
                    ],
                    "default": "bundle"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/components/import": {
      "post": {
        "operationId": "postApiComponentsImport",
        "tags": [
          "Site components"
        ],
        "summary": "POST /api/components/import (ComponentsImportRequest) → ComponentsImportResult (components.manage and brand.ma",
        "description": "Contract: POST /api/components/import (ComponentsImportRequest) → ComponentsImportResult (components.manage and brand.manage; media.upload\n\nPermission: `components.manage`, `brand.manage`.",
        "x-permission": [
          "components.manage",
          "brand.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "object",
                    "properties": {
                      "format": {},
                      "formatVersion": {
                        "type": "integer",
                        "minimum": 1
                      },
                      "kind": {
                        "const": "components",
                        "default": "components"
                      },
                      "key": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 63,
                        "default": "components"
                      },
                      "label": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      "description": {
                        "type": "string",
                        "maxLength": 1000,
                        "default": ""
                      },
                      "version": {
                        "type": "string",
                        "maxLength": 40,
                        "default": "1"
                      },
                      "exportedAt": {
                        "type": "string",
                        "maxLength": 40,
                        "default": ""
                      },
                      "spillway": {
                        "type": "string",
                        "maxLength": 40
                      },
                      "patterns": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            },
                            "label": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            },
                            "category": {
                              "type": "string",
                              "x-enum": "PATTERN_CATEGORIES as unknown as [string, ...string[]]"
                            },
                            "description": {
                              "type": "string",
                              "maxLength": 500
                            },
                            "blocks": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 120
                                  },
                                  "props": {
                                    "type": "object",
                                    "additionalProperties": {}
                                  }
                                },
                                "required": [
                                  "type",
                                  "props"
                                ]
                              },
                              "minItems": 1,
                              "maxItems": 50
                            }
                          },
                          "required": [
                            "key",
                            "label",
                            "category",
                            "blocks"
                          ]
                        },
                        "default": []
                      },
                      "components": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "x-pattern": "SITE_COMPONENT_KEY_RE"
                            },
                            "label": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            },
                            "description": {
                              "type": "string",
                              "maxLength": 500
                            },
                            "category": {
                              "type": "string",
                              "maxLength": 60
                            },
                            "design": {
                              "type": "object",
                              "properties": {
                                "blocks": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "type": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 120
                                      },
                                      "props": {
                                        "type": "object",
                                        "additionalProperties": {}
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "props"
                                    ]
                                  },
                                  "minItems": 1
                                },
                                "fields": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "key": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 63
                                      },
                                      "label": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 120
                                      },
                                      "help": {
                                        "type": "string",
                                        "maxLength": 300
                                      },
                                      "block": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 80
                                      },
                                      "path": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 200
                                      },
                                      "type": {
                                        "type": "string",
                                        "maxLength": 40
                                      }
                                    },
                                    "required": [
                                      "key",
                                      "label",
                                      "block",
                                      "path"
                                    ]
                                  },
                                  "default": []
                                },
                                "variants": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "key": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 41
                                      },
                                      "label": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 80
                                      },
                                      "styles": {
                                        "type": "object",
                                        "additionalProperties": {
                                          "type": "string",
                                          "maxLength": 64
                                        },
                                        "default": {}
                                      }
                                    },
                                    "required": [
                                      "key",
                                      "label"
                                    ]
                                  },
                                  "default": []
                                }
                              },
                              "required": [
                                "blocks"
                              ]
                            }
                          },
                          "required": [
                            "key",
                            "label",
                            "design"
                          ]
                        },
                        "default": []
                      },
                      "styles": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "block": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 200
                            },
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 64
                            },
                            "label": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            },
                            "description": {
                              "type": "string",
                              "maxLength": 500
                            },
                            "tokens": {
                              "type": "object",
                              "additionalProperties": {
                                "type": "string",
                                "maxLength": 64
                              },
                              "default": {}
                            },
                            "roles": {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "maxLength": 64
                              },
                              "maxItems": 20
                            }
                          },
                          "required": [
                            "block",
                            "key",
                            "label"
                          ]
                        },
                        "default": []
                      },
                      "media": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "pattern": "^[a-z][a-z0-9_-]{0,62}$"
                            },
                            "filename": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 200
                            },
                            "url": {
                              "type": "string",
                              "maxLength": 2000
                            },
                            "base64": {
                              "type": "string"
                            },
                            "alt": {
                              "type": "string",
                              "maxLength": 1000,
                              "default": ""
                            },
                            "title": {
                              "type": "string",
                              "maxLength": 300
                            }
                          },
                          "required": [
                            "key",
                            "filename"
                          ]
                        },
                        "default": []
                      },
                      "skippedMedia": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "url": {
                              "type": "string",
                              "maxLength": 2000
                            },
                            "reason": {
                              "type": "string",
                              "maxLength": 300
                            }
                          },
                          "required": [
                            "url",
                            "reason"
                          ]
                        },
                        "maxItems": 500
                      }
                    },
                    "required": [
                      "format",
                      "formatVersion",
                      "label"
                    ]
                  },
                  "decisions": {
                    "type": "object",
                    "additionalProperties": {
                      "type": "string",
                      "enum": [
                        "skip",
                        "replace",
                        "both"
                      ]
                    },
                    "default": {}
                  }
                },
                "required": [
                  "file"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/components/import/preview": {
      "post": {
        "operationId": "postApiComponentsImportPreview",
        "tags": [
          "Site components"
        ],
        "summary": "POST /api/components/import/preview (ComponentsFile, up to COMPONENTS_FILE_LIMITS.fileBytes) → ComponentsImpor",
        "description": "Contract: POST /api/components/import/preview (ComponentsFile, up to COMPONENTS_FILE_LIMITS.fileBytes) → ComponentsImportPreview\n\nPermission: `components.manage`, `brand.manage`.",
        "x-permission": [
          "components.manage",
          "brand.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "format": {},
                  "formatVersion": {
                    "type": "integer",
                    "minimum": 1
                  },
                  "kind": {
                    "const": "components",
                    "default": "components"
                  },
                  "key": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 63,
                    "default": "components"
                  },
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "description": {
                    "type": "string",
                    "maxLength": 1000,
                    "default": ""
                  },
                  "version": {
                    "type": "string",
                    "maxLength": 40,
                    "default": "1"
                  },
                  "exportedAt": {
                    "type": "string",
                    "maxLength": 40,
                    "default": ""
                  },
                  "spillway": {
                    "type": "string",
                    "maxLength": 40
                  },
                  "patterns": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "key": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 120
                        },
                        "label": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 120
                        },
                        "category": {
                          "type": "string",
                          "x-enum": "PATTERN_CATEGORIES as unknown as [string, ...string[]]"
                        },
                        "description": {
                          "type": "string",
                          "maxLength": 500
                        },
                        "blocks": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 120
                              },
                              "props": {
                                "type": "object",
                                "additionalProperties": {}
                              }
                            },
                            "required": [
                              "type",
                              "props"
                            ]
                          },
                          "minItems": 1,
                          "maxItems": 50
                        }
                      },
                      "required": [
                        "key",
                        "label",
                        "category",
                        "blocks"
                      ]
                    },
                    "default": []
                  },
                  "components": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "key": {
                          "type": "string",
                          "x-pattern": "SITE_COMPONENT_KEY_RE"
                        },
                        "label": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 120
                        },
                        "description": {
                          "type": "string",
                          "maxLength": 500
                        },
                        "category": {
                          "type": "string",
                          "maxLength": 60
                        },
                        "design": {
                          "type": "object",
                          "properties": {
                            "blocks": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 120
                                  },
                                  "props": {
                                    "type": "object",
                                    "additionalProperties": {}
                                  }
                                },
                                "required": [
                                  "type",
                                  "props"
                                ]
                              },
                              "minItems": 1
                            },
                            "fields": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "key": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 63
                                  },
                                  "label": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 120
                                  },
                                  "help": {
                                    "type": "string",
                                    "maxLength": 300
                                  },
                                  "block": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 80
                                  },
                                  "path": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 200
                                  },
                                  "type": {
                                    "type": "string",
                                    "maxLength": 40
                                  }
                                },
                                "required": [
                                  "key",
                                  "label",
                                  "block",
                                  "path"
                                ]
                              },
                              "default": []
                            },
                            "variants": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "key": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 41
                                  },
                                  "label": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 80
                                  },
                                  "styles": {
                                    "type": "object",
                                    "additionalProperties": {
                                      "type": "string",
                                      "maxLength": 64
                                    },
                                    "default": {}
                                  }
                                },
                                "required": [
                                  "key",
                                  "label"
                                ]
                              },
                              "default": []
                            }
                          },
                          "required": [
                            "blocks"
                          ]
                        }
                      },
                      "required": [
                        "key",
                        "label",
                        "design"
                      ]
                    },
                    "default": []
                  },
                  "styles": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "block": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "key": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64
                        },
                        "label": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 120
                        },
                        "description": {
                          "type": "string",
                          "maxLength": 500
                        },
                        "tokens": {
                          "type": "object",
                          "additionalProperties": {
                            "type": "string",
                            "maxLength": 64
                          },
                          "default": {}
                        },
                        "roles": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "maxLength": 64
                          },
                          "maxItems": 20
                        }
                      },
                      "required": [
                        "block",
                        "key",
                        "label"
                      ]
                    },
                    "default": []
                  },
                  "media": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "key": {
                          "type": "string",
                          "pattern": "^[a-z][a-z0-9_-]{0,62}$"
                        },
                        "filename": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "url": {
                          "type": "string",
                          "maxLength": 2000
                        },
                        "base64": {
                          "type": "string"
                        },
                        "alt": {
                          "type": "string",
                          "maxLength": 1000,
                          "default": ""
                        },
                        "title": {
                          "type": "string",
                          "maxLength": 300
                        }
                      },
                      "required": [
                        "key",
                        "filename"
                      ]
                    },
                    "default": []
                  },
                  "skippedMedia": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "url": {
                          "type": "string",
                          "maxLength": 2000
                        },
                        "reason": {
                          "type": "string",
                          "maxLength": 300
                        }
                      },
                      "required": [
                        "url",
                        "reason"
                      ]
                    },
                    "maxItems": 500
                  }
                },
                "required": [
                  "format",
                  "formatVersion",
                  "label"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/components/packs": {
      "get": {
        "operationId": "getApiComponentsPacks",
        "tags": [
          "Components"
        ],
        "summary": "Component packs (Components → Add components)",
        "description": "Component packs (Components → Add components). Registered before /components/:name/* so \"packs\" is never read as a block name.\n\nContract: GET /api/components/packs → ComponentPack[] (content.create or site.settings): the bundled packs, the packs installed on this site,\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "registry",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "0",
                "1"
              ]
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/components/packs/preview": {
      "post": {
        "operationId": "postApiComponentsPacksPreview",
        "tags": [
          "Components"
        ],
        "summary": "POST /api/components/packs/preview ({ key } for a bundled pack | { name, version? } for a registry one, mode?:",
        "description": "Contract: POST /api/components/packs/preview ({ key } for a bundled pack | { name, version? } for a registry one, mode?: 'light' | 'dark' |\n\nPermission: `kits.install`.",
        "x-permission": [
          "kits.install"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string",
                    "pattern": "^[a-z][a-z0-9_-]{1,62}$"
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "version": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "mode": {
                    "type": "string",
                    "enum": [
                      "light",
                      "dark",
                      "contrast"
                    ],
                    "default": "light"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/components/packs/{key}": {
      "delete": {
        "operationId": "deleteApiComponentsPacksKey",
        "tags": [
          "Components"
        ],
        "summary": "DELETE /api/components/packs/:key → ComponentPackUninstallResult (kits.install): uninstalls a pack from this s",
        "description": "Contract: DELETE /api/components/packs/:key → ComponentPackUninstallResult (kits.install): uninstalls a pack from this site: its patterns\n\nPermission: `kits.install`.",
        "parameters": [
          {
            "name": "key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "kits.install"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/components/{name}/render": {
      "post": {
        "operationId": "postApiComponentsNameRender",
        "tags": [
          "Components"
        ],
        "summary": "POST /api/components/:name/render (ComponentRenderRequest) → { html } (the same): a standalone document with t",
        "description": "Contract: POST /api/components/:name/render (ComponentRenderRequest) → { html } (the same): a standalone document with the block drawn by\n\nRequires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "props": {
                    "type": "object",
                    "additionalProperties": {},
                    "default": {}
                  },
                  "style": {
                    "type": "string",
                    "maxLength": 100
                  },
                  "brand": {
                    "type": "string",
                    "enum": [
                      "published",
                      "draft"
                    ],
                    "default": "published"
                  },
                  "mode": {
                    "type": "string",
                    "enum": [
                      "light",
                      "dark",
                      "contrast"
                    ],
                    "default": "light"
                  },
                  "checks": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/components/{name}/usage": {
      "get": {
        "operationId": "getApiComponentsNameUsage",
        "tags": [
          "Components"
        ],
        "summary": "GET /api/components/:name/usage → ComponentUsage (the same): the pages using it, newest first, with counts per",
        "description": "Contract: GET /api/components/:name/usage → ComponentUsage (the same): the pages using it, newest first, with counts per style.\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/entities": {
      "get": {
        "operationId": "getApiEntities",
        "tags": [
          "Entities"
        ],
        "summary": "GET /api/entities?type=&status=&q=&page=&limit=&sort=updatedAt:desc → Paginated<Entity>",
        "description": "Contract: GET /api/entities?type=&status=&q=&page=&limit=&sort=updatedAt:desc → Paginated<Entity>\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "type",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "x-enum": "[...ENTITY_STATUSES, 'scheduled', 'unpublished_changes'] as unknown as [string, ...string[]]"
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          },
          {
            "name": "locale",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 2,
              "maxLength": 35
            }
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^(updatedAt|createdAt|title|publishedAt):(asc|desc)$",
              "default": "updatedAt:desc"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "operationId": "postApiEntities",
        "tags": [
          "Entities"
        ],
        "summary": "audited `entity.visibility`)",
        "description": "Contract: audited `entity.visibility`). POST /api/entities takes `visibility` too; without it a new entry gets its type's\n\nPermission: `content.create`.",
        "x-permission": [
          "content.create"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "x-pattern": "CONTENT_TYPE_KEY_RE"
                  },
                  "title": {
                    "type": "string",
                    "maxLength": 500,
                    "default": ""
                  },
                  "slug": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 200
                  },
                  "locale": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 20
                  },
                  "data": {
                    "type": "object",
                    "additionalProperties": {},
                    "default": {}
                  },
                  "sectionId": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 64
                  },
                  "visibility": {
                    "x-zod": "z.lazy(() => visibilitySchema)"
                  }
                },
                "required": [
                  "type"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/entities/bulk": {
      "post": {
        "operationId": "postApiEntitiesBulk",
        "tags": [
          "Bulk actions"
        ],
        "summary": "POST /api/entities/bulk (BulkRequest, at most BULK_MAX ids) → BulkResponse",
        "description": "Contract: POST /api/entities/bulk (BulkRequest, at most BULK_MAX ids) → BulkResponse. Permissions are checked per item exactly as for the single-entity\n\nRequires a signed-in user (cookie session or bearer token).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "ids": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 100
                    },
                    "minItems": 1
                  },
                  "action": {
                    "type": "string",
                    "x-enum": "BULK_ACTIONS as [string, ...string[]]"
                  },
                  "value": {}
                },
                "required": [
                  "ids",
                  "action"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/entities/by-path": {
      "get": {
        "operationId": "getApiEntitiesByPath",
        "tags": [
          "Entities"
        ],
        "summary": "Registered before /entities/:id so \"by-path\" is never read as an id.",
        "description": "Registered before /entities/:id so \"by-path\" is never read as an id.\n\nContract: GET /api/entities/by-path?path=/about → Entity (published only unless authenticated with content.view_drafts)\n\nRequires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "path",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "locale",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/entities/{id}": {
      "get": {
        "operationId": "getApiEntitiesId",
        "tags": [
          "Entities"
        ],
        "summary": "GET /api/entities/:id → Entity",
        "description": "Contract: GET /api/entities/:id → Entity\n\nRequires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "operationId": "putApiEntitiesId",
        "tags": [
          "Entities"
        ],
        "summary": "PUT /api/entities/:id (Partial<EntityInput> & { note?: string }) → Entity (new revision)",
        "description": "Contract: PUT /api/entities/:id (Partial<EntityInput> & { note?: string }) → Entity (new revision)\n\nRequires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "breakLock",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string"
                  },
                  "title": {
                    "type": "string",
                    "maxLength": 500
                  },
                  "slug": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 200
                  },
                  "locale": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 20
                  },
                  "data": {
                    "type": "object",
                    "additionalProperties": {}
                  },
                  "note": {
                    "type": "string",
                    "maxLength": 1000
                  },
                  "sectionId": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 64
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "operationId": "deleteApiEntitiesId",
        "tags": [
          "Entities"
        ],
        "summary": "DELETE /api/entities/:id → 204",
        "description": "Contract: DELETE /api/entities/:id → 204\n\nRequires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/entities/{id}/archive": {
      "post": {
        "operationId": "postApiEntitiesIdArchive",
        "tags": [
          "Entities"
        ],
        "summary": "Takes published content off the site into archived (the bulk action and archive_entity do the same for one ite",
        "description": "Takes published content off the site into archived (the bulk action and archive_entity do the same for one item).\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/entities/{id}/checks": {
      "get": {
        "operationId": "getApiEntitiesIdChecks",
        "tags": [
          "Review"
        ],
        "summary": "GET /api/entities/:id/checks → { checks: EntityCheck[] } computed on the latest revision: required fields, SEO",
        "description": "Contract: GET /api/entities/:id/checks → { checks: EntityCheck[] } computed on the latest revision: required fields, SEO title (10..60) and description (50..160),\n\nRequires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/entities/{id}/clone": {
      "post": {
        "operationId": "postApiEntitiesIdClone",
        "tags": [
          "Bulk actions"
        ],
        "summary": "POST /api/entities/:id/clone → Entity (201): a draft copy titled \"Copy of <title>\" with a fresh unique slug, t",
        "description": "Contract: POST /api/entities/:id/clone → Entity (201): a draft copy titled \"Copy of <title>\" with a fresh unique slug, the same data, the caller as author.\n\nPermission: `content.create`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "content.create"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/entities/{id}/comments": {
      "get": {
        "operationId": "getApiEntitiesIdComments",
        "tags": [
          "Review"
        ],
        "summary": "GET /api/entities/:id/comments[?revision=<id>] → EntityComment[] (threads in creation order, each thread's rep",
        "description": "Contract: GET /api/entities/:id/comments[?revision=<id>] → EntityComment[] (threads in creation order, each thread's replies after it; anchored\n\nRequires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "revision",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "operationId": "postApiEntitiesIdComments",
        "tags": [
          "Review"
        ],
        "summary": "POST /api/entities/{id}/comments",
        "description": "Requires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "body": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 5000
                  },
                  "fieldKey": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 100
                  },
                  "anchor": {
                    "type": [
                      "object",
                      "null"
                    ],
                    "properties": {
                      "blockId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      "point": {
                        "type": "object",
                        "properties": {
                          "x": {
                            "type": "number"
                          },
                          "y": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "x",
                          "y"
                        ]
                      },
                      "quote": {
                        "type": "object",
                        "properties": {
                          "exact": {
                            "type": "string",
                            "maxLength": 2000
                          },
                          "prefix": {
                            "type": "string",
                            "maxLength": 400
                          },
                          "suffix": {
                            "type": "string",
                            "maxLength": 400
                          }
                        },
                        "required": [
                          "exact"
                        ]
                      }
                    },
                    "required": [
                      "blockId"
                    ]
                  },
                  "revisionId": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "parentId": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "mentions": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64
                    },
                    "maxItems": 20
                  }
                },
                "required": [
                  "body"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/entities/{id}/lock": {
      "get": {
        "operationId": "getApiEntitiesIdLock",
        "tags": [
          "Editorial"
        ],
        "summary": "GET /api/entities/{id}/lock",
        "description": "Requires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "operationId": "postApiEntitiesIdLock",
        "tags": [
          "Editorial"
        ],
        "summary": "POST /api/entities/:id/lock (acquire or heartbeat; 409 `lock_held` with the current lock in details when held ",
        "description": "Contract: POST /api/entities/:id/lock (acquire or heartbeat; 409 `lock_held` with the current lock in details when held by someone else),\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "operationId": "deleteApiEntitiesIdLock",
        "tags": [
          "Editorial"
        ],
        "summary": "DELETE /api/entities/:id/lock (release; content.edit_any may break another user's lock), GET returns the lock ",
        "description": "Contract: DELETE /api/entities/:id/lock (release; content.edit_any may break another user's lock), GET returns the lock or null.\n\nRequires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/entities/{id}/placements": {
      "get": {
        "operationId": "getApiEntitiesIdPlacements",
        "tags": [
          "Placements"
        ],
        "summary": "The placements that show on an entity's page, and which of their regions the page hides: the editor's \"Placed ",
        "description": "The placements that show on an entity's page, and which of their regions the page hides: the editor's \"Placed blocks\" panel.\n\nContract: GET /api/entities/:id/placements → { placements: EntityPlacement[] }: the enabled placements whose rules match the entity (content.view_drafts). */\n\nPermission: `content.view_drafts`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "content.view_drafts"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/entities/{id}/publish": {
      "post": {
        "operationId": "postApiEntitiesIdPublish",
        "tags": [
          "Entities"
        ],
        "summary": "POST /api/entities/:id/publish ({ force?, publishNow? }) → Entity",
        "description": "Contract: POST /api/entities/:id/publish ({ force?, publishNow? }) → Entity. Content that is not live yet and whose display date (a date field\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/entities/{id}/reject": {
      "post": {
        "operationId": "postApiEntitiesIdReject",
        "tags": [
          "Review"
        ],
        "summary": "POST /api/entities/:id/reject ({ note }) → Entity (status draft, revision note \"Rejected: <note>\") (content.pu",
        "description": "Contract: POST /api/entities/:id/reject ({ note }) → Entity (status draft, revision note \"Rejected: <note>\") (content.publish)\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "note": {
                    "type": "string",
                    "maxLength": 1000,
                    "default": ""
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/entities/{id}/review-links": {
      "get": {
        "operationId": "getApiEntitiesIdReviewLinks",
        "tags": [
          "Review links"
        ],
        "summary": "GET  /api/entities/:id/review-links → ReviewLink[] (content.view_drafts on the item), newest first",
        "description": "Contract: GET  /api/entities/:id/review-links → ReviewLink[] (content.view_drafts on the item), newest first\n\nRequires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "operationId": "postApiEntitiesIdReviewLinks",
        "tags": [
          "Review links"
        ],
        "summary": "POST /api/entities/:id/review-links ({ revisionId?, days? (1–REVIEW_LINK_DAYS_MAX, default 7), maxComments? (1",
        "description": "Contract: POST /api/entities/:id/review-links ({ revisionId?, days? (1–REVIEW_LINK_DAYS_MAX, default 7), maxComments? (1–REVIEW_LINK_COMMENTS_MAX,\n\nRequires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "revisionId": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "days": {
                    "type": "integer",
                    "minimum": 1
                  },
                  "maxComments": {
                    "type": "integer",
                    "minimum": 1
                  },
                  "note": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 500
                  },
                  "email": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "email",
                    "maxLength": 254
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/entities/{id}/revisions": {
      "get": {
        "operationId": "getApiEntitiesIdRevisions",
        "tags": [
          "Entities"
        ],
        "summary": "GET /api/entities/:id/revisions → Revision[]",
        "description": "Contract: GET /api/entities/:id/revisions → Revision[]\n\nRequires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/entities/{id}/revisions/{a}/diff/{b}": {
      "get": {
        "operationId": "getApiEntitiesIdRevisionsADiffB",
        "tags": [
          "Editorial"
        ],
        "summary": "GET /api/entities/:id/revisions/:a/diff/:b → RevisionDiff, with `threads`: the comment threads opened and reso",
        "description": "Contract: GET /api/entities/:id/revisions/:a/diff/:b → RevisionDiff, with `threads`: the comment threads opened and resolved between the two\n\nRequires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "a",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "b",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/entities/{id}/revisions/{revisionId}/restore": {
      "post": {
        "operationId": "postApiEntitiesIdRevisionsRevisionIdRestore",
        "tags": [
          "Entities"
        ],
        "summary": "POST /api/entities/:id/revisions/:revisionId/restore → Entity (new revision copied from old)",
        "description": "Contract: POST /api/entities/:id/revisions/:revisionId/restore → Entity (new revision copied from old)\n\nRequires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "revisionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/entities/{id}/schedule": {
      "put": {
        "operationId": "putApiEntitiesIdSchedule",
        "tags": [
          "Editorial"
        ],
        "summary": "Scheduling (Phase 2b): set through PUT /api/entities/:id/schedule; cleared when the ticker acts on them",
        "description": "Contract: Scheduling (Phase 2b): set through PUT /api/entities/:id/schedule; cleared when the ticker acts on them. */\n\nRequires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "publishAt": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 40
                  },
                  "unpublishAt": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 40
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "operationId": "deleteApiEntitiesIdSchedule",
        "tags": [
          "Editorial"
        ],
        "summary": "DELETE /api/entities/{id}/schedule",
        "description": "Requires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/entities/{id}/submit": {
      "post": {
        "operationId": "postApiEntitiesIdSubmit",
        "tags": [
          "Entities"
        ],
        "summary": "POST /api/entities/:id/submit → Entity (status: review; releases the submitter's editing lock)",
        "description": "Contract: POST /api/entities/:id/submit → Entity (status: review; releases the submitter's editing lock)\n\nRequires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/entities/{id}/suggestions": {
      "get": {
        "operationId": "getApiEntitiesIdSuggestions",
        "tags": [
          "Suggestions"
        ],
        "summary": "GET    /api/entities/:id/suggestions (content.view_drafts) → Suggestion[]: open ones first, then the 20 most r",
        "description": "Contract: GET    /api/entities/:id/suggestions (content.view_drafts) → Suggestion[]: open ones first, then the 20 most recently decided.\n\nRequires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/entities/{id}/suggestions/mine": {
      "put": {
        "operationId": "putApiEntitiesIdSuggestionsMine",
        "tags": [
          "Suggestions"
        ],
        "summary": "PUT    /api/entities/:id/suggestions/mine (content.view_drafts + content.submit_review) SuggestionInput → Sugg",
        "description": "Contract: PUT    /api/entities/:id/suggestions/mine (content.view_drafts + content.submit_review) SuggestionInput → Suggestion (201 the first time, then 200):\n\nRequires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string",
                    "maxLength": 500
                  },
                  "data": {
                    "type": "object",
                    "additionalProperties": {}
                  },
                  "note": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 2000
                  }
                },
                "required": [
                  "data"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "operationId": "deleteApiEntitiesIdSuggestionsMine",
        "tags": [
          "Suggestions"
        ],
        "summary": "DELETE /api/entities/:id/suggestions/mine → 204: withdraws the caller's open suggestion.",
        "description": "Contract: DELETE /api/entities/:id/suggestions/mine → 204: withdraws the caller's open suggestion.\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/entities/{id}/transition": {
      "post": {
        "operationId": "postApiEntitiesIdTransition",
        "tags": [
          "Workflows"
        ],
        "summary": "POST /api/entities/:id/transition { transition, force?, publishNow?, note? } → Entity",
        "description": "Contract: POST /api/entities/:id/transition { transition, force?, publishNow?, note? } → Entity. 403 without the transition's permission,\n\nRequires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "transition": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 41
                  },
                  "force": {
                    "type": "boolean"
                  },
                  "publishNow": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "transition"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/entities/{id}/transitions": {
      "get": {
        "operationId": "getApiEntitiesIdTransitions",
        "tags": [
          "Workflows"
        ],
        "summary": "GET /api/entities/:id/transitions */",
        "description": "Contract: GET /api/entities/:id/transitions */\n\nRequires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/entities/{id}/translations": {
      "get": {
        "operationId": "getApiEntitiesIdTranslations",
        "tags": [
          "Translations"
        ],
        "summary": "API: GET /api/entities/:id/translations → { group: Entity[]; missing: string[] }; POST /api/entities/:id/trans",
        "description": "Contract: API: GET /api/entities/:id/translations → { group: Entity[]; missing: string[] }; POST /api/entities/:id/translations ({ locale, mode: 'empty' | 'copy' | 'ai' }) → Entity (draft; 'ai' uses the translate task with the brand glossary and marks fields; requires ai.use); PUT marks outdated on source save; GET /api/entities?locale=; GET /api/translations/status → counts per locale and a list of outdated or missing items (content.view_drafts). Locale management: PUT /api/site { locales, defaultLocale, localePrefixDefault } validates BCP 47; removing a locale with content is refused unless ?force.\n\nPermission: `content.view_drafts`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "content.view_drafts"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "operationId": "postApiEntitiesIdTranslations",
        "tags": [
          "Translations"
        ],
        "summary": "API: GET /api/entities/:id/translations → { group: Entity[]; missing: string[] }; POST /api/entities/:id/trans",
        "description": "Contract: API: GET /api/entities/:id/translations → { group: Entity[]; missing: string[] }; POST /api/entities/:id/translations ({ locale, mode: 'empty' | 'copy' | 'ai' }) → Entity (draft; 'ai' uses the translate task with the brand glossary and marks fields; requires ai.use); PUT marks outdated on source save; GET /api/entities?locale=; GET /api/translations/status → counts per locale and a list of outdated or missing items (content.view_drafts). Locale management: PUT /api/site { locales, defaultLocale, localePrefixDefault } validates BCP 47; removing a locale with content is refused unless ?force.\n\nPermission: `content.create`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "content.create"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "locale": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 35
                  },
                  "mode": {
                    "type": "string",
                    "enum": [
                      "empty",
                      "copy",
                      "ai"
                    ],
                    "default": "empty"
                  }
                },
                "required": [
                  "locale"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/entities/{id}/unpublish": {
      "post": {
        "operationId": "postApiEntitiesIdUnpublish",
        "tags": [
          "Entities"
        ],
        "summary": "POST /api/entities/:id/unpublish → Entity",
        "description": "Contract: POST /api/entities/:id/unpublish → Entity\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/entities/{id}/visibility": {
      "put": {
        "operationId": "putApiEntitiesIdVisibility",
        "tags": [
          "Entities"
        ],
        "summary": "Members-only content: who can see it, effective at once (published or not), so it needs content.publish on the",
        "description": "Members-only content: who can see it, effective at once (published or not), so it needs content.publish on the entity.\n\nContract: PUT /api/entities/:id/visibility Visibility → Entity (content.publish on the entity; takes effect at once, published or not;\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "audience": {
                    "type": "string",
                    "enum": [
                      "everyone",
                      "members",
                      "groups"
                    ]
                  },
                  "groups": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 100
                    },
                    "maxItems": 50
                  }
                },
                "required": [
                  "audience"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/entities/{path}": {
      "get": {
        "operationId": "getApiEntitiesPath",
        "tags": [
          "Entities"
        ],
        "summary": "Anything else under /entities needs a session; keeps 404 vs 401 from leaking ids.",
        "description": "Anything else under /entities needs a session; keeps 404 vs 401 from leaking ids.\n\n(Review routes — reject, comments, checks — are mounted before this router in app.ts.)\n\nRequires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "path",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "operationId": "postApiEntitiesPath",
        "tags": [
          "Entities"
        ],
        "summary": "Anything else under /entities needs a session; keeps 404 vs 401 from leaking ids.",
        "description": "Anything else under /entities needs a session; keeps 404 vs 401 from leaking ids.\n\n(Review routes — reject, comments, checks — are mounted before this router in app.ts.)\n\nRequires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "path",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "operationId": "putApiEntitiesPath",
        "tags": [
          "Entities"
        ],
        "summary": "Anything else under /entities needs a session; keeps 404 vs 401 from leaking ids.",
        "description": "Anything else under /entities needs a session; keeps 404 vs 401 from leaking ids.\n\n(Review routes — reject, comments, checks — are mounted before this router in app.ts.)\n\nRequires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "path",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "operationId": "deleteApiEntitiesPath",
        "tags": [
          "Entities"
        ],
        "summary": "Anything else under /entities needs a session; keeps 404 vs 401 from leaking ids.",
        "description": "Anything else under /entities needs a session; keeps 404 vs 401 from leaking ids.\n\n(Review routes — reject, comments, checks — are mounted before this router in app.ts.)\n\nRequires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "path",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/experiments": {
      "get": {
        "operationId": "getApiExperiments",
        "tags": [
          "Personalization"
        ],
        "summary": "GET /api/experiments",
        "description": "Permission: `personalization.manage`.",
        "x-permission": [
          "personalization.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "operationId": "postApiExperiments",
        "tags": [
          "Personalization"
        ],
        "summary": "Admin (site.settings): GET/POST /api/audiences, GET/PUT/DELETE /api/audiences/:id; GET/POST /api/experiments, ",
        "description": "Contract: Admin (site.settings): GET/POST /api/audiences, GET/PUT/DELETE /api/audiences/:id; GET/POST /api/experiments, GET/PUT/DELETE /api/experiments/:id,\n\nPermission: `personalization.manage`.",
        "x-permission": [
          "personalization.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "label": {
                    "x-zod": "text(200)",
                    "minimum": 1
                  },
                  "variants": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "key": {
                          "type": "string",
                          "x-enum": "EXPERIMENT_VARIANT_KEYS"
                        },
                        "label": {
                          "x-zod": "text(100)",
                          "default": ""
                        },
                        "weight": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 1000
                        }
                      },
                      "required": [
                        "key",
                        "weight"
                      ]
                    },
                    "minItems": 2,
                    "maxItems": 3
                  },
                  "goal": {
                    "x-zod": "z.discriminatedUnion('kind', [\n  z.object({ kind: z.literal('form'), formKey: key }),\n  z.object({ kind: z.literal('click'), selector: text(200).min(1) }),\n  z."
                  }
                },
                "required": [
                  "label",
                  "variants",
                  "goal"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/experiments/{id}": {
      "get": {
        "operationId": "getApiExperimentsId",
        "tags": [
          "Personalization"
        ],
        "summary": "GET /api/experiments/{id}",
        "description": "Permission: `personalization.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "personalization.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "operationId": "putApiExperimentsId",
        "tags": [
          "Personalization"
        ],
        "summary": "PUT /api/experiments/{id}",
        "description": "Permission: `personalization.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "personalization.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "label": {
                    "x-zod": "text(200)",
                    "minimum": 1
                  },
                  "variants": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "key": {
                          "type": "string",
                          "x-enum": "EXPERIMENT_VARIANT_KEYS"
                        },
                        "label": {
                          "x-zod": "text(100)",
                          "default": ""
                        },
                        "weight": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 1000
                        }
                      },
                      "required": [
                        "key",
                        "weight"
                      ]
                    },
                    "minItems": 2,
                    "maxItems": 3
                  },
                  "goal": {
                    "x-zod": "z.discriminatedUnion('kind', [\n  z.object({ kind: z.literal('form'), formKey: key }),\n  z.object({ kind: z.literal('click'), selector: text(200).min(1) }),\n  z."
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "operationId": "deleteApiExperimentsId",
        "tags": [
          "Personalization"
        ],
        "summary": "Admin (site.settings): GET/POST /api/audiences, GET/PUT/DELETE /api/audiences/:id; GET/POST /api/experiments, ",
        "description": "Contract: Admin (site.settings): GET/POST /api/audiences, GET/PUT/DELETE /api/audiences/:id; GET/POST /api/experiments, GET/PUT/DELETE /api/experiments/:id,\n\nPermission: `personalization.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "personalization.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/experiments/{id}/results": {
      "get": {
        "operationId": "getApiExperimentsIdResults",
        "tags": [
          "Personalization"
        ],
        "summary": "POST /api/experiments/:id/start|pause|end, GET /api/experiments/:id/results (the id may also be the key).",
        "description": "Contract: POST /api/experiments/:id/start|pause|end, GET /api/experiments/:id/results (the id may also be the key).\n\nPermission: `personalization.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "personalization.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/forms": {
      "get": {
        "operationId": "getApiForms",
        "tags": [
          "Forms"
        ],
        "summary": "Admin: GET /api/forms, POST /api/forms, GET/PUT/DELETE /api/forms/:id (forms.manage)",
        "description": "Contract: Admin: GET /api/forms, POST /api/forms, GET/PUT/DELETE /api/forms/:id (forms.manage)\n\nPublic, or checks access itself (see the description).",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "operationId": "postApiForms",
        "tags": [
          "Forms"
        ],
        "summary": "Admin: GET /api/forms, POST /api/forms, GET/PUT/DELETE /api/forms/:id (forms.manage)",
        "description": "Contract: Admin: GET /api/forms, POST /api/forms, GET/PUT/DELETE /api/forms/:id (forms.manage)\n\nPermission: `forms.manage`.",
        "x-permission": [
          "forms.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "x-schema": "formInputSchema"
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/forms/{id}": {
      "get": {
        "operationId": "getApiFormsId",
        "tags": [
          "Forms"
        ],
        "summary": "GET /api/forms/{id}",
        "description": "Public, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "operationId": "putApiFormsId",
        "tags": [
          "Forms"
        ],
        "summary": "PUT /api/forms/{id}",
        "description": "Permission: `forms.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "forms.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "x-schema": "formInputSchema"
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "operationId": "deleteApiFormsId",
        "tags": [
          "Forms"
        ],
        "summary": "Admin: GET /api/forms, POST /api/forms, GET/PUT/DELETE /api/forms/:id (forms.manage)",
        "description": "Contract: Admin: GET /api/forms, POST /api/forms, GET/PUT/DELETE /api/forms/:id (forms.manage)\n\nPermission: `forms.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "forms.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/forms/{id}/feedback": {
      "get": {
        "operationId": "getApiFormsIdFeedback",
        "tags": [
          "Forms"
        ],
        "summary": "The yes/no tally and last comments of a feedback form (the docs kit's docs_feedback) for the Dashboard card.",
        "description": "The yes/no tally and last comments of a feedback form (the docs kit's docs_feedback) for the Dashboard card.\n\nContract: GET /api/forms/:id/feedback?days=30 (forms.view_submissions): the yes/no tally of a feedback form such as the docs kit's `docs_feedback`\n\nPermission: `forms.view_submissions`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "days",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "x-coerce": true,
              "minimum": 1,
              "maximum": 365,
              "default": 30
            }
          }
        ],
        "x-permission": [
          "forms.view_submissions"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/forms/{id}/submissions": {
      "get": {
        "operationId": "getApiFormsIdSubmissions",
        "tags": [
          "Forms"
        ],
        "summary": "GET /api/forms/:id/submissions?page=&limit= → Paginated<FormSubmission>; GET /api/forms/:id/submissions.csv; D",
        "description": "Contract: GET /api/forms/:id/submissions?page=&limit= → Paginated<FormSubmission>; GET /api/forms/:id/submissions.csv; DELETE /api/forms/:id/submissions/:sid (forms.manage)\n\nPermission: `forms.view_submissions`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "received",
                "delivered",
                "failed",
                "spam",
                "awaiting_payment",
                "unpaid"
              ]
            }
          }
        ],
        "x-permission": [
          "forms.view_submissions"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/forms/{id}/submissions.csv": {
      "get": {
        "operationId": "getApiFormsIdSubmissionsCsv",
        "tags": [
          "Forms"
        ],
        "summary": "GET /api/forms/:id/submissions?page=&limit= → Paginated<FormSubmission>; GET /api/forms/:id/submissions.csv; D",
        "description": "Contract: GET /api/forms/:id/submissions?page=&limit= → Paginated<FormSubmission>; GET /api/forms/:id/submissions.csv; DELETE /api/forms/:id/submissions/:sid (forms.manage)\n\nPermission: `forms.view_submissions`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "forms.view_submissions"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/forms/{id}/submissions/{sid}": {
      "delete": {
        "operationId": "deleteApiFormsIdSubmissionsSid",
        "tags": [
          "Forms"
        ],
        "summary": "GET /api/forms/:id/submissions?page=&limit= → Paginated<FormSubmission>; GET /api/forms/:id/submissions.csv; D",
        "description": "Contract: GET /api/forms/:id/submissions?page=&limit= → Paginated<FormSubmission>; GET /api/forms/:id/submissions.csv; DELETE /api/forms/:id/submissions/:sid (forms.manage)\n\nPermission: `forms.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "forms.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/forms/{id}/submissions/{sid}/files/{fid}": {
      "get": {
        "operationId": "getApiFormsIdSubmissionsSidFilesFid",
        "tags": [
          "Forms"
        ],
        "summary": "An uploaded file, as an attachment: only through this route, never under /media, and only for people who may r",
        "description": "An uploaded file, as an attachment: only through this route, never under /media, and only for people who may read submissions.\n\nContract: GET /api/forms/:id/submissions/:sid/files/:fid → the uploaded file as an attachment (forms.view_submissions); 404 for any other id.\n\nPermission: `forms.view_submissions`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "forms.view_submissions"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/forms/{id}/submissions/{sid}/not-spam": {
      "post": {
        "operationId": "postApiFormsIdSubmissionsSidNotSpam",
        "tags": [
          "Forms"
        ],
        "summary": "Not spam: releases a submission a spam filter module held; it is then delivered like any other.",
        "description": "Not spam: releases a submission a spam filter module held; it is then delivered like any other.\n\nPermission: `forms.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "forms.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/forms/{id}/submissions/{sid}/redeliver": {
      "post": {
        "operationId": "postApiFormsIdSubmissionsSidRedeliver",
        "tags": [
          "Forms"
        ],
        "summary": "POST /api/forms/:id/submissions/:sid/redeliver → FormSubmission",
        "description": "Contract: POST /api/forms/:id/submissions/:sid/redeliver → FormSubmission\n\nPermission: `forms.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "forms.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/forms/{key}/submit": {
      "post": {
        "operationId": "postApiFormsKeySubmit",
        "tags": [
          "Forms"
        ],
        "summary": "Public: POST /api/forms/:key/submit (JSON, application/x-www-form-urlencoded, or multipart/form-data when the ",
        "description": "Contract: Public: POST /api/forms/:key/submit (JSON, application/x-www-form-urlencoded, or multipart/form-data when the form has `file` fields; multipart\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "302": {
            "description": "Redirect"
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/forms/{key}/validate": {
      "post": {
        "operationId": "postApiFormsKeyValidate",
        "tags": [
          "Forms"
        ],
        "summary": "The stepper validates one step at a time before moving on; nothing is stored and no CAPTCHA is needed (the fin",
        "description": "The stepper validates one step at a time before moving on; nothing is stored and no CAPTCHA is needed (the final submit checks everything).\n\nContract: POST /api/forms/:key/validate ({ step: number, ...values }) → { ok: true } or 400 validation_error with details for the fields of that\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/forms/{path}": {
      "get": {
        "operationId": "getApiFormsPath",
        "tags": [
          "Forms"
        ],
        "summary": "GET /api/forms/{path}",
        "description": "Requires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "path",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "operationId": "postApiFormsPath",
        "tags": [
          "Forms"
        ],
        "summary": "POST /api/forms/{path}",
        "description": "Requires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "path",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "operationId": "putApiFormsPath",
        "tags": [
          "Forms"
        ],
        "summary": "PUT /api/forms/{path}",
        "description": "Requires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "path",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "operationId": "deleteApiFormsPath",
        "tags": [
          "Forms"
        ],
        "summary": "DELETE /api/forms/{path}",
        "description": "Requires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "path",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/generated-modules": {
      "get": {
        "operationId": "getApiGeneratedModules",
        "tags": [
          "Generated modules"
        ],
        "summary": "GET  /api/generated-modules?migration= (modules.manage or imports.manage) → { items: GeneratedModule[] }",
        "description": "Contract: GET  /api/generated-modules?migration= (modules.manage or imports.manage) → { items: GeneratedModule[] }\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "migration",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/generated-modules/{id}": {
      "get": {
        "operationId": "getApiGeneratedModulesId",
        "tags": [
          "Generated modules"
        ],
        "summary": "GET  /api/generated-modules/:id → GeneratedModule (with the review: capabilities in plain words, hosts, manife",
        "description": "Contract: GET  /api/generated-modules/:id → GeneratedModule (with the review: capabilities in plain words, hosts, manifest, template or\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/generated-modules/{id}/decline": {
      "post": {
        "operationId": "postApiGeneratedModulesIdDecline",
        "tags": [
          "Generated modules"
        ],
        "summary": "POST /api/generated-modules/:id/decline → GeneratedModule",
        "description": "Contract: POST /api/generated-modules/:id/decline → GeneratedModule. Audited module.generated_decline.\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/generated-modules/{id}/hosts": {
      "put": {
        "operationId": "putApiGeneratedModulesIdHosts",
        "tags": [
          "Generated modules"
        ],
        "summary": "PUT  /api/generated-modules/:id/hosts { hosts } → GeneratedModule: grants or withdraws hosts (a new signature)",
        "description": "Contract: PUT  /api/generated-modules/:id/hosts { hosts } → GeneratedModule: grants or withdraws hosts (a new signature); same rules.\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "hosts": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 253
                    },
                    "maxItems": 10,
                    "default": []
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/generated-modules/{id}/install": {
      "post": {
        "operationId": "postApiGeneratedModulesIdInstall",
        "tags": [
          "Generated modules"
        ],
        "summary": "POST /api/generated-modules/:id/install { hosts: string[] } → GeneratedModule: the person's click",
        "description": "Contract: POST /api/generated-modules/:id/install { hosts: string[] } → GeneratedModule: the person's click. A signed-in session only (a\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "hosts": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 253
                    },
                    "maxItems": 10,
                    "default": []
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/generated-modules/{id}/remove": {
      "post": {
        "operationId": "postApiGeneratedModulesIdRemove",
        "tags": [
          "Generated modules"
        ],
        "summary": "POST /api/generated-modules/:id/remove { keepHtml?: boolean } → { module: GeneratedModule; pages: number }: re",
        "description": "Contract: POST /api/generated-modules/:id/remove { keepHtml?: boolean } → { module: GeneratedModule; pages: number }: removes the installed\n\nPermission: `modules.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "modules.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "keepHtml": {
                    "type": "boolean",
                    "default": false
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/google": {
      "get": {
        "operationId": "getApiGoogle",
        "tags": [
          "Google"
        ],
        "summary": "GET /api/google → GoogleStatus; PUT /api/google (GoogleSettingsInput) → GoogleStatus (site.settings)",
        "description": "Contract: GET /api/google → GoogleStatus; PUT /api/google (GoogleSettingsInput) → GoogleStatus (site.settings). Changing the client id or\n\nPermission: `integrations.manage`.",
        "x-permission": [
          "integrations.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "operationId": "putApiGoogle",
        "tags": [
          "Google"
        ],
        "summary": "GET /api/google → GoogleStatus; PUT /api/google (GoogleSettingsInput) → GoogleStatus (site.settings)",
        "description": "Contract: GET /api/google → GoogleStatus; PUT /api/google (GoogleSettingsInput) → GoogleStatus (site.settings). Changing the client id or\n\nPermission: `integrations.manage`.",
        "x-permission": [
          "integrations.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "clientId": {
                    "type": "string",
                    "maxLength": 300
                  },
                  "clientSecret": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 500
                  },
                  "ga4PropertyId": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "pattern": "^(properties\\/)?\\d{1,20}$"
                  },
                  "searchConsoleSite": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "pattern": "^(sc-domain:[a-z0-9.-]+|https?:\\/\\/\\S+\\/)$"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/google/connect": {
      "get": {
        "operationId": "getApiGoogleConnect",
        "tags": [
          "Google"
        ],
        "summary": "GET /api/google/connect → 302 to Google's consent screen (site.settings); Google returns to GET /google/callba",
        "description": "Contract: GET /api/google/connect → 302 to Google's consent screen (site.settings); Google returns to GET /google/callback, which stores the\n\nPermission: `integrations.manage`.",
        "x-permission": [
          "integrations.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "302": {
            "description": "Redirect"
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/google/connection": {
      "delete": {
        "operationId": "deleteApiGoogleConnection",
        "tags": [
          "Google"
        ],
        "summary": "DELETE /api/google/connection → GoogleStatus (site.settings): revokes the token at Google and forgets it",
        "description": "Contract: DELETE /api/google/connection → GoogleStatus (site.settings): revokes the token at Google and forgets it. Audited.\n\nPermission: `integrations.manage`.",
        "x-permission": [
          "integrations.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/google/properties": {
      "get": {
        "operationId": "getApiGoogleProperties",
        "tags": [
          "Google"
        ],
        "summary": "GET /api/google/properties → GoogleProperties (site.settings): the GA4 properties and Search Console sites the",
        "description": "Contract: GET /api/google/properties → GoogleProperties (site.settings): the GA4 properties and Search Console sites the account can read.\n\nPermission: `integrations.manage`.",
        "x-permission": [
          "integrations.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/guest-review/{token}": {
      "get": {
        "operationId": "getApiGuestReviewToken",
        "tags": [
          "Review links"
        ],
        "summary": "What the guest page knows about the link and the guest (GET /api/guest-review/:token)",
        "description": "Contract: What the guest page knows about the link and the guest (GET /api/guest-review/:token). */\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "token",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/guest-review/{token}/comments": {
      "get": {
        "operationId": "getApiGuestReviewTokenComments",
        "tags": [
          "Review links"
        ],
        "summary": "GET  /api/guest-review/:token/comments → EntityComment[]: the threads started through this link with all their",
        "description": "Contract: GET  /api/guest-review/:token/comments → EntityComment[]: the threads started through this link with all their replies, placed on its revision\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "token",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "operationId": "postApiGuestReviewTokenComments",
        "tags": [
          "Review links"
        ],
        "summary": "POST /api/guest-review/:token/comments ({ body (≤ GUEST_COMMENT_MAX), anchor?, parentId?, mentions? }) → 201 E",
        "description": "Contract: POST /api/guest-review/:token/comments ({ body (≤ GUEST_COMMENT_MAX), anchor?, parentId?, mentions? }) → 201 EntityComment: a thread on\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "token",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "body": {
                    "type": "string",
                    "minLength": 1
                  },
                  "anchor": {
                    "x-schema": "commentAnchorSchema"
                  },
                  "parentId": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "mentions": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64
                    },
                    "maxItems": 5
                  }
                },
                "required": [
                  "body",
                  "anchor"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/guest-review/{token}/guest": {
      "post": {
        "operationId": "postApiGuestReviewTokenGuest",
        "tags": [
          "Review links"
        ],
        "summary": "POST /api/guest-review/:token/guest ({ name, email }) → GuestReviewState: this browser becomes a guest of the ",
        "description": "Contract: POST /api/guest-review/:token/guest ({ name, email }) → GuestReviewState: this browser becomes a guest of the link (an HttpOnly\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "token",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80
                  },
                  "email": {
                    "type": "string",
                    "format": "email",
                    "maxLength": 254
                  }
                },
                "required": [
                  "name",
                  "email"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/guest-review/{token}/verify": {
      "post": {
        "operationId": "postApiGuestReviewTokenVerify",
        "tags": [
          "Review links"
        ],
        "summary": "POST /api/guest-review/:token/verify ({ code }) → GuestReviewState",
        "description": "Contract: POST /api/guest-review/:token/verify ({ code }) → GuestReviewState. Audited as review_link.verify.\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "token",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string"
                  }
                },
                "required": [
                  "code"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/hosting/summary": {
      "get": {
        "operationId": "getApiHostingSummary",
        "tags": [
          "Hosting usage"
        ],
        "summary": "The site runs on a hosting platform (HOST_API_URL): Settings → Usage shows its plan and usage (GET /api/hostin",
        "description": "Contract: The site runs on a hosting platform (HOST_API_URL): Settings → Usage shows its plan and usage (GET /api/hosting/usage), and the dashboard its Hosting card (GET /api/hosting/summary). */\n\nPermission: `site.settings`.",
        "x-permission": [
          "site.settings"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/hosting/upgrade": {
      "get": {
        "operationId": "getApiHostingUpgrade",
        "tags": [
          "Hosting usage"
        ],
        "summary": "GET /api/hosting/upgrade (ai.use or site.settings) → HostUpgradeOptions: what the signed-in person may do abou",
        "description": "Contract: GET /api/hosting/upgrade (ai.use or site.settings) → HostUpgradeOptions: what the signed-in person may do about the hosted\n\nRequires a signed-in user (cookie session or bearer token).",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/hosting/upgrade/request": {
      "post": {
        "operationId": "postApiHostingUpgradeRequest",
        "tags": [
          "Hosting usage"
        ],
        "summary": "POST /api/hosting/upgrade/request { kind } (credits: ai.use or site.settings; plan: site.settings) → HostUpgra",
        "description": "Contract: POST /api/hosting/upgrade/request { kind } (credits: ai.use or site.settings; plan: site.settings) → HostUpgradeRequestResult:\n\nPermission: `site.settings`.",
        "x-permission": [
          "site.settings"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "credits",
                      "plan"
                    ]
                  }
                },
                "required": [
                  "kind"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/hosting/usage": {
      "get": {
        "operationId": "getApiHostingUsage",
        "tags": [
          "Hosting usage"
        ],
        "summary": "The site runs on a hosting platform (HOST_API_URL): Settings → Usage shows its plan and usage (GET /api/hostin",
        "description": "Contract: The site runs on a hosting platform (HOST_API_URL): Settings → Usage shows its plan and usage (GET /api/hosting/usage), and the dashboard its Hosting card (GET /api/hosting/summary). */\n\nPermission: `site.settings`.",
        "x-permission": [
          "site.settings"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/i18n": {
      "get": {
        "operationId": "getApiI18n",
        "tags": [
          "Translations"
        ],
        "summary": "GET /api/i18n",
        "description": "Public, or checks access itself (see the description).",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/i18n/tms/jobs": {
      "post": {
        "operationId": "postApiI18nTmsJobs",
        "tags": [
          "I18n tms"
        ],
        "summary": "Jobs (content.translate): POST /api/i18n/tms/jobs { entityIds, targetLocales, due? } → 201 TranslationJob (sta",
        "description": "Contract: Jobs (content.translate): POST /api/i18n/tms/jobs { entityIds, targetLocales, due? } → 201 TranslationJob (status requested, or in_progress\n\nPermission: `content.translate`.",
        "x-permission": [
          "content.translate"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "entityIds": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 100
                    },
                    "minItems": 1,
                    "maxItems": 100
                  },
                  "targetLocales": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 2,
                      "maxLength": 35
                    },
                    "minItems": 1,
                    "maxItems": 50
                  },
                  "due": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 40
                  }
                },
                "required": [
                  "entityIds",
                  "targetLocales"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "get": {
        "operationId": "getApiI18nTmsJobs",
        "tags": [
          "I18n tms"
        ],
        "summary": "for API providers); GET /api/i18n/tms/jobs?status= → Paginated<TranslationJob>; GET /api/i18n/tms/jobs/:id; PO",
        "description": "Contract: for API providers); GET /api/i18n/tms/jobs?status= → Paginated<TranslationJob>; GET /api/i18n/tms/jobs/:id; POST .../pull downloads every\n\nPermission: `content.view_drafts`.",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "x-enum": "TRANSLATION_JOB_STATUSES as [TranslationJobStatus, ...TranslationJobStatus[]]"
            }
          }
        ],
        "x-permission": [
          "content.view_drafts"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/i18n/tms/jobs/{id}": {
      "get": {
        "operationId": "getApiI18nTmsJobsId",
        "tags": [
          "I18n tms"
        ],
        "summary": "for API providers); GET /api/i18n/tms/jobs?status= → Paginated<TranslationJob>; GET /api/i18n/tms/jobs/:id; PO",
        "description": "Contract: for API providers); GET /api/i18n/tms/jobs?status= → Paginated<TranslationJob>; GET /api/i18n/tms/jobs/:id; POST .../pull downloads every\n\nPermission: `content.view_drafts`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "content.view_drafts"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/i18n/tms/jobs/{id}/cancel": {
      "post": {
        "operationId": "postApiI18nTmsJobsIdCancel",
        "tags": [
          "I18n tms"
        ],
        "summary": "POST /api/i18n/tms/jobs/{id}/cancel",
        "description": "Permission: `content.translate`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "content.translate"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/i18n/tms/jobs/{id}/pull": {
      "post": {
        "operationId": "postApiI18nTmsJobsIdPull",
        "tags": [
          "I18n tms"
        ],
        "summary": "API providers: downloads every target and lands the drafts; answers the job with its report and any per-file e",
        "description": "API providers: downloads every target and lands the drafts; answers the job with its report and any per-file errors.\n\nPermission: `content.translate`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "content.translate"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/i18n/tms/jobs/{id}/xliff": {
      "get": {
        "operationId": "getApiI18nTmsJobsIdXliff",
        "tags": [
          "I18n tms"
        ],
        "summary": "The XLIFF bundle as a zip: `<entityId>.<locale>.xlf` per entity and target, plus manifest.json (any provider; ",
        "description": "The XLIFF bundle as a zip: `<entityId>.<locale>.xlf` per entity and target, plus manifest.json (any provider; the manual one lives on it).\n\nPermission: `content.view_drafts`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "content.view_drafts"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "operationId": "postApiI18nTmsJobsIdXliff",
        "tags": [
          "I18n tms"
        ],
        "summary": "Translated files for the manual provider: a zip of XLIFF files, one XLIFF document, or multipart",
        "description": "Translated files for the manual provider: a zip of XLIFF files, one XLIFF document, or multipart\n`file` parts (each a zip or an XLIFF). Each file lands as a draft; the answer carries the job and the files that could not be applied.\n\nPermission: `content.translate`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "content.translate"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/i18n/tms/settings": {
      "get": {
        "operationId": "getApiI18nTmsSettings",
        "tags": [
          "I18n tms"
        ],
        "summary": "Settings (per site, stored in `translation_setting`, secrets encrypted with the AI secrets helper): GET /api/i",
        "description": "Contract: Settings (per site, stored in `translation_setting`, secrets encrypted with the AI secrets helper): GET /api/i18n/tms/settings → TmsSettings\n\nPermission: `integrations.manage`.",
        "x-permission": [
          "integrations.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "operationId": "putApiI18nTmsSettings",
        "tags": [
          "I18n tms"
        ],
        "summary": "PUT /api/i18n/tms/settings",
        "description": "Permission: `integrations.manage`.",
        "x-permission": [
          "integrations.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "provider": {
                    "type": "string",
                    "x-enum": "TMS_PROVIDERS as [TmsProvider, ...TmsProvider[]]"
                  },
                  "projectId": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 200
                  },
                  "baseUrl": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "uri",
                    "maxLength": 300
                  },
                  "credentials": {
                    "type": "object",
                    "properties": {
                      "token": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 2000
                      },
                      "userId": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 200
                      },
                      "secret": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 2000
                      }
                    }
                  },
                  "webhookSecret": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 2000
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/i18n/tms/status": {
      "get": {
        "operationId": "getApiI18nTmsStatus",
        "tags": [
          "I18n tms"
        ],
        "summary": "For the Translations screen: which provider is set and whether it is usable (no secrets, no project id).",
        "description": "For the Translations screen: which provider is set and whether it is usable (no secrets, no project id).\n\nContract: GET /api/i18n/tms/status (content.view_drafts): what editors need before sending, without the settings themselves. */\n\nPermission: `content.view_drafts`.",
        "x-permission": [
          "content.view_drafts"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/i18n/tms/test": {
      "post": {
        "operationId": "postApiI18nTmsTest",
        "tags": [
          "I18n tms"
        ],
        "summary": "Tries the stored credentials against the provider (a project lookup); never throws for a provider-side failure",
        "description": "Tries the stored credentials against the provider (a project lookup); never throws for a provider-side failure, it reports it.\n\nContract: (secrets masked as '********'), PUT with TmsSettingsInput (site.settings; the mask keeps the stored value, null clears), POST /api/i18n/tms/test\n\nPermission: `integrations.manage`.",
        "x-permission": [
          "integrations.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/i18n/tms/webhook/{provider}": {
      "post": {
        "operationId": "postApiI18nTmsWebhookProvider",
        "tags": [
          "I18n tms"
        ],
        "summary": "Public: the provider says a translation is done",
        "description": "Public: the provider says a translation is done. Accepted with `X-Spillway-Signature: sha256=<hmac-sha256(body, secret)>`\nor `X-Webhook-Secret: <secret>` (the secret from the TMS settings); refused with 403 otherwise, 404 when the provider is not this site's.\n\nContract: POST .../xliff (manual provider: one XLIFF file or a zip of them, body or multipart `file`). POST /api/i18n/tms/webhook/:provider is public\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "provider",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/i18n/{locale}": {
      "get": {
        "operationId": "getApiI18nLocale",
        "tags": [
          "Translations"
        ],
        "summary": "The admin UI language (a locale with a message bundle, see GET /api/i18n/:locale); null means the browser's ch",
        "description": "Contract: The admin UI language (a locale with a message bundle, see GET /api/i18n/:locale); null means the browser's choice. PUT /api/auth/me. */\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "locale",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/imports": {
      "post": {
        "operationId": "postApiImports",
        "tags": [
          "Imports"
        ],
        "summary": "POST /api/imports { url, options?: Partial<ImportJobOptions> } → 201 ImportJob (queued; a process that runs th",
        "description": "Contract: POST /api/imports { url, options?: Partial<ImportJobOptions> } → 201 ImportJob (queued; a process that runs the ticker starts it at once,\n\nPermission: `imports.manage`.",
        "x-permission": [
          "imports.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2000
                  },
                  "options": {
                    "type": "object",
                    "properties": {
                      "maxPages": {
                        "type": "integer",
                        "minimum": 1
                      },
                      "rateLimitMs": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 60000
                      },
                      "respectRobots": {
                        "type": "boolean"
                      },
                      "include": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 500
                        },
                        "maxItems": 100
                      },
                      "exclude": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 500
                        },
                        "maxItems": 100
                      },
                      "followSubdomains": {
                        "type": "boolean"
                      },
                      "useSitemap": {
                        "type": "boolean"
                      },
                      "adapters": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "enum": [
                            "drupal",
                            "wordpress"
                          ]
                        },
                        "maxItems": 2
                      },
                      "locale": {
                        "type": "string",
                        "minLength": 2,
                        "maxLength": 10
                      },
                      "workstream": {
                        "type": "boolean"
                      },
                      "offsiteRedirects": {
                        "type": "string",
                        "enum": [
                          "keep",
                          "drop"
                        ]
                      },
                      "useAi": {
                        "type": "boolean"
                      }
                    }
                  }
                },
                "required": [
                  "url"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "get": {
        "operationId": "getApiImports",
        "tags": [
          "Imports"
        ],
        "summary": "GET /api/imports?page=&limit= → Paginated<ImportJob>; GET /api/imports/:id → ImportJob; POST /api/imports/:id/",
        "description": "Contract: GET /api/imports?page=&limit= → Paginated<ImportJob>; GET /api/imports/:id → ImportJob; POST /api/imports/:id/cancel → ImportJob;\n\nPermission: `imports.manage`.",
        "x-permission": [
          "imports.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/imports/estimate": {
      "post": {
        "operationId": "postApiImportsEstimate",
        "tags": [
          "Imports"
        ],
        "summary": "The AI usage estimate before a job exists (importer/estimate.ts): reads robots.txt and the sitemap, writes not",
        "description": "The AI usage estimate before a job exists (importer/estimate.ts): reads robots.txt and the sitemap, writes nothing.\n\nContract: POST /api/imports/estimate { url, options?: Partial<ImportJobOptions> } → ImportAiEstimate (stage `before_crawl`): reads robots.txt and the\n\nPermission: `imports.manage`.",
        "x-permission": [
          "imports.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2000
                  },
                  "options": {
                    "type": "object",
                    "properties": {
                      "maxPages": {
                        "type": "integer",
                        "minimum": 1
                      },
                      "rateLimitMs": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 60000
                      },
                      "respectRobots": {
                        "type": "boolean"
                      },
                      "include": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 500
                        },
                        "maxItems": 100
                      },
                      "exclude": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 500
                        },
                        "maxItems": 100
                      },
                      "followSubdomains": {
                        "type": "boolean"
                      },
                      "useSitemap": {
                        "type": "boolean"
                      },
                      "adapters": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "enum": [
                            "drupal",
                            "wordpress"
                          ]
                        },
                        "maxItems": 2
                      },
                      "locale": {
                        "type": "string",
                        "minLength": 2,
                        "maxLength": 10
                      },
                      "workstream": {
                        "type": "boolean"
                      },
                      "offsiteRedirects": {
                        "type": "string",
                        "enum": [
                          "keep",
                          "drop"
                        ]
                      },
                      "useAi": {
                        "type": "boolean"
                      }
                    }
                  }
                },
                "required": [
                  "url"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/imports/{id}": {
      "get": {
        "operationId": "getApiImportsId",
        "tags": [
          "Imports"
        ],
        "summary": "GET /api/imports?page=&limit= → Paginated<ImportJob>; GET /api/imports/:id → ImportJob; POST /api/imports/:id/",
        "description": "Contract: GET /api/imports?page=&limit= → Paginated<ImportJob>; GET /api/imports/:id → ImportJob; POST /api/imports/:id/cancel → ImportJob;\n\nPermission: `imports.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "imports.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "operationId": "deleteApiImportsId",
        "tags": [
          "Imports"
        ],
        "summary": "DELETE /api/imports/:id → 204 (rows and fetched files; landed entities stay);",
        "description": "Contract: DELETE /api/imports/:id → 204 (rows and fetched files; landed entities stay);\n\nPermission: `imports.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "imports.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/imports/{id}/assets": {
      "get": {
        "operationId": "getApiImportsIdAssets",
        "tags": [
          "Imports"
        ],
        "summary": "GET /api/imports/:id/assets → ImportAsset[]; GET /api/imports/:id/redirects → ImportRedirect[]; GET /api/impor",
        "description": "Contract: GET /api/imports/:id/assets → ImportAsset[]; GET /api/imports/:id/redirects → ImportRedirect[]; GET /api/imports/:id/menus → ImportMenu[];\n\nPermission: `imports.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "imports.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/imports/{id}/cancel": {
      "post": {
        "operationId": "postApiImportsIdCancel",
        "tags": [
          "Imports"
        ],
        "summary": "GET /api/imports?page=&limit= → Paginated<ImportJob>; GET /api/imports/:id → ImportJob; POST /api/imports/:id/",
        "description": "Contract: GET /api/imports?page=&limit= → Paginated<ImportJob>; GET /api/imports/:id → ImportJob; POST /api/imports/:id/cancel → ImportJob;\n\nPermission: `imports.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "imports.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/imports/{id}/classify": {
      "post": {
        "operationId": "postApiImportsIdClassify",
        "tags": [
          "Imports plan"
        ],
        "summary": "Clusters the crawled pages and proposes a content type per cluster (AI-refined when a provider is configured).",
        "description": "Clusters the crawled pages and proposes a content type per cluster (AI-refined when a provider is configured).\n\nContract: POST /api/imports/:id/classify → { job: ImportJob, clusters: ImportCluster[], notes: string[], usedAi: boolean } (clusters pages by urlPattern +\n\nPermission: `imports.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "imports.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/imports/{id}/clusters": {
      "get": {
        "operationId": "getApiImportsIdClusters",
        "tags": [
          "Imports plan"
        ],
        "summary": "GET /api/imports/:id/clusters → ImportCluster[];",
        "description": "Contract: GET /api/imports/:id/clusters → ImportCluster[];\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/imports/{id}/clusters/{cid}": {
      "put": {
        "operationId": "putApiImportsIdClustersCid",
        "tags": [
          "Imports plan"
        ],
        "summary": "The owner's decision per cluster: approve, skip, merge into another cluster, rename, retarget, or edit the pro",
        "description": "The owner's decision per cluster: approve, skip, merge into another cluster, rename, retarget, or edit the proposal.\n\nContract: PUT /api/imports/:id/clusters/:cid { decision?, label?, targetTypeKey?, mergedIntoId?, proposal? } → ImportCluster (`merged` needs mergedIntoId;\n\nPermission: `imports.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "imports.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "decision": {
                    "type": "string",
                    "enum": [
                      "pending",
                      "approved",
                      "merged",
                      "skipped"
                    ]
                  },
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "targetTypeKey": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "x-pattern": "CONTENT_TYPE_KEY_RE"
                  },
                  "mergedIntoId": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "proposal": {
                    "type": "object",
                    "properties": {
                      "key": {
                        "type": "string",
                        "x-pattern": "CONTENT_TYPE_KEY_RE"
                      },
                      "name": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      "description": {
                        "type": "string",
                        "maxLength": 2000,
                        "default": ""
                      },
                      "reason": {
                        "type": "string",
                        "maxLength": 2000,
                        "default": ""
                      },
                      "fields": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "x-pattern": "FIELD_KEY_RE"
                            },
                            "label": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 200
                            },
                            "type": {
                              "type": "string",
                              "x-enum": "IMPORT_FIELD_TYPES as unknown as [string, ...string[]]"
                            },
                            "required": {
                              "type": "boolean",
                              "default": false
                            },
                            "source": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 200
                            },
                            "vocabulary": {
                              "type": "string",
                              "x-pattern": "CONTENT_TYPE_KEY_RE"
                            },
                            "multiple": {
                              "type": "boolean"
                            },
                            "options": {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "maxLength": 200
                              },
                              "maxItems": 200
                            },
                            "placement": {
                              "type": "string",
                              "enum": [
                                "page",
                                "inline"
                              ]
                            }
                          },
                          "required": [
                            "key",
                            "label",
                            "type",
                            "source"
                          ]
                        },
                        "minItems": 1,
                        "maxItems": 40
                      },
                      "pathPattern": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      "sampleUrls": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "maxLength": 2000
                        },
                        "maxItems": 10,
                        "default": []
                      },
                      "existingTypeKey": {
                        "type": "string",
                        "x-pattern": "CONTENT_TYPE_KEY_RE"
                      },
                      "sourceType": {
                        "type": "string",
                        "maxLength": 200
                      }
                    },
                    "required": [
                      "key",
                      "name",
                      "fields",
                      "pathPattern"
                    ]
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/imports/{id}/continue": {
      "post": {
        "operationId": "postApiImportsIdContinue",
        "tags": [
          "Imports"
        ],
        "summary": "A cancelled or failed crawl goes on from where it stopped: the fetched pages stay, the URLs not reached yet ar",
        "description": "A cancelled or failed crawl goes on from where it stopped: the fetched pages stay, the URLs not reached yet are fetched.\n\nContract: POST /api/imports/:id/continue → ImportJob (a cancelled or failed crawl goes on from where it stopped: fetched pages stay, the URLs not reached\n\nPermission: `imports.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "imports.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/imports/{id}/convert": {
      "post": {
        "operationId": "postApiImportsIdConvert",
        "tags": [
          "Imports plan"
        ],
        "summary": "Fills fields and converts bodies to blocks for the approved clusters and scores every page.",
        "description": "Fills fields and converts bodies to blocks for the approved clusters and scores every page.\n\nContract: POST /api/imports/:id/convert { clusterIds? } → { job, converted, skipped, averageScore, notes } (`averageScore` counts pages that failed to\n\nPermission: `imports.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "imports.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "clusterIds": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64
                    },
                    "maxItems": 5000
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/imports/{id}/estimate": {
      "get": {
        "operationId": "getApiImportsIdEstimate",
        "tags": [
          "Imports"
        ],
        "summary": "The same estimate for a job: measured from the crawled pages once the crawl is done.",
        "description": "The same estimate for a job: measured from the crawled pages once the crawl is done.\n\nContract: GET /api/imports/:id/estimate → ImportAiEstimate (stage `after_crawl`, the job's own `useAi`): clusters the crawled pages the way classify will\n\nPermission: `imports.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "imports.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/imports/{id}/events": {
      "get": {
        "operationId": "getApiImportsIdEvents",
        "tags": [
          "Imports"
        ],
        "summary": "GET /api/imports/:id/events → { items: string[] } (the last 200 log lines).",
        "description": "Contract: GET /api/imports/:id/events → { items: string[] } (the last 200 log lines).\n\nPermission: `imports.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "imports.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/imports/{id}/land": {
      "post": {
        "operationId": "postApiImportsIdLand",
        "tags": [
          "Imports plan"
        ],
        "summary": "Lands the planned job as drafts: types, entities (in the job's release), media, redirects, menus, shared block",
        "description": "Lands the planned job as drafts: types, entities (in the job's release), media, redirects, menus, shared blocks.\n\nContract: POST /api/imports/:id/land { pageIds?, clusterIds?, publish? } → ImportReport & { summary: { entities, types, assets, redirects, redirectsDropped, menus, sharedBlocks,\n\nPermission: `imports.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "imports.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "pageIds": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64
                    },
                    "maxItems": 5000
                  },
                  "clusterIds": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64
                    },
                    "maxItems": 5000
                  },
                  "publish": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/imports/{id}/menus": {
      "get": {
        "operationId": "getApiImportsIdMenus",
        "tags": [
          "Imports"
        ],
        "summary": "GET /api/imports/:id/assets → ImportAsset[]; GET /api/imports/:id/redirects → ImportRedirect[]; GET /api/impor",
        "description": "Contract: GET /api/imports/:id/assets → ImportAsset[]; GET /api/imports/:id/redirects → ImportRedirect[]; GET /api/imports/:id/menus → ImportMenu[];\n\nPermission: `imports.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "imports.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/imports/{id}/pages": {
      "get": {
        "operationId": "getApiImportsIdPages",
        "tags": [
          "Imports"
        ],
        "summary": "GET /api/imports/:id/pages?status=&cluster=&q=&page=&limit= → Paginated<ImportPageSummary> (ImportPage without",
        "description": "Contract: GET /api/imports/:id/pages?status=&cluster=&q=&page=&limit= → Paginated<ImportPageSummary> (ImportPage without mainHtml, text and blocks;\n\nPermission: `imports.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "ok",
                "redirect",
                "error"
              ]
            }
          },
          {
            "name": "cluster",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          }
        ],
        "x-permission": [
          "imports.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/imports/{id}/pages/{pid}": {
      "get": {
        "operationId": "getApiImportsIdPagesPid",
        "tags": [
          "Imports"
        ],
        "summary": "GET /api/imports/:id/pages/:pid → ImportPage; GET /api/imports/:id/pages/:pid/raw → text/html of the fetched s",
        "description": "Contract: GET /api/imports/:id/pages/:pid → ImportPage; GET /api/imports/:id/pages/:pid/raw → text/html of the fetched source, served with\n\nPermission: `imports.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "pid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "imports.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/imports/{id}/pages/{pid}/compare": {
      "get": {
        "operationId": "getApiImportsIdPagesPidCompare",
        "tags": [
          "Imports plan"
        ],
        "summary": "The fetched original next to the converted page (server-rendered) with its quality.",
        "description": "The fetched original next to the converted page (server-rendered) with its quality.\n\nContract: GET /api/imports/:id/pages/:pid/compare → { original: { html, text, images, links }, converted: { blocks, html (server-rendered), text }, quality };\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "pid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/imports/{id}/pages/{pid}/raw": {
      "get": {
        "operationId": "getApiImportsIdPagesPidRaw",
        "tags": [
          "Imports"
        ],
        "summary": "GET /api/imports/:id/pages/:pid → ImportPage; GET /api/imports/:id/pages/:pid/raw → text/html of the fetched s",
        "description": "Contract: GET /api/imports/:id/pages/:pid → ImportPage; GET /api/imports/:id/pages/:pid/raw → text/html of the fetched source, served with\n\nPermission: `imports.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "pid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "imports.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/imports/{id}/recrawl": {
      "post": {
        "operationId": "postApiImportsIdRecrawl",
        "tags": [
          "Imports"
        ],
        "summary": "POST /api/imports/:id/recrawl { pageIds?: string[] } → ImportJob (requeues the listed pages, or the whole site",
        "description": "Contract: POST /api/imports/:id/recrawl { pageIds?: string[] } → ImportJob (requeues the listed pages, or the whole site when omitted);\n\nPermission: `imports.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "imports.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "pageIds": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 100
                    },
                    "maxItems": 500
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/imports/{id}/redirects": {
      "get": {
        "operationId": "getApiImportsIdRedirects",
        "tags": [
          "Imports"
        ],
        "summary": "GET /api/imports/:id/assets → ImportAsset[]; GET /api/imports/:id/redirects → ImportRedirect[]; GET /api/impor",
        "description": "Contract: GET /api/imports/:id/assets → ImportAsset[]; GET /api/imports/:id/redirects → ImportRedirect[]; GET /api/imports/:id/menus → ImportMenu[];\n\nPermission: `imports.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "imports.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/imports/{id}/report": {
      "get": {
        "operationId": "getApiImportsIdReport",
        "tags": [
          "Imports plan"
        ],
        "summary": "GET /api/imports/:id/report → ImportReport.",
        "description": "Contract: GET /api/imports/:id/report → ImportReport.\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/imports/{id}/theme": {
      "get": {
        "operationId": "getApiImportsIdTheme",
        "tags": [
          "Imports theme"
        ],
        "summary": "GET /api/imports/:id/theme → ImportThemeResult (404 until extracted).",
        "description": "Contract: GET /api/imports/:id/theme → ImportThemeResult (404 until extracted).\n\nPermission: `imports.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "imports.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/imports/{id}/theme/apply": {
      "post": {
        "operationId": "postApiImportsIdThemeApply",
        "tags": [
          "Imports theme"
        ],
        "summary": "POST /api/imports/:id/theme/apply ImportThemeApplyRequest → ImportThemeResult: merges the given (or the extrac",
        "description": "Contract: POST /api/imports/:id/theme/apply ImportThemeApplyRequest → ImportThemeResult: merges the given (or the extracted) tokens into the brand\n\nPermission: `imports.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "imports.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "tokens": {
                    "type": "object",
                    "properties": {
                      "colorPrimary": {
                        "type": "string",
                        "maxLength": 100
                      },
                      "colorText": {
                        "type": "string",
                        "maxLength": 100
                      },
                      "colorBackground": {
                        "type": "string",
                        "maxLength": 100
                      },
                      "fontBody": {
                        "type": "string",
                        "maxLength": 300
                      },
                      "fontHeading": {
                        "type": "string",
                        "maxLength": 300
                      },
                      "radius": {
                        "type": "string",
                        "maxLength": 50
                      },
                      "maxWidth": {
                        "type": "string",
                        "maxLength": 50
                      }
                    }
                  },
                  "custom": {
                    "type": "object",
                    "additionalProperties": {
                      "type": "string",
                      "maxLength": 300
                    }
                  },
                  "logoAsMedia": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/imports/{id}/theme/extract": {
      "post": {
        "operationId": "postApiImportsIdThemeExtract",
        "tags": [
          "Imports theme"
        ],
        "summary": "POST /api/imports/:id/theme/extract → ImportThemeResult: reads the stylesheets the crawled pages link to (thro",
        "description": "Contract: POST /api/imports/:id/theme/extract → ImportThemeResult: reads the stylesheets the crawled pages link to (through the SSRF guard, at most\n\nPermission: `imports.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "imports.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/kits": {
      "get": {
        "operationId": "getApiKits",
        "tags": [
          "Kits and structure"
        ],
        "summary": "GET /api/kits → KitSummary[] (bundled in packages/kits/<key>/kit.json or KITS_DIR; \"installed\" when every type",
        "description": "Contract: GET /api/kits → KitSummary[] (bundled in packages/kits/<key>/kit.json or KITS_DIR; \"installed\" when every type of the kit exists); any user.\n\nRequires a signed-in user (cookie session or bearer token).",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/kits/install-from-registry": {
      "post": {
        "operationId": "postApiKitsInstallFromRegistry",
        "tags": [
          "Kits and structure"
        ],
        "summary": "A kit or theme from the registry this site is pointed at (REGISTRY_URL): the module system's client fetches an",
        "description": "A kit or theme from the registry this site is pointed at (REGISTRY_URL): the module system's client fetches and verifies the tarball.\n\nContract: POST /api/kits/install-from-registry ({ name, version?, withSampleContent?: boolean }) → KitInstallReport (users.manage): downloads the kit or theme\n\nPublic, or checks access itself (see the description).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "version": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "withSampleContent": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "name"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/kits/plan-from-registry": {
      "post": {
        "operationId": "postApiKitsPlanFromRegistry",
        "tags": [
          "Kits and structure"
        ],
        "summary": "The resolved plan of a kit install (GET /api/kits/:key/plan, POST /api/kits/plan-from-registry): the kits in i",
        "description": "Contract: The resolved plan of a kit install (GET /api/kits/:key/plan, POST /api/kits/plan-from-registry): the kits in install order (dependencies first,\n\nPublic, or checks access itself (see the description).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "version": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "withSampleContent": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "name"
                ],
                "x-pick": true
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/kits/registry": {
      "get": {
        "operationId": "getApiKitsRegistry",
        "tags": [
          "Kits and structure"
        ],
        "summary": "What installing a registry kit would do (dependencies resolved against the bundled kits and the registry), wit",
        "description": "What installing a registry kit would do (dependencies resolved against the bundled kits and the registry), without installing.\n\nThe kits, themes and brands the registry this site is pointed at lists, for Kits → Install from registry.\n\nContract: and with ?registry=1 (users.manage at instance scope, like GET /api/kits/registry) the registry's packs too; installed ones first.\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/kits/{key}/install": {
      "post": {
        "operationId": "postApiKitsKeyInstall",
        "tags": [
          "Kits and structure"
        ],
        "summary": "Installing is the kit install: POST /api/kits/:key/install (bundled) or POST /api/kits/install-from-registry",
        "description": "Contract: Installing is the kit install: POST /api/kits/:key/install (bundled) or POST /api/kits/install-from-registry. A components kit's\n\nPermission: `types.manage`, `kits.install`.",
        "parameters": [
          {
            "name": "key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "types.manage",
          "kits.install"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "withSampleContent": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/kits/{key}/plan": {
      "get": {
        "operationId": "getApiKitsKeyPlan",
        "tags": [
          "Kits and structure"
        ],
        "summary": "What installing a bundled kit would do: the kits in install order, the modules, the core check",
        "description": "What installing a bundled kit would do: the kits in install order, the modules, the core check. The Kits screen shows it before confirming.\n\nContract: The resolved plan of a kit install (GET /api/kits/:key/plan, POST /api/kits/plan-from-registry): the kits in install order (dependencies first,\n\nPermission: `types.manage`.",
        "parameters": [
          {
            "name": "key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "types.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/mail": {
      "get": {
        "operationId": "getApiMail",
        "tags": [
          "Mail"
        ],
        "summary": "GET    /api/mail → MailSettings (users.manage)",
        "description": "Contract: GET    /api/mail → MailSettings (users.manage)\n\nPublic, or checks access itself (see the description).",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "operationId": "putApiMail",
        "tags": [
          "Mail"
        ],
        "summary": "PUT    /api/mail MailSettingsInput → MailSettings (users.manage; 409 mail_env when SMTP_URL is set; audited `m",
        "description": "Contract: PUT    /api/mail MailSettingsInput → MailSettings (users.manage; 409 mail_env when SMTP_URL is set; audited `mail.update`)\n\nPublic, or checks access itself (see the description).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "provider": {
                    "type": "string",
                    "x-enum": "MAIL_PROVIDERS"
                  },
                  "host": {
                    "type": "string",
                    "maxLength": 253
                  },
                  "port": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 65535
                  },
                  "security": {
                    "type": "string",
                    "x-enum": "MAIL_SECURITIES as [string, ...string[]]"
                  },
                  "username": {
                    "type": "string",
                    "maxLength": 500
                  },
                  "password": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 2000
                  },
                  "from": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 320
                  }
                },
                "required": [
                  "provider",
                  "from"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "operationId": "deleteApiMail",
        "tags": [
          "Mail"
        ],
        "summary": "DELETE /api/mail → 204 (users.manage; 409 mail_env; audited `mail.delete`)",
        "description": "Contract: DELETE /api/mail → 204 (users.manage; 409 mail_env; audited `mail.delete`)\n\nPublic, or checks access itself (see the description).",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/mail/test": {
      "post": {
        "operationId": "postApiMailTest",
        "tags": [
          "Mail"
        ],
        "summary": "POST   /api/mail/test MailTestInput → MailTestResult (users.manage): sends one plain-text message through the ",
        "description": "Contract: POST   /api/mail/test MailTestInput → MailTestResult (users.manage): sends one plain-text message through the resolved relay\n\nPublic, or checks access itself (see the description).",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/me/preferences": {
      "get": {
        "operationId": "getApiMePreferences",
        "tags": [
          "Preferences"
        ],
        "summary": "GET /api/me/preferences → UserPreference[]; GET /api/me/preferences/:key → UserPreference (404 `not_found` whe",
        "description": "Contract: GET /api/me/preferences → UserPreference[]; GET /api/me/preferences/:key → UserPreference (404 `not_found` when unset);\n\nRequires a signed-in user (cookie session or bearer token).",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/me/preferences/{key}": {
      "get": {
        "operationId": "getApiMePreferencesKey",
        "tags": [
          "Preferences"
        ],
        "summary": "GET /api/me/preferences → UserPreference[]; GET /api/me/preferences/:key → UserPreference (404 `not_found` whe",
        "description": "Contract: GET /api/me/preferences → UserPreference[]; GET /api/me/preferences/:key → UserPreference (404 `not_found` when unset);\n\nRequires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "operationId": "putApiMePreferencesKey",
        "tags": [
          "Preferences"
        ],
        "summary": "PUT /api/me/preferences/:key { value } → UserPreference (any JSON, 64 KB at most, 413 beyond); DELETE → 204.",
        "description": "Contract: PUT /api/me/preferences/:key { value } → UserPreference (any JSON, 64 KB at most, 413 beyond); DELETE → 204.\n\nRequires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "value": {}
                },
                "required": [
                  "value"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "operationId": "deleteApiMePreferencesKey",
        "tags": [
          "Preferences"
        ],
        "summary": "Per-user preference keys the onboarding uses (GET/PUT/DELETE /api/me/preferences/:key)",
        "description": "Contract: Per-user preference keys the onboarding uses (GET/PUT/DELETE /api/me/preferences/:key). */\n\nRequires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/me/sites": {
      "get": {
        "operationId": "getApiMeSites",
        "tags": [
          "Sites (multisite)"
        ],
        "summary": "The sites a user can open: every site for a user with a global role (admins see paused ones too), else the sit",
        "description": "The sites a user can open: every site for a user with a global role (admins see paused ones too), else the sites of their site or section roles.\n\nContract: site; others see only the sites where they hold a site or section role. GET /api/me/sites → MeSitesResponse (for the admin site switcher).\n\nRequires a signed-in user (cookie session or bearer token).",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/media": {
      "get": {
        "operationId": "getApiMedia",
        "tags": [
          "Media"
        ],
        "summary": "GET /api/media?folder=<id>|root → items in that folder (root: not filed); without folder, every item.",
        "description": "Contract: GET /api/media?folder=<id>|root → items in that folder (root: not filed); without folder, every item.\n\nRequires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          },
          {
            "name": "folder",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "operationId": "postApiMedia",
        "tags": [
          "Media"
        ],
        "summary": "POST /api/media (multipart/form-data: file, alt?) → MediaItem",
        "description": "Contract: POST /api/media (multipart/form-data: file, alt?) → MediaItem\n\nPermission: `media.upload`.",
        "x-permission": [
          "media.upload"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/media/dam/import": {
      "post": {
        "operationId": "postApiMediaDamImport",
        "tags": [
          "Dam"
        ],
        "summary": "POST /api/media/dam/import (DamImportRequest) → MediaItem (201; 200 with the existing item when the asset was ",
        "description": "Contract: POST /api/media/dam/import (DamImportRequest) → MediaItem (201; 200 with the existing item when the asset was imported before) (media.upload).\n\nPermission: `media.upload`.",
        "x-permission": [
          "media.upload"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "externalId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  },
                  "alt": {
                    "type": "string",
                    "maxLength": 1000
                  },
                  "title": {
                    "type": "string",
                    "maxLength": 300
                  }
                },
                "required": [
                  "externalId"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/media/dam/search": {
      "get": {
        "operationId": "getApiMediaDamSearch",
        "tags": [
          "Dam"
        ],
        "summary": "GET  /api/media/dam/search?q=&page=&cursor=&kind= → DamSearchResponse (media.upload)",
        "description": "Contract: GET  /api/media/dam/search?q=&page=&cursor=&kind= → DamSearchResponse (media.upload)\n\nPermission: `media.upload`.",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "x-coerce": true,
              "minimum": 1,
              "maximum": 1000
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 500
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "x-enum": "DAM_ASSET_KINDS as [string, ...string[]]"
            }
          }
        ],
        "x-permission": [
          "media.upload"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/media/dam/test": {
      "post": {
        "operationId": "postApiMediaDamTest",
        "tags": [
          "Dam"
        ],
        "summary": "POST /api/media/dam/test ({ provider?, credentials?, defaultFolder? }, else the stored settings) → DamTestResp",
        "description": "Contract: POST /api/media/dam/test ({ provider?, credentials?, defaultFolder? }, else the stored settings) → DamTestResponse (site.settings)\n\nPermission: `integrations.manage`.",
        "x-permission": [
          "integrations.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "provider": {
                    "type": "string",
                    "enum": [
                      "none",
                      "cloudinary",
                      "bynder",
                      "brandfolder"
                    ]
                  },
                  "credentials": {
                    "type": "object",
                    "additionalProperties": {
                      "type": "string",
                      "maxLength": 2000
                    }
                  },
                  "defaultFolder": {
                    "type": "string",
                    "maxLength": 300
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/media/dam/webhook/{provider}": {
      "post": {
        "operationId": "postApiMediaDamWebhookProvider",
        "tags": [
          "Dam"
        ],
        "summary": "Provider notifications",
        "description": "Provider notifications. Public: the provider's own signature (Cloudinary) or the shared webhook token identifies the caller;\nevery site configured for that provider is tried, since the provider does not know which Spillway site imported the asset.\n\nContract: POST /api/media/dam/webhook/:provider (public, rate limited; Cloudinary notifications verified with X-Cld-Signature, every provider\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "provider",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "202": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/media/folders": {
      "get": {
        "operationId": "getApiMediaFolders",
        "tags": [
          "Media"
        ],
        "summary": "GET /api/media/folders → MediaFolder[] (any user); POST (media.upload) { label, parentId? } → 201 MediaFolder;",
        "description": "Contract: GET /api/media/folders → MediaFolder[] (any user); POST (media.upload) { label, parentId? } → 201 MediaFolder;\n\nRequires a signed-in user (cookie session or bearer token).",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "operationId": "postApiMediaFolders",
        "tags": [
          "Media"
        ],
        "summary": "POST /api/media/folders",
        "description": "Permission: `media.upload`.",
        "x-permission": [
          "media.upload"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "parentId": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 64
                  }
                },
                "required": [
                  "label"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/media/folders/{id}": {
      "put": {
        "operationId": "putApiMediaFoldersId",
        "tags": [
          "Media"
        ],
        "summary": "PUT /api/media/folders/:id { label?, parentId? } (a folder cannot move into itself or below itself: 400);",
        "description": "Contract: PUT /api/media/folders/:id { label?, parentId? } (a folder cannot move into itself or below itself: 400);\n\nPermission: `media.upload`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "media.upload"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "parentId": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 64
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "operationId": "deleteApiMediaFoldersId",
        "tags": [
          "Media"
        ],
        "summary": "DELETE /api/media/folders/:id → 204; its items and subfolders move to its parent.",
        "description": "Contract: DELETE /api/media/folders/:id → 204; its items and subfolders move to its parent.\n\nPermission: `media.upload`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "media.upload"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/media/free/import": {
      "post": {
        "operationId": "postApiMediaFreeImport",
        "tags": [
          "Free media"
        ],
        "summary": "POST /api/media/free/import { source, id, alt?, folderId? } (media.upload) → 201 MediaItem (200 with the exist",
        "description": "Contract: POST /api/media/free/import { source, id, alt?, folderId? } (media.upload) → 201 MediaItem (200 with the existing item when it was\n\nPermission: `media.upload`.",
        "x-permission": [
          "media.upload"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "source": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 200,
                    "pattern": "^[@a-z0-9/_-]+\\/[a-z][a-z0-9-]{0,40}$"
                  },
                  "id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "alt": {
                    "type": "string",
                    "maxLength": 500
                  },
                  "folderId": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 64
                  }
                },
                "required": [
                  "source",
                  "id"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/media/free/search": {
      "get": {
        "operationId": "getApiMediaFreeSearch",
        "tags": [
          "Free media"
        ],
        "summary": "GET  /api/media/free/search?source=<module>/<key>&q=&page=&orientation= (media.upload) → FreeMediaSearch",
        "description": "Contract: GET  /api/media/free/search?source=<module>/<key>&q=&page=&orientation= (media.upload) → FreeMediaSearch. Results are cached\n\nPermission: `media.upload`.",
        "parameters": [
          {
            "name": "source",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 3,
              "maxLength": 200,
              "pattern": "^[@a-z0-9/_-]+\\/[a-z][a-z0-9-]{0,40}$"
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "x-coerce": true,
              "minimum": 1,
              "maximum": 50,
              "default": 1
            }
          },
          {
            "name": "orientation",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "landscape",
                "portrait",
                "square"
              ]
            }
          }
        ],
        "x-permission": [
          "media.upload"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/media/free/sources": {
      "get": {
        "operationId": "getApiMediaFreeSources",
        "tags": [
          "Free media"
        ],
        "summary": "GET  /api/media/free/sources (media.upload) → FreeMediaSource[]: the enabled modules' libraries.",
        "description": "Contract: GET  /api/media/free/sources (media.upload) → FreeMediaSource[]: the enabled modules' libraries.\n\nPermission: `media.upload`.",
        "x-permission": [
          "media.upload"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/media/move": {
      "post": {
        "operationId": "postApiMediaMove",
        "tags": [
          "Media"
        ],
        "summary": "PUT /api/media/:id { folderId } files one item; POST /api/media/move { ids, folderId } files several (media.up",
        "description": "Contract: PUT /api/media/:id { folderId } files one item; POST /api/media/move { ids, folderId } files several (media.upload).\n\nPermission: `media.upload`.",
        "x-permission": [
          "media.upload"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "ids": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "minItems": 1,
                    "maxItems": 500
                  },
                  "folderId": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 64
                  }
                },
                "required": [
                  "ids",
                  "folderId"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/media/{id}": {
      "get": {
        "operationId": "getApiMediaId",
        "tags": [
          "Media"
        ],
        "summary": "GET /api/media/{id}",
        "description": "Requires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "operationId": "putApiMediaId",
        "tags": [
          "Media"
        ],
        "summary": "/media URL answers 404, or redirects someone who may see it, so links pasted before keep working for them",
        "description": "Contract: /media URL answers 404, or redirects someone who may see it, so links pasted before keep working for them. PUT /api/media/:id\n\nPermission: `media.upload`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "media.upload"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "alt": {
                    "type": "string",
                    "maxLength": 1000
                  },
                  "title": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 300
                  },
                  "focalPoint": {
                    "type": [
                      "object",
                      "null"
                    ],
                    "properties": {
                      "x": {
                        "type": "number",
                        "minimum": 0,
                        "maximum": 1
                      },
                      "y": {
                        "type": "number",
                        "minimum": 0,
                        "maximum": 1
                      }
                    },
                    "required": [
                      "x",
                      "y"
                    ]
                  },
                  "folderId": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 64
                  },
                  "visibility": {
                    "oneOf": [
                      {
                        "x-schema": "visibilitySchema"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "operationId": "deleteApiMediaId",
        "tags": [
          "Media"
        ],
        "summary": "DELETE /api/media/:id → 204",
        "description": "Contract: DELETE /api/media/:id → 204\n\nPermission: `media.delete`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "media.delete"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/media/{id}/copy-local": {
      "post": {
        "operationId": "postApiMediaIdCopyLocal",
        "tags": [
          "Dam"
        ],
        "summary": "downloads the bytes; derivatives of external media are URL rewrites, never sharp runs",
        "description": "Contract: downloads the bytes; derivatives of external media are URL rewrites, never sharp runs. POST /api/media/:id/copy-local downloads\n\nPermission: `media.upload`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "media.upload"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/media/{id}/replace": {
      "post": {
        "operationId": "postApiMediaIdReplace",
        "tags": [
          "Media"
        ],
        "summary": "POST /api/media/:id/replace (multipart `file`, media.upload) → MediaItem: new bytes under the same id and URL;",
        "description": "Contract: POST /api/media/:id/replace (multipart `file`, media.upload) → MediaItem: new bytes under the same id and URL; size, type and\n\nPermission: `media.upload`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "media.upload"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/media/{id}/usage": {
      "get": {
        "operationId": "getApiMediaIdUsage",
        "tags": [
          "Media"
        ],
        "summary": "GET /api/media/:id/usage → MediaUsage.",
        "description": "Contract: GET /api/media/:id/usage → MediaUsage.\n\nRequires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/menus": {
      "get": {
        "operationId": "getApiMenus",
        "tags": [
          "Menus"
        ],
        "summary": "Inside a workstream (X-Spillway-Workstream) reads return the branch's overlay and PUT writes to it; create and",
        "description": "Inside a workstream (X-Spillway-Workstream) reads return the branch's overlay and PUT writes to it; create and delete stay on the main line.\n\nContract: GET /api/menus → Menu[]; POST (MenuInput); GET/PUT (Partial<MenuInput>)/DELETE /api/menus/:id (site.settings writes, any user reads).\n\nRequires a signed-in user (cookie session or bearer token).",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "operationId": "postApiMenus",
        "tags": [
          "Menus"
        ],
        "summary": "POST /api/menus",
        "description": "Permission: `menus.manage`.",
        "x-permission": [
          "menus.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 63
                  },
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "items": {
                    "type": "array",
                    "items": {
                      "x-zod": "z.lazy(() =>\n  z.object({\n    id: z.string().max(64).optional(),\n    label: z.string().max(200),\n    /** Per-locale labels (locale → label); unknown locales are"
                    },
                    "maxItems": 200,
                    "default": []
                  }
                },
                "required": [
                  "key",
                  "label"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/menus/{id}": {
      "get": {
        "operationId": "getApiMenusId",
        "tags": [
          "Menus"
        ],
        "summary": "GET /api/menus/{id}",
        "description": "Requires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "operationId": "putApiMenusId",
        "tags": [
          "Menus"
        ],
        "summary": "DELETE /api/entities/:id records a delete intent; PUT /api/menus/:id and PUT /api/site are stored as release o",
        "description": "Contract: DELETE /api/entities/:id records a delete intent; PUT /api/menus/:id and PUT /api/site are stored as release overlays. Publish, unpublish, submit\n\nRequires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 63
                  },
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "items": {
                    "type": "array",
                    "items": {
                      "x-zod": "z.lazy(() =>\n  z.object({\n    id: z.string().max(64).optional(),\n    label: z.string().max(200),\n    /** Per-locale labels (locale → label); unknown locales are"
                    },
                    "maxItems": 200,
                    "default": []
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "operationId": "deleteApiMenusId",
        "tags": [
          "Menus"
        ],
        "summary": "GET /api/menus → Menu[]; POST (MenuInput); GET/PUT (Partial<MenuInput>)/DELETE /api/menus/:id (site.settings w",
        "description": "Contract: GET /api/menus → Menu[]; POST (MenuInput); GET/PUT (Partial<MenuInput>)/DELETE /api/menus/:id (site.settings writes, any user reads).\n\nPermission: `menus.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "menus.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/migrations": {
      "post": {
        "operationId": "postApiMigrations",
        "tags": [
          "Migrations"
        ],
        "summary": "POST /api/migrations MigrationCreateRequest → 201 Migration (status analyzing; the runner starts at once)",
        "description": "Contract: POST /api/migrations MigrationCreateRequest → 201 Migration (status analyzing; the runner starts at once). Credentials are refused for a\n\nPermission: `imports.manage`.",
        "x-permission": [
          "imports.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2000
                  },
                  "connection": {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "enum": [
                          "address",
                          "wordpress",
                          "drupal",
                          "wxr"
                        ]
                      },
                      "user": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      "password": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 500
                      },
                      "exportFileId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 100
                      }
                    },
                    "required": [
                      "kind"
                    ]
                  },
                  "options": {
                    "type": "object",
                    "properties": {
                      "maxPages": {
                        "type": "integer",
                        "minimum": 1
                      },
                      "maxItems": {
                        "type": "integer",
                        "minimum": 1
                      },
                      "rateLimitMs": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 60000
                      },
                      "respectRobots": {
                        "type": "boolean"
                      },
                      "useSitemap": {
                        "type": "boolean"
                      },
                      "include": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 500
                        },
                        "maxItems": 100
                      },
                      "exclude": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 500
                        },
                        "maxItems": 100
                      },
                      "useAi": {
                        "type": "boolean"
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "get": {
        "operationId": "getApiMigrations",
        "tags": [
          "Migrations"
        ],
        "summary": "GET /api/migrations?page=&limit= → Paginated<Migration>; GET /api/migrations/:id → Migration.",
        "description": "Contract: GET /api/migrations?page=&limit= → Paginated<Migration>; GET /api/migrations/:id → Migration.\n\nPermission: `imports.manage`.",
        "x-permission": [
          "imports.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/migrations/check": {
      "post": {
        "operationId": "postApiMigrationsCheck",
        "tags": [
          "Migrations"
        ],
        "summary": "POST /api/migrations/check { url } → MigrationCheck: what the address is (reachable, platform and version, whe",
        "description": "Contract: POST /api/migrations/check { url } → MigrationCheck: what the address is (reachable, platform and version, whether its API answers,\n\nPermission: `imports.manage`.",
        "x-permission": [
          "imports.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2000
                  }
                },
                "required": [
                  "url"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/migrations/export-files": {
      "post": {
        "operationId": "postApiMigrationsExportFiles",
        "tags": [
          "Migrations"
        ],
        "summary": "A WordPress export (WXR): multipart `file`, or the raw XML body with ?filename=.",
        "description": "A WordPress export (WXR): multipart `file`, or the raw XML body with ?filename=.\n\nContract: POST /api/migrations/export-files (multipart `file`, or the raw body with ?filename=) → 201 MigrationExportFile: a WordPress export\n\nPermission: `imports.manage`.",
        "parameters": [
          {
            "name": "filename",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "imports.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/migrations/{id}": {
      "get": {
        "operationId": "getApiMigrationsId",
        "tags": [
          "Migrations"
        ],
        "summary": "GET /api/migrations?page=&limit= → Paginated<Migration>; GET /api/migrations/:id → Migration.",
        "description": "Contract: GET /api/migrations?page=&limit= → Paginated<Migration>; GET /api/migrations/:id → Migration.\n\nPermission: `imports.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "imports.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "operationId": "deleteApiMigrationsId",
        "tags": [
          "Migrations"
        ],
        "summary": "DELETE /api/migrations/:id → 204 (the rows and the files; what landed stays).",
        "description": "Contract: DELETE /api/migrations/:id → 204 (the rows and the files; what landed stays).\n\nPermission: `imports.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "imports.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/migrations/{id}/archive": {
      "post": {
        "operationId": "postApiMigrationsIdArchive",
        "tags": [
          "Migrations"
        ],
        "summary": "DELETE /api/migrations/:id/credentials → Migration; POST /api/migrations/:id/archive → Migration (nothing runs",
        "description": "Contract: DELETE /api/migrations/:id/credentials → Migration; POST /api/migrations/:id/archive → Migration (nothing runs; credentials deleted);\n\nPermission: `imports.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "imports.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/migrations/{id}/authors": {
      "get": {
        "operationId": "getApiMigrationsIdAuthors",
        "tags": [
          "Migrations"
        ],
        "summary": "GET /api/migrations/:id/authors → { items: MigrationAuthor[] }.",
        "description": "Contract: GET /api/migrations/:id/authors → { items: MigrationAuthor[] }.\n\nPermission: `imports.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "imports.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/migrations/{id}/authors/{authorId}/invite": {
      "post": {
        "operationId": "postApiMigrationsIdAuthorsAuthorIdInvite",
        "tags": [
          "Migrations"
        ],
        "summary": "Invite emails a person: users.manage as well, and never an MCP tool (docs/dev/migration.md, Authors).",
        "description": "Invite emails a person: users.manage as well, and never an MCP tool (docs/dev/migration.md, Authors).\n\nContract: POST /api/migrations/:id/authors/:authorId/invite { email?, role? } (users.manage) → MigrationAuthor: Spillway's account invitation to the\n\nPermission: `imports.manage`, `users.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "authorId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "imports.manage",
          "users.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string",
                    "format": "email",
                    "maxLength": 254
                  },
                  "role": {
                    "type": "string",
                    "enum": [
                      "viewer",
                      "author",
                      "editor",
                      "manager"
                    ]
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/migrations/{id}/budget": {
      "post": {
        "operationId": "postApiMigrationsIdBudget",
        "tags": [
          "Migrations"
        ],
        "summary": "Add to the budget",
        "description": "Add to the budget. An agent (an API token) may add only what the migration allowance covers.\n\nContract: POST /api/migrations/:id/budget { add } → Migration: Add to the budget (tokens), with the same rule for agents. Continue resumes.\n\nPermission: `imports.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "imports.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "add": {
                    "type": "integer",
                    "minimum": 1000,
                    "maximum": 50000000
                  }
                },
                "required": [
                  "add"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/migrations/{id}/continue": {
      "post": {
        "operationId": "postApiMigrationsIdContinue",
        "tags": [
          "Migrations"
        ],
        "summary": "POST /api/migrations/:id/pause → Migration (stops after the items in progress); POST /api/migrations/:id/conti",
        "description": "Contract: POST /api/migrations/:id/pause → Migration (stops after the items in progress); POST /api/migrations/:id/continue → Migration (resumes\n\nPermission: `imports.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "imports.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/migrations/{id}/credentials": {
      "delete": {
        "operationId": "deleteApiMigrationsIdCredentials",
        "tags": [
          "Migrations"
        ],
        "summary": "DELETE /api/migrations/:id/credentials → Migration; POST /api/migrations/:id/archive → Migration (nothing runs",
        "description": "Contract: DELETE /api/migrations/:id/credentials → Migration; POST /api/migrations/:id/archive → Migration (nothing runs; credentials deleted);\n\nPermission: `imports.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "imports.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/migrations/{id}/cutover": {
      "get": {
        "operationId": "getApiMigrationsIdCutover",
        "tags": [
          "Migrations"
        ],
        "summary": "GET  /api/migrations/:id/cutover → MigrationCutover: the checklist, the DNS help, the cutover and its rollback",
        "description": "Contract: GET  /api/migrations/:id/cutover → MigrationCutover: the checklist, the DNS help, the cutover and its rollback window, the watch\n\nPermission: `imports.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "imports.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/migrations/{id}/design": {
      "put": {
        "operationId": "putApiMigrationsIdDesign",
        "tags": [
          "Migrations"
        ],
        "summary": "PUT  /api/migrations/:id/design { version, ...MigrationDesignChoice } → { plan, items }: a new plan version wi",
        "description": "Contract: PUT  /api/migrations/:id/design { version, ...MigrationDesignChoice } → { plan, items }: a new plan version with the direction; after a\n\nPermission: `imports.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "imports.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "look": {
                    "type": "string",
                    "x-enum": "MIGRATION_DESIGN_STOPS as [string, ...string[]]"
                  },
                  "layout": {
                    "type": "string",
                    "x-enum": "MIGRATION_DESIGN_STOPS as [string, ...string[]]"
                  },
                  "advanced": {
                    "type": "boolean"
                  },
                  "perType": {
                    "type": "object",
                    "additionalProperties": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "x-enum": "MIGRATION_DESIGN_STOPS as [string, ...string[]]"
                    }
                  },
                  "version": {
                    "type": "integer",
                    "minimum": 1
                  }
                },
                "required": [
                  "version"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/migrations/{id}/design/preview": {
      "get": {
        "operationId": "getApiMigrationsIdDesignPreview",
        "tags": [
          "Migrations"
        ],
        "summary": "GET  /api/migrations/:id/design/preview?page=home|inner|listing&look=&layout=&item= → { html }: one of three o",
        "description": "Contract: GET  /api/migrations/:id/design/preview?page=home|inner|listing&look=&layout=&item= → { html }: one of three of the site's own pages\n\nPermission: `imports.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "home",
                "inner",
                "listing"
              ],
              "default": "home"
            }
          },
          {
            "name": "look",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "x-enum": "MIGRATION_DESIGN_STOPS as [string, ...string[]]"
            }
          },
          {
            "name": "layout",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "x-enum": "MIGRATION_DESIGN_STOPS as [string, ...string[]]"
            }
          },
          {
            "name": "item",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          }
        ],
        "x-permission": [
          "imports.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/migrations/{id}/dns/check": {
      "post": {
        "operationId": "postApiMigrationsIdDnsCheck",
        "tags": [
          "Migrations"
        ],
        "summary": "POST /api/migrations/:id/dns/check → MigrationCutover: the records to set, each looked up live with its status",
        "description": "Contract: POST /api/migrations/:id/dns/check → MigrationCutover: the records to set, each looked up live with its status; the mail records\n\nPermission: `imports.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "imports.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/migrations/{id}/domain": {
      "put": {
        "operationId": "putApiMigrationsIdDomain",
        "tags": [
          "Migrations"
        ],
        "summary": "PUT  /api/migrations/:id/domain { domain, target? } → MigrationCutover: the domain the old site answers at and",
        "description": "Contract: PUT  /api/migrations/:id/domain { domain, target? } → MigrationCutover: the domain the old site answers at and, on a self-hosted\n\nPermission: `imports.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "imports.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "domain": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 300
                  },
                  "target": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 500
                  }
                },
                "required": [
                  "domain"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/migrations/{id}/estimate": {
      "get": {
        "operationId": "getApiMigrationsIdEstimate",
        "tags": [
          "Migrations"
        ],
        "summary": "GET  /api/migrations/:id/estimate → MigrationAiEstimate: the AI the run would use, step by step (calls and tok",
        "description": "Contract: GET  /api/migrations/:id/estimate → MigrationAiEstimate: the AI the run would use, step by step (calls and tokens, low to high), what\n\nPermission: `imports.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "imports.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/migrations/{id}/events": {
      "get": {
        "operationId": "getApiMigrationsIdEvents",
        "tags": [
          "Migrations"
        ],
        "summary": "GET /api/migrations/:id/events?problems=1&limit= → { items: MigrationEvent[] } (the plain-language log, newest",
        "description": "Contract: GET /api/migrations/:id/events?problems=1&limit= → { items: MigrationEvent[] } (the plain-language log, newest first).\n\nPermission: `imports.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "problems",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "0",
                "1"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "x-coerce": true,
              "minimum": 1,
              "maximum": 500,
              "default": 100
            }
          }
        ],
        "x-permission": [
          "imports.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/migrations/{id}/gaps/{key}/generate": {
      "post": {
        "operationId": "postApiMigrationsIdGapsKeyGenerate",
        "tags": [
          "Migrations"
        ],
        "summary": "Rung 3: a module the AI writes for the gap, proposed with its checks; installing it is a separate review.",
        "description": "Rung 3: a module the AI writes for the gap, proposed with its checks; installing it is a separate review.\n\nContract: POST /api/migrations/:id/gaps/:key/generate (imports.manage) → GeneratedModule (status proposed): the AI writes the package\n\nPermission: `imports.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "imports.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/migrations/{id}/gaps/{key}/install": {
      "post": {
        "operationId": "postApiMigrationsIdGapsKeyInstall",
        "tags": [
          "Migrations"
        ],
        "summary": "Rung 1: the registry package, installed as Modules installs it (a trusted one needs SPILLWAY_TRUSTED_MODULE_IN",
        "description": "Rung 1: the registry package, installed as Modules installs it (a trusted one needs SPILLWAY_TRUSTED_MODULE_INSTALL=1 and an admin).\n\nContract: POST /api/migrations/:id/gaps/:key/install (modules.manage; users.manage too for a trusted package) → { module: InstalledModule; gap }:\n\nPermission: `imports.manage`, `modules.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "imports.manage",
          "modules.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/migrations/{id}/go-live": {
      "post": {
        "operationId": "postApiMigrationsIdGoLive",
        "tags": [
          "Migrations"
        ],
        "summary": "Go live and Roll back change the live site and the domain's future: an administrator, in a signed-in session (",
        "description": "Go live and Roll back change the live site and the domain's future: an administrator, in a signed-in session (never a token).\n\nContract: POST /api/migrations/:id/go-live { confirm: true } (users.manage; a signed-in session only) → MigrationCutover: Go live. Publishes\n\nPermission: `imports.manage`, `users.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "imports.manage",
          "users.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "confirm": {
                    "const": true
                  }
                },
                "required": [
                  "confirm"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/migrations/{id}/items": {
      "get": {
        "operationId": "getApiMigrationsIdItems",
        "tags": [
          "Migrations"
        ],
        "summary": "GET /api/migrations/:id/items?stage=&status=&type=&section=&q=&page=&limit= → Paginated<MigrationItem>.",
        "description": "Contract: GET /api/migrations/:id/items?stage=&status=&type=&section=&q=&page=&limit= → Paginated<MigrationItem>.\n\nPermission: `imports.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "stage",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "x-enum": "MIGRATION_RUN_STAGES as [string, ...string[]]"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "x-enum": "MIGRATION_ITEM_STATUSES as [string, ...string[]]"
            }
          },
          {
            "name": "type",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "x-pattern": "CONTENT_TYPE_KEY_RE"
            }
          },
          {
            "name": "section",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 500
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          },
          {
            "name": "note",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "edited_by_hand"
              ]
            }
          }
        ],
        "x-permission": [
          "imports.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/migrations/{id}/options": {
      "put": {
        "operationId": "putApiMigrationsIdOptions",
        "tags": [
          "Migrations"
        ],
        "summary": "PUT /api/migrations/:id/options { options: Partial<MigrationOptions> } → Migration",
        "description": "Contract: PUT /api/migrations/:id/options { options: Partial<MigrationOptions> } → Migration. `respectRobots: false` is refused (409\n\nPermission: `imports.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "imports.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "options": {
                    "type": "object",
                    "properties": {
                      "maxPages": {
                        "type": "integer",
                        "minimum": 1
                      },
                      "maxItems": {
                        "type": "integer",
                        "minimum": 1
                      },
                      "rateLimitMs": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 60000
                      },
                      "respectRobots": {
                        "type": "boolean"
                      },
                      "useSitemap": {
                        "type": "boolean"
                      },
                      "include": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 500
                        },
                        "maxItems": 100
                      },
                      "exclude": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 500
                        },
                        "maxItems": 100
                      },
                      "useAi": {
                        "type": "boolean"
                      }
                    }
                  }
                },
                "required": [
                  "options"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/migrations/{id}/pause": {
      "post": {
        "operationId": "postApiMigrationsIdPause",
        "tags": [
          "Migrations"
        ],
        "summary": "POST /api/migrations/:id/pause → Migration (stops after the items in progress); POST /api/migrations/:id/conti",
        "description": "Contract: POST /api/migrations/:id/pause → Migration (stops after the items in progress); POST /api/migrations/:id/continue → Migration (resumes\n\nPermission: `imports.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "imports.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/migrations/{id}/plan": {
      "get": {
        "operationId": "getApiMigrationsIdPlan",
        "tags": [
          "Migrations"
        ],
        "summary": "GET /api/migrations/:id/plan?version= → MigrationPlan (the latest version by default).",
        "description": "Contract: GET /api/migrations/:id/plan?version= → MigrationPlan (the latest version by default).\n\nPermission: `imports.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "version",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "x-coerce": true,
              "minimum": 1
            }
          }
        ],
        "x-permission": [
          "imports.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "operationId": "putApiMigrationsIdPlan",
        "tags": [
          "Migrations"
        ],
        "summary": "PUT /api/migrations/:id/plan MigrationPlanUpdate → MigrationPlan: a new version with the changes; 409 `plan_ch",
        "description": "Contract: PUT /api/migrations/:id/plan MigrationPlanUpdate → MigrationPlan: a new version with the changes; 409 `plan_changed` when `version` is\n\nPermission: `imports.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "imports.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "version": {
                    "type": "integer",
                    "minimum": 1
                  },
                  "types": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "action": {
                          "type": "string",
                          "enum": [
                            "new",
                            "existing",
                            "skip"
                          ]
                        },
                        "targetTypeKey": {
                          "type": "string",
                          "x-pattern": "CONTENT_TYPE_KEY_RE"
                        },
                        "label": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "proposal": {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "x-pattern": "CONTENT_TYPE_KEY_RE"
                            },
                            "name": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 200
                            },
                            "description": {
                              "type": "string",
                              "maxLength": 2000,
                              "default": ""
                            },
                            "reason": {
                              "type": "string",
                              "maxLength": 2000,
                              "default": ""
                            },
                            "fields": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "key": {
                                    "type": "string",
                                    "x-pattern": "FIELD_KEY_RE"
                                  },
                                  "label": {
                                    "type": "string",
                                    "maxLength": 200,
                                    "default": ""
                                  },
                                  "type": {
                                    "type": "string",
                                    "x-enum": "IMPORT_FIELD_TYPES as unknown as [string, ...string[]]"
                                  },
                                  "required": {
                                    "type": "boolean",
                                    "default": false
                                  },
                                  "source": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 200
                                  },
                                  "vocabulary": {
                                    "type": "string",
                                    "x-pattern": "CONTENT_TYPE_KEY_RE"
                                  },
                                  "multiple": {
                                    "type": "boolean"
                                  },
                                  "options": {
                                    "type": "array",
                                    "items": {
                                      "type": "string",
                                      "maxLength": 200
                                    },
                                    "maxItems": 200
                                  },
                                  "placement": {
                                    "type": "string",
                                    "enum": [
                                      "page",
                                      "inline"
                                    ]
                                  }
                                },
                                "required": [
                                  "key",
                                  "type",
                                  "source"
                                ]
                              },
                              "minItems": 1,
                              "maxItems": 60
                            },
                            "pathPattern": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 200
                            },
                            "sampleUrls": {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "maxLength": 2000
                              },
                              "maxItems": 10,
                              "default": []
                            },
                            "existingTypeKey": {
                              "type": "string",
                              "x-pattern": "CONTENT_TYPE_KEY_RE"
                            },
                            "sourceType": {
                              "type": "string",
                              "maxLength": 200
                            }
                          },
                          "required": [
                            "key",
                            "name",
                            "fields",
                            "pathPattern"
                          ]
                        }
                      },
                      "required": [
                        "id"
                      ]
                    },
                    "maxItems": 200
                  },
                  "gaps": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "key": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 100
                        },
                        "choice": {
                          "oneOf": [
                            {
                              "const": 1
                            },
                            {
                              "const": 2
                            },
                            {
                              "const": 3
                            },
                            {
                              "const": 4
                            },
                            {
                              "const": "leave_out"
                            }
                          ]
                        }
                      },
                      "required": [
                        "key",
                        "choice"
                      ]
                    },
                    "maxItems": 200
                  },
                  "forms": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "key": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 600
                        },
                        "action": {
                          "type": "string",
                          "enum": [
                            "form",
                            "leave_out"
                          ]
                        }
                      },
                      "required": [
                        "key",
                        "action"
                      ]
                    },
                    "maxItems": 200
                  },
                  "listings": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "path": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 2000
                        },
                        "decision": {
                          "type": "string",
                          "enum": [
                            "collection",
                            "page"
                          ]
                        }
                      },
                      "required": [
                        "path",
                        "decision"
                      ]
                    },
                    "maxItems": 200
                  },
                  "comments": {
                    "type": "string",
                    "enum": [
                      "drop",
                      "text"
                    ]
                  },
                  "keepOffsiteRedirects": {
                    "type": "boolean"
                  },
                  "theme": {
                    "type": "object",
                    "properties": {
                      "apply": {
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "apply"
                    ]
                  },
                  "decisions": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 300
                        },
                        "value": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        }
                      },
                      "required": [
                        "id",
                        "value"
                      ]
                    },
                    "maxItems": 200
                  },
                  "design": {
                    "x-zod": "z.lazy(() => designSchema)"
                  },
                  "ai": {
                    "type": "object",
                    "properties": {
                      "steps": {
                        "type": "object",
                        "additionalProperties": {
                          "type": "boolean"
                        }
                      }
                    },
                    "required": [
                      "steps"
                    ]
                  }
                },
                "required": [
                  "version"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/migrations/{id}/plan/approve": {
      "post": {
        "operationId": "postApiMigrationsIdPlanApprove",
        "tags": [
          "Migrations"
        ],
        "summary": "POST /api/migrations/:id/plan/approve { version } → Migration (status running): refused with 409 `decisions_op",
        "description": "Contract: POST /api/migrations/:id/plan/approve { version } → Migration (status running): refused with 409 `decisions_open` while a decision is\n\nPermission: `imports.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "imports.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "version": {
                    "type": "integer",
                    "minimum": 1
                  },
                  "confirm": {
                    "type": "object",
                    "properties": {
                      "tokens": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 1000000000
                      }
                    },
                    "required": [
                      "tokens"
                    ]
                  }
                },
                "required": [
                  "version"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/migrations/{id}/redirects": {
      "post": {
        "operationId": "postApiMigrationsIdRedirects",
        "tags": [
          "Migrations"
        ],
        "summary": "Creating redirects changes the live site's routing: redirects.manage, as under Redirects.",
        "description": "Creating redirects changes the live site's routing: redirects.manage, as under Redirects.\n\nContract: POST /api/migrations/:id/redirects { paths?: string[] } (redirects.manage) → { created; collapsed; check }: creates the proposed\n\nPermission: `imports.manage`, `redirects.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "imports.manage",
          "redirects.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "paths": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 2000
                    },
                    "maxItems": 5000
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/migrations/{id}/redirects/check": {
      "post": {
        "operationId": "postApiMigrationsIdRedirectsCheck",
        "tags": [
          "Migrations"
        ],
        "summary": "POST /api/migrations/:id/redirects/check → MigrationRedirectCheck: every URL the source had (crawl, sitemap an",
        "description": "Contract: POST /api/migrations/:id/redirects/check → MigrationRedirectCheck: every URL the source had (crawl, sitemap and links found, the\n\nPermission: `imports.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "imports.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "get": {
        "operationId": "getApiMigrationsIdRedirectsCheck",
        "tags": [
          "Migrations"
        ],
        "summary": "GET  /api/migrations/:id/redirects/check?status=&page=&limit= → MigrationRedirectCheck (the last check, filter",
        "description": "Contract: GET  /api/migrations/:id/redirects/check?status=&page=&limit= → MigrationRedirectCheck (the last check, filtered).\n\nPermission: `imports.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "x-enum": "URL_STATUSES as [string, ...string[]]"
            }
          }
        ],
        "x-permission": [
          "imports.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/migrations/{id}/rerun": {
      "post": {
        "operationId": "postApiMigrationsIdRerun",
        "tags": [
          "Migrations"
        ],
        "summary": "POST /api/migrations/:id/rerun MigrationRerunRequest → { migration: Migration; items: number }: marks the matc",
        "description": "Contract: POST /api/migrations/:id/rerun MigrationRerunRequest → { migration: Migration; items: number }: marks the matching items pending and runs\n\nPermission: `imports.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "imports.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "stage": {
                    "type": "string",
                    "x-enum": "['analyze', ...MIGRATION_RUN_STAGES] as [string, ...string[]]"
                  },
                  "typeKey": {
                    "type": "string",
                    "x-pattern": "CONTENT_TYPE_KEY_RE"
                  },
                  "section": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  },
                  "paths": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 2000
                    },
                    "maxItems": 1000
                  },
                  "itemIds": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 100
                    },
                    "maxItems": 5000
                  },
                  "restart": {
                    "type": "boolean"
                  },
                  "force": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/migrations/{id}/review": {
      "get": {
        "operationId": "getApiMigrationsIdReview",
        "tags": [
          "Migrations"
        ],
        "summary": "GET  /api/migrations/:id/review?type=&section=&below=&issue=&status=&q=&page=&limit= → MigrationReviewList: th",
        "description": "Contract: GET  /api/migrations/:id/review?type=&section=&below=&issue=&status=&q=&page=&limit= → MigrationReviewList: the migrated pages with their\n\nPermission: `imports.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "type",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "x-pattern": "CONTENT_TYPE_KEY_RE"
            }
          },
          {
            "name": "section",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 500
            }
          },
          {
            "name": "below",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "x-coerce": true,
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "issue",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[a-z_]{1,60}$"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "pending",
                "reviewed",
                "skipped",
                "failed",
                "not_checked"
              ]
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          }
        ],
        "x-permission": [
          "imports.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/migrations/{id}/review/accept-alt": {
      "post": {
        "operationId": "postApiMigrationsIdReviewAcceptAlt",
        "tags": [
          "Migrations"
        ],
        "summary": "POST /api/migrations/:id/review/accept-alt → { accepted }: accepts every AI-written alt text of the migration.",
        "description": "Contract: POST /api/migrations/:id/review/accept-alt → { accepted }: accepts every AI-written alt text of the migration.\n\nPermission: `imports.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "imports.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/migrations/{id}/review/{itemId}": {
      "get": {
        "operationId": "getApiMigrationsIdReviewItemId",
        "tags": [
          "Migrations"
        ],
        "summary": "GET  /api/migrations/:id/review/:itemId → MigrationComparison: Compare (the original and the new page: text, s",
        "description": "Contract: GET  /api/migrations/:id/review/:itemId → MigrationComparison: Compare (the original and the new page: text, structure, chrome, the\n\nPermission: `imports.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "itemId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "imports.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "operationId": "putApiMigrationsIdReviewItemId",
        "tags": [
          "Migrations"
        ],
        "summary": "PUT  /api/migrations/:id/review/:itemId { status?, alt? } → MigrationReviewPage: Mark as reviewed, Skip this p",
        "description": "Contract: PUT  /api/migrations/:id/review/:itemId { status?, alt? } → MigrationReviewPage: Mark as reviewed, Skip this page (its draft leaves the\n\nPermission: `imports.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "itemId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "imports.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "pending",
                      "reviewed",
                      "skipped"
                    ]
                  },
                  "alt": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "mediaId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 100
                        },
                        "alt": {
                          "type": "string",
                          "maxLength": 300
                        }
                      },
                      "required": [
                        "mediaId"
                      ]
                    },
                    "maxItems": 200
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/migrations/{id}/review/{itemId}/ai-fix": {
      "post": {
        "operationId": "postApiMigrationsIdReviewItemIdAiFix",
        "tags": [
          "Migrations"
        ],
        "summary": "POST /api/migrations/:id/review/:itemId/ai-fix → MigrationFixProposal: Ask AI to fix (the person's own request",
        "description": "Contract: POST /api/migrations/:id/review/:itemId/ai-fix → MigrationFixProposal: Ask AI to fix (the person's own request, counted as `fixes`).\n\nPermission: `imports.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "itemId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "imports.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/migrations/{id}/review/{itemId}/ai-fix/apply": {
      "post": {
        "operationId": "postApiMigrationsIdReviewItemIdAiFixApply",
        "tags": [
          "Migrations"
        ],
        "summary": "A page fix writes a draft revision of the page: content.edit as well.",
        "description": "A page fix writes a draft revision of the page: content.edit as well.\n\nContract: POST /api/migrations/:id/review/:itemId/ai-fix/apply { proposalId } → MigrationReviewPage: a page fix becomes a new draft revision\n\nPermission: `imports.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "itemId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "imports.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "proposalId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  }
                },
                "required": [
                  "proposalId"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/migrations/{id}/review/{itemId}/fix": {
      "post": {
        "operationId": "postApiMigrationsIdReviewItemIdFix",
        "tags": [
          "Migrations"
        ],
        "summary": "POST /api/migrations/{id}/review/{itemId}/fix",
        "description": "Permission: `imports.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "itemId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "imports.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "layout": {
                    "type": "object",
                    "properties": {
                      "content": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 100
                            },
                            "props": {
                              "type": "object",
                              "additionalProperties": {}
                            }
                          },
                          "required": [
                            "type",
                            "props"
                          ]
                        },
                        "maxItems": 500
                      },
                      "root": {
                        "type": "object",
                        "additionalProperties": {}
                      },
                      "zones": {
                        "type": "object",
                        "additionalProperties": {}
                      }
                    },
                    "required": [
                      "content"
                    ]
                  },
                  "note": {
                    "type": "string",
                    "maxLength": 300,
                    "default": ""
                  }
                },
                "required": [
                  "layout"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/migrations/{id}/review/{itemId}/fix-type": {
      "post": {
        "operationId": "postApiMigrationsIdReviewItemIdFixType",
        "tags": [
          "Migrations"
        ],
        "summary": "POST /api/migrations/:id/review/:itemId/fix-type { version, change } → { migration, plan, items }: Fix every p",
        "description": "Contract: POST /api/migrations/:id/review/:itemId/fix-type { version, change } → { migration, plan, items }: Fix every page like this: `change`\n\nPermission: `imports.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "itemId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "imports.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "version": {
                    "type": "integer",
                    "minimum": 1
                  },
                  "change": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      "action": {
                        "type": "string",
                        "enum": [
                          "new",
                          "existing",
                          "skip"
                        ]
                      },
                      "targetTypeKey": {
                        "type": "string",
                        "x-pattern": "CONTENT_TYPE_KEY_RE"
                      },
                      "label": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      "proposal": {
                        "type": "object",
                        "properties": {
                          "key": {
                            "type": "string",
                            "x-pattern": "CONTENT_TYPE_KEY_RE"
                          },
                          "name": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 200
                          },
                          "description": {
                            "type": "string",
                            "maxLength": 2000,
                            "default": ""
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 2000,
                            "default": ""
                          },
                          "fields": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "key": {
                                  "type": "string",
                                  "x-pattern": "FIELD_KEY_RE"
                                },
                                "label": {
                                  "type": "string",
                                  "maxLength": 200,
                                  "default": ""
                                },
                                "type": {
                                  "type": "string",
                                  "x-enum": "IMPORT_FIELD_TYPES as unknown as [string, ...string[]]"
                                },
                                "required": {
                                  "type": "boolean",
                                  "default": false
                                },
                                "source": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 200
                                },
                                "vocabulary": {
                                  "type": "string",
                                  "x-pattern": "CONTENT_TYPE_KEY_RE"
                                },
                                "multiple": {
                                  "type": "boolean"
                                },
                                "options": {
                                  "type": "array",
                                  "items": {
                                    "type": "string",
                                    "maxLength": 200
                                  },
                                  "maxItems": 200
                                },
                                "placement": {
                                  "type": "string",
                                  "enum": [
                                    "page",
                                    "inline"
                                  ]
                                }
                              },
                              "required": [
                                "key",
                                "type",
                                "source"
                              ]
                            },
                            "minItems": 1,
                            "maxItems": 60
                          },
                          "pathPattern": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 200
                          },
                          "sampleUrls": {
                            "type": "array",
                            "items": {
                              "type": "string",
                              "maxLength": 2000
                            },
                            "maxItems": 10,
                            "default": []
                          },
                          "existingTypeKey": {
                            "type": "string",
                            "x-pattern": "CONTENT_TYPE_KEY_RE"
                          },
                          "sourceType": {
                            "type": "string",
                            "maxLength": 200
                          }
                        },
                        "required": [
                          "key",
                          "name",
                          "fields",
                          "pathPattern"
                        ]
                      }
                    },
                    "required": [
                      "id"
                    ]
                  }
                },
                "required": [
                  "version",
                  "change"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/migrations/{id}/rollback": {
      "post": {
        "operationId": "postApiMigrationsIdRollback",
        "tags": [
          "Migrations"
        ],
        "summary": "POST /api/migrations/:id/rollback (users.manage; a signed-in session only) → MigrationCutover: within the wind",
        "description": "Contract: POST /api/migrations/:id/rollback (users.manage; a signed-in session only) → MigrationCutover: within the window, puts back what Go\n\nPermission: `imports.manage`, `users.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "imports.manage",
          "users.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/migrations/{id}/screenshots/{file}": {
      "get": {
        "operationId": "getApiMigrationsIdScreenshotsFile",
        "tags": [
          "Migrations"
        ],
        "summary": "GET  /api/migrations/:id/screenshots/:file → image/png: the renderer's screenshots and difference images.",
        "description": "Contract: GET  /api/migrations/:id/screenshots/:file → image/png: the renderer's screenshots and difference images.\n\nPermission: `imports.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "file",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "imports.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/migrations/{id}/sync": {
      "post": {
        "operationId": "postApiMigrationsIdSync",
        "tags": [
          "Migrations"
        ],
        "summary": "POST /api/migrations/:id/sync → Migration (status syncing): Sync now",
        "description": "Contract: POST /api/migrations/:id/sync → Migration (status syncing): Sync now. Reads the source again (the API with the connection, then the\n\nPermission: `imports.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "imports.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/migrations/{id}/syncs": {
      "get": {
        "operationId": "getApiMigrationsIdSyncs",
        "tags": [
          "Migrations"
        ],
        "summary": "GET  /api/migrations/:id/syncs → { items: MigrationSync[] } (newest first).",
        "description": "Contract: GET  /api/migrations/:id/syncs → { items: MigrationSync[] } (newest first).\n\nPermission: `imports.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "imports.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/migrations/{id}/syncs/{syncId}/removals": {
      "post": {
        "operationId": "postApiMigrationsIdSyncsSyncIdRemovals",
        "tags": [
          "Migrations"
        ],
        "summary": "POST /api/migrations/:id/syncs/:syncId/removals { sourceIds?: string[]; all?: boolean } → MigrationSync: remov",
        "description": "Contract: POST /api/migrations/:id/syncs/:syncId/removals { sourceIds?: string[]; all?: boolean } → MigrationSync: removes the pages the\n\nPermission: `imports.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "syncId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "imports.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "sourceIds": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 500
                    },
                    "maxItems": 5000
                  },
                  "all": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/migrations/{id}/verify": {
      "post": {
        "operationId": "postApiMigrationsIdVerify",
        "tags": [
          "Migrations"
        ],
        "summary": "POST /api/migrations/:id/verify → Migration: checks the domain verification (the token at /.well-known/spillwa",
        "description": "Contract: POST /api/migrations/:id/verify → Migration: checks the domain verification (the token at /.well-known/spillway-verify.txt, a\n\nPermission: `imports.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "imports.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/module/{folder}/{path}": {
      "get": {
        "operationId": "getApiModuleFolderPath",
        "tags": [
          "Modules"
        ],
        "summary": "Module API routes (`api.registerRoute`, docs/modules.md \"API routes\"): /api/module/<folder>/<path>, for the ro",
        "description": "Module API routes (`api.registerRoute`, docs/modules.md \"API routes\"): /api/module/<folder>/<path>, for the routes of a\nloaded module. A route with a permission is open to people holding module.<name>.<key> (on the instance when the route says\n`instance`); every route is open to module managers. JSON in and out; the handler's 4xx errors pass through, anything else is\nlogged on the module and answers 500.\n\nRequires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "folder",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "path",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "operationId": "postApiModuleFolderPath",
        "tags": [
          "Modules"
        ],
        "summary": "Module API routes (`api.registerRoute`, docs/modules.md \"API routes\"): /api/module/<folder>/<path>, for the ro",
        "description": "Module API routes (`api.registerRoute`, docs/modules.md \"API routes\"): /api/module/<folder>/<path>, for the routes of a\nloaded module. A route with a permission is open to people holding module.<name>.<key> (on the instance when the route says\n`instance`); every route is open to module managers. JSON in and out; the handler's 4xx errors pass through, anything else is\nlogged on the module and answers 500.\n\nRequires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "folder",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "path",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "operationId": "putApiModuleFolderPath",
        "tags": [
          "Modules"
        ],
        "summary": "Module API routes (`api.registerRoute`, docs/modules.md \"API routes\"): /api/module/<folder>/<path>, for the ro",
        "description": "Module API routes (`api.registerRoute`, docs/modules.md \"API routes\"): /api/module/<folder>/<path>, for the routes of a\nloaded module. A route with a permission is open to people holding module.<name>.<key> (on the instance when the route says\n`instance`); every route is open to module managers. JSON in and out; the handler's 4xx errors pass through, anything else is\nlogged on the module and answers 500.\n\nRequires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "folder",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "path",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "operationId": "deleteApiModuleFolderPath",
        "tags": [
          "Modules"
        ],
        "summary": "Module API routes (`api.registerRoute`, docs/modules.md \"API routes\"): /api/module/<folder>/<path>, for the ro",
        "description": "Module API routes (`api.registerRoute`, docs/modules.md \"API routes\"): /api/module/<folder>/<path>, for the routes of a\nloaded module. A route with a permission is open to people holding module.<name>.<key> (on the instance when the route says\n`instance`); every route is open to module managers. JSON in and out; the handler's 4xx errors pass through, anything else is\nlogged on the module and answers 500.\n\nRequires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "folder",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "path",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/modules": {
      "get": {
        "operationId": "getApiModules",
        "tags": [
          "Modules"
        ],
        "summary": "GET /api/modules → InstalledModule[]",
        "description": "Contract: GET /api/modules → InstalledModule[]\n\nPermission: `modules.manage`.",
        "x-permission": [
          "modules.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/modules/admin-pages": {
      "get": {
        "operationId": "getApiModulesAdminPages",
        "tags": [
          "Modules"
        ],
        "summary": "The module admin pages this person may open: every page for module managers; a page registered with a permissi",
        "description": "The module admin pages this person may open: every page for module managers; a page registered with a permission for people\nholding module.<name>.<key> (docs/modules.md, \"Permissions\").\n\nContract: A trusted module's admin page (capability \"admin\"), as GET /api/modules/admin-pages lists it: every page for people with\n\nRequires a signed-in user (cookie session or bearer token).",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/modules/contributions": {
      "get": {
        "operationId": "getApiModulesContributions",
        "tags": [
          "Modules"
        ],
        "summary": "What loaded modules contribute, for the admin and other tooling.",
        "description": "What loaded modules contribute, for the admin and other tooling.\n\nPermission: `modules.manage`.",
        "x-permission": [
          "modules.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/modules/install": {
      "post": {
        "operationId": "postApiModulesInstall",
        "tags": [
          "Modules"
        ],
        "summary": "Trust model (docs/modules.md): a trusted-tier archive is server code",
        "description": "Trust model (docs/modules.md): a trusted-tier archive is server code. Installing one over HTTP needs\nSPILLWAY_TRUSTED_MODULE_INSTALL=1 in the environment *and* an admin (users.manage); otherwise 403\ntrusted_install_disabled. Every trusted install is written to the audit log as module.install_trusted.\n\nContract: POST /api/modules/install ({ source: 'registry', name, version? } | multipart upload of a .tgz under field \"file\") → InstalledModule (201)\n\nPermission: `modules.manage`.",
        "x-permission": [
          "modules.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/modules/registries": {
      "get": {
        "operationId": "getApiModulesRegistries",
        "tags": [
          "Modules"
        ],
        "summary": "GET /api/modules/registries → RegistrySources (modules.manage): the registry sources this instance reads, in o",
        "description": "Contract: GET /api/modules/registries → RegistrySources (modules.manage): the registry sources this instance reads, in order.\n\nPermission: `modules.manage`.",
        "x-permission": [
          "modules.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/modules/registries/check": {
      "post": {
        "operationId": "postApiModulesRegistriesCheck",
        "tags": [
          "Modules"
        ],
        "summary": "POST /api/modules/registries/check ({ url, publicKey }) → RegistrySourceCheck (users.manage at instance scope)",
        "description": "Contract: POST /api/modules/registries/check ({ url, publicKey }) → RegistrySourceCheck (users.manage at instance scope): reads the index\n\nPublic, or checks access itself (see the description).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2000
                  },
                  "publicKey": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 4000
                  }
                },
                "required": [
                  "url",
                  "publicKey"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/modules/registries/policy": {
      "put": {
        "operationId": "putApiModulesRegistriesPolicy",
        "tags": [
          "Modules"
        ],
        "summary": "PUT /api/modules/registries/policy (RegistryPolicyInput) → RegistrySources (users.manage at instance scope, au",
        "description": "Contract: PUT /api/modules/registries/policy (RegistryPolicyInput) → RegistrySources (users.manage at instance scope, audited as\n\nPublic, or checks access itself (see the description).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "lockdown": {
                    "type": [
                      "array",
                      "null"
                    ],
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 32
                    },
                    "minItems": 1,
                    "maxItems": 50
                  },
                  "primarySupplies": {
                    "type": [
                      "array",
                      "null"
                    ],
                    "items": {
                      "type": "string",
                      "x-enum": "REGISTRY_SUPPLIES as unknown as [RegistrySupply, ...RegistrySupply[]]"
                    },
                    "minItems": 1
                  },
                  "order": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 32
                    }
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/modules/registries/sources": {
      "post": {
        "operationId": "postApiModulesRegistriesSources",
        "tags": [
          "Modules"
        ],
        "summary": "POST /api/modules/registries/sources (RegistrySourceInput) → 201 RegistrySourceStatus; PUT /api/modules/regist",
        "description": "Contract: POST /api/modules/registries/sources (RegistrySourceInput) → 201 RegistrySourceStatus; PUT /api/modules/registries/sources/:id\n\nPublic, or checks access itself (see the description).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 32
                  },
                  "label": {
                    "type": "string",
                    "maxLength": 80,
                    "default": ""
                  },
                  "url": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2000
                  },
                  "publicKey": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 4000
                  },
                  "scopes": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "maxLength": 65
                    },
                    "maxItems": 20
                  },
                  "supplies": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "x-enum": "REGISTRY_SUPPLIES as unknown as [RegistrySupply, ...RegistrySupply[]]"
                    },
                    "minItems": 1
                  },
                  "fingerprint": {
                    "type": "string",
                    "maxLength": 100
                  }
                },
                "required": [
                  "id",
                  "url",
                  "publicKey"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/modules/registries/sources/{id}": {
      "put": {
        "operationId": "putApiModulesRegistriesSourcesId",
        "tags": [
          "Modules"
        ],
        "summary": "POST /api/modules/registries/sources (RegistrySourceInput) → 201 RegistrySourceStatus; PUT /api/modules/regist",
        "description": "Contract: POST /api/modules/registries/sources (RegistrySourceInput) → 201 RegistrySourceStatus; PUT /api/modules/registries/sources/:id\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 32
                  },
                  "label": {
                    "type": "string",
                    "maxLength": 80,
                    "default": ""
                  },
                  "url": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2000
                  },
                  "publicKey": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 4000
                  },
                  "scopes": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "maxLength": 65
                    },
                    "maxItems": 20
                  },
                  "supplies": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "x-enum": "REGISTRY_SUPPLIES as unknown as [RegistrySupply, ...RegistrySupply[]]"
                    },
                    "minItems": 1
                  },
                  "fingerprint": {
                    "type": "string",
                    "maxLength": 100
                  }
                },
                "x-omit": true
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "operationId": "deleteApiModulesRegistriesSourcesId",
        "tags": [
          "Modules"
        ],
        "summary": "(Partial<RegistrySourceInput>, `id` unchanged) → RegistrySourceStatus; DELETE /api/modules/registries/sources/",
        "description": "Contract: (Partial<RegistrySourceInput>, `id` unchanged) → RegistrySourceStatus; DELETE /api/modules/registries/sources/:id → 204.\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/modules/registry": {
      "get": {
        "operationId": "getApiModulesRegistry",
        "tags": [
          "Modules"
        ],
        "summary": "GET /api/modules/registry?q= → { items: RegistryEntry[] } */",
        "description": "Contract: GET /api/modules/registry?q= → { items: RegistryEntry[] } */\n\nPermission: `modules.manage`.",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200,
              "default": ""
            }
          }
        ],
        "x-permission": [
          "modules.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/modules/status": {
      "get": {
        "operationId": "getApiModulesStatus",
        "tags": [
          "Modules"
        ],
        "summary": "GET /api/modules/status */",
        "description": "Contract: GET /api/modules/status */\n\nPermission: `modules.manage`.",
        "x-permission": [
          "modules.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/modules/{id}": {
      "delete": {
        "operationId": "deleteApiModulesId",
        "tags": [
          "Modules"
        ],
        "summary": "DELETE /api/modules/:id → 204 (removes the files too)",
        "description": "Contract: DELETE /api/modules/:id → 204 (removes the files too)\n\nPermission: `modules.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "modules.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/modules/{id}/disable": {
      "post": {
        "operationId": "postApiModulesIdDisable",
        "tags": [
          "Modules"
        ],
        "summary": "POST /api/modules/:id/enable | POST /api/modules/:id/disable → InstalledModule",
        "description": "Contract: POST /api/modules/:id/enable | POST /api/modules/:id/disable → InstalledModule\n\nPermission: `modules.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "modules.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/modules/{id}/enable": {
      "post": {
        "operationId": "postApiModulesIdEnable",
        "tags": [
          "Modules"
        ],
        "summary": "POST /api/modules/:id/enable | POST /api/modules/:id/disable → InstalledModule",
        "description": "Contract: POST /api/modules/:id/enable | POST /api/modules/:id/disable → InstalledModule\n\nPermission: `modules.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "modules.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/modules/{id}/logs": {
      "get": {
        "operationId": "getApiModulesIdLogs",
        "tags": [
          "Modules"
        ],
        "summary": "GET /api/modules/:id/logs → { lines: string[] } (last 200 log lines, in memory)",
        "description": "Contract: GET /api/modules/:id/logs → { lines: string[] } (last 200 log lines, in memory)\n\nPermission: `modules.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "modules.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/modules/{id}/settings": {
      "put": {
        "operationId": "putApiModulesIdSettings",
        "tags": [
          "Modules"
        ],
        "summary": "PUT /api/modules/:id/settings (Record<string, unknown>) → InstalledModule",
        "description": "Contract: PUT /api/modules/:id/settings (Record<string, unknown>) → InstalledModule\n\nPermission: `modules.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "modules.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/notifications/outbox": {
      "get": {
        "operationId": "getApiNotificationsOutbox",
        "tags": [
          "Editorial"
        ],
        "summary": "GET /api/notifications/outbox?page= (site.settings) → Paginated<OutboxItem>, the last OUTBOX_KEEP deliveries w",
        "description": "Contract: GET /api/notifications/outbox?page= (site.settings) → Paginated<OutboxItem>, the last OUTBOX_KEEP deliveries with status.\n\nPermission: `site.settings`.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "x-coerce": true,
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          }
        ],
        "x-permission": [
          "site.settings"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/notifications/rules": {
      "get": {
        "operationId": "getApiNotificationsRules",
        "tags": [
          "Editorial"
        ],
        "summary": "GET /api/notifications/rules",
        "description": "Permission: `site.settings`.",
        "x-permission": [
          "site.settings"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "operationId": "postApiNotificationsRules",
        "tags": [
          "Editorial"
        ],
        "summary": "POST /api/notifications/rules",
        "description": "Permission: `site.settings`.",
        "x-permission": [
          "site.settings"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "event": {
                    "type": "string",
                    "x-enum": "NOTIFICATION_EVENTS as [string, ...string[]]"
                  },
                  "channel": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "const": "email"
                          },
                          "to": {
                            "type": "string",
                            "enum": [
                              "author",
                              "reviewers",
                              "custom"
                            ]
                          },
                          "emails": {
                            "type": "array",
                            "items": {
                              "type": "string",
                              "format": "email",
                              "maxLength": 320
                            },
                            "maxItems": 50
                          }
                        },
                        "required": [
                          "kind",
                          "to"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "const": "webhook"
                          },
                          "url": {
                            "type": "string",
                            "format": "uri",
                            "maxLength": 2000
                          },
                          "secret": {
                            "type": "string",
                            "maxLength": 500
                          }
                        },
                        "required": [
                          "kind",
                          "url"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "const": "slack"
                          },
                          "webhookUrl": {
                            "type": "string",
                            "format": "uri",
                            "maxLength": 2000
                          }
                        },
                        "required": [
                          "kind",
                          "webhookUrl"
                        ]
                      }
                    ]
                  },
                  "enabled": {
                    "type": "boolean",
                    "default": true
                  },
                  "filter": {
                    "type": "object",
                    "properties": {
                      "types": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "maxLength": 100
                        },
                        "maxItems": 100
                      }
                    }
                  }
                },
                "required": [
                  "event",
                  "channel"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/notifications/rules/{id}": {
      "put": {
        "operationId": "putApiNotificationsRulesId",
        "tags": [
          "Editorial"
        ],
        "summary": "PUT /api/notifications/rules/{id}",
        "description": "Permission: `site.settings`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "site.settings"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "event": {
                    "type": "string",
                    "x-enum": "NOTIFICATION_EVENTS as [string, ...string[]]"
                  },
                  "channel": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "const": "email"
                          },
                          "to": {
                            "type": "string",
                            "enum": [
                              "author",
                              "reviewers",
                              "custom"
                            ]
                          },
                          "emails": {
                            "type": "array",
                            "items": {
                              "type": "string",
                              "format": "email",
                              "maxLength": 320
                            },
                            "maxItems": 50
                          }
                        },
                        "required": [
                          "kind",
                          "to"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "const": "webhook"
                          },
                          "url": {
                            "type": "string",
                            "format": "uri",
                            "maxLength": 2000
                          },
                          "secret": {
                            "type": "string",
                            "maxLength": 500
                          }
                        },
                        "required": [
                          "kind",
                          "url"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "const": "slack"
                          },
                          "webhookUrl": {
                            "type": "string",
                            "format": "uri",
                            "maxLength": 2000
                          }
                        },
                        "required": [
                          "kind",
                          "webhookUrl"
                        ]
                      }
                    ]
                  },
                  "enabled": {
                    "type": "boolean",
                    "default": true
                  },
                  "filter": {
                    "type": "object",
                    "properties": {
                      "types": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "maxLength": 100
                        },
                        "maxItems": 100
                      }
                    }
                  }
                },
                "required": [
                  "event",
                  "channel"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "operationId": "deleteApiNotificationsRulesId",
        "tags": [
          "Editorial"
        ],
        "summary": "DELETE /api/notifications/rules/{id}",
        "description": "Permission: `site.settings`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "site.settings"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/notifications/rules/{id}/test": {
      "post": {
        "operationId": "postApiNotificationsRulesIdTest",
        "tags": [
          "Editorial"
        ],
        "summary": "GET/POST/PUT/DELETE /api/notifications/rules (site.settings); POST /api/notifications/rules/:id/test sends a s",
        "description": "Contract: GET/POST/PUT/DELETE /api/notifications/rules (site.settings); POST /api/notifications/rules/:id/test sends a sample event through the rule now;\n\nPermission: `site.settings`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "site.settings"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/oauth/grants": {
      "get": {
        "operationId": "getApiOauthGrants",
        "tags": [
          "Oauth"
        ],
        "summary": "Connected apps: GET /api/oauth/grants (own; `?all=true` with users.manage) → OAuthGrant[]; DELETE /api/oauth/g",
        "description": "Contract: Connected apps: GET /api/oauth/grants (own; `?all=true` with users.manage) → OAuthGrant[]; DELETE /api/oauth/grants/:id (own, or\n\nRequires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "all",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/oauth/grants/{id}": {
      "delete": {
        "operationId": "deleteApiOauthGrantsId",
        "tags": [
          "Oauth"
        ],
        "summary": "Connected apps: GET /api/oauth/grants (own; `?all=true` with users.manage) → OAuthGrant[]; DELETE /api/oauth/g",
        "description": "Contract: Connected apps: GET /api/oauth/grants (own; `?all=true` with users.manage) → OAuthGrant[]; DELETE /api/oauth/grants/:id (own, or\n\nRequires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/patterns": {
      "get": {
        "operationId": "getApiPatterns",
        "tags": [
          "Patterns"
        ],
        "summary": "GET /api/patterns → Pattern[] (signed-in users): Spillway's own, then the site's shared ones and the caller's ",
        "description": "Contract: GET /api/patterns → Pattern[] (signed-in users): Spillway's own, then the site's shared ones and the caller's private ones.\n\nRequires a signed-in user (cookie session or bearer token).",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "operationId": "postApiPatterns",
        "tags": [
          "Patterns"
        ],
        "summary": "POST /api/patterns (PatternInput) → 201 Pattern (content.create)",
        "description": "Contract: POST /api/patterns (PatternInput) → 201 Pattern (content.create). Sharing with the site (`visibility: 'site'`) needs brand.manage.\n\nPermission: `content.create`.",
        "x-permission": [
          "content.create"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "category": {
                    "type": "string",
                    "x-enum": "PATTERN_CATEGORIES as unknown as [string, ...string[]]"
                  },
                  "description": {
                    "type": "string",
                    "maxLength": 500
                  },
                  "blocks": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 120
                        },
                        "props": {
                          "type": "object",
                          "additionalProperties": {}
                        }
                      },
                      "required": [
                        "type",
                        "props"
                      ]
                    },
                    "minItems": 1,
                    "maxItems": 50
                  },
                  "visibility": {
                    "type": "string",
                    "enum": [
                      "site",
                      "private"
                    ]
                  }
                },
                "required": [
                  "label",
                  "category",
                  "blocks"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/patterns/{id}": {
      "put": {
        "operationId": "putApiPatternsId",
        "tags": [
          "Patterns"
        ],
        "summary": "PUT /api/patterns/:id (Partial<PatternInput>), DELETE /api/patterns/:id: the person who saved it, or brand.man",
        "description": "Contract: PUT /api/patterns/:id (Partial<PatternInput>), DELETE /api/patterns/:id: the person who saved it, or brand.manage. Spillway's\n\nRequires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "category": {
                    "type": "string",
                    "x-enum": "PATTERN_CATEGORIES as unknown as [string, ...string[]]"
                  },
                  "description": {
                    "type": "string",
                    "maxLength": 500
                  },
                  "blocks": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 120
                        },
                        "props": {
                          "type": "object",
                          "additionalProperties": {}
                        }
                      },
                      "required": [
                        "type",
                        "props"
                      ]
                    },
                    "minItems": 1,
                    "maxItems": 50
                  },
                  "visibility": {
                    "type": "string",
                    "enum": [
                      "site",
                      "private"
                    ]
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "operationId": "deleteApiPatternsId",
        "tags": [
          "Patterns"
        ],
        "summary": "DELETE /api/patterns/{id}",
        "description": "Requires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/patterns/{id}/hidden": {
      "put": {
        "operationId": "putApiPatternsIdHidden",
        "tags": [
          "Patterns"
        ],
        "summary": "Hide from editors, or offer again: the block set's managers decide what editors get (Structure → Components).",
        "description": "Hide from editors, or offer again: the block set's managers decide what editors get (Structure → Components).\n\nContract: PUT /api/patterns/:id/hidden ({ hidden: boolean }) → Pattern (site.settings): hides a pattern from editors on this site, or offers it\n\nPermission: `site.settings`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "site.settings"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "hidden": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "hidden"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/patterns/{id}/render": {
      "post": {
        "operationId": "postApiPatternsIdRender",
        "tags": [
          "Patterns"
        ],
        "summary": "The pattern drawn in the site's brand for the pattern library's thumbnails and previews (a sandboxed frame, no",
        "description": "The pattern drawn in the site's brand for the pattern library's thumbnails and previews (a sandboxed frame, no scripts).\n\nContract: POST /api/patterns/:id/render ({ brand?: 'published' | 'draft', mode?: 'light' | 'dark' | 'contrast' }) → { html } (content.create or\n\nRequires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "brand": {
                    "type": "string",
                    "enum": [
                      "published",
                      "draft"
                    ],
                    "default": "published"
                  },
                  "mode": {
                    "type": "string",
                    "enum": [
                      "light",
                      "dark",
                      "contrast"
                    ],
                    "default": "light"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/permissions": {
      "get": {
        "operationId": "getApiPermissions",
        "tags": [
          "Roles"
        ],
        "summary": "The catalog, then each content type's, vocabulary's, menu's and form's own permissions (`item` set).",
        "description": "The catalog, then each content type's, vocabulary's, menu's and form's own permissions (`item` set).\n\nContract: GET /api/permissions → PermissionDef[] (any signed-in user): the catalog, then each content type's eight content.<type>.<action> keys (`type` set)\n\nRequires a signed-in user (cookie session or bearer token).",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/placements": {
      "get": {
        "operationId": "getApiPlacements",
        "tags": [
          "Placements"
        ],
        "summary": "GET /api/placements → Placement[]; POST /api/placements (PlacementInput) → 201 Placement; GET/PUT (Partial<Pla",
        "description": "Contract: GET /api/placements → Placement[]; POST /api/placements (PlacementInput) → 201 Placement; GET/PUT (Partial<PlacementInput>)/DELETE\n\nPermission: `placements.manage`.",
        "x-permission": [
          "placements.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "operationId": "postApiPlacements",
        "tags": [
          "Placements"
        ],
        "summary": "GET /api/placements → Placement[]; POST /api/placements (PlacementInput) → 201 Placement; GET/PUT (Partial<Pla",
        "description": "Contract: GET /api/placements → Placement[]; POST /api/placements (PlacementInput) → 201 Placement; GET/PUT (Partial<PlacementInput>)/DELETE\n\nPermission: `placements.manage`.",
        "x-permission": [
          "placements.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string",
                    "x-pattern": "PLACEMENT_KEY_RE"
                  },
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "region": {
                    "type": "string",
                    "x-enum": "PLACEMENT_REGIONS"
                  },
                  "block": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "const": "Shared"
                          },
                          "props": {
                            "type": "object",
                            "properties": {
                              "sharedKey": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 100
                              }
                            },
                            "required": [
                              "sharedKey"
                            ]
                          }
                        },
                        "required": [
                          "type",
                          "props"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "const": "Menu"
                          },
                          "props": {
                            "type": "object",
                            "properties": {
                              "source": {
                                "type": "string",
                                "enum": [
                                  "menu",
                                  "section"
                                ],
                                "default": "menu"
                              },
                              "menuKey": {
                                "type": "string",
                                "maxLength": 100,
                                "default": ""
                              },
                              "show": {
                                "type": "string",
                                "enum": [
                                  "all",
                                  "branch"
                                ],
                                "default": "all"
                              },
                              "depth": {
                                "oneOf": [
                                  {
                                    "const": 1
                                  },
                                  {
                                    "const": 2
                                  }
                                ],
                                "default": 2
                              },
                              "heading": {
                                "type": "string",
                                "maxLength": 200,
                                "default": ""
                              },
                              "layout": {
                                "type": "string",
                                "enum": [
                                  "vertical",
                                  "horizontal"
                                ],
                                "default": "vertical"
                              }
                            }
                          }
                        },
                        "required": [
                          "type",
                          "props"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "const": "Breadcrumbs"
                          },
                          "props": {
                            "type": "object",
                            "properties": {
                              "source": {
                                "type": "string",
                                "enum": [
                                  "path",
                                  "menu"
                                ],
                                "default": "path"
                              },
                              "showCurrent": {
                                "type": "boolean",
                                "default": true
                              }
                            },
                            "additionalProperties": false
                          }
                        },
                        "required": [
                          "type",
                          "props"
                        ]
                      }
                    ]
                  },
                  "rules": {
                    "type": "object",
                    "properties": {
                      "types": {
                        "x-zod": "list(50, z.string().max(64))"
                      },
                      "paths": {
                        "x-zod": "list(50, z.string().max(300).refine((s) => s.trim() === '' || s.trim().startsWith('/') || s.trim() === '*', 'a path pattern starts with /, such as /blog/*'))"
                      },
                      "excludePaths": {
                        "x-zod": "list(50, z.string().max(300).refine((s) => s.trim() === '' || s.trim().startsWith('/') || s.trim() === '*', 'a path pattern starts with /, such as /blog/*'))"
                      },
                      "sections": {
                        "x-zod": "list(50, z.string().max(64))"
                      },
                      "locales": {
                        "x-zod": "list(50, z.string().max(35))"
                      }
                    },
                    "default": {}
                  },
                  "weight": {
                    "type": "integer",
                    "minimum": -1000,
                    "maximum": 1000,
                    "default": 0
                  },
                  "enabled": {
                    "type": "boolean",
                    "default": true
                  }
                },
                "required": [
                  "label",
                  "region",
                  "block"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/placements/{id}": {
      "get": {
        "operationId": "getApiPlacementsId",
        "tags": [
          "Placements"
        ],
        "summary": "GET /api/placements/{id}",
        "description": "Permission: `placements.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "placements.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "operationId": "putApiPlacementsId",
        "tags": [
          "Placements"
        ],
        "summary": "PUT /api/placements/{id}",
        "description": "Permission: `placements.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "placements.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string",
                    "x-pattern": "PLACEMENT_KEY_RE"
                  },
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "region": {
                    "type": "string",
                    "x-enum": "PLACEMENT_REGIONS"
                  },
                  "block": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "const": "Shared"
                          },
                          "props": {
                            "type": "object",
                            "properties": {
                              "sharedKey": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 100
                              }
                            },
                            "required": [
                              "sharedKey"
                            ]
                          }
                        },
                        "required": [
                          "type",
                          "props"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "const": "Menu"
                          },
                          "props": {
                            "type": "object",
                            "properties": {
                              "source": {
                                "type": "string",
                                "enum": [
                                  "menu",
                                  "section"
                                ],
                                "default": "menu"
                              },
                              "menuKey": {
                                "type": "string",
                                "maxLength": 100,
                                "default": ""
                              },
                              "show": {
                                "type": "string",
                                "enum": [
                                  "all",
                                  "branch"
                                ],
                                "default": "all"
                              },
                              "depth": {
                                "oneOf": [
                                  {
                                    "const": 1
                                  },
                                  {
                                    "const": 2
                                  }
                                ],
                                "default": 2
                              },
                              "heading": {
                                "type": "string",
                                "maxLength": 200,
                                "default": ""
                              },
                              "layout": {
                                "type": "string",
                                "enum": [
                                  "vertical",
                                  "horizontal"
                                ],
                                "default": "vertical"
                              }
                            }
                          }
                        },
                        "required": [
                          "type",
                          "props"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "const": "Breadcrumbs"
                          },
                          "props": {
                            "type": "object",
                            "properties": {
                              "source": {
                                "type": "string",
                                "enum": [
                                  "path",
                                  "menu"
                                ],
                                "default": "path"
                              },
                              "showCurrent": {
                                "type": "boolean",
                                "default": true
                              }
                            },
                            "additionalProperties": false
                          }
                        },
                        "required": [
                          "type",
                          "props"
                        ]
                      }
                    ]
                  },
                  "rules": {
                    "type": "object",
                    "properties": {
                      "types": {
                        "x-zod": "list(50, z.string().max(64))"
                      },
                      "paths": {
                        "x-zod": "list(50, z.string().max(300).refine((s) => s.trim() === '' || s.trim().startsWith('/') || s.trim() === '*', 'a path pattern starts with /, such as /blog/*'))"
                      },
                      "excludePaths": {
                        "x-zod": "list(50, z.string().max(300).refine((s) => s.trim() === '' || s.trim().startsWith('/') || s.trim() === '*', 'a path pattern starts with /, such as /blog/*'))"
                      },
                      "sections": {
                        "x-zod": "list(50, z.string().max(64))"
                      },
                      "locales": {
                        "x-zod": "list(50, z.string().max(35))"
                      }
                    },
                    "default": {}
                  },
                  "weight": {
                    "type": "integer",
                    "minimum": -1000,
                    "maximum": 1000,
                    "default": 0
                  },
                  "enabled": {
                    "type": "boolean",
                    "default": true
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "operationId": "deleteApiPlacementsId",
        "tags": [
          "Placements"
        ],
        "summary": "DELETE /api/placements/{id}",
        "description": "Permission: `placements.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "placements.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/public/brand": {
      "get": {
        "operationId": "getApiPublicBrand",
        "tags": [
          "Public render"
        ],
        "summary": "The published brand as tokens, variables, fonts and logos (theme/public-brand.ts)",
        "description": "The published brand as tokens, variables, fonts and logos (theme/public-brand.ts). Cached per site under the theme tag, which\n\nevery brand publish purges, and the site tag (identity media and settings writes). Drafts are never shown, so no preview.\n\nContract: GET /api/public/brand → PublicBrand: the published brand for a front end of its own (docs/adapters.md#the-brand): the tokens with\n\nPublic, or checks access itself (see the description).",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/public/collections/{key}/items": {
      "get": {
        "operationId": "getApiPublicCollectionsKeyItems",
        "tags": [
          "Public render"
        ],
        "summary": "The data behind a Collection block with extra filters and a keyword on top of the saved query.",
        "description": "The data behind a Collection block with extra filters and a keyword on top of the saved query.\n\nContract: GET /api/public/collections/:key/items?page=&limit=&locale=&q=&filters=<json CollectionFilter[]> → Paginated<CollectionItem>,\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "x-coerce": true,
              "minimum": 1,
              "maximum": 10000
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "x-coerce": true,
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "locale",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 2,
              "maxLength": 35
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          },
          {
            "name": "filters",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 4000
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/public/entities/{type}/{idOrSlug}": {
      "get": {
        "operationId": "getApiPublicEntitiesTypeIdOrSlug",
        "tags": [
          "Public render"
        ],
        "summary": "One entity by id or slug: the published snapshot for visitors, the branch or latest revision for a preview cre",
        "description": "One entity by id or slug: the published snapshot for visitors, the branch or latest revision for a preview credential.\n\nContract: GET /api/public/entities/:type/:idOrSlug?locale= → Entity (published snapshot; 404 otherwise).\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "type",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "idOrSlug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "locale",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/public/media/{id}": {
      "get": {
        "operationId": "getApiPublicMediaId",
        "tags": [
          "Public render"
        ],
        "summary": "GET /api/public/media/:id → MediaItem with absolute URLs.",
        "description": "Contract: GET /api/public/media/:id → MediaItem with absolute URLs.\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/public/members/{handle}": {
      "get": {
        "operationId": "getApiPublicMembersHandle",
        "tags": [
          "Member profiles"
        ],
        "summary": "GET /api/public/members/:handle → PublicMemberProfile (the same rules; 404 otherwise, 401 `members_only`).",
        "description": "Contract: GET /api/public/members/:handle → PublicMemberProfile (the same rules; 404 otherwise, 401 `members_only`).\n\nRequires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "handle",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/public/menus/{key}": {
      "get": {
        "operationId": "getApiPublicMenusKey",
        "tags": [
          "Public render"
        ],
        "summary": "A menu as links, resolved the way the shell renders it (locale labels, translations, prefixes, unpublished tar",
        "description": "A menu as links, resolved the way the shell renders it (locale labels, translations, prefixes, unpublished targets dropped).\n\nContract: GET /api/public/menus/:key?locale=&path= → PublicMenu, items resolved to links the way the server shell renders them.\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "locale",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 2,
              "maxLength": 35
            }
          },
          {
            "name": "path",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 1000
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/public/paths": {
      "get": {
        "operationId": "getApiPublicPaths",
        "tags": [
          "Public render"
        ],
        "summary": "Every published public path, for static builds",
        "description": "Every published public path, for static builds. The home page is listed as `/` (per locale) as well as under its own path.\n\nContract: GET /api/public/paths?type=&locale= → { items: PublicPath[] }: every published path (for getStaticPaths / generateStaticParams).\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "type",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "x-pattern": "CONTENT_TYPE_KEY_RE"
            }
          },
          {
            "name": "locale",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 2,
              "maxLength": 35
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/public/redirects": {
      "get": {
        "operationId": "getApiPublicRedirects",
        "tags": [
          "Public render"
        ],
        "summary": "The enabled redirects, for a front end that routes on its own",
        "description": "The enabled redirects, for a front end that routes on its own. Tagged `redirects`, which every redirect change purges.\n\nContract: GET /api/public/redirects → PublicRedirectsResponse: the site's enabled redirects ({ from, to, status }), for a front end's own\n\nPublic, or checks access itself (see the description).",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/public/render": {
      "get": {
        "operationId": "getApiPublicRender",
        "tags": [
          "Public render"
        ],
        "summary": "GET /api/public/render",
        "description": "Public, or checks access itself (see the description).",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/public/render/{path}": {
      "get": {
        "operationId": "getApiPublicRenderPath",
        "tags": [
          "Public render"
        ],
        "summary": "GET /api/public/render/{path}",
        "description": "Public, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "path",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/public/site": {
      "get": {
        "operationId": "getApiPublicSite",
        "tags": [
          "Public render"
        ],
        "summary": "The visitor-safe part of the settings: no integrations, privacy or embed configuration.",
        "description": "The visitor-safe part of the settings: no integrations, privacy or embed configuration.\n\nContract: GET /api/public/site → PublicSite (the visitor-safe part of the settings plus the theme as CSS).\n\nPublic, or checks access itself (see the description).",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/redirects": {
      "get": {
        "operationId": "getApiRedirects",
        "tags": [
          "Redirects"
        ],
        "summary": "GET /api/redirects → Redirect[]; POST /api/redirects ({from,to,status?,enabled?}) → Redirect",
        "description": "Contract: GET /api/redirects → Redirect[]; POST /api/redirects ({from,to,status?,enabled?}) → Redirect\n\nPermission: `redirects.manage`.",
        "x-permission": [
          "redirects.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "operationId": "postApiRedirects",
        "tags": [
          "Redirects"
        ],
        "summary": "GET /api/redirects → Redirect[]; POST /api/redirects ({from,to,status?,enabled?}) → Redirect",
        "description": "Contract: GET /api/redirects → Redirect[]; POST /api/redirects ({from,to,status?,enabled?}) → Redirect\n\nPermission: `redirects.manage`.",
        "x-permission": [
          "redirects.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "from": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2000
                  },
                  "to": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2000
                  },
                  "status": {
                    "oneOf": [
                      {
                        "const": 301
                      },
                      {
                        "const": 302
                      }
                    ]
                  },
                  "enabled": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "from",
                  "to"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/redirects/misses": {
      "get": {
        "operationId": "getApiRedirectsMisses",
        "tags": [
          "Redirects"
        ],
        "summary": "Before /redirects/:id so \"misses\" is never read as an id.",
        "description": "Before /redirects/:id so \"misses\" is never read as an id.\n\nContract: GET /api/redirects/misses → { items: { path: string; count: number; lastSeen: string }[] } (top 404 paths, site.settings)\n\nPermission: `redirects.manage`.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "redirects.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "operationId": "deleteApiRedirectsMisses",
        "tags": [
          "Redirects"
        ],
        "summary": "DELETE /api/redirects/misses",
        "description": "Permission: `redirects.manage`.",
        "parameters": [
          {
            "name": "path",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "redirects.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/redirects/{id}": {
      "get": {
        "operationId": "getApiRedirectsId",
        "tags": [
          "Redirects"
        ],
        "summary": "GET /api/redirects/{id}",
        "description": "Permission: `redirects.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "redirects.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "operationId": "putApiRedirectsId",
        "tags": [
          "Redirects"
        ],
        "summary": "PUT /api/redirects/:id; DELETE /api/redirects/:id",
        "description": "Contract: PUT /api/redirects/:id; DELETE /api/redirects/:id. Permission: site.settings.\n\nPermission: `redirects.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "redirects.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "from": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2000
                  },
                  "to": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2000
                  },
                  "status": {
                    "oneOf": [
                      {
                        "const": 301
                      },
                      {
                        "const": 302
                      }
                    ]
                  },
                  "enabled": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "operationId": "deleteApiRedirectsId",
        "tags": [
          "Redirects"
        ],
        "summary": "DELETE /api/redirects/{id}",
        "description": "Permission: `redirects.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "redirects.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/registry/advisories": {
      "post": {
        "operationId": "postApiRegistryAdvisories",
        "tags": [
          "Registry"
        ],
        "summary": "({ note? }); POST /api/registry/advisories (Omit<Advisory, 'id' | 'createdAt'>) → 201 Advisory; DELETE /api/re",
        "description": "Contract: ({ note? }); POST /api/registry/advisories (Omit<Advisory, 'id' | 'createdAt'>) → 201 Advisory; DELETE /api/registry/advisories/:id;\n\nPublic, or checks access itself (see the description).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "package": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "versions": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "severity": {
                    "type": "string",
                    "enum": [
                      "low",
                      "moderate",
                      "high",
                      "critical"
                    ]
                  },
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 300
                  },
                  "url": {
                    "type": "string",
                    "format": "uri",
                    "maxLength": 500
                  }
                },
                "required": [
                  "package",
                  "versions",
                  "severity",
                  "title"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/registry/advisories/{id}": {
      "delete": {
        "operationId": "deleteApiRegistryAdvisoriesId",
        "tags": [
          "Registry"
        ],
        "summary": "({ note? }); POST /api/registry/advisories (Omit<Advisory, 'id' | 'createdAt'>) → 201 Advisory; DELETE /api/re",
        "description": "Contract: ({ note? }); POST /api/registry/advisories (Omit<Advisory, 'id' | 'createdAt'>) → 201 Advisory; DELETE /api/registry/advisories/:id;\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/registry/namespaces": {
      "get": {
        "operationId": "getApiRegistryNamespaces",
        "tags": [
          "Registry"
        ],
        "summary": "GET /api/registry/namespaces?page=&limit= → Paginated<Namespace>.",
        "description": "Contract: GET /api/registry/namespaces?page=&limit= → Paginated<Namespace>.\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "x-coerce": true,
              "minimum": 1,
              "default": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "x-coerce": true,
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/registry/namespaces/mine": {
      "get": {
        "operationId": "getApiRegistryNamespacesMine",
        "tags": [
          "Registry"
        ],
        "summary": "(a Publisher row is otherwise created on first publish, handle derived from the email)",
        "description": "Contract: (a Publisher row is otherwise created on first publish, handle derived from the email). GET /api/registry/namespaces/mine → Namespace[].\n\nRequires a signed-in user (cookie session or bearer token).",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/registry/namespaces/{name}/transfer": {
      "post": {
        "operationId": "postApiRegistryNamespacesNameTransfer",
        "tags": [
          "Registry"
        ],
        "summary": "deprecate and yank their own packages too); POST /api/registry/namespaces/:name/transfer ({ ownerPublisherId, ",
        "description": "Contract: deprecate and yank their own packages too); POST /api/registry/namespaces/:name/transfer ({ ownerPublisherId, maintainers? }); POST /api/registry/publishers/:id/verify\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "ownerPublisherId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "ownerOrgId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "maintainers": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    },
                    "maxItems": 50
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/registry/orgs": {
      "post": {
        "operationId": "postApiRegistryOrgs",
        "tags": [
          "Registry"
        ],
        "summary": "POST /api/registry/orgs ({ handle, displayName, url?, avatarUrl? }) → 201 RegistryOrg (the caller's publisher ",
        "description": "Contract: POST /api/registry/orgs ({ handle, displayName, url?, avatarUrl? }) → 201 RegistryOrg (the caller's publisher becomes the owner; 409 handle_taken);\n\nPermission: `registry.publish`.",
        "x-permission": [
          "registry.publish"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "handle": {
                    "type": "string",
                    "x-pattern": "REGISTRY_HANDLE_RE"
                  },
                  "displayName": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "url": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "uri",
                    "maxLength": 500
                  },
                  "avatarUrl": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "uri",
                    "maxLength": 500
                  }
                },
                "required": [
                  "handle",
                  "displayName"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "get": {
        "operationId": "getApiRegistryOrgs",
        "tags": [
          "Registry"
        ],
        "summary": "Reviewer listing behind the Orgs screen.",
        "description": "Reviewer listing behind the Orgs screen.\n\nContract: Reviewers (users.manage): GET /api/registry/orgs?q=&page=&limit= → Paginated<RegistryOrg>; POST /api/registry/orgs/:id/verify ({ verified }) → RegistryOrg.\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "x-coerce": true,
              "minimum": 1,
              "default": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "x-coerce": true,
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/registry/orgs/mine": {
      "get": {
        "operationId": "getApiRegistryOrgsMine",
        "tags": [
          "Registry"
        ],
        "summary": "GET /api/registry/orgs/mine → RegistryOrgMembership[]; GET /api/registry/orgs/:id → RegistryOrgDetail (members",
        "description": "Contract: GET /api/registry/orgs/mine → RegistryOrgMembership[]; GET /api/registry/orgs/:id → RegistryOrgDetail (members or users.manage);\n\nRequires a signed-in user (cookie session or bearer token).",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/registry/orgs/{id}": {
      "get": {
        "operationId": "getApiRegistryOrgsId",
        "tags": [
          "Registry"
        ],
        "summary": "GET /api/registry/orgs/:id (members and reviewers) and GET /registry/v1/orgs/:handle (public, `packages` inste",
        "description": "Contract: GET /api/registry/orgs/:id (members and reviewers) and GET /registry/v1/orgs/:handle (public, `packages` instead of `namespaces`). */\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "operationId": "putApiRegistryOrgsId",
        "tags": [
          "Registry"
        ],
        "summary": "PUT /api/registry/orgs/:id ({ handle?, displayName?, url?, avatarUrl? }) → RegistryOrg (owner or admin);",
        "description": "Contract: PUT /api/registry/orgs/:id ({ handle?, displayName?, url?, avatarUrl? }) → RegistryOrg (owner or admin);\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "handle": {
                    "type": "string",
                    "x-pattern": "REGISTRY_HANDLE_RE"
                  },
                  "displayName": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "url": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "uri",
                    "maxLength": 500
                  },
                  "avatarUrl": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "uri",
                    "maxLength": 500
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/registry/orgs/{id}/leave": {
      "post": {
        "operationId": "postApiRegistryOrgsIdLeave",
        "tags": [
          "Registry"
        ],
        "summary": "DELETE /api/registry/orgs/:id/members/:publisherId → 204 (owner); POST /api/registry/orgs/:id/leave → 204 (any",
        "description": "Contract: DELETE /api/registry/orgs/:id/members/:publisherId → 204 (owner); POST /api/registry/orgs/:id/leave → 204 (any member);\n\nRequires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/registry/orgs/{id}/members": {
      "post": {
        "operationId": "postApiRegistryOrgsIdMembers",
        "tags": [
          "Registry"
        ],
        "summary": "POST /api/registry/orgs/:id/members ({ handle, role? }) → RegistryOrgMember (owner); PUT /api/registry/orgs/:i",
        "description": "Contract: POST /api/registry/orgs/:id/members ({ handle, role? }) → RegistryOrgMember (owner); PUT /api/registry/orgs/:id/members/:publisherId ({ role }) → RegistryOrgMember (owner);\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "handle": {
                    "type": "string",
                    "x-pattern": "REGISTRY_HANDLE_RE"
                  },
                  "role": {
                    "type": "string",
                    "enum": [
                      "owner",
                      "admin",
                      "member"
                    ]
                  }
                },
                "required": [
                  "handle"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/registry/orgs/{id}/members/{publisherId}": {
      "put": {
        "operationId": "putApiRegistryOrgsIdMembersPublisherId",
        "tags": [
          "Registry"
        ],
        "summary": "POST /api/registry/orgs/:id/members ({ handle, role? }) → RegistryOrgMember (owner); PUT /api/registry/orgs/:i",
        "description": "Contract: POST /api/registry/orgs/:id/members ({ handle, role? }) → RegistryOrgMember (owner); PUT /api/registry/orgs/:id/members/:publisherId ({ role }) → RegistryOrgMember (owner);\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "publisherId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "role": {
                    "type": "string",
                    "enum": [
                      "owner",
                      "admin",
                      "member"
                    ]
                  }
                },
                "required": [
                  "role"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "operationId": "deleteApiRegistryOrgsIdMembersPublisherId",
        "tags": [
          "Registry"
        ],
        "summary": "DELETE /api/registry/orgs/:id/members/:publisherId → 204 (owner); POST /api/registry/orgs/:id/leave → 204 (any",
        "description": "Contract: DELETE /api/registry/orgs/:id/members/:publisherId → 204 (owner); POST /api/registry/orgs/:id/leave → 204 (any member);\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "publisherId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/registry/orgs/{id}/namespaces/{name}/maintainers": {
      "put": {
        "operationId": "putApiRegistryOrgsIdNamespacesNameMaintainers",
        "tags": [
          "Registry"
        ],
        "summary": "PUT /api/registry/orgs/:id/namespaces/:name/maintainers ({ maintainers: publisherId[] }) → Namespace (owner or",
        "description": "Contract: PUT /api/registry/orgs/:id/namespaces/:name/maintainers ({ maintainers: publisherId[] }) → Namespace (owner or admin).\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "maintainers": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    },
                    "maxItems": 50
                  }
                },
                "required": [
                  "maintainers"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/registry/orgs/{id}/namespaces/{name}/transfer": {
      "post": {
        "operationId": "postApiRegistryOrgsIdNamespacesNameTransfer",
        "tags": [
          "Registry"
        ],
        "summary": "The namespace's owner publisher moves it into an organization they own; reviewers may move any namespace.",
        "description": "The namespace's owner publisher moves it into an organization they own; reviewers may move any namespace.\n\nContract: POST /api/registry/orgs/:id/namespaces/:name/transfer → Namespace (the namespace's owner publisher who is also an org owner, or users.manage);\n\nRequires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/registry/orgs/{id}/verify": {
      "post": {
        "operationId": "postApiRegistryOrgsIdVerify",
        "tags": [
          "Registry"
        ],
        "summary": "Reviewers (users.manage): GET /api/registry/orgs?q=&page=&limit= → Paginated<RegistryOrg>; POST /api/registry/",
        "description": "Contract: Reviewers (users.manage): GET /api/registry/orgs?q=&page=&limit= → Paginated<RegistryOrg>; POST /api/registry/orgs/:id/verify ({ verified }) → RegistryOrg.\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "verified": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "verified"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/registry/packages/{name}/deprecate": {
      "post": {
        "operationId": "postApiRegistryPackagesNameDeprecate",
        "tags": [
          "Registry"
        ],
        "summary": "POST /api/registry/packages/:name/deprecate ({ note? }) | undeprecate; POST /api/registry/packages/:name/versi",
        "description": "Contract: POST /api/registry/packages/:name/deprecate ({ note? }) | undeprecate; POST /api/registry/packages/:name/versions/:v/yank ({ reason }) (the publisher may\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "note": {
                    "type": "string",
                    "maxLength": 2000
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/registry/packages/{name}/undeprecate": {
      "post": {
        "operationId": "postApiRegistryPackagesNameUndeprecate",
        "tags": [
          "Registry"
        ],
        "summary": "POST /api/registry/packages/{name}/undeprecate",
        "description": "Public, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/registry/packages/{name}/versions/{version}/yank": {
      "post": {
        "operationId": "postApiRegistryPackagesNameVersionsVersionYank",
        "tags": [
          "Registry"
        ],
        "summary": "POST /api/registry/packages/{name}/versions/{version}/yank",
        "description": "Public, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "version",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  }
                },
                "required": [
                  "reason"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/registry/publish": {
      "post": {
        "operationId": "postApiRegistryPublish",
        "tags": [
          "Registry"
        ],
        "summary": "The same publish pipeline for a signed-in session (the site's upload form); CSRF-protected like every /api rou",
        "description": "The same publish pipeline for a signed-in session (the site's upload form); CSRF-protected like every /api route.\n\nPublic, or checks access itself (see the description).",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/registry/publishers": {
      "get": {
        "operationId": "getApiRegistryPublishers",
        "tags": [
          "Registry"
        ],
        "summary": "Reviewer listings behind the Publishers and Namespaces screens.",
        "description": "Reviewer listings behind the Publishers and Namespaces screens.\n\nContract: Reviewer listings (users.manage): GET /api/registry/publishers?q=&page=&limit= → Paginated<Publisher> (q matches handle and display name);\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "x-coerce": true,
              "minimum": 1,
              "default": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "x-coerce": true,
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/registry/publishers/me": {
      "get": {
        "operationId": "getApiRegistryPublishersMe",
        "tags": [
          "Registry"
        ],
        "summary": "Publisher profile: GET /api/registry/publishers/me → Publisher | null; POST /api/registry/publishers/me ({ han",
        "description": "Contract: Publisher profile: GET /api/registry/publishers/me → Publisher | null; POST /api/registry/publishers/me ({ handle, displayName, url? }) creates or updates it\n\nRequires a signed-in user (cookie session or bearer token).",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "operationId": "postApiRegistryPublishersMe",
        "tags": [
          "Registry"
        ],
        "summary": "Publisher profile: GET /api/registry/publishers/me → Publisher | null; POST /api/registry/publishers/me ({ han",
        "description": "Contract: Publisher profile: GET /api/registry/publishers/me → Publisher | null; POST /api/registry/publishers/me ({ handle, displayName, url? }) creates or updates it\n\nPermission: `registry.publish`.",
        "x-permission": [
          "registry.publish"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "handle": {
                    "type": "string",
                    "x-pattern": "REGISTRY_HANDLE_RE"
                  },
                  "displayName": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "url": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "uri",
                    "maxLength": 500
                  },
                  "avatarUrl": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "uri",
                    "maxLength": 500
                  }
                },
                "required": [
                  "handle",
                  "displayName"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/registry/publishers/{id}/verify": {
      "post": {
        "operationId": "postApiRegistryPublishersIdVerify",
        "tags": [
          "Registry"
        ],
        "summary": "deprecate and yank their own packages too); POST /api/registry/namespaces/:name/transfer ({ ownerPublisherId, ",
        "description": "Contract: deprecate and yank their own packages too); POST /api/registry/namespaces/:name/transfer ({ ownerPublisherId, maintainers? }); POST /api/registry/publishers/:id/verify\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "verified": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "verified"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/registry/review": {
      "get": {
        "operationId": "getApiRegistryReview",
        "tags": [
          "Registry"
        ],
        "summary": "Review (users.manage on the registry instance): GET /api/registry/review → PackageVersion[] (pending); POST /a",
        "description": "Contract: Review (users.manage on the registry instance): GET /api/registry/review → PackageVersion[] (pending); POST /api/registry/review/:name/:version/approve|reject\n\nPublic, or checks access itself (see the description).",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/registry/review/{name}/{version}/approve": {
      "post": {
        "operationId": "postApiRegistryReviewNameVersionApprove",
        "tags": [
          "Registry"
        ],
        "summary": "Review (users.manage on the registry instance): GET /api/registry/review → PackageVersion[] (pending); POST /a",
        "description": "Contract: Review (users.manage on the registry instance): GET /api/registry/review → PackageVersion[] (pending); POST /api/registry/review/:name/:version/approve|reject\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "version",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "note": {
                    "type": "string",
                    "maxLength": 2000
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/registry/review/{name}/{version}/reject": {
      "post": {
        "operationId": "postApiRegistryReviewNameVersionReject",
        "tags": [
          "Registry"
        ],
        "summary": "POST /api/registry/review/{name}/{version}/reject",
        "description": "Public, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "version",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "note": {
                    "type": "string",
                    "maxLength": 2000
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/registry/status": {
      "get": {
        "operationId": "getApiRegistryStatus",
        "tags": [
          "Registry"
        ],
        "summary": "Status: GET /api/registry/status → { enabled: boolean, fourEyes: boolean } answers on every instance (any sign",
        "description": "Contract: Status: GET /api/registry/status → { enabled: boolean, fourEyes: boolean } answers on every instance (any signed-in user; 200 with enabled: false when\n\nRequires a signed-in user (cookie session or bearer token).",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/releases": {
      "get": {
        "operationId": "getApiReleases",
        "tags": [
          "Workstreams"
        ],
        "summary": "GET /api/releases?status= → Workstream[] (content.view_drafts); POST /api/releases (WorkstreamInput) → Workstr",
        "description": "Contract: GET /api/releases?status= → Workstream[] (content.view_drafts); POST /api/releases (WorkstreamInput) → Workstream (content.create; the caller owns it)\n\nPermission: `content.view_drafts`.",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "x-enum": "WORKSTREAM_STATUSES as unknown as [string, ...string[]]"
            }
          }
        ],
        "x-permission": [
          "content.view_drafts"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "operationId": "postApiReleases",
        "tags": [
          "Workstreams"
        ],
        "summary": "GET /api/releases?status= → Workstream[] (content.view_drafts); POST /api/releases (WorkstreamInput) → Workstr",
        "description": "Contract: GET /api/releases?status= → Workstream[] (content.view_drafts); POST /api/releases (WorkstreamInput) → Workstream (content.create; the caller owns it)\n\nPermission: `content.create`.",
        "x-permission": [
          "content.create"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string",
                    "x-pattern": "WORKSTREAM_KEY_RE"
                  },
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "description": {
                    "type": "string",
                    "maxLength": 2000
                  }
                },
                "required": [
                  "label"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/releases/{id}": {
      "get": {
        "operationId": "getApiReleasesId",
        "tags": [
          "Workstreams"
        ],
        "summary": "GET /api/releases/:id → Workstream & { items: WorkstreamItem[] }; PUT /api/releases/:id ({ label?, description",
        "description": "Contract: GET /api/releases/:id → Workstream & { items: WorkstreamItem[] }; PUT /api/releases/:id ({ label?, description? }); DELETE /api/releases/:id → 204\n\nPermission: `content.view_drafts`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "content.view_drafts"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "operationId": "putApiReleasesId",
        "tags": [
          "Workstreams"
        ],
        "summary": "GET /api/releases/:id → Workstream & { items: WorkstreamItem[] }; PUT /api/releases/:id ({ label?, description",
        "description": "Contract: GET /api/releases/:id → Workstream & { items: WorkstreamItem[] }; PUT /api/releases/:id ({ label?, description? }); DELETE /api/releases/:id → 204\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "description": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 2000
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "operationId": "deleteApiReleasesId",
        "tags": [
          "Workstreams"
        ],
        "summary": "GET /api/releases/:id → Workstream & { items: WorkstreamItem[] }; PUT /api/releases/:id ({ label?, description",
        "description": "Contract: GET /api/releases/:id → Workstream & { items: WorkstreamItem[] }; PUT /api/releases/:id ({ label?, description? }); DELETE /api/releases/:id → 204\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/releases/{id}/diff": {
      "get": {
        "operationId": "getApiReleasesIdDiff",
        "tags": [
          "Workstreams"
        ],
        "summary": "GET /api/releases/:id/diff → WorkstreamDiff: every item with the number of changed fields and layout blocks (c",
        "description": "Contract: GET /api/releases/:id/diff → WorkstreamDiff: every item with the number of changed fields and layout blocks (content/diff.ts) and its pre-publish checks.\n\nPermission: `content.view_drafts`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "content.view_drafts"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/releases/{id}/discard": {
      "post": {
        "operationId": "postApiReleasesIdDiscard",
        "tags": [
          "Workstreams"
        ],
        "summary": "POST /api/releases/:id/discard → Workstream (status discarded; the release's revisions, overlays and entities ",
        "description": "Contract: POST /api/releases/:id/discard → Workstream (status discarded; the release's revisions, overlays and entities created inside it are deleted)\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/releases/{id}/merge": {
      "post": {
        "operationId": "postApiReleasesIdMerge",
        "tags": [
          "Workstreams"
        ],
        "summary": "POST /api/releases/:id/merge ({ force?: boolean }) → WorkstreamMergeResult (content.publish)",
        "description": "Contract: POST /api/releases/:id/merge ({ force?: boolean }) → WorkstreamMergeResult (content.publish). Publishes every item through the normal publish path\n\nPermission: `content.publish`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "content.publish"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "force": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/releases/{id}/schedule": {
      "post": {
        "operationId": "postApiReleasesIdSchedule",
        "tags": [
          "Workstreams"
        ],
        "summary": "publishAt: string | null;  // set through POST /api/releases/:id/schedule; the ticker merges when it comes",
        "description": "Contract: publishAt: string | null;  // set through POST /api/releases/:id/schedule; the ticker merges when it comes\n\nPermission: `content.publish`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "content.publish"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "publishAt": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 40
                  }
                },
                "required": [
                  "publishAt"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/releases/{id}/share-link": {
      "post": {
        "operationId": "postApiReleasesIdShareLink",
        "tags": [
          "Workstreams"
        ],
        "summary": "POST /api/releases/:id/share-link → WorkstreamShareLink: a token valid WORKSTREAM_SHARE_DAYS that lets a stake",
        "description": "Contract: POST /api/releases/:id/share-link → WorkstreamShareLink: a token valid WORKSTREAM_SHARE_DAYS that lets a stakeholder open the preview without a session.\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/render/block": {
      "post": {
        "operationId": "postApiRenderBlock",
        "tags": [
          "Builder"
        ],
        "summary": "POST /api/render/block ({ module, key, props, path?, locale? }) → BlockRenderResult: the HTML the ModuleBlock ",
        "description": "Contract: POST /api/render/block ({ module, key, props, path?, locale? }) → BlockRenderResult: the HTML the ModuleBlock would render on a page. */\n\nRequires a signed-in user (cookie session or bearer token).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "module": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "key": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "props": {
                    "type": "object",
                    "additionalProperties": {},
                    "default": {}
                  },
                  "style": {
                    "type": "string",
                    "maxLength": 64
                  },
                  "path": {
                    "type": "string",
                    "maxLength": 2000
                  },
                  "locale": {
                    "type": "string",
                    "maxLength": 20
                  }
                },
                "required": [
                  "module",
                  "key"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/review-links/{id}": {
      "delete": {
        "operationId": "deleteApiReviewLinksId",
        "tags": [
          "Review links"
        ],
        "summary": "DELETE /api/review-links/:id → ReviewLink (revoked): its creator, or edit access to the item",
        "description": "Contract: DELETE /api/review-links/:id → ReviewLink (revoked): its creator, or edit access to the item. Audited as review_link.revoke.\n\nRequires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/review/queue": {
      "get": {
        "operationId": "getApiReviewQueue",
        "tags": [
          "Review"
        ],
        "summary": "GET /api/review/queue → ReviewQueueItem[] (content.publish)",
        "description": "Contract: GET /api/review/queue → ReviewQueueItem[] (content.publish)\n\nPermission: `content.publish`.",
        "parameters": [
          {
            "name": "view",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "content.publish"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/richtext/sanitize": {
      "post": {
        "operationId": "postApiRichtextSanitize",
        "tags": [
          "Rich text"
        ],
        "summary": "POST /api/richtext/sanitize ({ html }) → { html } (any user) for the admin preview.",
        "description": "Contract: POST /api/richtext/sanitize ({ html }) → { html } (any user) for the admin preview.\n\nRequires a signed-in user (cookie session or bearer token).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "html": {
                    "type": "string",
                    "maxLength": 2000000
                  }
                },
                "required": [
                  "html"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/roles": {
      "get": {
        "operationId": "getApiRoles",
        "tags": [
          "Roles"
        ],
        "summary": "The presets' permissions, for global roles at instance scope",
        "description": "Contract: The presets' permissions, for global roles at instance scope. On a site, roles resolve through that site's definitions (GET /api/roles). */\n\nPermission: `users.manage`.",
        "x-permission": [
          "users.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "operationId": "postApiRoles",
        "tags": [
          "Roles"
        ],
        "summary": "POST /api/roles (RoleInput & { copyFrom?: RoleKey }) → RoleDef, 201",
        "description": "Contract: POST /api/roles (RoleInput & { copyFrom?: RoleKey }) → RoleDef, 201. Keys match ROLE_KEY_RE and are not a preset's.\n\nPublic, or checks access itself (see the description).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string",
                    "x-pattern": "ROLE_KEY_RE"
                  },
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "description": {
                    "type": "string",
                    "maxLength": 500
                  },
                  "permissions": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "maxItems": 200,
                    "default": []
                  },
                  "copyFrom": {
                    "type": "string",
                    "maxLength": 63
                  }
                },
                "required": [
                  "key",
                  "label"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "operationId": "putApiRoles",
        "tags": [
          "Roles"
        ],
        "summary": "The permissions matrix: every role's permissions in one save, all or none.",
        "description": "The permissions matrix: every role's permissions in one save, all or none.\n\nContract: PUT /api/roles ({ permissions: Record<RoleKey, Permission[]> }) → RoleDef[]: the permissions matrix saved in one transaction.\n\nPublic, or checks access itself (see the description).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "permissions": {
                    "type": "object",
                    "additionalProperties": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "maxLength": 64
                      },
                      "maxItems": 200
                    }
                  }
                },
                "required": [
                  "permissions"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/roles/labels": {
      "get": {
        "operationId": "getApiRolesLabels",
        "tags": [
          "Roles"
        ],
        "summary": "Lists can show a role's label for any key a person holds here.",
        "description": "Lists can show a role's label for any key a person holds here.\n\nRequires a signed-in user (cookie session or bearer token).",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/roles/{key}": {
      "put": {
        "operationId": "putApiRolesKey",
        "tags": [
          "Roles"
        ],
        "summary": "PUT /api/roles/:key ({ label?, description?, permissions? }) → RoleDef",
        "description": "Contract: PUT /api/roles/:key ({ label?, description?, permissions? }) → RoleDef. The admin role cannot change (409 role_locked).\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "description": {
                    "type": "string",
                    "maxLength": 500
                  },
                  "permissions": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "maxItems": 200
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "operationId": "deleteApiRolesKey",
        "tags": [
          "Roles"
        ],
        "summary": "DELETE /api/roles/:key (?reassignTo=<key>) → 204",
        "description": "Contract: DELETE /api/roles/:key (?reassignTo=<key>) → 204. Presets cannot be deleted (reset them instead); a role someone holds on the site\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "reassignTo",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/roles/{key}/reset": {
      "post": {
        "operationId": "postApiRolesKeyReset",
        "tags": [
          "Roles"
        ],
        "summary": "POST /api/roles/:key/reset → RoleDef: a preset back to its default permissions and label.",
        "description": "Contract: POST /api/roles/:key/reset → RoleDef: a preset back to its default permissions and label.\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/search": {
      "get": {
        "operationId": "getApiSearch",
        "tags": [
          "Search"
        ],
        "summary": "GET /api/search?q=&type=&term=&page=&limit= → SearchResponse (Paginated<SearchResult> plus `facets`)",
        "description": "Contract: GET /api/search?q=&type=&term=&page=&limit= → SearchResponse (Paginated<SearchResult> plus `facets`). Public; anonymous sees published\n\nRequires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200,
              "default": ""
            }
          },
          {
            "name": "type",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          },
          {
            "name": "term",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          },
          {
            "name": "locale",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 2,
              "maxLength": 35
            }
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "relevance",
                "newest"
              ]
            }
          },
          {
            "name": "since",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/search/answer": {
      "get": {
        "operationId": "getApiSearchAnswer",
        "tags": [
          "Search"
        ],
        "summary": "GET /api/search/answer?q=&locale=&h=&tz= (public; SEARCH_ANSWER_RATE_PER_MINUTE per address, else 429; every t",
        "description": "Contract: GET /api/search/answer?q=&locale=&h=&tz= (public; SEARCH_ANSWER_RATE_PER_MINUTE per address, else 429; every turn of a\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 300
            }
          },
          {
            "name": "locale",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 2,
              "maxLength": 35
            }
          },
          {
            "name": "tz",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/search/reindex": {
      "post": {
        "operationId": "postApiSearchReindex",
        "tags": [
          "Search"
        ],
        "summary": "POST /api/search/reindex → { indexed: number } (site.settings); `spillway search reindex` does the same from t",
        "description": "Contract: POST /api/search/reindex → { indexed: number } (site.settings); `spillway search reindex` does the same from the CLI.\n\nPermission: `site.settings`.",
        "x-permission": [
          "site.settings"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/search/semantic": {
      "get": {
        "operationId": "getApiSearchSemantic",
        "tags": [
          "Search"
        ],
        "summary": "Site settings → Search: whether search by meaning runs on this server and how far the site's pages are embedde",
        "description": "Site settings → Search: whether search by meaning runs on this server and how far the site's pages are embedded.\n\nContract: Default true; it runs only where the server has the model (GET /api/search/semantic says).\n\nPermission: `site.settings`.",
        "x-permission": [
          "site.settings"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/search/suggest": {
      "get": {
        "operationId": "getApiSearchSuggest",
        "tags": [
          "Search"
        ],
        "summary": "Suggestions while visitors type: published pages only, cached briefly by browsers and the CDN.",
        "description": "Suggestions while visitors type: published pages only, cached briefly by browsers and the CDN.\n\nContract: GET /api/search/suggest?q=&locale= → up to six published pages for what a visitor has typed (two characters or more). Public. */\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200,
              "default": ""
            }
          },
          {
            "name": "locale",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 2,
              "maxLength": 35
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/sections": {
      "get": {
        "operationId": "getApiSections",
        "tags": [
          "Sections"
        ],
        "summary": "GET /api/sections → Section[] (any user; section editors see only their own), POST /api/sections (SectionInput",
        "description": "Contract: GET /api/sections → Section[] (any user; section editors see only their own), POST /api/sections (SectionInput) → Section (201, site.settings),\n\nRequires a signed-in user (cookie session or bearer token).",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "operationId": "postApiSections",
        "tags": [
          "Sections"
        ],
        "summary": "GET /api/sections → Section[] (any user; section editors see only their own), POST /api/sections (SectionInput",
        "description": "Contract: GET /api/sections → Section[] (any user; section editors see only their own), POST /api/sections (SectionInput) → Section (201, site.settings),\n\nPermission: `sections.manage`.",
        "x-permission": [
          "sections.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 63
                  },
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "pathPrefix": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "menuKey": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 63
                  },
                  "visibility": {
                    "type": [
                      "object",
                      "null"
                    ],
                    "properties": {
                      "audience": {
                        "type": "string",
                        "enum": [
                          "everyone",
                          "members",
                          "groups"
                        ]
                      },
                      "groups": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 100
                        },
                        "maxItems": 50
                      }
                    },
                    "required": [
                      "audience"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "key",
                  "label",
                  "pathPrefix"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/sections/{id}": {
      "get": {
        "operationId": "getApiSectionsId",
        "tags": [
          "Sections"
        ],
        "summary": "GET /api/sections/{id}",
        "description": "Requires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "operationId": "putApiSectionsId",
        "tags": [
          "Sections"
        ],
        "summary": "PUT /api/sections/{id}",
        "description": "Permission: `sections.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "sections.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 63
                  },
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "pathPrefix": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "menuKey": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 63
                  },
                  "visibility": {
                    "type": [
                      "object",
                      "null"
                    ],
                    "properties": {
                      "audience": {
                        "type": "string",
                        "enum": [
                          "everyone",
                          "members",
                          "groups"
                        ]
                      },
                      "groups": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 100
                        },
                        "maxItems": 50
                      }
                    },
                    "required": [
                      "audience"
                    ],
                    "additionalProperties": false
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "operationId": "deleteApiSectionsId",
        "tags": [
          "Sections"
        ],
        "summary": "GET/PUT (Partial<SectionInput>)/DELETE /api/sections/:id (site.settings; the id may be the key)",
        "description": "Contract: GET/PUT (Partial<SectionInput>)/DELETE /api/sections/:id (site.settings; the id may be the key). Creating a section (or changing its prefix) assigns\n\nPermission: `sections.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "sections.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/setup": {
      "post": {
        "operationId": "postApiSetup",
        "tags": [
          "Setup"
        ],
        "summary": "GET /api/setup/status",
        "description": "Contract: GET /api/setup/status. setupTokenRequired: the server has SETUP_TOKEN set, so POST /api/setup needs the X-Setup-Token header. */\n\nPublic, or checks access itself (see the description).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "siteName": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "email": {
                    "type": "string",
                    "format": "email",
                    "maxLength": 200
                  },
                  "password": {
                    "type": "string",
                    "minLength": 8,
                    "maxLength": 200
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  }
                },
                "required": [
                  "siteName",
                  "email",
                  "password",
                  "name"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/setup/status": {
      "get": {
        "operationId": "getApiSetupStatus",
        "tags": [
          "Setup"
        ],
        "summary": "GET /api/setup/status",
        "description": "Public, or checks access itself (see the description).",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/shared-blocks": {
      "get": {
        "operationId": "getApiSharedBlocks",
        "tags": [
          "Shared blocks"
        ],
        "summary": "GET /api/shared-blocks → (SharedBlock & { usageCount: number })[]; POST (SharedBlockInput); GET/PUT/DELETE /ap",
        "description": "Contract: GET /api/shared-blocks → (SharedBlock & { usageCount: number })[]; POST (SharedBlockInput); GET/PUT/DELETE /api/shared-blocks/:id (types.manage for\n\nRequires a signed-in user (cookie session or bearer token).",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "operationId": "postApiSharedBlocks",
        "tags": [
          "Shared blocks"
        ],
        "summary": "POST /api/shared-blocks",
        "description": "Permission: `types.manage`.",
        "x-permission": [
          "types.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string",
                    "x-pattern": "CONTENT_TYPE_KEY_RE"
                  },
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "block": {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 100
                      },
                      "props": {
                        "type": "object",
                        "additionalProperties": {}
                      },
                      "readOnly": {
                        "type": "object",
                        "additionalProperties": {
                          "type": "boolean"
                        }
                      }
                    },
                    "required": [
                      "type",
                      "props"
                    ]
                  }
                },
                "required": [
                  "key",
                  "label",
                  "block"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/shared-blocks/{id}": {
      "get": {
        "operationId": "getApiSharedBlocksId",
        "tags": [
          "Shared blocks"
        ],
        "summary": "GET /api/shared-blocks/{id}",
        "description": "Requires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "operationId": "putApiSharedBlocksId",
        "tags": [
          "Shared blocks"
        ],
        "summary": "PUT /api/shared-blocks/{id}",
        "description": "Permission: `types.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "types.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string",
                    "x-pattern": "CONTENT_TYPE_KEY_RE"
                  },
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "block": {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 100
                      },
                      "props": {
                        "type": "object",
                        "additionalProperties": {}
                      },
                      "readOnly": {
                        "type": "object",
                        "additionalProperties": {
                          "type": "boolean"
                        }
                      }
                    },
                    "required": [
                      "type",
                      "props"
                    ]
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "operationId": "deleteApiSharedBlocksId",
        "tags": [
          "Shared blocks"
        ],
        "summary": "GET /api/shared-blocks → (SharedBlock & { usageCount: number })[]; POST (SharedBlockInput); GET/PUT/DELETE /ap",
        "description": "Contract: GET /api/shared-blocks → (SharedBlock & { usageCount: number })[]; POST (SharedBlockInput); GET/PUT/DELETE /api/shared-blocks/:id (types.manage for\n\nPermission: `types.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "types.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/site": {
      "get": {
        "operationId": "getApiSite",
        "tags": [
          "Site settings"
        ],
        "summary": "GET /api/site → SiteSettings; PUT /api/site (Partial<SiteSettings>) → SiteSettings */",
        "description": "Contract: GET /api/site → SiteSettings; PUT /api/site (Partial<SiteSettings>) → SiteSettings */\n\nRequires a signed-in user (cookie session or bearer token).",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "operationId": "putApiSite",
        "tags": [
          "Site settings"
        ],
        "summary": "PUT /api/site { builder } (site.settings) changes the block set; GET /api/builder/config carries it as `builde",
        "description": "Contract: PUT /api/site { builder } (site.settings) changes the block set; GET /api/builder/config carries it as `builder`, and the AI's\n\nPermission: `site.settings`.",
        "parameters": [
          {
            "name": "force",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "site.settings"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "tagline": {
                    "type": "string",
                    "maxLength": 500
                  },
                  "footerNote": {
                    "type": "string",
                    "maxLength": 1000
                  },
                  "organization": {
                    "type": "object",
                    "properties": {
                      "address": {
                        "type": "object",
                        "properties": {
                          "street": {
                            "x-zod": "optText(200)"
                          },
                          "locality": {
                            "x-zod": "optText(100)"
                          },
                          "region": {
                            "x-zod": "optText(100)"
                          },
                          "postalCode": {
                            "x-zod": "optText(100)"
                          },
                          "country": {
                            "x-zod": "optText(100)"
                          }
                        },
                        "required": [
                          "street",
                          "locality",
                          "region",
                          "postalCode",
                          "country"
                        ],
                        "additionalProperties": false
                      },
                      "phone": {
                        "type": "string",
                        "maxLength": 40,
                        "pattern": "^[0-9+().\\-\\s/a-zA-Z]*$"
                      },
                      "email": {
                        "oneOf": [
                          {
                            "const": ""
                          },
                          {
                            "type": "string",
                            "maxLength": 200,
                            "format": "email"
                          }
                        ]
                      },
                      "social": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "network": {
                              "type": "string",
                              "x-enum": "SOCIAL_NETWORKS"
                            },
                            "url": {
                              "type": "string",
                              "maxLength": 500,
                              "pattern": "^https:\\/\\/[^\\s<>\"]+$"
                            },
                            "label": {
                              "type": "string",
                              "maxLength": 60
                            }
                          },
                          "required": [
                            "network",
                            "url"
                          ],
                          "additionalProperties": false
                        }
                      }
                    },
                    "additionalProperties": false
                  },
                  "breadcrumbs": {
                    "type": "object",
                    "properties": {
                      "types": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "pattern": "^[a-z][a-z0-9_]{0,63}$"
                        },
                        "maxItems": 100
                      },
                      "source": {
                        "type": "string",
                        "enum": [
                          "path",
                          "menu"
                        ]
                      }
                    },
                    "additionalProperties": false
                  },
                  "search": {
                    "type": "object",
                    "properties": {
                      "header": {
                        "type": "boolean"
                      },
                      "headerAsk": {
                        "type": "boolean"
                      },
                      "suggestions": {
                        "type": "boolean"
                      },
                      "semantic": {
                        "type": "boolean"
                      },
                      "meaningWeight": {
                        "type": "number",
                        "minimum": 0,
                        "maximum": 1,
                        "x-multipleOf": true
                      },
                      "synonyms": {
                        "type": "array",
                        "items": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "maxLength": 60
                          }
                        },
                        "maxItems": 200
                      },
                      "pins": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "queries": {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "maxLength": 100
                              },
                              "minItems": 1,
                              "maxItems": 10
                            },
                            "entityIds": {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 64
                              },
                              "minItems": 1,
                              "maxItems": 3
                            }
                          },
                          "required": [
                            "queries",
                            "entityIds"
                          ],
                          "additionalProperties": false
                        },
                        "maxItems": 200
                      },
                      "answers": {
                        "type": "object",
                        "properties": {
                          "enabled": {
                            "type": "boolean"
                          },
                          "types": {
                            "type": "array",
                            "items": {
                              "type": "string",
                              "pattern": "^[a-z][a-z0-9_]{0,63}$"
                            },
                            "maxItems": 100
                          },
                          "dailyCap": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 100000
                          },
                          "contactUrl": {
                            "oneOf": [
                              {
                                "const": ""
                              },
                              {
                                "type": "string",
                                "maxLength": 500,
                                "pattern": "^(\\/(?!\\/)|https:\\/\\/)"
                              }
                            ]
                          }
                        },
                        "additionalProperties": false
                      }
                    },
                    "additionalProperties": false
                  },
                  "builder": {
                    "type": "object",
                    "properties": {
                      "hidden": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "pattern": "^[A-Za-z][\\w.-]{0,99}(\\/[\\w.-]{1,100})?$"
                        },
                        "maxItems": 300
                      },
                      "favorites": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "pattern": "^[A-Za-z][\\w.-]{0,99}(\\/[\\w.-]{1,100})?$"
                        }
                      },
                      "hiddenPatterns": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "pattern": "^[\\w:.-]{1,120}$"
                        },
                        "maxItems": 1000
                      }
                    },
                    "additionalProperties": false
                  },
                  "componentLibrary": {
                    "type": "object",
                    "properties": {
                      "public": {
                        "type": "boolean"
                      },
                      "visibility": {
                        "type": [
                          "object",
                          "null"
                        ],
                        "properties": {
                          "audience": {
                            "type": "string",
                            "enum": [
                              "everyone",
                              "members",
                              "groups"
                            ]
                          },
                          "groups": {
                            "type": "array",
                            "items": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 100
                            },
                            "maxItems": 50
                          }
                        },
                        "required": [
                          "audience"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "required": [
                      "public"
                    ],
                    "additionalProperties": false
                  },
                  "baseUrl": {
                    "type": "string",
                    "format": "uri",
                    "maxLength": 300
                  },
                  "defaultLocale": {
                    "type": "string",
                    "maxLength": 35
                  },
                  "locales": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "maxLength": 35
                    },
                    "minItems": 1,
                    "maxItems": 50
                  },
                  "localePrefixDefault": {
                    "type": "boolean"
                  },
                  "homePageId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "theme": {
                    "x-schema": "siteThemeSchema"
                  },
                  "identity": {
                    "x-schema": "identitySchema"
                  },
                  "integrations": {
                    "type": "object",
                    "properties": {
                      "gtmId": {
                        "type": "string",
                        "maxLength": 32
                      },
                      "ga4Id": {
                        "type": "string",
                        "maxLength": 32
                      },
                      "plausibleDomain": {
                        "type": "string",
                        "maxLength": 253
                      },
                      "customHeadHtml": {
                        "type": "string",
                        "maxLength": 20000
                      },
                      "footerHtml": {
                        "type": "string",
                        "maxLength": 20000
                      },
                      "metaPixelId": {
                        "type": "string",
                        "pattern": "^(\\d{10,20})?$"
                      },
                      "linkedinPartnerId": {
                        "type": "string",
                        "pattern": "^(\\d{4,12})?$"
                      },
                      "tiktokPixelId": {
                        "type": "string",
                        "x-toUpperCase": true,
                        "pattern": "^([A-Z0-9]{15,25})?$"
                      },
                      "clarityId": {
                        "type": "string",
                        "pattern": "^([a-z0-9]{6,16})?$"
                      },
                      "hotjarId": {
                        "type": "string",
                        "pattern": "^(\\d{5,10})?$"
                      },
                      "matomoUrl": {
                        "type": "string",
                        "pattern": "^(https:\\/\\/[a-z0-9.-]+(:\\d+)?(\\/[A-Za-z0-9._~\\/-]*)?)?$"
                      },
                      "matomoSiteId": {
                        "type": "string",
                        "pattern": "^(\\d{1,8})?$"
                      }
                    }
                  },
                  "seo": {
                    "type": "object",
                    "properties": {
                      "titleSuffix": {
                        "type": "string",
                        "maxLength": 200
                      },
                      "defaultDescription": {
                        "type": "string",
                        "maxLength": 500
                      },
                      "ogImageMediaId": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "robots": {
                        "type": "string",
                        "maxLength": 5000
                      },
                      "securityTxt": {
                        "type": "string",
                        "maxLength": 5000
                      },
                      "llmsTxt": {
                        "type": "boolean"
                      },
                      "mcpDiscovery": {
                        "type": "boolean"
                      },
                      "mcpPublic": {
                        "type": "object",
                        "properties": {
                          "read": {
                            "type": "boolean"
                          },
                          "perAddressPerMinute": {
                            "type": "integer",
                            "minimum": 1
                          },
                          "perAddressPerDay": {
                            "type": "integer",
                            "minimum": 1
                          },
                          "globalPerMinute": {
                            "type": "integer",
                            "minimum": 1
                          }
                        },
                        "additionalProperties": false
                      },
                      "wellKnownFiles": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "name": {
                              "type": "string",
                              "x-enum": "WELL_KNOWN_FILE_NAMES"
                            },
                            "content": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "name",
                            "content"
                          ],
                          "additionalProperties": false
                        }
                      }
                    }
                  },
                  "content": {
                    "type": "object",
                    "properties": {
                      "keepRevisions": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 10000
                      },
                      "openCommentsBlockPublish": {
                        "type": "boolean"
                      }
                    }
                  },
                  "privacy": {
                    "type": "object",
                    "properties": {
                      "consentMode": {
                        "type": "string",
                        "enum": [
                          "none",
                          "banner"
                        ]
                      },
                      "banner": {
                        "type": "object",
                        "properties": {
                          "text": {
                            "type": "string",
                            "maxLength": 600
                          },
                          "policyHref": {
                            "type": "string",
                            "maxLength": 500
                          },
                          "policyLabel": {
                            "type": "string",
                            "maxLength": 60
                          },
                          "acceptLabel": {
                            "type": "string",
                            "maxLength": 40
                          },
                          "rejectLabel": {
                            "type": "string",
                            "maxLength": 40
                          },
                          "chooseLabel": {
                            "type": "string",
                            "maxLength": 40
                          },
                          "saveLabel": {
                            "type": "string",
                            "maxLength": 40
                          },
                          "settingsLabel": {
                            "type": "string",
                            "maxLength": 40
                          }
                        },
                        "additionalProperties": false
                      }
                    },
                    "required": [
                      "consentMode"
                    ]
                  },
                  "forms": {
                    "type": "object",
                    "properties": {
                      "captcha": {
                        "type": "object",
                        "properties": {
                          "provider": {
                            "type": "string",
                            "enum": [
                              "none",
                              "turnstile",
                              "hcaptcha",
                              "recaptcha-v2",
                              "recaptcha-v3",
                              "friendly"
                            ]
                          },
                          "siteKey": {
                            "type": "string",
                            "maxLength": 200
                          },
                          "secret": {
                            "type": "string",
                            "maxLength": 200
                          },
                          "minScore": {
                            "type": "number",
                            "minimum": 0,
                            "maximum": 1
                          }
                        },
                        "required": [
                          "provider"
                        ]
                      }
                    }
                  },
                  "accounts": {
                    "type": "object",
                    "properties": {
                      "enabled": {
                        "type": "boolean"
                      },
                      "signup": {
                        "type": "boolean"
                      },
                      "registration": {
                        "type": "string",
                        "enum": [
                          "closed",
                          "invite",
                          "approval",
                          "open"
                        ]
                      },
                      "allowedDomains": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "x-pattern": "ACCOUNT_DOMAIN_RE"
                        },
                        "maxItems": 100
                      },
                      "approvalSkipForDomains": {
                        "type": "boolean"
                      },
                      "domainGroups": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "domain": {
                              "type": "string",
                              "x-pattern": "ACCOUNT_DOMAIN_RE"
                            },
                            "groupId": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 100
                            }
                          },
                          "required": [
                            "domain",
                            "groupId"
                          ],
                          "additionalProperties": false
                        },
                        "maxItems": 100
                      },
                      "membersArea": {
                        "type": [
                          "object",
                          "null"
                        ],
                        "properties": {
                          "label": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 60
                          },
                          "href": {
                            "type": "string",
                            "maxLength": 500
                          }
                        },
                        "required": [
                          "label",
                          "href"
                        ]
                      },
                      "requestAccess": {
                        "type": [
                          "object",
                          "null"
                        ],
                        "properties": {
                          "label": {
                            "type": "string",
                            "maxLength": 60
                          },
                          "href": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 500
                          }
                        },
                        "required": [
                          "href"
                        ],
                        "additionalProperties": false
                      },
                      "headerLinks": {
                        "type": "boolean",
                        "default": false
                      },
                      "publicProfiles": {
                        "type": "boolean"
                      },
                      "github": {
                        "type": "boolean"
                      },
                      "google": {
                        "type": "boolean"
                      },
                      "microsoft": {
                        "type": "boolean"
                      },
                      "action": {
                        "type": [
                          "object",
                          "null"
                        ],
                        "properties": {
                          "label": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 40
                          },
                          "href": {
                            "type": "string",
                            "maxLength": 500
                          }
                        },
                        "required": [
                          "label",
                          "href"
                        ]
                      }
                    },
                    "required": [
                      "enabled"
                    ],
                    "additionalProperties": false
                  },
                  "media": {
                    "type": "object",
                    "properties": {
                      "dam": {
                        "type": "object",
                        "properties": {
                          "provider": {
                            "type": "string",
                            "enum": [
                              "none",
                              "cloudinary",
                              "bynder",
                              "brandfolder"
                            ]
                          },
                          "credentials": {
                            "type": "object",
                            "additionalProperties": {
                              "type": "string",
                              "maxLength": 2000
                            }
                          },
                          "defaultFolder": {
                            "type": "string",
                            "maxLength": 300
                          }
                        },
                        "required": [
                          "provider"
                        ]
                      }
                    }
                  },
                  "cdn": {
                    "x-schema": "siteCdnSchema"
                  },
                  "embedAllowedHosts": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "pattern": "^(?=.{1,253}$)([a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\\.)+[a-z]{2,63}$"
                    },
                    "maxItems": 50
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/site-components": {
      "get": {
        "operationId": "getApiSiteComponents",
        "tags": [
          "Site components"
        ],
        "summary": "Pages whose current version or live version uses it (GET /api/site-components only)",
        "description": "Contract: Pages whose current version or live version uses it (GET /api/site-components only). */\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "review"
              ]
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "operationId": "postApiSiteComponents",
        "tags": [
          "Site components"
        ],
        "summary": "POST /api/site-components (SiteComponentInput) → 201 SiteComponent (components.manage): a new component as a d",
        "description": "Contract: POST /api/site-components (SiteComponentInput) → 201 SiteComponent (components.manage): a new component as a draft. The server\n\nPermission: `components.manage`.",
        "x-permission": [
          "components.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string",
                    "x-pattern": "SITE_COMPONENT_KEY_RE"
                  },
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "description": {
                    "type": "string",
                    "maxLength": 500
                  },
                  "category": {
                    "type": "string",
                    "maxLength": 60
                  },
                  "design": {
                    "type": "object",
                    "properties": {
                      "blocks": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            },
                            "props": {
                              "type": "object",
                              "additionalProperties": {}
                            }
                          },
                          "required": [
                            "type",
                            "props"
                          ]
                        },
                        "minItems": 1
                      },
                      "fields": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 63
                            },
                            "label": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            },
                            "help": {
                              "type": "string",
                              "maxLength": 300
                            },
                            "block": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 80
                            },
                            "path": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 200
                            },
                            "type": {
                              "type": "string",
                              "maxLength": 40
                            }
                          },
                          "required": [
                            "key",
                            "label",
                            "block",
                            "path"
                          ]
                        },
                        "default": []
                      },
                      "variants": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 41
                            },
                            "label": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 80
                            },
                            "styles": {
                              "type": "object",
                              "additionalProperties": {
                                "type": "string",
                                "maxLength": 64
                              },
                              "default": {}
                            }
                          },
                          "required": [
                            "key",
                            "label"
                          ]
                        },
                        "default": []
                      }
                    },
                    "required": [
                      "blocks"
                    ]
                  }
                },
                "required": [
                  "key",
                  "label",
                  "design"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/site-components/storybook": {
      "post": {
        "operationId": "postApiSiteComponentsStorybook",
        "tags": [
          "Site components"
        ],
        "summary": "POST /api/site-components/storybook ({ url }) → StorybookCatalog (components.manage): reads a Storybook's inde",
        "description": "Contract: POST /api/site-components/storybook ({ url }) → StorybookCatalog (components.manage): reads a Storybook's index.json (or\n\nPermission: `components.manage`.",
        "x-permission": [
          "components.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "minLength": 8,
                    "maxLength": 2000
                  },
                  "fresh": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "url"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/site-components/storybook/draft": {
      "post": {
        "operationId": "postApiSiteComponentsStorybookDraft",
        "tags": [
          "Site components"
        ],
        "summary": "POST /api/site-components/storybook/draft (StorybookDraftRequest, at most STORYBOOK_IMPORT_LIMITS.draftPerRequ",
        "description": "Contract: POST /api/site-components/storybook/draft (StorybookDraftRequest, at most STORYBOOK_IMPORT_LIMITS.draftPerRequest components) →\n\nPermission: `components.manage`, `ai.use`.",
        "x-permission": [
          "components.manage",
          "ai.use"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "minLength": 8,
                    "maxLength": 2000
                  },
                  "components": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "title": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 300
                        },
                        "main": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 300
                        },
                        "variants": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 300
                          }
                        },
                        "existing": {
                          "type": "string",
                          "enum": [
                            "update",
                            "new",
                            "skip"
                          ]
                        },
                        "target": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 100
                        },
                        "key": {
                          "type": "string",
                          "x-pattern": "SITE_COMPONENT_KEY_RE"
                        },
                        "label": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 120
                        }
                      },
                      "required": [
                        "title",
                        "main"
                      ],
                      "additionalProperties": false
                    },
                    "minItems": 1
                  }
                },
                "required": [
                  "url",
                  "components"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/site-components/storybook/estimate": {
      "post": {
        "operationId": "postApiSiteComponentsStorybookEstimate",
        "tags": [
          "Site components"
        ],
        "summary": "POST /api/site-components/storybook/estimate (StorybookDraftRequest) → StorybookDraftEstimate (components.mana",
        "description": "Contract: POST /api/site-components/storybook/estimate (StorybookDraftRequest) → StorybookDraftEstimate (components.manage and ai.use).\n\nPermission: `components.manage`, `ai.use`.",
        "x-permission": [
          "components.manage",
          "ai.use"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "minLength": 8,
                    "maxLength": 2000
                  },
                  "components": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "title": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 300
                        },
                        "main": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 300
                        },
                        "variants": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 300
                          }
                        },
                        "existing": {
                          "type": "string",
                          "enum": [
                            "update",
                            "new",
                            "skip"
                          ]
                        },
                        "target": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 100
                        },
                        "key": {
                          "type": "string",
                          "x-pattern": "SITE_COMPONENT_KEY_RE"
                        },
                        "label": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 120
                        }
                      },
                      "required": [
                        "title",
                        "main"
                      ],
                      "additionalProperties": false
                    },
                    "minItems": 1
                  }
                },
                "required": [
                  "url",
                  "components"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/site-components/{id}": {
      "get": {
        "operationId": "getApiSiteComponentsId",
        "tags": [
          "Site components"
        ],
        "summary": "GET /api/site-components/:id → SiteComponent (the same as the list; :id may be the key).",
        "description": "Contract: GET /api/site-components/:id → SiteComponent (the same as the list; :id may be the key).\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "operationId": "putApiSiteComponentsId",
        "tags": [
          "Site components"
        ],
        "summary": "PUT /api/site-components/:id ({ label?, description?, category?, design? }) → SiteComponent (components.manage",
        "description": "Contract: PUT /api/site-components/:id ({ label?, description?, category?, design? }) → SiteComponent (components.manage): label, description\n\nPermission: `components.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "components.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "description": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 500
                  },
                  "category": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 60
                  },
                  "design": {
                    "type": "object",
                    "properties": {
                      "blocks": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            },
                            "props": {
                              "type": "object",
                              "additionalProperties": {}
                            }
                          },
                          "required": [
                            "type",
                            "props"
                          ]
                        },
                        "minItems": 1
                      },
                      "fields": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 63
                            },
                            "label": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            },
                            "help": {
                              "type": "string",
                              "maxLength": 300
                            },
                            "block": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 80
                            },
                            "path": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 200
                            },
                            "type": {
                              "type": "string",
                              "maxLength": 40
                            }
                          },
                          "required": [
                            "key",
                            "label",
                            "block",
                            "path"
                          ]
                        },
                        "default": []
                      },
                      "variants": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 41
                            },
                            "label": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 80
                            },
                            "styles": {
                              "type": "object",
                              "additionalProperties": {
                                "type": "string",
                                "maxLength": 64
                              },
                              "default": {}
                            }
                          },
                          "required": [
                            "key",
                            "label"
                          ]
                        },
                        "default": []
                      }
                    },
                    "required": [
                      "blocks"
                    ]
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "operationId": "deleteApiSiteComponentsId",
        "tags": [
          "Site components"
        ],
        "summary": "DELETE /api/site-components/:id → 204 (components.manage); 409 component_in_use with { pages, sharedBlocks } w",
        "description": "Contract: DELETE /api/site-components/:id → 204 (components.manage); 409 component_in_use with { pages, sharedBlocks } while a page's\n\nPermission: `components.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "components.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/site-components/{id}/discard": {
      "post": {
        "operationId": "postApiSiteComponentsIdDiscard",
        "tags": [
          "Site components"
        ],
        "summary": "POST /api/site-components/:id/discard → SiteComponent (components.manage): drops the draft (409 when never pub",
        "description": "Contract: POST /api/site-components/:id/discard → SiteComponent (components.manage): drops the draft (409 when never published).\n\nPermission: `components.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "components.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/site-components/{id}/publish": {
      "post": {
        "operationId": "postApiSiteComponentsIdPublish",
        "tags": [
          "Site components"
        ],
        "summary": "POST /api/site-components/:id/publish ({ pages?: number }) → { component: SiteComponent, pages: SiteComponentU",
        "description": "Contract: POST /api/site-components/:id/publish ({ pages?: number }) → { component: SiteComponent, pages: SiteComponentUsagePage[] }\n\nPermission: `components.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "components.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "pages": {
                    "type": "integer",
                    "minimum": 0
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/site-components/{id}/render": {
      "post": {
        "operationId": "postApiSiteComponentsIdRender",
        "tags": [
          "Site components"
        ],
        "summary": "POST /api/site-components/:id/render (SiteComponentRenderRequest) → { html, checks: SiteComponentCheck[] } (th",
        "description": "Contract: POST /api/site-components/:id/render (SiteComponentRenderRequest) → { html, checks: SiteComponentCheck[] } (the same as the list;\n\nRequires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "version": {
                    "type": "string",
                    "enum": [
                      "draft",
                      "published"
                    ]
                  },
                  "variant": {
                    "type": "string",
                    "maxLength": 41
                  },
                  "mode": {
                    "type": "string",
                    "enum": [
                      "light",
                      "dark",
                      "contrast"
                    ],
                    "default": "light"
                  },
                  "values": {
                    "type": "object",
                    "additionalProperties": {}
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/site-components/{id}/submit": {
      "post": {
        "operationId": "postApiSiteComponentsIdSubmit",
        "tags": [
          "Site components"
        ],
        "summary": "POST /api/site-components/:id/submit → SiteComponent (components.manage): the draft goes to review (409 nothin",
        "description": "Contract: POST /api/site-components/:id/submit → SiteComponent (components.manage): the draft goes to review (409 nothing_to_publish without\n\nPermission: `components.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "components.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/site-components/{id}/usage": {
      "get": {
        "operationId": "getApiSiteComponentsIdUsage",
        "tags": [
          "Site components"
        ],
        "summary": "GET /api/site-components/:id/usage → SiteComponentUsage (the same as the list): the pages whose current or liv",
        "description": "Contract: GET /api/site-components/:id/usage → SiteComponentUsage (the same as the list): the pages whose current or live version uses it,\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/site/cdn/purge": {
      "post": {
        "operationId": "postApiSiteCdnPurge",
        "tags": [
          "Cdn"
        ],
        "summary": "POST /api/site/cdn/purge (CdnPurgeRequest) → CdnPurge (202; queued and delivered at once) (site.settings)",
        "description": "Contract: POST /api/site/cdn/purge (CdnPurgeRequest) → CdnPurge (202; queued and delivered at once) (site.settings)\n\nPermission: `integrations.manage`.",
        "x-permission": [
          "integrations.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "tags": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "x-pattern": "TAG_RE"
                    },
                    "maxItems": 500
                  },
                  "urls": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 2000
                    },
                    "maxItems": 500
                  },
                  "everything": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "202": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/site/cdn/purges": {
      "get": {
        "operationId": "getApiSiteCdnPurges",
        "tags": [
          "Cdn"
        ],
        "summary": "GET  /api/site/cdn/purges?page=&limit= → Paginated<CdnPurge>, the last CDN_PURGE_KEEP purges of the site (site",
        "description": "Contract: GET  /api/site/cdn/purges?page=&limit= → Paginated<CdnPurge>, the last CDN_PURGE_KEEP purges of the site (site.settings)\n\nPermission: `integrations.manage`.",
        "x-permission": [
          "integrations.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/site/cdn/test": {
      "post": {
        "operationId": "postApiSiteCdnTest",
        "tags": [
          "Cdn"
        ],
        "summary": "POST /api/site/cdn/test ({ provider?, credentials?, zoneId? } or the stored settings) → CdnTestResponse (site.",
        "description": "Contract: POST /api/site/cdn/test ({ provider?, credentials?, zoneId? } or the stored settings) → CdnTestResponse (site.settings)\n\nPermission: `integrations.manage`.",
        "x-permission": [
          "integrations.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "provider": {
                    "type": "string",
                    "x-enum": "['none', ...CDN_PROVIDERS] as ['none', ...typeof CDN_PROVIDERS]"
                  },
                  "credentials": {
                    "type": "object",
                    "additionalProperties": {
                      "type": "string",
                      "maxLength": 2000
                    }
                  },
                  "zoneId": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "tagPurge": {
                    "type": "boolean"
                  },
                  "purgeEverythingOnTheme": {
                    "type": "boolean"
                  },
                  "sMaxAge": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 31536000
                  },
                  "staleWhileRevalidate": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 31536000
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/site/onboarding": {
      "get": {
        "operationId": "getApiSiteOnboarding",
        "tags": [
          "Onboarding"
        ],
        "summary": "GET /api/site/onboarding → OnboardingState (site.settings)",
        "description": "Contract: GET /api/site/onboarding → OnboardingState (site.settings). The checklist state, computed on the server from the site itself:\n\nPermission: `site.settings`.",
        "x-permission": [
          "site.settings"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/site/onboarding/blank": {
      "post": {
        "operationId": "postApiSiteOnboardingBlank",
        "tags": [
          "Onboarding"
        ],
        "summary": "POST /api/site/onboarding/blank → OnboardingState: records that the site starts without a kit (the setup wizar",
        "description": "Contract: POST /api/site/onboarding/blank → OnboardingState: records that the site starts without a kit (the setup wizard's offer and the checklist's \"Start blank\"). Audited as onboarding.blank.\n\nPermission: `site.settings`.",
        "x-permission": [
          "site.settings"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/site/onboarding/dismiss": {
      "post": {
        "operationId": "postApiSiteOnboardingDismiss",
        "tags": [
          "Onboarding"
        ],
        "summary": "POST /api/site/onboarding/dismiss { undo?: boolean } → OnboardingState: hides the checklist for the caller (un",
        "description": "Contract: POST /api/site/onboarding/dismiss { undo?: boolean } → OnboardingState: hides the checklist for the caller (undo brings it back). Audited as onboarding.dismiss / onboarding.restore.\n\nPermission: `site.settings`.",
        "x-permission": [
          "site.settings"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "undo": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/site/security": {
      "get": {
        "operationId": "getApiSiteSecurity",
        "tags": [
          "Two step"
        ],
        "summary": "GET /api/site/security → SiteSecurityResponse (users.manage); PUT /api/site/security (SiteSecurityInput) → Sit",
        "description": "Contract: GET /api/site/security → SiteSecurityResponse (users.manage); PUT /api/site/security (SiteSecurityInput) → SiteSecurityResponse\n\nPermission: `users.manage`.",
        "x-permission": [
          "users.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "operationId": "putApiSiteSecurity",
        "tags": [
          "Two step"
        ],
        "summary": "PUT /api/site/security (users.manage); PUT /api/site ignores it",
        "description": "Contract: PUT /api/site/security (users.manage); PUT /api/site ignores it. See \"Two-step sign-in\" and \"Admin IP allowlist\".\n\nPermission: `users.manage`.",
        "x-permission": [
          "users.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "requireTwoStep": {
                    "type": "string",
                    "x-enum": "TWO_STEP_REQUIREMENTS as [string, ...string[]]"
                  },
                  "adminAllowlist": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "maxLength": 100
                    }
                  },
                  "mcpClients": {
                    "type": "object",
                    "properties": {
                      "registration": {
                        "type": "string",
                        "enum": [
                          "open",
                          "allowlist",
                          "off"
                        ]
                      },
                      "allowedNames": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 100
                        }
                      },
                      "allowedRedirectHosts": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 253,
                          "pattern": "^(\\[[0-9a-f:]+\\]|[a-z0-9.-]+)$"
                        }
                      }
                    },
                    "additionalProperties": false
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/site/structure": {
      "get": {
        "operationId": "getApiSiteStructure",
        "tags": [
          "Kits and structure"
        ],
        "summary": "Registered here (before siteRoutes' /site handlers would not matter: the path is distinct) as config-as-code f",
        "description": "Registered here (before siteRoutes' /site handlers would not matter: the path is distinct) as config-as-code for git and provisioning tools.\n\nContract: GET /api/site/structure → KitManifest for the current site (types, vocabularies with terms, collections, forms, menus with entity links as paths);\n\nPermission: `kits.install`.",
        "x-permission": [
          "kits.install"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "operationId": "postApiSiteStructure",
        "tags": [
          "Kits and structure"
        ],
        "summary": "key \"site\", no pages or sample content",
        "description": "Contract: key \"site\", no pages or sample content. POST /api/site/structure (KitManifest, site.settings) applies one: creates what is missing and updates\n\nPermission: `kits.install`.",
        "x-permission": [
          "kits.install"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/sites": {
      "get": {
        "operationId": "getApiSites",
        "tags": [
          "Sites (multisite)"
        ],
        "summary": "GET /api/sites → Site[]; POST /api/sites (SiteInput) → Site (201); GET/PUT (Partial<SiteInput>)/DELETE /api/si",
        "description": "Contract: GET /api/sites → Site[]; POST /api/sites (SiteInput) → Site (201); GET/PUT (Partial<SiteInput>)/DELETE /api/sites/:id (the id may be the key). Permission: sites.manage\n\nPublic, or checks access itself (see the description).",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "operationId": "postApiSites",
        "tags": [
          "Sites (multisite)"
        ],
        "summary": "GET /api/sites → Site[]; POST /api/sites (SiteInput) → Site (201); GET/PUT (Partial<SiteInput>)/DELETE /api/si",
        "description": "Contract: GET /api/sites → Site[]; POST /api/sites (SiteInput) → Site (201); GET/PUT (Partial<SiteInput>)/DELETE /api/sites/:id (the id may be the key). Permission: sites.manage\n\nPublic, or checks access itself (see the description).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 63
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "domains": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "maxLength": 253
                    },
                    "maxItems": 50
                  },
                  "primaryDomain": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 253
                  },
                  "defaultLocale": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 35
                  },
                  "locales": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 2,
                      "maxLength": 35
                    },
                    "maxItems": 50
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "active",
                      "paused"
                    ]
                  },
                  "brandParent": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 63
                  }
                },
                "required": [
                  "key",
                  "name"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/sites/{id}": {
      "get": {
        "operationId": "getApiSitesId",
        "tags": [
          "Sites (multisite)"
        ],
        "summary": "GET /api/sites/{id}",
        "description": "Public, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "operationId": "putApiSitesId",
        "tags": [
          "Sites (multisite)"
        ],
        "summary": "instance admin with PUT /api/sites/:id { brandParent }); absent when the site keeps its own brand",
        "description": "Contract: instance admin with PUT /api/sites/:id { brandParent }); absent when the site keeps its own brand. PUT /api/site ignores it.\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 63
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "domains": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "maxLength": 253
                    },
                    "maxItems": 50
                  },
                  "primaryDomain": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 253
                  },
                  "defaultLocale": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 35
                  },
                  "locales": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 2,
                      "maxLength": 35
                    },
                    "maxItems": 50
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "active",
                      "paused"
                    ]
                  },
                  "brandParent": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 63
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "operationId": "deleteApiSitesId",
        "tags": [
          "Sites (multisite)"
        ],
        "summary": "GET /api/sites → Site[]; POST /api/sites (SiteInput) → Site (201); GET/PUT (Partial<SiteInput>)/DELETE /api/si",
        "description": "Contract: GET /api/sites → Site[]; POST /api/sites (SiteInput) → Site (201); GET/PUT (Partial<SiteInput>)/DELETE /api/sites/:id (the id may be the key). Permission: sites.manage\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/sso/github-app/manifest": {
      "post": {
        "operationId": "postApiSsoGithubAppManifest",
        "tags": [
          "Enterprise sign-in (SSO)"
        ],
        "summary": "One-click GitHub sign-in: the manifest for a new GitHub App and the GitHub URL the browser POSTs it to",
        "description": "One-click GitHub sign-in: the manifest for a new GitHub App and the GitHub URL the browser POSTs it to. The signed\ncookie binds GitHub's redirect back (/sso/github-app/callback) to this admin and this browser.\n\nPublic, or checks access itself (see the description).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "org": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9](?:[A-Za-z0-9-]{0,37}[A-Za-z0-9])?$"
                  },
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "slug": {
                    "type": "string",
                    "x-pattern": "SSO_SLUG_RE"
                  },
                  "issuer": {
                    "type": "string",
                    "format": "uri",
                    "maxLength": 2000
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/sso/providers": {
      "get": {
        "operationId": "getApiSsoProviders",
        "tags": [
          "Enterprise sign-in (SSO)"
        ],
        "summary": "GET /api/sso/providers",
        "description": "Public, or checks access itself (see the description).",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "operationId": "postApiSsoProviders",
        "tags": [
          "Enterprise sign-in (SSO)"
        ],
        "summary": "Admin (users.manage): GET/POST /api/sso/providers, GET/PUT/DELETE /api/sso/providers/:id, POST /api/sso/provid",
        "description": "Contract: Admin (users.manage): GET/POST /api/sso/providers, GET/PUT/DELETE /api/sso/providers/:id, POST /api/sso/providers/:id/test (OIDC: fetch discovery + JWKS, report issuer/endpoints; SAML: parse cert, report SP metadata URL)\n\nPublic, or checks access itself (see the description).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "slug": {
                    "type": "string",
                    "x-pattern": "SSO_SLUG_RE"
                  },
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "protocol": {
                    "type": "string",
                    "enum": [
                      "oidc",
                      "saml",
                      "github",
                      "cas"
                    ]
                  },
                  "enabled": {
                    "type": "boolean"
                  },
                  "issuer": {
                    "type": "string",
                    "maxLength": 2000
                  },
                  "clientId": {
                    "type": "string",
                    "maxLength": 500
                  },
                  "clientSecret": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 2000
                  },
                  "scopes": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 100
                    },
                    "maxItems": 20
                  },
                  "entryPoint": {
                    "type": "string",
                    "maxLength": 2000
                  },
                  "idpCert": {
                    "type": "string",
                    "maxLength": 20000
                  },
                  "spEntityId": {
                    "type": "string",
                    "maxLength": 500
                  },
                  "authParams": {
                    "type": "object",
                    "additionalProperties": {
                      "type": "string",
                      "maxLength": 500
                    }
                  },
                  "emailAttribute": {
                    "type": "string",
                    "maxLength": 100
                  },
                  "emailDomain": {
                    "type": "string",
                    "maxLength": 253
                  },
                  "nameAttribute": {
                    "type": "string",
                    "maxLength": 100
                  },
                  "accountsOnly": {
                    "type": "boolean"
                  },
                  "jitProvisioning": {
                    "type": "boolean"
                  },
                  "defaultRoles": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "viewer",
                        "author",
                        "editor",
                        "manager",
                        "admin"
                      ]
                    },
                    "maxItems": 5
                  },
                  "groupClaim": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 200
                  },
                  "groupRoleMap": {
                    "type": "object",
                    "additionalProperties": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "viewer",
                          "author",
                          "editor",
                          "manager",
                          "admin"
                        ]
                      },
                      "maxItems": 5
                    }
                  },
                  "allowedDomains": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "maxLength": 253
                    },
                    "maxItems": 100
                  },
                  "githubOrgs": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "maxLength": 40
                    },
                    "maxItems": 100
                  },
                  "githubUsers": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "maxLength": 40
                    },
                    "maxItems": 500
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/sso/providers/public": {
      "get": {
        "operationId": "getApiSsoProvidersPublic",
        "tags": [
          "Enterprise sign-in (SSO)"
        ],
        "summary": "Public, before the :id routes so \"public\" is never read as an id.",
        "description": "Public, before the :id routes so \"public\" is never read as an id.\n\nContract: Public: GET /api/sso/providers/public → SsoPublicProvider[] (enabled only)\n\nPublic, or checks access itself (see the description).",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/sso/providers/{id}": {
      "get": {
        "operationId": "getApiSsoProvidersId",
        "tags": [
          "Enterprise sign-in (SSO)"
        ],
        "summary": "GET /api/sso/providers/{id}",
        "description": "Public, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "operationId": "putApiSsoProvidersId",
        "tags": [
          "Enterprise sign-in (SSO)"
        ],
        "summary": "PUT /api/sso/providers/{id}",
        "description": "Public, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "slug": {
                    "type": "string",
                    "x-pattern": "SSO_SLUG_RE"
                  },
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "protocol": {
                    "type": "string",
                    "enum": [
                      "oidc",
                      "saml",
                      "github",
                      "cas"
                    ]
                  },
                  "enabled": {
                    "type": "boolean"
                  },
                  "issuer": {
                    "type": "string",
                    "maxLength": 2000
                  },
                  "clientId": {
                    "type": "string",
                    "maxLength": 500
                  },
                  "clientSecret": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 2000
                  },
                  "scopes": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 100
                    },
                    "maxItems": 20
                  },
                  "entryPoint": {
                    "type": "string",
                    "maxLength": 2000
                  },
                  "idpCert": {
                    "type": "string",
                    "maxLength": 20000
                  },
                  "spEntityId": {
                    "type": "string",
                    "maxLength": 500
                  },
                  "authParams": {
                    "type": "object",
                    "additionalProperties": {
                      "type": "string",
                      "maxLength": 500
                    }
                  },
                  "emailAttribute": {
                    "type": "string",
                    "maxLength": 100
                  },
                  "emailDomain": {
                    "type": "string",
                    "maxLength": 253
                  },
                  "nameAttribute": {
                    "type": "string",
                    "maxLength": 100
                  },
                  "accountsOnly": {
                    "type": "boolean"
                  },
                  "jitProvisioning": {
                    "type": "boolean"
                  },
                  "defaultRoles": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "viewer",
                        "author",
                        "editor",
                        "manager",
                        "admin"
                      ]
                    },
                    "maxItems": 5
                  },
                  "groupClaim": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 200
                  },
                  "groupRoleMap": {
                    "type": "object",
                    "additionalProperties": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "viewer",
                          "author",
                          "editor",
                          "manager",
                          "admin"
                        ]
                      },
                      "maxItems": 5
                    }
                  },
                  "allowedDomains": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "maxLength": 253
                    },
                    "maxItems": 100
                  },
                  "githubOrgs": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "maxLength": 40
                    },
                    "maxItems": 100
                  },
                  "githubUsers": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "maxLength": 40
                    },
                    "maxItems": 500
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "operationId": "deleteApiSsoProvidersId",
        "tags": [
          "Enterprise sign-in (SSO)"
        ],
        "summary": "Admin (users.manage): GET/POST /api/sso/providers, GET/PUT/DELETE /api/sso/providers/:id, POST /api/sso/provid",
        "description": "Contract: Admin (users.manage): GET/POST /api/sso/providers, GET/PUT/DELETE /api/sso/providers/:id, POST /api/sso/providers/:id/test (OIDC: fetch discovery + JWKS, report issuer/endpoints; SAML: parse cert, report SP metadata URL)\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/sso/providers/{id}/scim": {
      "get": {
        "operationId": "getApiSsoProvidersIdScim",
        "tags": [
          "Enterprise sign-in (SSO)"
        ],
        "summary": "The SCIM base URL, the token's public record, the last sync and the last 20 SCIM audit events.",
        "description": "The SCIM base URL, the token's public record, the last sync and the last 20 SCIM audit events.\n\nContract: GET    /api/sso/providers/:id/scim        → ScimStatus (base URL, the token's public record, last sync, the last 20 SCIM audit events)\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/sso/providers/{id}/scim-token": {
      "post": {
        "operationId": "postApiSsoProvidersIdScimToken",
        "tags": [
          "Enterprise sign-in (SSO)"
        ],
        "summary": "Rotates the provider's SCIM token: the previous one stops working, the new secret is shown once (201).",
        "description": "Rotates the provider's SCIM token: the previous one stops working, the new secret is shown once (201).\n\nContract: POST   /api/sso/providers/:id/scim-token  → ScimTokenCreateResponse (201; rotates: the previous token stops working, the secret is shown once)\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "operationId": "deleteApiSsoProvidersIdScimToken",
        "tags": [
          "Enterprise sign-in (SSO)"
        ],
        "summary": "DELETE /api/sso/providers/:id/scim-token  → 204 (revokes without replacement)",
        "description": "Contract: DELETE /api/sso/providers/:id/scim-token  → 204 (revokes without replacement)\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/sso/providers/{id}/test": {
      "post": {
        "operationId": "postApiSsoProvidersIdTest",
        "tags": [
          "Enterprise sign-in (SSO)"
        ],
        "summary": "POST /api/sso/providers/:id/test → what the IdP answered (OIDC: discovery and JWKS; SAML: the certificate and ",
        "description": "Contract: POST /api/sso/providers/:id/test → what the IdP answered (OIDC: discovery and JWKS; SAML: the certificate and the SP metadata URL). */\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/stripe": {
      "get": {
        "operationId": "getApiStripe",
        "tags": [
          "Stripe"
        ],
        "summary": "GET /api/stripe → StripeStatus; PUT /api/stripe (StripeSettingsInput) → StripeStatus (site.settings)",
        "description": "Contract: GET /api/stripe → StripeStatus; PUT /api/stripe (StripeSettingsInput) → StripeStatus (site.settings). The keys are write-only and\n\nPermission: `integrations.manage`.",
        "x-permission": [
          "integrations.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "operationId": "putApiStripe",
        "tags": [
          "Stripe"
        ],
        "summary": "GET /api/stripe → StripeStatus; PUT /api/stripe (StripeSettingsInput) → StripeStatus (site.settings)",
        "description": "Contract: GET /api/stripe → StripeStatus; PUT /api/stripe (StripeSettingsInput) → StripeStatus (site.settings). The keys are write-only and\n\nPermission: `integrations.manage`.",
        "x-permission": [
          "integrations.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "secretKey": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 300
                  },
                  "webhookSecret": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 300
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/stripe/webhook/{siteId}": {
      "post": {
        "operationId": "postApiStripeWebhookSiteId",
        "tags": [
          "Stripe"
        ],
        "summary": "The webhook: verified against the site's signing secret, then a Checkout Session event moves its submission on",
        "description": "The webhook: verified against the site's signing secret, then a Checkout Session event moves its submission on. Anything we do\nnot act on is acknowledged with 200 so Stripe stops retrying; only a bad signature (400) or a failure of ours (5xx) is retried.\n\nContract: POST /api/stripe/webhook/:siteId (public, verified by the Stripe-Signature header with the webhook signing secret, 5 minutes'\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "siteId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/suggestions": {
      "get": {
        "operationId": "getApiSuggestions",
        "tags": [
          "Suggestions"
        ],
        "summary": "In lists across items (GET /api/suggestions): the item the suggestion is for",
        "description": "Contract: In lists across items (GET /api/suggestions): the item the suggestion is for. */\n\nRequires a signed-in user (cookie session or bearer token).",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/suggestions/{id}/apply": {
      "post": {
        "operationId": "postApiSuggestionsIdApply",
        "tags": [
          "Suggestions"
        ],
        "summary": "POST   /api/suggestions/:id/apply ApplySuggestionRequest (edit access to the item; publish also needs content.",
        "description": "Contract: POST   /api/suggestions/:id/apply ApplySuggestionRequest (edit access to the item; publish also needs content.publish) → { entity, suggestion }:\n\nRequires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "publish": {
                    "type": "boolean"
                  },
                  "force": {
                    "type": "boolean"
                  },
                  "note": {
                    "type": "string",
                    "maxLength": 2000
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/suggestions/{id}/decline": {
      "post": {
        "operationId": "postApiSuggestionsIdDecline",
        "tags": [
          "Suggestions"
        ],
        "summary": "POST   /api/suggestions/:id/decline DeclineSuggestionRequest (edit access to the item) → Suggestion",
        "description": "Contract: POST   /api/suggestions/:id/decline DeclineSuggestionRequest (edit access to the item) → Suggestion. Both emit suggestion.decided to the suggester.\n\nRequires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "note": {
                    "type": "string",
                    "maxLength": 2000
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/suggestions/{id}/diff": {
      "get": {
        "operationId": "getApiSuggestionsIdDiff",
        "tags": [
          "Suggestions"
        ],
        "summary": "GET    /api/suggestions/:id/diff (content.view_drafts) → RevisionDiff: `a` is the item's current revision, `b`",
        "description": "Contract: GET    /api/suggestions/:id/diff (content.view_drafts) → RevisionDiff: `a` is the item's current revision, `b` the suggestion (number 0).\n\nRequires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/system/backups": {
      "get": {
        "operationId": "getApiSystemBackups",
        "tags": [
          "System"
        ],
        "summary": "GET  /api/system/backups → BackupsResponse (users.manage): the instance configuration (no credentials), the la",
        "description": "Contract: GET  /api/system/backups → BackupsResponse (users.manage): the instance configuration (no credentials), the last BACKUP_RUN_KEEP runs and the restore state\n\nPublic, or checks access itself (see the description).",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/system/backups/run": {
      "post": {
        "operationId": "postApiSystemBackupsRun",
        "tags": [
          "System"
        ],
        "summary": "POST /api/system/backups/run → BackupRun (users.manage; 201 when it succeeded, 500 with the row when it failed",
        "description": "Contract: POST /api/system/backups/run → BackupRun (users.manage; 201 when it succeeded, 500 with the row when it failed; 400 without BACKUP_TARGET)\n\nPublic, or checks access itself (see the description).",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/system/backups/{id}/restore": {
      "get": {
        "operationId": "getApiSystemBackupsIdRestore",
        "tags": [
          "System"
        ],
        "summary": "Restore from the admin (backup/admin-restore.ts): what a run replaces, then the job; both need system.restore.",
        "description": "Restore from the admin (backup/admin-restore.ts): what a run replaces, then the job; both need system.restore.\n\nContract: GET  /api/system/backups/:id/restore → RestorePlan (system.restore): what restoring that run replaces, read from its backup.json\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "operationId": "postApiSystemBackupsIdRestore",
        "tags": [
          "System"
        ],
        "summary": "POST /api/system/backups/:id/restore { confirm } → RestoreJob (system.restore; 202): backs up the instance as ",
        "description": "Contract: POST /api/system/backups/:id/restore { confirm } → RestoreJob (system.restore; 202): backs up the instance as it is now (trigger\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "202": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/system/go-live": {
      "get": {
        "operationId": "getApiSystemGoLive",
        "tags": [
          "System"
        ],
        "summary": "What is left before launch (the Go live screen); read-only, so no audit row.",
        "description": "What is left before launch (the Go live screen); read-only, so no audit row.\n\nContract: GET /api/system/go-live → GoLiveReport (users.manage). Checks, in order: `address` (BASE_URL set, https, not a local host),\n\nPublic, or checks access itself (see the description).",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/system/restore/undo": {
      "post": {
        "operationId": "postApiSystemRestoreUndo",
        "tags": [
          "System"
        ],
        "summary": "POST /api/system/restore/undo { confirm } → LastRestore (system.restore; 202): within RESTORE_UNDO_HOURS of a ",
        "description": "Contract: POST /api/system/restore/undo { confirm } → LastRestore (system.restore; 202): within RESTORE_UNDO_HOURS of a restore, restarts\n\nPublic, or checks access itself (see the description).",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "202": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/theme/export": {
      "get": {
        "operationId": "getApiThemeExport",
        "tags": [
          "Theme"
        ],
        "summary": "GET /api/theme/tokens.css → :root block as text/css (public, tag theme)",
        "description": "Contract: GET /api/theme/tokens.css → :root block as text/css (public, tag theme). GET /api/theme/export → DTCG JSON of the current theme (any user).\n\nRequires a signed-in user (cookie session or bearer token).",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/theme/import": {
      "post": {
        "operationId": "postApiThemeImport",
        "tags": [
          "Theme"
        ],
        "summary": "POST /api/theme/import { format: 'w3c'|'figma'|'css'|'tailwind-json'|'auto', content: string } → TokenImportRe",
        "description": "Contract: POST /api/theme/import { format: 'w3c'|'figma'|'css'|'tailwind-json'|'auto', content: string } → TokenImportResult (site.settings). Does not save.\n\nPermission: `brand.manage`.",
        "x-permission": [
          "brand.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "format": {
                    "type": "string",
                    "enum": [
                      "w3c",
                      "figma",
                      "css",
                      "tailwind-json",
                      "auto"
                    ],
                    "default": "auto"
                  },
                  "content": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "content"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/theme/tokens.css": {
      "get": {
        "operationId": "getApiThemeTokensCss",
        "tags": [
          "Theme"
        ],
        "summary": "GET /api/theme/tokens.css → :root block as text/css (public, tag theme)",
        "description": "Contract: GET /api/theme/tokens.css → :root block as text/css (public, tag theme). GET /api/theme/export → DTCG JSON of the current theme (any user).\n\nPublic, or checks access itself (see the description).",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/tokens": {
      "get": {
        "operationId": "getApiTokens",
        "tags": [
          "Tokens"
        ],
        "summary": "GET /api/tokens (own tokens; users.manage sees all), POST /api/tokens ({ label, permissions?, expiresInDays? }",
        "description": "Contract: GET /api/tokens (own tokens; users.manage sees all), POST /api/tokens ({ label, permissions?, expiresInDays? }) → { token: ApiToken; secret: string } (secret shown once; stored as sha256), PUT /api/tokens/:id ({ label?, permissions? } → ApiToken; the owner only, from a browser session, within the owner's permissions; the secret and expiry stay), DELETE /api/tokens/:id.\n\nRequires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "all",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "operationId": "postApiTokens",
        "tags": [
          "Tokens"
        ],
        "summary": "GET /api/tokens (own tokens; users.manage sees all), POST /api/tokens ({ label, permissions?, expiresInDays? }",
        "description": "Contract: GET /api/tokens (own tokens; users.manage sees all), POST /api/tokens ({ label, permissions?, expiresInDays? }) → { token: ApiToken; secret: string } (secret shown once; stored as sha256), PUT /api/tokens/:id ({ label?, permissions? } → ApiToken; the owner only, from a browser session, within the owner's permissions; the secret and expiry stay), DELETE /api/tokens/:id.\n\nRequires a signed-in user (cookie session or bearer token).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "permissions": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "maxItems": 500
                  },
                  "expiresInDays": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 1
                  }
                },
                "required": [
                  "label"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/tokens/{id}": {
      "put": {
        "operationId": "putApiTokensId",
        "tags": [
          "Tokens"
        ],
        "summary": "Edit a token's label or permissions in place, so a token in use keeps its secret",
        "description": "Edit a token's label or permissions in place, so a token in use keeps its secret. Only its owner may: the permissions\n\nare checked against the owner's, and an administrator who could raise them would hand the owner what their roles do not.\n\nContract: GET /api/tokens (own tokens; users.manage sees all), POST /api/tokens ({ label, permissions?, expiresInDays? }) → { token: ApiToken; secret: string } (secret shown once; stored as sha256), PUT /api/tokens/:id ({ label?, permissions? } → ApiToken; the owner only, from a browser session, within the owner's permissions; the secret and expiry stay), DELETE /api/tokens/:id.\n\nRequires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "permissions": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "maxItems": 500
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "operationId": "deleteApiTokensId",
        "tags": [
          "Tokens"
        ],
        "summary": "DELETE /api/tokens/{id}",
        "description": "Requires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/translations/status": {
      "get": {
        "operationId": "getApiTranslationsStatus",
        "tags": [
          "Translations"
        ],
        "summary": "API: GET /api/entities/:id/translations → { group: Entity[]; missing: string[] }; POST /api/entities/:id/trans",
        "description": "Contract: API: GET /api/entities/:id/translations → { group: Entity[]; missing: string[] }; POST /api/entities/:id/translations ({ locale, mode: 'empty' | 'copy' | 'ai' }) → Entity (draft; 'ai' uses the translate task with the brand glossary and marks fields; requires ai.use); PUT marks outdated on source save; GET /api/entities?locale=; GET /api/translations/status → counts per locale and a list of outdated or missing items (content.view_drafts). Locale management: PUT /api/site { locales, defaultLocale, localePrefixDefault } validates BCP 47; removing a locale with content is refused unless ?force.\n\nPermission: `content.view_drafts`.",
        "x-permission": [
          "content.view_drafts"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/translations/{path}": {
      "get": {
        "operationId": "getApiTranslationsPath",
        "tags": [
          "Translations"
        ],
        "summary": "Keeps 401 vs 404 consistent with the entity router for anything else under /translations.",
        "description": "Keeps 401 vs 404 consistent with the entity router for anything else under /translations.\n\nRequires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "path",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "operationId": "postApiTranslationsPath",
        "tags": [
          "Translations"
        ],
        "summary": "Keeps 401 vs 404 consistent with the entity router for anything else under /translations.",
        "description": "Keeps 401 vs 404 consistent with the entity router for anything else under /translations.\n\nRequires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "path",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "operationId": "putApiTranslationsPath",
        "tags": [
          "Translations"
        ],
        "summary": "Keeps 401 vs 404 consistent with the entity router for anything else under /translations.",
        "description": "Keeps 401 vs 404 consistent with the entity router for anything else under /translations.\n\nRequires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "path",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "operationId": "deleteApiTranslationsPath",
        "tags": [
          "Translations"
        ],
        "summary": "Keeps 401 vs 404 consistent with the entity router for anything else under /translations.",
        "description": "Keeps 401 vs 404 consistent with the entity router for anything else under /translations.\n\nRequires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "path",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/types": {
      "get": {
        "operationId": "getApiTypes",
        "tags": [
          "Types"
        ],
        "summary": "GET /api/types → ContentType[]; POST /api/types (ContentTypeInput); GET/PUT/DELETE /api/types/:key */",
        "description": "Contract: GET /api/types → ContentType[]; POST /api/types (ContentTypeInput); GET/PUT/DELETE /api/types/:key */\n\nRequires a signed-in user (cookie session or bearer token).",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "operationId": "postApiTypes",
        "tags": [
          "Types"
        ],
        "summary": "GET /api/types → ContentType[]; POST /api/types (ContentTypeInput); GET/PUT/DELETE /api/types/:key */",
        "description": "Contract: GET /api/types → ContentType[]; POST /api/types (ContentTypeInput); GET/PUT/DELETE /api/types/:key */\n\nPermission: `types.manage`.",
        "x-permission": [
          "types.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string",
                    "x-pattern": "CONTENT_TYPE_KEY_RE"
                  },
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "labelPlural": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "description": {
                    "type": "string",
                    "maxLength": 2000
                  },
                  "icon": {
                    "type": "string",
                    "maxLength": 64
                  },
                  "hasPath": {
                    "type": "boolean"
                  },
                  "pathPattern": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "titleField": {
                    "type": "string",
                    "x-pattern": "FIELD_KEY_RE",
                    "default": "title"
                  },
                  "fields": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "key": {
                          "type": "string",
                          "x-pattern": "FIELD_KEY_RE"
                        },
                        "label": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "type": {
                          "type": "string",
                          "x-enum": "fieldTypes"
                        },
                        "required": {
                          "type": "boolean"
                        },
                        "multiple": {
                          "type": "boolean"
                        },
                        "help": {
                          "type": "string",
                          "maxLength": 1000
                        },
                        "aiHint": {
                          "type": "string",
                          "maxLength": 2000
                        },
                        "options": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "refType": {
                          "type": "string",
                          "x-pattern": "CONTENT_TYPE_KEY_RE"
                        },
                        "vocabulary": {
                          "type": "string",
                          "x-pattern": "CONTENT_TYPE_KEY_RE"
                        },
                        "default": {},
                        "translatable": {
                          "type": "boolean"
                        },
                        "searchable": {
                          "type": "boolean"
                        },
                        "placement": {
                          "type": "string",
                          "enum": [
                            "page",
                            "inline"
                          ]
                        },
                        "access": {
                          "type": "string",
                          "enum": [
                            "public",
                            "custom"
                          ]
                        },
                        "publicView": {
                          "type": "boolean"
                        },
                        "blocks": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 120
                          },
                          "maxItems": 200
                        }
                      },
                      "required": [
                        "key",
                        "label",
                        "type"
                      ]
                    },
                    "maxItems": 200
                  },
                  "defaultVisibility": {
                    "type": "object",
                    "properties": {
                      "audience": {
                        "type": "string",
                        "enum": [
                          "everyone",
                          "members",
                          "groups"
                        ]
                      },
                      "groups": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 100
                        },
                        "maxItems": 50
                      }
                    },
                    "required": [
                      "audience"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "key",
                  "label",
                  "labelPlural",
                  "hasPath",
                  "fields"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/types/{key}": {
      "get": {
        "operationId": "getApiTypesKey",
        "tags": [
          "Types"
        ],
        "summary": "GET /api/types/{key}",
        "description": "Requires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "operationId": "putApiTypesKey",
        "tags": [
          "Types"
        ],
        "summary": "PUT /api/types/{key}",
        "description": "Permission: `types.manage`.",
        "parameters": [
          {
            "name": "key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "types.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string",
                    "x-pattern": "CONTENT_TYPE_KEY_RE"
                  },
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "labelPlural": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "description": {
                    "type": "string",
                    "maxLength": 2000
                  },
                  "icon": {
                    "type": "string",
                    "maxLength": 64
                  },
                  "hasPath": {
                    "type": "boolean"
                  },
                  "pathPattern": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "titleField": {
                    "type": "string",
                    "x-pattern": "FIELD_KEY_RE",
                    "default": "title"
                  },
                  "fields": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "key": {
                          "type": "string",
                          "x-pattern": "FIELD_KEY_RE"
                        },
                        "label": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "type": {
                          "type": "string",
                          "x-enum": "fieldTypes"
                        },
                        "required": {
                          "type": "boolean"
                        },
                        "multiple": {
                          "type": "boolean"
                        },
                        "help": {
                          "type": "string",
                          "maxLength": 1000
                        },
                        "aiHint": {
                          "type": "string",
                          "maxLength": 2000
                        },
                        "options": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "refType": {
                          "type": "string",
                          "x-pattern": "CONTENT_TYPE_KEY_RE"
                        },
                        "vocabulary": {
                          "type": "string",
                          "x-pattern": "CONTENT_TYPE_KEY_RE"
                        },
                        "default": {},
                        "translatable": {
                          "type": "boolean"
                        },
                        "searchable": {
                          "type": "boolean"
                        },
                        "placement": {
                          "type": "string",
                          "enum": [
                            "page",
                            "inline"
                          ]
                        },
                        "access": {
                          "type": "string",
                          "enum": [
                            "public",
                            "custom"
                          ]
                        },
                        "publicView": {
                          "type": "boolean"
                        },
                        "blocks": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 120
                          },
                          "maxItems": 200
                        }
                      },
                      "required": [
                        "key",
                        "label",
                        "type"
                      ]
                    },
                    "maxItems": 200
                  },
                  "defaultVisibility": {
                    "type": "object",
                    "properties": {
                      "audience": {
                        "type": "string",
                        "enum": [
                          "everyone",
                          "members",
                          "groups"
                        ]
                      },
                      "groups": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 100
                        },
                        "maxItems": 50
                      }
                    },
                    "required": [
                      "audience"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "key",
                  "label",
                  "labelPlural",
                  "hasPath",
                  "fields"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "operationId": "deleteApiTypesKey",
        "tags": [
          "Types"
        ],
        "summary": "GET /api/types → ContentType[]; POST /api/types (ContentTypeInput); GET/PUT/DELETE /api/types/:key */",
        "description": "Contract: GET /api/types → ContentType[]; POST /api/types (ContentTypeInput); GET/PUT/DELETE /api/types/:key */\n\nPermission: `types.manage`.",
        "parameters": [
          {
            "name": "key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "types.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/updates": {
      "get": {
        "operationId": "getApiUpdates",
        "tags": [
          "Updates"
        ],
        "summary": "GET /api/updates[?refresh=1] (site.settings) → what has a newer version: Spillway itself (compared with the bu",
        "description": "Contract: GET /api/updates[?refresh=1] (site.settings) → what has a newer version: Spillway itself (compared with the build the registry\n\nPermission: `site.settings`.",
        "parameters": [
          {
            "name": "refresh",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "1",
                "true"
              ]
            }
          }
        ],
        "x-permission": [
          "site.settings"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/updates/apply": {
      "post": {
        "operationId": "postApiUpdatesApply",
        "tags": [
          "Updates"
        ],
        "summary": "Update all (updates/apply.ts)",
        "description": "Update all (updates/apply.ts). Opening it needs site.settings, like the screen; each item then needs what its single install\nroute needs (POST /api/kits/install-from-registry, POST /api/modules/install), and an item the caller may not update is\nskipped with the reason rather than failing the batch.\n\nContract: POST /api/updates/apply (UpdatesApplyInput, site.settings) → UpdatesApplyResponse: Update all. Installs the newest version of\n\nPermission: `site.settings`.",
        "x-permission": [
          "site.settings"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "only": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "maxItems": 500
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/updates/settings": {
      "get": {
        "operationId": "getApiUpdatesSettings",
        "tags": [
          "Updates"
        ],
        "summary": "GET /api/updates/settings (site.settings) → UpdateSettingsResponse: the settings, when the daily check last ra",
        "description": "Contract: GET /api/updates/settings (site.settings) → UpdateSettingsResponse: the settings, when the daily check last ran and which\n\nPermission: `site.settings`.",
        "x-permission": [
          "site.settings"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "operationId": "putApiUpdatesSettings",
        "tags": [
          "Updates"
        ],
        "summary": "PUT /api/updates/settings (UpdateSettingsInput; an administrator: users.manage from a global role) → UpdateSet",
        "description": "Contract: PUT /api/updates/settings (UpdateSettingsInput; an administrator: users.manage from a global role) → UpdateSettingsResponse;\n\nPermission: `site.settings`.",
        "x-permission": [
          "site.settings"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "emailAdmins": {
                    "type": "boolean"
                  },
                  "autoPatchModules": {
                    "type": "boolean"
                  },
                  "autoPatchSpillway": {
                    "type": "boolean"
                  },
                  "spillwayWindow": {
                    "type": "object",
                    "properties": {
                      "day": {
                        "type": [
                          "integer",
                          "null"
                        ],
                        "minimum": 0,
                        "maximum": 6
                      },
                      "hour": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 23
                      },
                      "hours": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 12
                      }
                    },
                    "required": [
                      "day",
                      "hour",
                      "hours"
                    ],
                    "additionalProperties": false
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/updates/spillway": {
      "get": {
        "operationId": "getApiUpdatesSpillway",
        "tags": [
          "Updates"
        ],
        "summary": "One-click Spillway updates (updates/one-click.ts, docs/dev/one-click-updates.md): the updater, the version Upd",
        "description": "One-click Spillway updates (updates/one-click.ts, docs/dev/one-click-updates.md): the updater, the version Update to installs\nand the current or last run with its checklist. The admin polls it while an update runs; each call reads the updater's\nprogress. Reading needs site.settings, like the screen; starting an update an administrator (users.manage from a global role).\n\nContract: GET /api/updates/spillway (site.settings) → SpillwayUpdaterStatus: whether this server can update Spillway itself with one\n\nPermission: `site.settings`.",
        "x-permission": [
          "site.settings"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "operationId": "postApiUpdatesSpillway",
        "tags": [
          "Updates"
        ],
        "summary": "POST /api/updates/spillway (SpillwayUpdateInput; an administrator: users.manage from a global role) → 202 Spil",
        "description": "Contract: POST /api/updates/spillway (SpillwayUpdateInput; an administrator: users.manage from a global role) → 202 SpillwayUpdaterStatus:\n\nPermission: `site.settings`.",
        "x-permission": [
          "site.settings"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "version": {
                    "type": "string",
                    "pattern": "^\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?$",
                    "maxLength": 64
                  }
                },
                "required": [
                  "version"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "202": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/users": {
      "get": {
        "operationId": "getApiUsers",
        "tags": [
          "Users"
        ],
        "summary": "Multisite: per-site and per-section role assignments (GET /api/users and /api/users/:id carry them; see the mu",
        "description": "Contract: Multisite: per-site and per-section role assignments (GET /api/users and /api/users/:id carry them; see the multisite contract). */\n\nPermission: `users.manage`.",
        "x-permission": [
          "users.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "operationId": "postApiUsers",
        "tags": [
          "Users"
        ],
        "summary": "GET /api/users → User[]; POST /api/users (CreateUserRequest) → CreateUserResponse (201)",
        "description": "Contract: GET /api/users → User[]; POST /api/users (CreateUserRequest) → CreateUserResponse (201)\n\nPermission: `users.manage`.",
        "x-permission": [
          "users.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string",
                    "format": "email",
                    "maxLength": 200
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "password": {
                    "type": "string"
                  },
                  "roles": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "viewer",
                        "author",
                        "editor",
                        "manager",
                        "admin"
                      ]
                    }
                  }
                },
                "required": [
                  "email",
                  "name",
                  "roles"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/users/names": {
      "get": {
        "operationId": "getApiUsersNames",
        "tags": [
          "Users"
        ],
        "summary": "Display names for everyone who can read drafts, so authors and reviewers see who wrote, edited or published so",
        "description": "Display names for everyone who can read drafts, so authors and reviewers see who wrote, edited or published something\n(revisions, activity, releases) instead of a dash. Names only: no emails, roles or sign-in data.\n\nContract: GET /api/users/names (content.view_drafts): display names only, for showing who wrote or published something. */\n\nPermission: `content.view_drafts`.",
        "x-permission": [
          "content.view_drafts"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/users/{id}": {
      "get": {
        "operationId": "getApiUsersId",
        "tags": [
          "Users"
        ],
        "summary": "GET /api/users/{id}",
        "description": "Permission: `users.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "users.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "operationId": "putApiUsersId",
        "tags": [
          "Users"
        ],
        "summary": "PUT /api/users/:id ({ name?, roles?, password? }) → User; DELETE /api/users/:id → 204",
        "description": "Contract: PUT /api/users/:id ({ name?, roles?, password? }) → User; DELETE /api/users/:id → 204\n\nPermission: `users.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "users.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "roles": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "viewer",
                        "author",
                        "editor",
                        "manager",
                        "admin"
                      ]
                    }
                  },
                  "password": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "operationId": "deleteApiUsersId",
        "tags": [
          "Users"
        ],
        "summary": "PUT /api/users/:id ({ name?, roles?, password? }) → User; DELETE /api/users/:id → 204",
        "description": "Contract: PUT /api/users/:id ({ name?, roles?, password? }) → User; DELETE /api/users/:id → 204\n\nPermission: `users.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "users.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/users/{id}/invite": {
      "post": {
        "operationId": "postApiUsersIdInvite",
        "tags": [
          "Users"
        ],
        "summary": "POST /api/users/:id/invite → PasswordLink: a new invite link for a user who has never signed in (password sign",
        "description": "Contract: POST /api/users/:id/invite → PasswordLink: a new invite link for a user who has never signed in (password sign-in, active);\n\nPermission: `users.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "users.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/users/{id}/password-reset": {
      "post": {
        "operationId": "postApiUsersIdPasswordReset",
        "tags": [
          "Users"
        ],
        "summary": "POST /api/users/:id/password-reset → PasswordLink: a reset link (1 hour) for an active user; 409 `sso_user` fo",
        "description": "Contract: POST /api/users/:id/password-reset → PasswordLink: a reset link (1 hour) for an active user; 409 `sso_user` for an SSO\n\nPermission: `users.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "users.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/users/{id}/section-roles": {
      "get": {
        "operationId": "getApiUsersIdSectionRoles",
        "tags": [
          "Users"
        ],
        "summary": "GET /api/users/{id}/section-roles",
        "description": "Permission: `users.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "users.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "operationId": "putApiUsersIdSectionRoles",
        "tags": [
          "Users"
        ],
        "summary": "GET /api/users/:id/site-roles → UserSiteRole[]",
        "description": "Contract: GET /api/users/:id/site-roles → UserSiteRole[]. PUT /api/users/:id/section-roles ({ sectionRoles: UserSectionRole[] }) → UserSectionRole[];\n\nPermission: `users.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "users.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "sectionRoles": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "sectionId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64
                        },
                        "roles": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "x-pattern": "ROLE_KEY_RE",
                            "maxLength": 63
                          },
                          "maxItems": 50
                        }
                      },
                      "required": [
                        "sectionId",
                        "roles"
                      ]
                    },
                    "maxItems": 500
                  }
                },
                "required": [
                  "sectionRoles"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/users/{id}/site-roles": {
      "get": {
        "operationId": "getApiUsersIdSiteRoles",
        "tags": [
          "Users"
        ],
        "summary": "GET /api/users/:id/site-roles → UserSiteRole[]",
        "description": "Contract: GET /api/users/:id/site-roles → UserSiteRole[]. PUT /api/users/:id/section-roles ({ sectionRoles: UserSectionRole[] }) → UserSectionRole[];\n\nPermission: `users.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "users.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "operationId": "putApiUsersIdSiteRoles",
        "tags": [
          "Users"
        ],
        "summary": "PUT /api/users/:id/site-roles ({ siteRoles: UserSiteRole[] }) → UserSiteRole[] replaces the user's site roles ",
        "description": "Contract: PUT /api/users/:id/site-roles ({ siteRoles: UserSiteRole[] }) → UserSiteRole[] replaces the user's site roles (an entry with roles: [] removes it);\n\nPermission: `users.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "users.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "siteRoles": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "siteId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64
                        },
                        "roles": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "x-pattern": "ROLE_KEY_RE",
                            "maxLength": 63
                          },
                          "maxItems": 50
                        }
                      },
                      "required": [
                        "siteId",
                        "roles"
                      ]
                    },
                    "maxItems": 200
                  }
                },
                "required": [
                  "siteRoles"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/users/{id}/two-step": {
      "delete": {
        "operationId": "deleteApiUsersIdTwoStep",
        "tags": [
          "Two step"
        ],
        "summary": "An administrator turns someone else's two-step off (they lost their phone and their codes); the person is emai",
        "description": "An administrator turns someone else's two-step off (they lost their phone and their codes); the person is emailed.\n\nContract: Administrators: DELETE /api/users/:id/two-step → 204 (users.manage, a global role for someone with global roles): turns another\n\nPermission: `users.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "users.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/views": {
      "get": {
        "operationId": "getApiViews",
        "tags": [
          "Views"
        ],
        "summary": "GET /api/views?table=<key> → SharedView[]: the shared views of that table the caller sees, each with `inAudien",
        "description": "Contract: GET /api/views?table=<key> → SharedView[]: the shared views of that table the caller sees, each with `inAudience` (any signed-in\n\nRequires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "table",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "operationId": "postApiViews",
        "tags": [
          "Views"
        ],
        "summary": "POST /api/views { table, name, view, roles?, isDefault? } → SharedView (201; `views.share`)",
        "description": "Contract: POST /api/views { table, name, view, roles?, isDefault? } → SharedView (201; `views.share`)\n\nPermission: `views.share`.",
        "x-permission": [
          "views.share"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "table": {
                    "type": "string",
                    "x-pattern": "VIEW_TABLE_RE"
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 60
                  },
                  "view": {
                    "type": "object",
                    "properties": {
                      "filters": {
                        "type": "object",
                        "additionalProperties": {
                          "type": "string",
                          "maxLength": 500
                        }
                      },
                      "sort": {
                        "type": "object",
                        "properties": {
                          "key": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "maxLength": 100
                          },
                          "dir": {
                            "type": "string",
                            "enum": [
                              "asc",
                              "desc"
                            ]
                          }
                        },
                        "required": [
                          "key",
                          "dir"
                        ]
                      },
                      "hidden": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "maxLength": 100
                        },
                        "maxItems": 100
                      },
                      "density": {
                        "type": "string",
                        "enum": [
                          "compact",
                          "default",
                          "comfortable"
                        ]
                      },
                      "limit": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 500
                      }
                    },
                    "required": [
                      "filters",
                      "sort",
                      "hidden",
                      "density"
                    ],
                    "additionalProperties": false
                  },
                  "roles": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "x-enum": "ROLES"
                    },
                    "default": []
                  },
                  "isDefault": {
                    "type": "boolean",
                    "default": false
                  }
                },
                "required": [
                  "table",
                  "name",
                  "view"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/views/{id}": {
      "put": {
        "operationId": "putApiViewsId",
        "tags": [
          "Views"
        ],
        "summary": "PUT /api/views/:id { name?, view?, roles?, isDefault? } → SharedView (`views.share`)",
        "description": "Contract: PUT /api/views/:id { name?, view?, roles?, isDefault? } → SharedView (`views.share`)\n\nPermission: `views.share`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "views.share"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 60
                  },
                  "view": {
                    "type": "object",
                    "properties": {
                      "filters": {
                        "type": "object",
                        "additionalProperties": {
                          "type": "string",
                          "maxLength": 500
                        }
                      },
                      "sort": {
                        "type": "object",
                        "properties": {
                          "key": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "maxLength": 100
                          },
                          "dir": {
                            "type": "string",
                            "enum": [
                              "asc",
                              "desc"
                            ]
                          }
                        },
                        "required": [
                          "key",
                          "dir"
                        ]
                      },
                      "hidden": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "maxLength": 100
                        },
                        "maxItems": 100
                      },
                      "density": {
                        "type": "string",
                        "enum": [
                          "compact",
                          "default",
                          "comfortable"
                        ]
                      },
                      "limit": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 500
                      }
                    },
                    "required": [
                      "filters",
                      "sort",
                      "hidden",
                      "density"
                    ],
                    "additionalProperties": false
                  },
                  "roles": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "x-enum": "ROLES"
                    }
                  },
                  "isDefault": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "operationId": "deleteApiViewsId",
        "tags": [
          "Views"
        ],
        "summary": "DELETE /api/views/:id → 204 (`views.share`)",
        "description": "Contract: DELETE /api/views/:id → 204 (`views.share`)\n\nPermission: `views.share`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "views.share"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/vocabularies": {
      "get": {
        "operationId": "getApiVocabularies",
        "tags": [
          "Vocabularies"
        ],
        "summary": "GET /api/vocabularies → Vocabulary[]; POST /api/vocabularies (VocabularyInput); GET/PUT/DELETE /api/vocabulari",
        "description": "Contract: GET /api/vocabularies → Vocabulary[]; POST /api/vocabularies (VocabularyInput); GET/PUT/DELETE /api/vocabularies/:id (types.manage for writes, any user reads;\n\nRequires a signed-in user (cookie session or bearer token).",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "operationId": "postApiVocabularies",
        "tags": [
          "Vocabularies"
        ],
        "summary": "GET /api/vocabularies → Vocabulary[]; POST /api/vocabularies (VocabularyInput); GET/PUT/DELETE /api/vocabulari",
        "description": "Contract: GET /api/vocabularies → Vocabulary[]; POST /api/vocabularies (VocabularyInput); GET/PUT/DELETE /api/vocabularies/:id (types.manage for writes, any user reads;\n\nPermission: `types.manage`.",
        "x-permission": [
          "types.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string",
                    "x-pattern": "CONTENT_TYPE_KEY_RE"
                  },
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "hierarchical": {
                    "type": "boolean",
                    "default": true
                  },
                  "description": {
                    "type": "string",
                    "maxLength": 2000
                  },
                  "termPathPattern": {
                    "type": "string",
                    "maxLength": 200
                  }
                },
                "required": [
                  "key",
                  "label"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/vocabularies/{id}": {
      "get": {
        "operationId": "getApiVocabulariesId",
        "tags": [
          "Vocabularies"
        ],
        "summary": "GET /api/vocabularies/{id}",
        "description": "Requires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "operationId": "putApiVocabulariesId",
        "tags": [
          "Vocabularies"
        ],
        "summary": "PUT /api/vocabularies/{id}",
        "description": "Permission: `types.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "types.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string",
                    "x-pattern": "CONTENT_TYPE_KEY_RE"
                  },
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "hierarchical": {
                    "type": "boolean",
                    "default": true
                  },
                  "description": {
                    "type": "string",
                    "maxLength": 2000
                  },
                  "termPathPattern": {
                    "type": "string",
                    "maxLength": 200
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "operationId": "deleteApiVocabulariesId",
        "tags": [
          "Vocabularies"
        ],
        "summary": "GET /api/vocabularies → Vocabulary[]; POST /api/vocabularies (VocabularyInput); GET/PUT/DELETE /api/vocabulari",
        "description": "Contract: GET /api/vocabularies → Vocabulary[]; POST /api/vocabularies (VocabularyInput); GET/PUT/DELETE /api/vocabularies/:id (types.manage for writes, any user reads;\n\nPermission: `types.manage`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "types.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/vocabularies/{id}/terms": {
      "get": {
        "operationId": "getApiVocabulariesIdTerms",
        "tags": [
          "Vocabularies"
        ],
        "summary": "The tree is public when the vocabulary has term pages (the paths are public anyway); otherwise any signed-in u",
        "description": "The tree is public when the vocabulary has term pages (the paths are public anyway); otherwise any signed-in user.\n\nContract: Nested shape returned by GET /api/vocabularies/:id/terms (ordered by weight, then label). */\n\nRequires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "operationId": "postApiVocabulariesIdTerms",
        "tags": [
          "Vocabularies"
        ],
        "summary": "POST /api/vocabularies/:id/terms (TermInput) → Term; PUT /api/vocabularies/:id/terms/:termId (Partial<TermInpu",
        "description": "Contract: POST /api/vocabularies/:id/terms (TermInput) → Term; PUT /api/vocabularies/:id/terms/:termId (Partial<TermInput>) → Term; DELETE → 204 (children move up to the parent).\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "slug": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "parentId": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 100
                  },
                  "description": {
                    "type": "string",
                    "maxLength": 2000
                  },
                  "weight": {
                    "type": "integer",
                    "minimum": -1000000,
                    "maximum": 1000000
                  },
                  "data": {
                    "type": "object",
                    "additionalProperties": {}
                  }
                },
                "required": [
                  "label"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/vocabularies/{id}/terms/reorder": {
      "post": {
        "operationId": "postApiVocabulariesIdTermsReorder",
        "tags": [
          "Vocabularies"
        ],
        "summary": "Before /terms/:termId so \"reorder\" is never read as a term id.",
        "description": "Before /terms/:termId so \"reorder\" is never read as a term id.\n\nContract: POST /api/vocabularies/:id/terms/reorder (TermMove[]) → TermNode[]: moves and re-weights the listed terms; a term cannot become its own descendant.\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "parentId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "minLength": 1
                    },
                    "weight": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "id",
                    "parentId",
                    "weight"
                  ]
                },
                "maxItems": 2000
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/vocabularies/{id}/terms/{termId}": {
      "put": {
        "operationId": "putApiVocabulariesIdTermsTermId",
        "tags": [
          "Vocabularies"
        ],
        "summary": "POST /api/vocabularies/:id/terms (TermInput) → Term; PUT /api/vocabularies/:id/terms/:termId (Partial<TermInpu",
        "description": "Contract: POST /api/vocabularies/:id/terms (TermInput) → Term; PUT /api/vocabularies/:id/terms/:termId (Partial<TermInput>) → Term; DELETE → 204 (children move up to the parent).\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "termId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "slug": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "parentId": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 100
                  },
                  "description": {
                    "type": "string",
                    "maxLength": 2000
                  },
                  "weight": {
                    "type": "integer",
                    "minimum": -1000000,
                    "maximum": 1000000
                  },
                  "data": {
                    "type": "object",
                    "additionalProperties": {}
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "operationId": "deleteApiVocabulariesIdTermsTermId",
        "tags": [
          "Vocabularies"
        ],
        "summary": "DELETE /api/vocabularies/{id}/terms/{termId}",
        "description": "Public, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "termId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/vocabularies/{id}/terms/{termId}/usage": {
      "get": {
        "operationId": "getApiVocabulariesIdTermsTermIdUsage",
        "tags": [
          "Vocabularies"
        ],
        "summary": "GET /api/vocabularies/{id}/terms/{termId}/usage",
        "description": "Requires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "termId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/workflows": {
      "get": {
        "operationId": "getApiWorkflows",
        "tags": [
          "Workflows"
        ],
        "summary": "GET /api/workflows → Workflow[] (any signed-in user): Editorial first, then the custom ones.",
        "description": "Contract: GET /api/workflows → Workflow[] (any signed-in user): Editorial first, then the custom ones.\n\nRequires a signed-in user (cookie session or bearer token).",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "operationId": "postApiWorkflows",
        "tags": [
          "Workflows"
        ],
        "summary": "POST /api/workflows (WorkflowInput) → 201 Workflow; PUT /api/workflows/:key; DELETE /api/workflows/:key (workf",
        "description": "Contract: POST /api/workflows (WorkflowInput) → 201 Workflow; PUT /api/workflows/:key; DELETE /api/workflows/:key (workflows.manage). A type\n\nPermission: `workflows.manage`.",
        "x-permission": [
          "workflows.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "states": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "label": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 120
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "draft",
                            "review",
                            "published",
                            "archived"
                          ]
                        }
                      },
                      "required": [
                        "label",
                        "status"
                      ]
                    },
                    "minItems": 1,
                    "maxItems": 20
                  },
                  "transitions": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "label": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 120
                        },
                        "from": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 41
                          },
                          "minItems": 1,
                          "maxItems": 20
                        },
                        "to": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 41
                        }
                      },
                      "required": [
                        "label",
                        "from",
                        "to"
                      ]
                    },
                    "maxItems": 40
                  },
                  "types": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "maxItems": 200,
                    "default": []
                  }
                },
                "required": [
                  "label",
                  "states",
                  "transitions"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/workflows/{key}": {
      "get": {
        "operationId": "getApiWorkflowsKey",
        "tags": [
          "Workflows"
        ],
        "summary": "GET /api/workflows/{key}",
        "description": "Requires a signed-in user (cookie session or bearer token).",
        "parameters": [
          {
            "name": "key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "operationId": "putApiWorkflowsKey",
        "tags": [
          "Workflows"
        ],
        "summary": "POST /api/workflows (WorkflowInput) → 201 Workflow; PUT /api/workflows/:key; DELETE /api/workflows/:key (workf",
        "description": "Contract: POST /api/workflows (WorkflowInput) → 201 Workflow; PUT /api/workflows/:key; DELETE /api/workflows/:key (workflows.manage). A type\n\nPermission: `workflows.manage`.",
        "parameters": [
          {
            "name": "key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "workflows.manage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "states": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "label": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 120
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "draft",
                            "review",
                            "published",
                            "archived"
                          ]
                        }
                      },
                      "required": [
                        "label",
                        "status"
                      ]
                    },
                    "minItems": 1,
                    "maxItems": 20
                  },
                  "transitions": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "label": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 120
                        },
                        "from": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 41
                          },
                          "minItems": 1,
                          "maxItems": 20
                        },
                        "to": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 41
                        }
                      },
                      "required": [
                        "label",
                        "from",
                        "to"
                      ]
                    },
                    "maxItems": 40
                  },
                  "types": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "maxItems": 200,
                    "default": []
                  },
                  "key": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 41
                  }
                },
                "required": [
                  "label",
                  "states",
                  "transitions"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "operationId": "deleteApiWorkflowsKey",
        "tags": [
          "Workflows"
        ],
        "summary": "POST /api/workflows (WorkflowInput) → 201 Workflow; PUT /api/workflows/:key; DELETE /api/workflows/:key (workf",
        "description": "Contract: POST /api/workflows (WorkflowInput) → 201 Workflow; PUT /api/workflows/:key; DELETE /api/workflows/:key (workflows.manage). A type\n\nPermission: `workflows.manage`.",
        "parameters": [
          {
            "name": "key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "workflows.manage"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/workstreams": {
      "get": {
        "operationId": "getApiWorkstreams",
        "tags": [
          "Workstreams"
        ],
        "summary": "Deprecated alias of GET /api/releases",
        "description": "Deprecated: the former path of `GET /api/releases`, which it answers exactly like.\n\nContract: GET /api/releases?status= → Workstream[] (content.view_drafts); POST /api/releases (WorkstreamInput) → Workstream (content.create; the caller owns it)\n\nPermission: `content.view_drafts`.",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "x-enum": "WORKSTREAM_STATUSES as unknown as [string, ...string[]]"
            }
          }
        ],
        "x-permission": [
          "content.view_drafts"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        },
        "deprecated": true
      },
      "post": {
        "operationId": "postApiWorkstreams",
        "tags": [
          "Workstreams"
        ],
        "summary": "Deprecated alias of POST /api/releases",
        "description": "Deprecated: the former path of `POST /api/releases`, which it answers exactly like.\n\nContract: GET /api/releases?status= → Workstream[] (content.view_drafts); POST /api/releases (WorkstreamInput) → Workstream (content.create; the caller owns it)\n\nPermission: `content.create`.",
        "x-permission": [
          "content.create"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string",
                    "x-pattern": "WORKSTREAM_KEY_RE"
                  },
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "description": {
                    "type": "string",
                    "maxLength": 2000
                  }
                },
                "required": [
                  "label"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        },
        "deprecated": true
      }
    },
    "/api/workstreams/{id}": {
      "get": {
        "operationId": "getApiWorkstreamsId",
        "tags": [
          "Workstreams"
        ],
        "summary": "Deprecated alias of GET /api/releases/{id}",
        "description": "Deprecated: the former path of `GET /api/releases/{id}`, which it answers exactly like.\n\nContract: GET /api/releases/:id → Workstream & { items: WorkstreamItem[] }; PUT /api/releases/:id ({ label?, description? }); DELETE /api/releases/:id → 204\n\nPermission: `content.view_drafts`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "content.view_drafts"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        },
        "deprecated": true
      },
      "put": {
        "operationId": "putApiWorkstreamsId",
        "tags": [
          "Workstreams"
        ],
        "summary": "Deprecated alias of PUT /api/releases/{id}",
        "description": "Deprecated: the former path of `PUT /api/releases/{id}`, which it answers exactly like.\n\nContract: GET /api/releases/:id → Workstream & { items: WorkstreamItem[] }; PUT /api/releases/:id ({ label?, description? }); DELETE /api/releases/:id → 204\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "description": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 2000
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        },
        "deprecated": true
      },
      "delete": {
        "operationId": "deleteApiWorkstreamsId",
        "tags": [
          "Workstreams"
        ],
        "summary": "Deprecated alias of DELETE /api/releases/{id}",
        "description": "Deprecated: the former path of `DELETE /api/releases/{id}`, which it answers exactly like.\n\nContract: GET /api/releases/:id → Workstream & { items: WorkstreamItem[] }; PUT /api/releases/:id ({ label?, description? }); DELETE /api/releases/:id → 204\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        },
        "deprecated": true
      }
    },
    "/api/workstreams/{id}/diff": {
      "get": {
        "operationId": "getApiWorkstreamsIdDiff",
        "tags": [
          "Workstreams"
        ],
        "summary": "Deprecated alias of GET /api/releases/{id}/diff",
        "description": "Deprecated: the former path of `GET /api/releases/{id}/diff`, which it answers exactly like.\n\nContract: GET /api/releases/:id/diff → WorkstreamDiff: every item with the number of changed fields and layout blocks (content/diff.ts) and its pre-publish checks.\n\nPermission: `content.view_drafts`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "content.view_drafts"
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        },
        "deprecated": true
      }
    },
    "/api/workstreams/{id}/discard": {
      "post": {
        "operationId": "postApiWorkstreamsIdDiscard",
        "tags": [
          "Workstreams"
        ],
        "summary": "Deprecated alias of POST /api/releases/{id}/discard",
        "description": "Deprecated: the former path of `POST /api/releases/{id}/discard`, which it answers exactly like.\n\nContract: POST /api/releases/:id/discard → Workstream (status discarded; the release's revisions, overlays and entities created inside it are deleted)\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        },
        "deprecated": true
      }
    },
    "/api/workstreams/{id}/merge": {
      "post": {
        "operationId": "postApiWorkstreamsIdMerge",
        "tags": [
          "Workstreams"
        ],
        "summary": "Deprecated alias of POST /api/releases/{id}/merge",
        "description": "Deprecated: the former path of `POST /api/releases/{id}/merge`, which it answers exactly like.\n\nContract: POST /api/releases/:id/merge ({ force?: boolean }) → WorkstreamMergeResult (content.publish). Publishes every item through the normal publish path\n\nPermission: `content.publish`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "content.publish"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "force": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        },
        "deprecated": true
      }
    },
    "/api/workstreams/{id}/schedule": {
      "post": {
        "operationId": "postApiWorkstreamsIdSchedule",
        "tags": [
          "Workstreams"
        ],
        "summary": "Deprecated alias of POST /api/releases/{id}/schedule",
        "description": "Deprecated: the former path of `POST /api/releases/{id}/schedule`, which it answers exactly like.\n\nContract: publishAt: string | null;  // set through POST /api/releases/:id/schedule; the ticker merges when it comes\n\nPermission: `content.publish`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-permission": [
          "content.publish"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "publishAt": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 40
                  }
                },
                "required": [
                  "publishAt"
                ]
              }
            }
          }
        },
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        },
        "deprecated": true
      }
    },
    "/api/workstreams/{id}/share-link": {
      "post": {
        "operationId": "postApiWorkstreamsIdShareLink",
        "tags": [
          "Workstreams"
        ],
        "summary": "Deprecated alias of POST /api/releases/{id}/share-link",
        "description": "Deprecated: the former path of `POST /api/releases/{id}/share-link`, which it answers exactly like.\n\nContract: POST /api/releases/:id/share-link → WorkstreamShareLink: a token valid WORKSTREAM_SHARE_DAYS that lets a stakeholder open the preview without a session.\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "cookieAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        },
        "deprecated": true
      }
    },
    "/feeds/{file}": {
      "get": {
        "operationId": "getFeedsFile",
        "tags": [
          "Feeds"
        ],
        "summary": "GET /feeds/{file}",
        "description": "Public, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "file",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/healthz": {
      "get": {
        "operationId": "getHealthz",
        "tags": [
          "Health"
        ],
        "summary": "GET /healthz → { ok: true, version, outbound: 'on' | 'off' } (outbound: SPILLWAY_OUTBOUND, see MeResponse.outb",
        "description": "Contract: GET /healthz → { ok: true, version, outbound: 'on' | 'off' } (outbound: SPILLWAY_OUTBOUND, see MeResponse.outbound)\n\nPublic, or checks access itself (see the description).",
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/hosting/sign-in": {
      "get": {
        "operationId": "getHostingSignIn",
        "tags": [
          "Hosting sign in"
        ],
        "summary": "GET /hosting/sign-in",
        "description": "Public, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [],
        "responses": {
          "302": {
            "description": "Redirect"
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/llms-full.txt": {
      "get": {
        "operationId": "getLlmsFullTxt",
        "tags": [
          "SEO files"
        ],
        "summary": "The whole documentation as text, generated into docs/reference (or DOCS_DIR) by `pnpm docs:build`; gated like ",
        "description": "The whole documentation as text, generated into docs/reference (or DOCS_DIR) by `pnpm docs:build`; gated like llms.txt.\n\nPublic, or checks access itself (see the description).",
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/llms.txt": {
      "get": {
        "operationId": "getLlmsTxt",
        "tags": [
          "SEO files"
        ],
        "summary": "GET /llms.txt     when SiteSettings.seo.llmsTxt is true: site name, tagline, description and the published pag",
        "description": "Contract: GET /llms.txt     when SiteSettings.seo.llmsTxt is true: site name, tagline, description and the published pages with their paths and summaries\n\nPublic, or checks access itself (see the description).",
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/mcp": {
      "post": {
        "operationId": "postMcp",
        "tags": [
          "MCP"
        ],
        "summary": "MCP: POST /mcp (Streamable HTTP, JSON-RPC 2.0) and GET /mcp for the SSE stream if implemented",
        "description": "Contract: MCP: POST /mcp (Streamable HTTP, JSON-RPC 2.0) and GET /mcp for the SSE stream if implemented. Auth: a bearer token, an API token or an OAuth access token (see \"Sign in to MCP with OAuth\"). The server exposes:\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "toolsets",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "get": {
        "operationId": "getMcp",
        "tags": [
          "MCP"
        ],
        "summary": "MCP: POST /mcp (Streamable HTTP, JSON-RPC 2.0) and GET /mcp for the SSE stream if implemented",
        "description": "Contract: MCP: POST /mcp (Streamable HTTP, JSON-RPC 2.0) and GET /mcp for the SSE stream if implemented. Auth: a bearer token, an API token or an OAuth access token (see \"Sign in to MCP with OAuth\"). The server exposes:\n\nPublic, or checks access itself (see the description).",
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "operationId": "deleteMcp",
        "tags": [
          "MCP"
        ],
        "summary": "DELETE /mcp",
        "description": "Public, or checks access itself (see the description).",
        "security": [],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/media/{id}/{filename}": {
      "get": {
        "operationId": "getMediaIdFilename",
        "tags": [
          "Media"
        ],
        "summary": "GET /media/:id/:filename → the file (public)",
        "description": "Contract: GET /media/:id/:filename → the file (public). A captions file (.vtt) must start with WEBVTT (400 otherwise) and is served as\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "filename",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [],
        "responses": {
          "302": {
            "description": "Redirect"
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/modules/{path}": {
      "get": {
        "operationId": "getModulesPath",
        "tags": [
          "Modules"
        ],
        "summary": "GET /modules/{path}",
        "description": "Public, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "path",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/oauth/authorize": {
      "get": {
        "operationId": "getOauthAuthorize",
        "tags": [
          "Oauth"
        ],
        "summary": "GET /oauth/authorize ?response_type=code&client_id&redirect_uri&code_challenge&code_challenge_method=S256&stat",
        "description": "Contract: GET /oauth/authorize ?response_type=code&client_id&redirect_uri&code_challenge&code_challenge_method=S256&state&scope&resource\n\nPublic, or checks access itself (see the description).",
        "security": [],
        "responses": {
          "302": {
            "description": "Redirect"
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/oauth/consent": {
      "get": {
        "operationId": "getOauthConsent",
        "tags": [
          "Oauth"
        ],
        "summary": "GET /oauth/consent?request=<id>: signed out, 302 to /admin/login?next=<this page> (password, two-step, SSO; Op",
        "description": "Contract: GET /oauth/consent?request=<id>: signed out, 302 to /admin/login?next=<this page> (password, two-step, SSO; Open admin from a\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "request",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [],
        "responses": {
          "302": {
            "description": "Redirect"
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "operationId": "postOauthConsent",
        "tags": [
          "Oauth"
        ],
        "summary": "POST /oauth/consent (form: request, csrf, decision allow|deny, write on|absent) → 303 to the redirect URI with",
        "description": "Contract: POST /oauth/consent (form: request, csrf, decision allow|deny, write on|absent) → 303 to the redirect URI with `code`, `state`\n\nPublic, or checks access itself (see the description).",
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "security": [],
        "responses": {
          "302": {
            "description": "Redirect"
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/oauth/register": {
      "post": {
        "operationId": "postOauthRegister",
        "tags": [
          "Oauth"
        ],
        "summary": "POST /oauth/register (RFC 7591, JSON) { redirect_uris, client_name?, grant_types?, response_types?, token_endp",
        "description": "Contract: POST /oauth/register (RFC 7591, JSON) { redirect_uris, client_name?, grant_types?, response_types?, token_endpoint_auth_method? }\n\nPublic, or checks access itself (see the description).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "security": [],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/oauth/revoke": {
      "post": {
        "operationId": "postOauthRevoke",
        "tags": [
          "Oauth"
        ],
        "summary": "RFC 7009: the answer is 200 whether or not the token was known, so it cannot be used to test tokens.",
        "description": "RFC 7009: the answer is 200 whether or not the token was known, so it cannot be used to test tokens.\n\nContract: POST /oauth/revoke (RFC 7009) token[&token_type_hint]&client_id → 200 always; the token's grant ends (`oauth.grant.revoke`).\n\nPublic, or checks access itself (see the description).",
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/oauth/token": {
      "post": {
        "operationId": "postOauthToken",
        "tags": [
          "Oauth"
        ],
        "summary": "POST /oauth/token (form or JSON):",
        "description": "Contract: POST /oauth/token (form or JSON):\n\nPublic, or checks access itself (see the description).",
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/openapi.json": {
      "get": {
        "operationId": "getOpenapiJson",
        "tags": [
          "SEO files"
        ],
        "summary": "The HTTP API as OpenAPI 3.1, from the same folder; served whenever the file exists.",
        "description": "The HTTP API as OpenAPI 3.1, from the same folder; served whenever the file exists.\n\nPublic, or checks access itself (see the description).",
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/registry/v1/advisories": {
      "get": {
        "operationId": "getRegistryV1Advisories",
        "tags": [
          "Registry"
        ],
        "summary": "immutable; anything else 404), GET /registry/v1/advisories?package= → Advisory[], GET /registry/v1/publishers/",
        "description": "Contract: immutable; anything else 404), GET /registry/v1/advisories?package= → Advisory[], GET /registry/v1/publishers/:handle →\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "package",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/registry/v1/core.json": {
      "get": {
        "operationId": "getRegistryV1CoreJson",
        "tags": [
          "Registry"
        ],
        "summary": "The build this registry host runs, with its release notes and the image digests of recent releases (updates/fe",
        "description": "The build this registry host runs, with its release notes and the image digests of recent releases (updates/feed.ts):\n\ninstances compare their own build with it to offer an update, and read `security` and `summary` for the email and the banner.\n\nSigned with the index's key when the host has one: one-click updates install only a digest from a signed feed\n\n(updates/images.ts, docs/dev/one-click-updates.md).\n\nContract: GET /registry/v1/core.json on a registry host (no auth, cached five minutes): the build the host runs, plus what its release\n\nPublic, or checks access itself (see the description).",
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/registry/v1/index.json": {
      "get": {
        "operationId": "getRegistryV1IndexJson",
        "tags": [
          "Registry"
        ],
        "summary": "Public JSON (no auth, cached 60 s, CORS *): GET /registry/v1/index.json (the signed index the module system co",
        "description": "Contract: Public JSON (no auth, cached 60 s, CORS *): GET /registry/v1/index.json (the signed index the module system consumes: `modules` holds listed module\n\nPublic, or checks access itself (see the description).",
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/registry/v1/mirror/index.json": {
      "get": {
        "operationId": "getRegistryV1MirrorIndexJson",
        "tags": [
          "Registry"
        ],
        "summary": "GET /registry/v1/mirror/index.json",
        "description": "Public, or checks access itself (see the description).",
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/registry/v1/mirror/packages/{dir}/{file}": {
      "get": {
        "operationId": "getRegistryV1MirrorPackagesDirFile",
        "tags": [
          "Registry"
        ],
        "summary": "GET /registry/v1/mirror/packages/{dir}/{file}",
        "description": "Public, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "dir",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "file",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/registry/v1/orgs/{handle}": {
      "get": {
        "operationId": "getRegistryV1OrgsHandle",
        "tags": [
          "Registry"
        ],
        "summary": "An organization's public page: the profile, its members by handle and the packages of the namespaces it owns.",
        "description": "An organization's public page: the profile, its members by handle and the packages of the namespaces it owns.\n\nContract: GET /api/registry/orgs/:id (members and reviewers) and GET /registry/v1/orgs/:handle (public, `packages` instead of `namespaces`). */\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "handle",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/registry/v1/packages": {
      "get": {
        "operationId": "getRegistryV1Packages",
        "tags": [
          "Registry"
        ],
        "summary": "GET /registry/v1/packages?q=&kind=&tier=&sort=downloads|updated|name&page=&limit= → Paginated<RegistryPackage>",
        "description": "Contract: GET /registry/v1/packages?q=&kind=&tier=&sort=downloads|updated|name&page=&limit= → Paginated<RegistryPackage> (unreviewed trusted modules are\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "module",
                "theme",
                "kit",
                "brand",
                "components"
              ]
            }
          },
          {
            "name": "tier",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "trusted",
                "sandboxed"
              ]
            }
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "downloads",
                "updated",
                "name"
              ]
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "x-coerce": true,
              "minimum": 1,
              "default": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "x-coerce": true,
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "include",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "unreviewed"
              ]
            }
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/registry/v1/packages/{name}": {
      "get": {
        "operationId": "getRegistryV1PackagesName",
        "tags": [
          "Registry"
        ],
        "summary": "GET /registry/v1/packages/:name answers `org` (RegistryOrg | null) next to `publisher`; the public blocks show",
        "description": "Contract: GET /registry/v1/packages/:name answers `org` (RegistryOrg | null) next to `publisher`; the public blocks show \"by <org>\" linking /registry/orgs/<handle>.\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/registry/v1/packages/{name}/manifest.json": {
      "get": {
        "operationId": "getRegistryV1PackagesNameManifestJson",
        "tags": [
          "Registry"
        ],
        "summary": "Agent-readable: GET /registry/v1/packages/:name/manifest.json → AgentPackageManifest ({ name, kind, latest, in",
        "description": "Contract: Agent-readable: GET /registry/v1/packages/:name/manifest.json → AgentPackageManifest ({ name, kind, latest, install: { command }, capabilities,\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/registry/v1/packages/{name}/{second}": {
      "get": {
        "operationId": "getRegistryV1PackagesNameSecond",
        "tags": [
          "Registry"
        ],
        "summary": "Unencoded scoped names: /registry/v1/packages/@ns/name[/manifest.json | /:version/download | /:version/readme]",
        "description": "Unencoded scoped names: /registry/v1/packages/@ns/name[/manifest.json | /:version/download | /:version/readme]\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "second",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/registry/v1/packages/{name}/{second}/manifest.json": {
      "get": {
        "operationId": "getRegistryV1PackagesNameSecondManifestJson",
        "tags": [
          "Registry"
        ],
        "summary": "GET /registry/v1/packages/{name}/{second}/manifest.json",
        "description": "Public, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "second",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/registry/v1/packages/{name}/{second}/{version}/download": {
      "get": {
        "operationId": "getRegistryV1PackagesNameSecondVersionDownload",
        "tags": [
          "Registry"
        ],
        "summary": "GET /registry/v1/packages/{name}/{second}/{version}/download",
        "description": "Public, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "second",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "version",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/registry/v1/packages/{name}/{second}/{version}/files/{path}": {
      "get": {
        "operationId": "getRegistryV1PackagesNameSecondVersionFilesPath",
        "tags": [
          "Registry"
        ],
        "summary": "GET /registry/v1/packages/{name}/{second}/{version}/files/{path}",
        "description": "Public, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "second",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "version",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "path",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/registry/v1/packages/{name}/{second}/{version}/readme": {
      "get": {
        "operationId": "getRegistryV1PackagesNameSecondVersionReadme",
        "tags": [
          "Registry"
        ],
        "summary": "GET /registry/v1/packages/{name}/{second}/{version}/readme",
        "description": "Public, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "second",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "version",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/registry/v1/packages/{name}/{version}/download": {
      "get": {
        "operationId": "getRegistryV1PackagesNameVersionDownload",
        "tags": [
          "Registry"
        ],
        "summary": "GET /registry/v1/packages/:name/:version/download → the tarball (counts a download, 1 per IP per version per d",
        "description": "Contract: GET /registry/v1/packages/:name/:version/download → the tarball (counts a download, 1 per IP per version per day; yanked and rejected versions 410/404),\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "version",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/registry/v1/packages/{name}/{version}/files/{path}": {
      "get": {
        "operationId": "getRegistryV1PackagesNameVersionFilesPath",
        "tags": [
          "Registry"
        ],
        "summary": "GET /registry/v1/packages/{name}/{version}/files/{path}",
        "description": "Public, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "version",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "path",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/registry/v1/packages/{name}/{version}/readme": {
      "get": {
        "operationId": "getRegistryV1PackagesNameVersionReadme",
        "tags": [
          "Registry"
        ],
        "summary": "GET /registry/v1/packages/:name/:version/readme → markdown, GET /registry/v1/packages/:name/:version/files/<pa",
        "description": "Contract: GET /registry/v1/packages/:name/:version/readme → markdown, GET /registry/v1/packages/:name/:version/files/<path> → one file out of the stored tarball\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "version",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/registry/v1/publishers/{handle}": {
      "get": {
        "operationId": "getRegistryV1PublishersHandle",
        "tags": [
          "Registry"
        ],
        "summary": "immutable; anything else 404), GET /registry/v1/advisories?package= → Advisory[], GET /registry/v1/publishers/",
        "description": "Contract: immutable; anything else 404), GET /registry/v1/advisories?package= → Advisory[], GET /registry/v1/publishers/:handle →\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "handle",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/registry/v1/stats": {
      "get": {
        "operationId": "getRegistryV1Stats",
        "tags": [
          "Registry"
        ],
        "summary": "GET /registry/v1/stats */",
        "description": "Contract: GET /registry/v1/stats */\n\nPublic, or checks access itself (see the description).",
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/registry/{name}/preview": {
      "get": {
        "operationId": "getRegistryNamePreview",
        "tags": [
          "Registry"
        ],
        "summary": "GET /registry/{name}/preview",
        "description": "Public, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/registry/{name}/preview/{path}": {
      "get": {
        "operationId": "getRegistryNamePreviewPath",
        "tags": [
          "Registry"
        ],
        "summary": "GET /registry/{name}/preview/{path}",
        "description": "Public, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "path",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/registry/{name}/{second}/preview": {
      "get": {
        "operationId": "getRegistryNameSecondPreview",
        "tags": [
          "Registry"
        ],
        "summary": "GET /registry/{name}/{second}/preview",
        "description": "Public, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "second",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/registry/{name}/{second}/preview/{path}": {
      "get": {
        "operationId": "getRegistryNameSecondPreviewPath",
        "tags": [
          "Registry"
        ],
        "summary": "GET /registry/{name}/{second}/preview/{path}",
        "description": "Public, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "second",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "path",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/robots.txt": {
      "get": {
        "operationId": "getRobotsTxt",
        "tags": [
          "SEO files"
        ],
        "summary": "GET /robots.txt   from SiteSettings.seo.robots or a default that allows all and points at the sitemap",
        "description": "Contract: GET /robots.txt   from SiteSettings.seo.robots or a default that allows all and points at the sitemap\n\nPublic, or checks access itself (see the description).",
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/scim/v2/Groups": {
      "get": {
        "operationId": "getScimV2Groups",
        "tags": [
          "Scim"
        ],
        "summary": "GET /scim/v2/Groups (filter: displayName eq, externalId eq, id eq), GET /Groups/:id, POST /Groups (201; 409 on",
        "description": "Contract: GET /scim/v2/Groups (filter: displayName eq, externalId eq, id eq), GET /Groups/:id, POST /Groups (201; 409 on a duplicate displayName within the\n\nPublic, or checks access itself (see the description).",
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "operationId": "postScimV2Groups",
        "tags": [
          "Scim"
        ],
        "summary": "POST /scim/v2/Groups",
        "description": "Public, or checks access itself (see the description).",
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/scim/v2/Groups/{id}": {
      "get": {
        "operationId": "getScimV2GroupsId",
        "tags": [
          "Scim"
        ],
        "summary": "GET /scim/v2/Groups/{id}",
        "description": "Public, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "operationId": "putScimV2GroupsId",
        "tags": [
          "Scim"
        ],
        "summary": "PUT /scim/v2/Groups/{id}",
        "description": "Public, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "patch": {
        "operationId": "patchScimV2GroupsId",
        "tags": [
          "Scim"
        ],
        "summary": "PATCH /scim/v2/Groups/{id}",
        "description": "Public, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "operationId": "deleteScimV2GroupsId",
        "tags": [
          "Scim"
        ],
        "summary": "DELETE /scim/v2/Groups/{id}",
        "description": "Public, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/scim/v2/ResourceTypes": {
      "get": {
        "operationId": "getScimV2ResourceTypes",
        "tags": [
          "Scim"
        ],
        "summary": "GET /scim/v2/ResourceTypes",
        "description": "Public, or checks access itself (see the description).",
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/scim/v2/ResourceTypes/{id}": {
      "get": {
        "operationId": "getScimV2ResourceTypesId",
        "tags": [
          "Scim"
        ],
        "summary": "GET /scim/v2/ResourceTypes/{id}",
        "description": "Public, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/scim/v2/Schemas": {
      "get": {
        "operationId": "getScimV2Schemas",
        "tags": [
          "Scim"
        ],
        "summary": "GET /scim/v2/Schemas",
        "description": "Public, or checks access itself (see the description).",
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/scim/v2/Schemas/{id}": {
      "get": {
        "operationId": "getScimV2SchemasId",
        "tags": [
          "Scim"
        ],
        "summary": "GET /scim/v2/Schemas/{id}",
        "description": "Public, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/scim/v2/ServiceProviderConfig": {
      "get": {
        "operationId": "getScimV2ServiceProviderConfig",
        "tags": [
          "Scim"
        ],
        "summary": "GET /scim/v2/ServiceProviderConfig, /ResourceTypes, /Schemas (no authentication; static)",
        "description": "Contract: GET /scim/v2/ServiceProviderConfig, /ResourceTypes, /Schemas (no authentication; static)\n\nPublic, or checks access itself (see the description).",
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/scim/v2/Users": {
      "get": {
        "operationId": "getScimV2Users",
        "tags": [
          "Scim"
        ],
        "summary": "GET /scim/v2/Users?filter=&startIndex=&count=   filter: `userName eq \"x\"`, `emails.value eq \"x\"`, `emails[type",
        "description": "Contract: GET /scim/v2/Users?filter=&startIndex=&count=   filter: `userName eq \"x\"`, `emails.value eq \"x\"`, `emails[type eq \"work\"].value eq \"x\"`,\n\nPublic, or checks access itself (see the description).",
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "operationId": "postScimV2Users",
        "tags": [
          "Scim"
        ],
        "summary": "GET /scim/v2/Users/:id, POST /scim/v2/Users (201; 409 uniqueness when the userName/email exists), PUT /scim/v2",
        "description": "Contract: GET /scim/v2/Users/:id, POST /scim/v2/Users (201; 409 uniqueness when the userName/email exists), PUT /scim/v2/Users/:id (replace),\n\nPublic, or checks access itself (see the description).",
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/scim/v2/Users/{id}": {
      "get": {
        "operationId": "getScimV2UsersId",
        "tags": [
          "Scim"
        ],
        "summary": "GET /scim/v2/Users/:id, POST /scim/v2/Users (201; 409 uniqueness when the userName/email exists), PUT /scim/v2",
        "description": "Contract: GET /scim/v2/Users/:id, POST /scim/v2/Users (201; 409 uniqueness when the userName/email exists), PUT /scim/v2/Users/:id (replace),\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "operationId": "putScimV2UsersId",
        "tags": [
          "Scim"
        ],
        "summary": "GET /scim/v2/Users/:id, POST /scim/v2/Users (201; 409 uniqueness when the userName/email exists), PUT /scim/v2",
        "description": "Contract: GET /scim/v2/Users/:id, POST /scim/v2/Users (201; 409 uniqueness when the userName/email exists), PUT /scim/v2/Users/:id (replace),\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "patch": {
        "operationId": "patchScimV2UsersId",
        "tags": [
          "Scim"
        ],
        "summary": "PATCH /scim/v2/Users/{id}",
        "description": "Public, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "operationId": "deleteScimV2UsersId",
        "tags": [
          "Scim"
        ],
        "summary": "DELETE /scim/v2/Users/:id → 204 and the account is deactivated (never deleted: content keeps its author).",
        "description": "Contract: DELETE /scim/v2/Users/:id → 204 and the account is deactivated (never deleted: content keeps its author).\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/sitemap.xml": {
      "get": {
        "operationId": "getSitemapXml",
        "tags": [
          "SEO files"
        ],
        "summary": "GET /sitemap.xml  published entities with paths, lastmod = updatedAt",
        "description": "Contract: GET /sitemap.xml  published entities with paths, lastmod = updatedAt\n\nPublic, or checks access itself (see the description).",
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/sso/{slug}/acs": {
      "post": {
        "operationId": "postSsoSlugAcs",
        "tags": [
          "Enterprise sign-in (SSO)"
        ],
        "summary": "GET /sso/:slug/callback (OIDC, GitHub, CAS) and POST /sso/:slug/acs (SAML) → verify, find or provision user, m",
        "description": "Contract: GET /sso/:slug/callback (OIDC, GitHub, CAS) and POST /sso/:slug/acs (SAML) → verify, find or provision user, map roles, create session, redirect to `return` (same-origin paths only) or /admin; on failure redirect to /admin/login?error=<code>\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "security": [],
        "responses": {
          "302": {
            "description": "Redirect"
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/sso/{slug}/callback": {
      "get": {
        "operationId": "getSsoSlugCallback",
        "tags": [
          "Enterprise sign-in (SSO)"
        ],
        "summary": "GET /sso/:slug/callback (OIDC, GitHub, CAS) and POST /sso/:slug/acs (SAML) → verify, find or provision user, m",
        "description": "Contract: GET /sso/:slug/callback (OIDC, GitHub, CAS) and POST /sso/:slug/acs (SAML) → verify, find or provision user, map roles, create session, redirect to `return` (same-origin paths only) or /admin; on failure redirect to /admin/login?error=<code>\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "state",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "ticket",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "error",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "error_description",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "code",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [],
        "responses": {
          "302": {
            "description": "Redirect"
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/sso/{slug}/metadata": {
      "get": {
        "operationId": "getSsoSlugMetadata",
        "tags": [
          "Enterprise sign-in (SSO)"
        ],
        "summary": "GET /sso/:slug/metadata (SAML SP metadata XML)",
        "description": "Contract: GET /sso/:slug/metadata (SAML SP metadata XML)\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/sso/{slug}/start": {
      "get": {
        "operationId": "getSsoSlugStart",
        "tags": [
          "Enterprise sign-in (SSO)"
        ],
        "summary": "GET /sso/:slug/start?return=/admin/..",
        "description": "Contract: GET /sso/:slug/start?return=/admin/... → redirect to IdP (OIDC: auth code + PKCE + state + nonce kept in a short-lived httpOnly cookie; SAML: AuthnRequest, HTTP-Redirect binding)\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "return",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [],
        "responses": {
          "302": {
            "description": "Redirect"
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/{path}": {
      "get": {
        "operationId": "getPath",
        "tags": [
          "SEO files"
        ],
        "summary": "Per-locale sitemaps (/sitemap-es.xml) listed by the index at /sitemap.xml on multi-locale sites.",
        "description": "Per-locale sitemaps (/sitemap-es.xml) listed by the index at /sitemap.xml on multi-locale sites.\n\nPublic, or checks access itself (see the description).",
        "parameters": [
          {
            "name": "path",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "cookieAuth": {
        "type": "apiKey",
        "in": "cookie",
        "name": "spillway_session",
        "description": "Browser session from POST /api/auth/login; mutating requests also need the header X-Requested-With: spillway."
      },
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "spw_<prefix>_<secret>",
        "description": "API token created in the admin (user menu → API tokens). Permissions are the intersection of the token's and its owner's."
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string",
                "description": "validation_error, unauthorized, invalid_credentials, forbidden, csrf, not_found, conflict, payload_too_large, rate_limited, checks_failed, …"
              },
              "message": {
                "type": "string"
              },
              "details": {
                "description": "Flattened zod issues, a list of { field, message }, or the data the error refers to."
              }
            }
          }
        }
      }
    },
    "responses": {
      "ValidationError": {
        "description": "The request did not validate (code validation_error, details hold the issues).",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Unauthorized": {
        "description": "No session or token (code unauthorized / invalid_token).",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Forbidden": {
        "description": "Missing permission, or the CSRF header is absent (code forbidden / csrf).",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "NotFound": {
        "description": "No such record on this site (code not_found).",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    }
  }
}
