{
  "components": {
    "parameters": {
      "author": {
        "description": "Who made this version: free text, trimmed, control characters removed, at most 80 characters.",
        "in": "query",
        "name": "author",
        "required": false,
        "schema": {
          "maxLength": 80,
          "type": "string"
        }
      },
      "create": {
        "description": "1 creates the site when you have none of that name.",
        "in": "query",
        "name": "create",
        "required": false,
        "schema": {
          "default": "0",
          "enum": [
            "1",
            "0",
            "true",
            "false"
          ],
          "type": "string"
        }
      },
      "createAccess": {
        "description": "Creation only. Default anyone; specific allows only the owner and named viewers from the first request.",
        "in": "query",
        "name": "access",
        "schema": {
          "enum": [
            "anyone",
            "specific"
          ],
          "type": "string"
        }
      },
      "createIdempotencyKey": {
        "description": "Opaque key for a create request. Errors: 409 idempotency_key_reused.",
        "in": "header",
        "name": "Idempotency-Key",
        "required": false,
        "schema": {
          "type": "string"
        }
      },
      "createViewers": {
        "description": "Optional creation viewer emails, only with access specific.",
        "explode": true,
        "in": "query",
        "name": "viewers",
        "schema": {
          "items": {
            "format": "email",
            "type": "string"
          },
          "type": "array"
        },
        "style": "form"
      },
      "csrf": {
        "description": "Required on cookie-authenticated writes",
        "in": "header",
        "name": "X-SH-CSRF",
        "required": false,
        "schema": {
          "enum": [
            "1"
          ],
          "type": "string"
        }
      },
      "familySuffix": {
        "description": "The family: trips.example.com or *.trips.example.com (URL-escaped)",
        "in": "path",
        "name": "suffix",
        "required": true,
        "schema": {
          "type": "string"
        }
      },
      "owner": {
        "description": "Handle of the team or account to act for (see the API description).",
        "in": "query",
        "name": "owner",
        "required": false,
        "schema": {
          "type": "string"
        }
      },
      "path": {
        "description": "Relative file path (may contain forward slashes)",
        "in": "path",
        "name": "path",
        "required": true,
        "schema": {
          "type": "string"
        }
      },
      "pending": {
        "description": "1 lists only the versions stored with publish=false that have never been live (status ready, not the live one)",
        "in": "query",
        "name": "pending",
        "required": false,
        "schema": {
          "enum": [
            "1",
            "true",
            "yes"
          ],
          "type": "string"
        }
      },
      "publish": {
        "description": "false stores the new version without making it live (updates only; a new site's first version always goes live: 400)",
        "in": "query",
        "name": "publish",
        "required": false,
        "schema": {
          "default": true,
          "type": "boolean"
        }
      },
      "sitename": {
        "in": "path",
        "name": "sitename",
        "required": true,
        "schema": {
          "type": "string"
        }
      },
      "version": {
        "in": "path",
        "name": "version",
        "required": true,
        "schema": {
          "minimum": 1,
          "type": "integer"
        }
      }
    },
    "responses": {
      "BadRequest": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        },
        "description": "Invalid request. A saved-data write whose JSON holds a NUL character."
      },
      "Conflict": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        },
        "description": "Conflict: the code says which (site_exists, domain_taken, custom_domain_required)"
      },
      "NotFound": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        },
        "description": "Not found"
      },
      "OriginMismatch": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        },
        "description": "Origin/Referer is not one of the site's own addresses (code origin_not_allowed)."
      },
      "OriginMismatchOrSiteLocked": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        },
        "description": "Origin/Referer is not one of the site's own addresses (code origin_not_allowed. Errors: site_locked."
      },
      "TooLarge": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        },
        "description": "Payload too large (on saved data, code item_too_large. Errors: site_too_large, site_total_too_large, account_storage_full."
      },
      "TooManyRequests": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        },
        "description": "Rate limited (code rate_limited)."
      },
      "Unauthorized": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        },
        "description": "Missing or invalid API key — send the X-API-Key header, not Authorization Bearer. Errors: missing_api_key, wrong_auth_header, invalid_api_key."
      }
    },
    "schemas": {
      "APIKey": {
        "properties": {
          "created_at": {
            "format": "date-time",
            "type": "string"
          },
          "current": {
            "description": "This is the key the request was made with",
            "type": "boolean"
          },
          "expired": {
            "description": "Present once the key has stopped working: past expires_at (expired) or unused too long (idle)",
            "enum": [
              "expired",
              "idle"
            ],
            "type": "string"
          },
          "expires_at": {
            "description": "The fixed expiry chosen when it was minted; null for none",
            "format": "date-time",
            "nullable": true,
            "type": "string"
          },
          "id": {
            "format": "uuid",
            "type": "string"
          },
          "idle_expires_at": {
            "description": "When it stops working unless used before then; null when idle expiry is off",
            "format": "date-time",
            "nullable": true,
            "type": "string"
          },
          "last4": {
            "description": "Last 4 characters of the key, to recognise it.",
            "type": "string"
          },
          "last_used_at": {
            "format": "date-time",
            "nullable": true,
            "type": "string"
          },
          "name": {
            "description": "Where it came from (dashboard sign-in, agent sign-in, event account, replacement key) or the name typed when it was created.",
            "type": "string"
          },
          "scope": {
            "description": "full, or deploy (create, update, roll back and list sites and make preview links only)",
            "enum": [
              "full",
              "deploy"
            ],
            "type": "string"
          }
        },
        "required": [
          "id",
          "created_at",
          "last_used_at",
          "current"
        ],
        "type": "object"
      },
      "AddressFamily": {
        "properties": {
          "bound_at": {
            "format": "date-time",
            "type": "string"
          },
          "canonical": {
            "description": "Whether a family address is each matching site's main address (unless it has a domain of its own)",
            "type": "boolean"
          },
          "cert_name": {
            "description": "Admin view only: the operator's certificate lineage",
            "type": "string"
          },
          "certificate": {
            "properties": {
              "expires_at": {
                "format": "date-time",
                "type": "string"
              },
              "mode": {
                "enum": [
                  "wildcard"
                ],
                "type": "string"
              },
              "note": {
                "type": "string"
              },
              "status": {
                "description": "waiting_for_operator (the operator has not set up the wildcard certificate yet), pending (the family is not verified yet), issuing.",
                "enum": [
                  "waiting_for_operator",
                  "pending",
                  "issuing",
                  "live",
                  "failed"
                ],
                "type": "string"
              }
            },
            "required": [
              "mode",
              "status"
            ],
            "type": "object"
          },
          "dns": {
            "description": "The wildcard record to add at the registrar",
            "properties": {
              "host": {
                "type": "string"
              },
              "type": {
                "type": "string"
              },
              "value": {
                "type": "string"
              }
            },
            "type": "object"
          },
          "dns_a": {
            "description": "The A-record alternative to dns, where the server hands one out",
            "properties": {
              "host": {
                "type": "string"
              },
              "type": {
                "type": "string"
              },
              "value": {
                "type": "string"
              }
            },
            "type": "object"
          },
          "dns_txt": {
            "description": "The ownership record: TXT _simple-host.\u003csuffix\u003e holding the family's token.",
            "properties": {
              "host": {
                "type": "string"
              },
              "type": {
                "type": "string"
              },
              "value": {
                "type": "string"
              }
            },
            "type": "object"
          },
          "example_url": {
            "description": "One matching site's address under the family",
            "type": "string"
          },
          "expires_at": {
            "description": "Pending only: when it is dropped if its records are still not seen",
            "format": "date-time",
            "type": "string"
          },
          "failing_since": {
            "format": "date-time",
            "type": "string"
          },
          "family": {
            "type": "string"
          },
          "id": {
            "format": "uuid",
            "type": "string"
          },
          "last_error": {
            "description": "What the last check found, when it failed",
            "type": "string"
          },
          "live": {
            "description": "Its addresses are answered now: verified and its certificate live",
            "type": "boolean"
          },
          "owner": {
            "description": "Admin view only: the owner's email",
            "type": "string"
          },
          "owner_id": {
            "description": "Admin view only: the owner's account id",
            "type": "string"
          },
          "proof_exempt": {
            "description": "Present and true when the operator verified it without the TXT record",
            "type": "boolean"
          },
          "rank": {
            "type": "integer"
          },
          "release_at": {
            "description": "When a failing family is disconnected (after its owner was emailed)",
            "format": "date-time",
            "type": "string"
          },
          "site_prefix": {
            "type": "string"
          },
          "sites": {
            "description": "Only with ?sites=1: every matching site and its address",
            "items": {
              "properties": {
                "address": {
                  "type": "string"
                },
                "lives_at": {
                  "description": "The site has a domain of its own; this address redirects there",
                  "type": "string"
                },
                "main": {
                  "description": "This is the site's main address",
                  "type": "boolean"
                },
                "site": {
                  "type": "string"
                }
              },
              "required": [
                "site",
                "address",
                "main"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "status": {
            "description": "pending (waiting for the DNS records), active (verified), failing (verified, but its checks fail now)",
            "enum": [
              "pending",
              "active",
              "failing"
            ],
            "type": "string"
          },
          "suffix": {
            "type": "string"
          },
          "verified_at": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "id",
          "family",
          "suffix",
          "site_prefix",
          "rank",
          "canonical",
          "status",
          "live",
          "bound_at",
          "certificate"
        ],
        "type": "object"
      },
      "AddressFamilyRequest": {
        "description": "`suffix` or `family` names it: `*.trips.example.com` or `trips.example.com`.",
        "properties": {
          "canonical": {
            "default": true,
            "description": "A family address is the site's main address (unless the site has a domain of its own); false keeps the site's own address as the main one.",
            "type": "boolean"
          },
          "cert_mode": {
            "default": "wildcard",
            "description": "wildcard: the operator's wildcard certificate. Errors: 400 cert_mode_unavailable.",
            "enum": [
              "wildcard",
              "per_host"
            ],
            "type": "string"
          },
          "family": {
            "description": "Same as suffix",
            "type": "string"
          },
          "rank": {
            "default": 0,
            "description": "Tie-break between families with the same site_prefix: the lowest rank is the main address.",
            "maximum": 1000,
            "minimum": 0,
            "type": "integer"
          },
          "site_prefix": {
            "description": "Sites named \u003csite_prefix\u003e\u003clabel\u003e answer at \u003clabel\u003e.\u003csuffix\u003e.",
            "type": "string"
          },
          "suffix": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "AddressState": {
        "description": "The account's own site address (https://\u003csite\u003e.\u003chandle\u003e.stage.simple-host.site/, or https://\u003csite\u003e--\u003chandle\u003e.stage.simple-host.site/ for newer accounts, always ready) and its certificate.",
        "properties": {
          "address": {
            "description": "The own address: on /v1/me the pattern (https://\u003csite\u003e.\u003chandle\u003e.stage.simple-host.site/ or https://\u003csite\u003e--\u003chandle\u003e.stage.simple-host.site/), on a site that site's address",
            "type": "string"
          },
          "interim_address": {
            "description": "Where sites are until then (waiting or failing)",
            "type": "string"
          },
          "note": {
            "description": "A plain sentence to show the person (waiting or failing)",
            "type": "string"
          },
          "ready_by": {
            "description": "Rough estimate (waiting or failing)",
            "format": "date-time",
            "type": "string"
          },
          "ready_in_hours": {
            "description": "The same, in whole hours, at least 1",
            "type": "integer"
          },
          "state": {
            "description": "ready; waiting (the certificate is queued behind the weekly and daily limits).",
            "enum": [
              "ready",
              "waiting",
              "failing"
            ],
            "type": "string"
          }
        },
        "type": "object"
      },
      "AuthResponse": {
        "properties": {
          "api_key": {
            "description": "A new key for this sign-in, starting shk_ (keys issued before 2026-09-27 are bare hex and keep working).",
            "type": "string"
          },
          "created": {
            "description": "true if this verify created the account",
            "type": "boolean"
          },
          "id": {
            "format": "uuid",
            "type": "string"
          },
          "is_admin": {
            "type": "boolean"
          },
          "login": {
            "description": "A password account's own login (account_passwords.login), present on a password sign-in or signup.",
            "type": "string"
          },
          "username": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "DeletedResponse": {
        "properties": {
          "deleted": {
            "type": "boolean"
          }
        },
        "required": [
          "deleted"
        ],
        "type": "object"
      },
      "ErrorResponse": {
        "properties": {
          "code": {
            "description": "A stable snake_case name for the refusal, present where one status has more than one meaning. Errors: 409 site_exists, 409 domain_taken, 400 invalid_name, 400 name_reserved, 400 invalid_domain, 400 invalid_rules, 400 redirects_invalid, 403 site_quota_reached, 409 custom_domain_required, use_custom_domain, missing_api_key, wrong_auth_header, invalid_api_key, 403 deploy_only_key, 403 csrf_required, 409 recently_deleted, 409 site_not_deleted, 400 confirm_required, 404 not_found, 404 site_not_found, 404 export_link_invalid, 403 site_suspended, 403 account_suspended, 403 site_offline, 409 preview_unavailable, 403 site_locked, 400 invalid_passcode, passcodes_not_enabled, 409 passcode_needs_own_address, 409 no_passcode, 400 invalid_request, 400 use_address_family, 404 no_address_family, invalid_site_prefix, invalid_rank, invalid_cert_mode, 400 cert_mode_unavailable, address_family_limit, 409 address_families_unavailable.",
            "type": "string"
          },
          "error": {
            "description": "What went wrong, in plain words.",
            "type": "string"
          },
          "hint": {
            "description": "How to fix the request, in plain words, where there is a concrete next step.",
            "type": "string"
          },
          "reason": {
            "description": "On 401 invalid_code from email sign-in, which failure it is: code_wrong, code_used_up, code_expired, or link_other_browser.",
            "type": "string"
          },
          "rule_error": {
            "$ref": "#/components/schemas/StorageRuleError"
          },
          "rules_errors": {
            "description": "All diagnostics for an invalid_rules save; rule_error is the first.",
            "items": {
              "$ref": "#/components/schemas/StorageRuleError"
            },
            "type": "array"
          },
          "tries_left": {
            "description": "Remaining guesses on a code_wrong sign-in answer.",
            "type": "integer"
          }
        },
        "required": [
          "error"
        ],
        "type": "object"
      },
      "FilesBody": {
        "properties": {
          "access": {
            "description": "Creation only (POST or PUT create=1).",
            "enum": [
              "anyone",
              "specific"
            ],
            "type": "string"
          },
          "files": {
            "additionalProperties": {
              "type": "string"
            },
            "description": "relative path -\u003e file contents (text).",
            "type": "object"
          },
          "files_base64": {
            "additionalProperties": {
              "format": "byte",
              "type": "string"
            },
            "description": "relative path -\u003e base64-encoded binary contents.",
            "type": "object"
          },
          "remove_files": {
            "description": "Paths to drop from the live version; only with PUT keep=1.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "viewers": {
            "description": "Optional emails, only with access specific; normalized, deduplicated, limited by SITE_VIEWERS_MAX.",
            "items": {
              "format": "email",
              "type": "string"
            },
            "type": "array"
          }
        },
        "required": [
          "files"
        ],
        "type": "object"
      },
      "Notification": {
        "description": "Owner-visible subscription. Never contains the signing secret or custom header value.",
        "properties": {
          "app_name": {
            "type": "string"
          },
          "auth_header_name": {
            "type": "string"
          },
          "created_at": {
            "format": "date-time",
            "type": "string"
          },
          "event": {
            "description": "For a group website, its group slug; use event instead of site with notification tools.",
            "type": "string"
          },
          "events": {
            "items": {
              "$ref": "#/components/schemas/NotificationEventName"
            },
            "type": "array"
          },
          "expires_at": {
            "format": "date-time",
            "nullable": true,
            "type": "string"
          },
          "failing_since": {
            "format": "date-time",
            "nullable": true,
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "last_attempt_at": {
            "format": "date-time",
            "nullable": true,
            "type": "string"
          },
          "last_result": {
            "$ref": "#/components/schemas/NotificationResult"
          },
          "last_success_at": {
            "format": "date-time",
            "nullable": true,
            "type": "string"
          },
          "site": {
            "type": "string"
          },
          "source": {
            "enum": [
              "mcp",
              "owner"
            ],
            "type": "string"
          },
          "state": {
            "enum": [
              "active",
              "paused",
              "suspended",
              "pending",
              "expired"
            ],
            "type": "string"
          },
          "storage": {
            "description": "Resource filter; empty matches all storage on the site.",
            "type": "string"
          },
          "url": {
            "format": "uri",
            "type": "string"
          }
        },
        "type": "object"
      },
      "NotificationAuthHeader": {
        "properties": {
          "name": {
            "description": "Authorization or X- followed by 1 to 62 letters, digits, or hyphens (case-insensitive).",
            "pattern": "^([Aa][Uu][Tt][Hh][Oo][Rr][Ii][Zz][Aa][Tt][Ii][Oo][Nn]|[Xx]-[A-Za-z0-9-]{1,62})$",
            "type": "string"
          },
          "value": {
            "description": "At most 1024 bytes; printable, with no CR or LF.",
            "maxLength": 1024,
            "type": "string",
            "writeOnly": true
          }
        },
        "required": [
          "name",
          "value"
        ],
        "type": "object"
      },
      "NotificationCreate": {
        "properties": {
          "auth_header": {
            "$ref": "#/components/schemas/NotificationAuthHeader"
          },
          "events": {
            "items": {
              "$ref": "#/components/schemas/NotificationEventName"
            },
            "minItems": 1,
            "type": "array"
          },
          "label": {
            "default": "",
            "type": "string"
          },
          "secret": {
            "$ref": "#/components/schemas/NotificationSecret"
          },
          "storage": {
            "default": "",
            "description": "Existing site storage resource; empty means all resources.",
            "type": "string"
          },
          "url": {
            "description": "HTTPS, at most 2048 bytes, no userinfo or fragment.",
            "format": "uri",
            "maxLength": 2048,
            "type": "string"
          }
        },
        "required": [
          "url",
          "events"
        ],
        "type": "object"
      },
      "NotificationCreated": {
        "properties": {
          "notification": {
            "$ref": "#/components/schemas/Notification"
          },
          "secret": {
            "$ref": "#/components/schemas/NotificationSecret"
          }
        },
        "required": [
          "notification",
          "secret"
        ],
        "type": "object"
      },
      "NotificationDeleted": {
        "properties": {
          "deleted": {
            "enum": [
              true
            ],
            "type": "boolean"
          }
        },
        "required": [
          "deleted"
        ],
        "type": "object"
      },
      "NotificationDeliveries": {
        "properties": {
          "deliveries": {
            "items": {
              "$ref": "#/components/schemas/NotificationDelivery"
            },
            "maxItems": 200,
            "type": "array"
          }
        },
        "required": [
          "deliveries"
        ],
        "type": "object"
      },
      "NotificationDelivery": {
        "properties": {
          "attempts": {
            "minimum": 0,
            "type": "integer"
          },
          "created_at": {
            "format": "date-time",
            "type": "string"
          },
          "duration_ms": {
            "nullable": true,
            "type": "integer"
          },
          "event_id": {
            "type": "string"
          },
          "last_attempt_at": {
            "format": "date-time",
            "nullable": true,
            "type": "string"
          },
          "last_http": {
            "nullable": true,
            "type": "integer"
          },
          "name": {
            "description": "Storage event name. Test sends do not appear in delivery history.",
            "type": "string"
          },
          "result": {
            "$ref": "#/components/schemas/NotificationResult"
          },
          "state": {
            "enum": [
              "pending",
              "delivered",
              "failed",
              "skipped"
            ],
            "type": "string"
          }
        },
        "type": "object"
      },
      "NotificationError": {
        "properties": {
          "code": {
            "description": "Notification-specific errors. Authentication middleware can also return its usual credential errors.",
            "enum": [
              "invalid_url",
              "refused_address",
              "invalid_events",
              "invalid_secret",
              "invalid_header",
              "storage_not_found",
              "too_many_notifications",
              "notifications_not_enabled",
              "notification_access_ended",
              "forbidden",
              "not_found",
              "not_offered",
              "client_secret"
            ],
            "type": "string"
          },
          "error": {
            "description": "Plain explanation.",
            "type": "string"
          }
        },
        "required": [
          "error",
          "code"
        ],
        "type": "object"
      },
      "NotificationEventName": {
        "description": "record.added, record.changed, and file.uploaded are visitor storage writes.",
        "enum": [
          "record.added",
          "record.changed",
          "file.uploaded",
          "site.deployed",
          "domain.status_changed",
          "viewer.access_requested",
          "visitor.signed_up"
        ],
        "type": "string"
      },
      "NotificationLimits": {
        "description": "Effective operator-configured limits.",
        "properties": {
          "can_create": {
            "description": "On group site lists, whether the current member may create a subscription now.",
            "type": "boolean"
          },
          "can_manage": {
            "description": "On group site lists, whether testing, pausing, resuming, and rotation are permitted now.",
            "type": "boolean"
          },
          "enabled": {
            "description": "Whether the server has PASSCODE_ENC_KEY and accepts new notifications.",
            "type": "boolean"
          },
          "history_days": {
            "type": "integer"
          },
          "per_day": {
            "type": "integer"
          },
          "per_minute": {
            "type": "integer"
          },
          "per_site": {
            "type": "integer"
          }
        },
        "required": [
          "enabled",
          "per_site",
          "per_minute",
          "per_day",
          "history_days"
        ],
        "type": "object"
      },
      "NotificationList": {
        "properties": {
          "limits": {
            "$ref": "#/components/schemas/NotificationLimits"
          },
          "notifications": {
            "items": {
              "$ref": "#/components/schemas/Notification"
            },
            "type": "array"
          }
        },
        "required": [
          "notifications",
          "limits"
        ],
        "type": "object"
      },
      "NotificationPause": {
        "properties": {
          "paused": {
            "description": "true pauses; false resumes a paused or suspended subscription and makes held deliveries due now.",
            "type": "boolean"
          }
        },
        "required": [
          "paused"
        ],
        "type": "object"
      },
      "NotificationResult": {
        "description": "Empty before an attempt; ok for success; otherwise a failure category.",
        "enum": [
          "",
          "ok",
          "connection_refused",
          "secret_unreadable",
          "timeout",
          "tls_error",
          "http_4xx",
          "http_5xx",
          "redirect",
          "refused_address",
          "dns_error",
          "challenge_failed",
          "site_unavailable"
        ],
        "type": "string"
      },
      "NotificationRotatedSecret": {
        "properties": {
          "previous_valid_until": {
            "description": "Null when the previous secret cannot be read.",
            "format": "date-time",
            "nullable": true,
            "type": "string"
          },
          "secret": {
            "$ref": "#/components/schemas/NotificationSecret"
          }
        },
        "required": [
          "secret",
          "previous_valid_until"
        ],
        "type": "object"
      },
      "NotificationSecret": {
        "description": "whsec_ followed by standard base64 encoding of 24 to 64 random bytes.",
        "format": "password",
        "pattern": "^whsec_[A-Za-z0-9+/]+={0,2}$",
        "type": "string"
      },
      "NotificationTestResult": {
        "properties": {
          "delivered": {
            "type": "boolean"
          },
          "result": {
            "$ref": "#/components/schemas/NotificationResult"
          },
          "status": {
            "description": "Receiver HTTP status, or 0 when no response was received.",
            "type": "integer"
          }
        },
        "required": [
          "delivered",
          "status",
          "result"
        ],
        "type": "object"
      },
      "NotificationUpdated": {
        "properties": {
          "notification": {
            "$ref": "#/components/schemas/Notification"
          }
        },
        "required": [
          "notification"
        ],
        "type": "object"
      },
      "Site": {
        "properties": {
          "access": {
            "description": "Who can open the site: anyone, or specific (only the owner and its named viewers; GET .../access).",
            "enum": [
              "anyone",
              "specific"
            ],
            "type": "string"
          },
          "active_version": {
            "type": "integer"
          },
          "address_state": {
            "$ref": "#/components/schemas/AddressState"
          },
          "created_at": {
            "format": "date-time",
            "type": "string"
          },
          "custom_domain": {
            "description": "The site's free \u003cname\u003e.stage.simple-host.site address or its own domain, when it has one",
            "type": "string"
          },
          "deployed_at": {
            "description": "When the newest version went live (site list only)",
            "format": "date-time",
            "type": "string"
          },
          "domain_certificate_status": {
            "description": "Site list only, for a domain not live yet: its certificate",
            "enum": [
              "pending",
              "issuing",
              "live",
              "failed"
            ],
            "type": "string"
          },
          "domain_dns": {
            "description": "Site list only, for an own domain that is not active: the DNS record that points it here, to add at the registrar",
            "properties": {
              "host": {
                "type": "string"
              },
              "type": {
                "type": "string"
              },
              "value": {
                "type": "string"
              }
            },
            "type": "object"
          },
          "domain_dns_txt": {
            "description": "Site list only, for an own domain that is not active: the TXT ownership record to add next to domain_dns.",
            "properties": {
              "host": {
                "type": "string"
              },
              "type": {
                "type": "string"
              },
              "value": {
                "type": "string"
              }
            },
            "type": "object"
          },
          "domain_expires_at": {
            "description": "Site list only: when an unproven domain binding is released (24 h after binding; absent once DNS points here)",
            "format": "date-time",
            "type": "string"
          },
          "domain_last_error": {
            "description": "Site list only, for a domain that is not active: what the last check found",
            "type": "string"
          },
          "domain_partner": {
            "description": "The custom domain's www / bare partner, which forwards to it (see GET .../domain partner_domain)",
            "type": "string"
          },
          "domain_partner_dns": {
            "description": "The record that points the partner here too",
            "properties": {
              "host": {
                "type": "string"
              },
              "type": {
                "type": "string"
              },
              "value": {
                "type": "string"
              }
            },
            "type": "object"
          },
          "domain_partner_note": {
            "description": "Why the partner is not set up, when it is not",
            "type": "string"
          },
          "domain_partner_status": {
            "enum": [
              "pending",
              "live",
              "not_set_up"
            ],
            "type": "string"
          },
          "domain_status": {
            "enum": [
              "pending",
              "active",
              "error"
            ],
            "type": "string"
          },
          "family_address": {
            "description": "The site's address under its account's most specific live address family.",
            "type": "string"
          },
          "family_addresses": {
            "description": "Every address family address the site answers at, the most specific first",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "file_bytes": {
            "description": "Website file footprint including live copy and kept versions; populated in GET /v1/sites",
            "type": "integer"
          },
          "files": {
            "description": "Only on GET /v1/sites?files=\u003cthis site\u003e: the files of the live version.",
            "items": {
              "properties": {
                "path": {
                  "type": "string"
                },
                "size": {
                  "format": "int64",
                  "type": "integer"
                }
              },
              "type": "object"
            },
            "type": "array"
          },
          "id": {
            "format": "uuid",
            "type": "string"
          },
          "idle_removal_at": {
            "description": "Site list only: the site had no visits by people and no new version for 90 days and its owner was emailed.",
            "format": "date-time",
            "type": "string"
          },
          "keep": {
            "description": "Site list only: the owner marked the site Keep; it is never flagged as idle (PUT .../keep)",
            "type": "boolean"
          },
          "keep_versions": {
            "description": "How many versions of this site are kept, when its owner set it (PUT .../keep-versions): the newest N plus the live one.",
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "offline": {
            "description": "Present and true when the owner has taken the site offline.",
            "type": "boolean"
          },
          "passcode_protected": {
            "description": "Present and true when the site has a passcode (PUT .../lock): every address shows \"This site is protected\" until a visitor enters it.",
            "type": "boolean"
          },
          "preview_expires_at": {
            "description": "When preview_url stops working.",
            "format": "date-time",
            "type": "string"
          },
          "preview_url": {
            "description": "Only on a deploy with publish=false: a link showing the stored version that works for anyone with it, for one hour.",
            "format": "uri",
            "type": "string"
          },
          "previous_domain": {
            "description": "Site list only, for a domain not live yet: the earlier address the site keeps answering at until it is",
            "type": "string"
          },
          "site_url": {
            "description": "The link to share: https://\u003csite\u003e.\u003chandle\u003e.stage.simple-host.site/ or, for newer accounts, https://\u003csite\u003e--\u003chandle\u003e.stage.simple-host.site/.",
            "nullable": true,
            "type": "string"
          },
          "summary": {
            "description": "Compact content from the newest uploaded index.html; omitted when empty.",
            "properties": {
              "description": {
                "description": "Meta description (up to 300 bytes).",
                "type": "string"
              },
              "headings": {
                "description": "First six headings (up to 300 bytes).",
                "type": "string"
              },
              "text": {
                "description": "Visible body text (up to 300 bytes).",
                "type": "string"
              },
              "title": {
                "description": "Page title (up to 200 bytes).",
                "type": "string"
              }
            },
            "type": "object"
          },
          "suspended": {
            "description": "Present and true when the operator has taken the site down.",
            "type": "boolean"
          },
          "suspended_reason": {
            "description": "The operator's one-line reason, when suspended.",
            "type": "string"
          },
          "unpublished_version": {
            "description": "Only on a deploy with publish=false: the version stored without going live.",
            "type": "integer"
          },
          "updated_at": {
            "format": "date-time",
            "type": "string"
          },
          "user_id": {
            "format": "uuid",
            "type": "string"
          },
          "views": {
            "description": "Site list only, and only on installs that read the analytics log: views by people in the last 7 and 30 days.",
            "properties": {
              "people_30_days": {
                "type": "integer"
              },
              "people_7_days": {
                "type": "integer"
              }
            },
            "type": "object"
          },
          "visibility": {
            "description": "List on my profile: public = on; unlisted = off (default).",
            "enum": [
              "public",
              "unlisted"
            ],
            "type": "string"
          }
        },
        "type": "object"
      },
      "SiteAccess": {
        "description": "Who can open a site (named viewers)",
        "properties": {
          "access": {
            "enum": [
              "anyone",
              "specific"
            ],
            "type": "string"
          },
          "added": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "already_listed": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "note": {
            "type": "string"
          },
          "passcode_protected": {
            "type": "boolean"
          },
          "removed": {
            "type": "string"
          },
          "site": {
            "type": "string"
          },
          "viewer_limit": {
            "description": "SITE_VIEWERS_MAX",
            "type": "integer"
          },
          "viewers": {
            "items": {
              "properties": {
                "added_at": {
                  "format": "date-time",
                  "type": "string"
                },
                "email": {
                  "type": "string"
                },
                "signed_in_at": {
                  "description": "When they first signed in to this site.",
                  "format": "date-time",
                  "type": "string"
                }
              },
              "type": "object"
            },
            "type": "array"
          }
        },
        "required": [
          "site",
          "access",
          "viewers",
          "viewer_limit",
          "passcode_protected"
        ],
        "type": "object"
      },
      "SitePasscode": {
        "properties": {
          "note": {
            "description": "What happened, in plain words, to relay to the person",
            "type": "string"
          },
          "passcode": {
            "description": "The passcode (owner only; GET and PUT .../lock).",
            "type": "string"
          },
          "passcode_protected": {
            "type": "boolean"
          },
          "passcode_set_at": {
            "format": "date-time",
            "type": "string"
          },
          "site": {
            "type": "string"
          }
        },
        "required": [
          "site",
          "passcode_protected"
        ],
        "type": "object"
      },
      "SiteWithNote": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Site"
          },
          {
            "properties": {
              "note": {
                "type": "string"
              }
            },
            "type": "object"
          }
        ]
      },
      "StorageDownloadLink": {
        "properties": {
          "expires_at": {
            "format": "date-time",
            "type": "string"
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "url",
          "expires_at"
        ],
        "type": "object"
      },
      "StoragePolicy": {
        "properties": {
          "check": {
            "description": "New-row predicate, at most 2048 UTF-8 bytes.",
            "type": "string"
          },
          "command": {
            "enum": [
              "read",
              "add",
              "edit",
              "delete",
              "all"
            ],
            "type": "string"
          },
          "name": {
            "description": "Unique policy name in this set.",
            "type": "string"
          },
          "restrictive": {
            "description": "Restrictive policies combine with AND; permissive policies combine with OR.",
            "type": "boolean"
          },
          "using": {
            "description": "Existing-row predicate, at most 2048 UTF-8 bytes.",
            "type": "string"
          }
        },
        "required": [
          "name",
          "command"
        ],
        "type": "object"
      },
      "StoragePolicySet": {
        "description": "Owner-written row rules for kv and sqlite; null is treated as absent.",
        "nullable": true,
        "properties": {
          "policies": {
            "items": {
              "$ref": "#/components/schemas/StoragePolicy"
            },
            "maxItems": 32,
            "type": "array"
          },
          "version": {
            "description": "Omit for version 1.",
            "enum": [
              1
            ],
            "type": "integer"
          }
        },
        "required": [
          "policies"
        ],
        "type": "object"
      },
      "StorageResource": {
        "description": "Every resource carries name, kind, site_passcode, rules, rules_status, rules_errors and (sqlite) tables.",
        "properties": {
          "kind": {
            "enum": [
              "kv",
              "sqlite",
              "files"
            ],
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "rules": {
            "$ref": "#/components/schemas/StoragePolicySet"
          },
          "rules_errors": {
            "items": {
              "$ref": "#/components/schemas/StorageRuleError"
            },
            "type": "array"
          },
          "rules_status": {
            "enum": [
              "rules",
              "invalid"
            ],
            "type": "string"
          },
          "site_passcode": {
            "enum": [
              "inherit",
              "off"
            ],
            "type": "string"
          },
          "tables": {
            "additionalProperties": {
              "properties": {
                "rules": {
                  "$ref": "#/components/schemas/StoragePolicySet"
                }
              },
              "type": "object"
            },
            "description": "sqlite only.",
            "type": "object"
          }
        },
        "type": "object"
      },
      "StorageRowCreated": {
        "properties": {
          "changes": {
            "type": "integer"
          },
          "last_insert_id": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "changes",
          "last_insert_id"
        ],
        "type": "object"
      },
      "StorageRuleError": {
        "properties": {
          "clause": {
            "description": "Clause or validation bound that failed.",
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "policy": {
            "description": "Policy name or empty for a set-level error.",
            "type": "string"
          },
          "position": {
            "description": "UTF-8 byte offset or -1 when no offset applies.",
            "type": "integer"
          },
          "table": {
            "description": "Table name or empty for resource defaults.",
            "type": "string"
          }
        },
        "required": [
          "table",
          "policy",
          "clause",
          "position",
          "message"
        ],
        "type": "object"
      },
      "StorageSQL": {
        "description": "Errors (body {error, code}): the error text says what happened and what to do; the owner's messages also list the real tables or columns. Errors: sql_request, sql_params, 503 storage_busy.",
        "properties": {
          "params": {
            "description": "Positional JSON scalar values",
            "items": {
              "nullable": true
            },
            "type": "array"
          },
          "sql": {
            "description": "One SQLite statement; use bound question-mark parameters.",
            "type": "string"
          }
        },
        "required": [
          "sql"
        ],
        "type": "object"
      },
      "TrafficCounts": {
        "properties": {
          "views": {
            "type": "integer"
          },
          "visitors": {
            "description": "Unique visitors — distinct hashed IPs over this bucket's window",
            "type": "integer"
          }
        },
        "type": "object"
      },
      "TrafficSplit": {
        "description": "One bucket of traffic, split by who was asking.",
        "properties": {
          "bot": {
            "$ref": "#/components/schemas/TrafficCounts"
          },
          "infra": {
            "$ref": "#/components/schemas/TrafficCounts"
          },
          "owner": {
            "$ref": "#/components/schemas/TrafficCounts"
          },
          "person": {
            "$ref": "#/components/schemas/TrafficCounts"
          },
          "unknown": {
            "$ref": "#/components/schemas/TrafficCounts"
          }
        },
        "type": "object"
      }
    },
    "securitySchemes": {
      "apiKey": {
        "in": "header",
        "name": "X-API-Key",
        "type": "apiKey"
      },
      "connector": {
        "description": "Per-person OAuth 2.1 (authorization code; PKCE S256 required for every self-registered client).",
        "flows": {
          "authorizationCode": {
            "authorizationUrl": "https://stage.simple-host.site/oauth/authorize",
            "refreshUrl": "https://stage.simple-host.site/oauth/token",
            "scopes": {
              "events": "Available when this server supports the operation.",
              "sites": "Publish and manage your sites and their data"
            },
            "tokenUrl": "https://stage.simple-host.site/oauth/token"
          }
        },
        "type": "oauth2"
      }
    }
  },
  "info": {
    "description": "Static website hosting with a light per-site backend. Every /v1/sites route, GET /v1/me/deleted-sites and GET /v1/analytics/sites take ?owner=\u003chandle\u003e to act, with your own key or sign-in, on the sites of a team you belong to or the one site of an account you edit (403 editor_scope outside that site's deploys, versions, saved data, visits and your own notifications).",
    "title": "Simple Host API",
    "version": "2.0.0"
  },
  "openapi": "3.0.3",
  "paths": {
    "/": {
      "get": {
        "description": "The selected product landing. Accept text/markdown negotiates Markdown; HTML is the default.",
        "responses": {
          "200": {
            "content": {
              "text/html": {
                "schema": {
                  "type": "string"
                }
              },
              "text/markdown": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "Read the product landing page"
          }
        },
        "security": [],
        "summary": "Read the product landing page",
        "tags": [
          "Discovery"
        ]
      }
    },
    "/.well-known/agent-card.json": {
      "get": {
        "description": "Public product identity, version, OAuth discovery, and generic tool overview.",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "Read the agent capability card"
          }
        },
        "security": [],
        "summary": "Read the agent capability card",
        "tags": [
          "Discovery"
        ]
      }
    },
    "/.well-known/ai-catalog.json": {
      "get": {
        "description": "Links the agent card, MCP server card, and OpenAPI document.",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "Read the AI catalog"
          }
        },
        "security": [],
        "summary": "Read the AI catalog",
        "tags": [
          "Discovery"
        ]
      }
    },
    "/.well-known/api-catalog": {
      "get": {
        "description": "RFC 9727 linkset for this product's OpenAPI formats, role or deployment guide, and API reference.",
        "responses": {
          "200": {
            "content": {
              "application/linkset+json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "Read the API catalog"
          }
        },
        "security": [],
        "summary": "Read the API catalog",
        "tags": [
          "Discovery"
        ]
      }
    },
    "/.well-known/ard.json": {
      "get": {
        "description": "Product-specific resource names and identifiers with links to the server card, skills, and REST API.",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "Read the agent resource directory"
          }
        },
        "security": [],
        "summary": "Read the agent resource directory",
        "tags": [
          "Discovery"
        ]
      }
    },
    "/.well-known/mcp/server-card.json": {
      "get": {
        "description": "Public product identity, build version, icon, and local MCP endpoint.",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "Read the MCP server card"
          }
        },
        "security": [],
        "summary": "Read the MCP server card",
        "tags": [
          "Discovery"
        ]
      }
    },
    "/auth.md": {
      "get": {
        "responses": {
          "200": {
            "content": {
              "text/markdown": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "Instance-aware sign-in documentation."
          }
        },
        "security": [],
        "summary": "Read the authentication reference",
        "tags": [
          "Auth"
        ]
      }
    },
    "/healthz": {
      "get": {
        "operationId": "getHealthz",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "status": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Alive"
          }
        },
        "summary": "Liveness probe",
        "tags": [
          "Health"
        ]
      }
    },
    "/index.md": {
      "get": {
        "description": "The selected product landing copy, with this instance's canonical address.",
        "responses": {
          "200": {
            "content": {
              "text/markdown": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "Read the landing as Markdown"
          }
        },
        "security": [],
        "summary": "Read the landing as Markdown",
        "tags": [
          "Discovery"
        ]
      }
    },
    "/llms.md": {
      "get": {
        "description": "Alias of /index.md.",
        "responses": {
          "200": {
            "content": {
              "text/markdown": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "Read the landing as Markdown"
          }
        },
        "security": [],
        "summary": "Read the landing as Markdown",
        "tags": [
          "Discovery"
        ]
      }
    },
    "/mcp/server-card": {
      "get": {
        "description": "Alias of /.well-known/mcp/server-card.json.",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "Read the MCP server card"
          }
        },
        "security": [],
        "summary": "Read the MCP server card",
        "tags": [
          "Discovery"
        ]
      }
    },
    "/readyz": {
      "get": {
        "operationId": "getReadyz",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "status": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Ready"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Not ready"
          }
        },
        "summary": "Readiness probe (DB connected)",
        "tags": [
          "Health"
        ]
      }
    },
    "/v1/analytics/sites": {
      "get": {
        "description": "One call returning the class split for all of the caller's sites, ordered by `person.views` descending.",
        "operationId": "getAnalyticsSites",
        "parameters": [
          {
            "description": "Number of UTC days to include (default 30, clamp 1..365)",
            "in": "query",
            "name": "days",
            "required": false,
            "schema": {
              "default": 30,
              "maximum": 365,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "Admins only — include every site on the instance.",
            "in": "query",
            "name": "all",
            "required": false,
            "schema": {
              "enum": [
                "1"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "range_days": {
                      "type": "integer"
                    },
                    "sites": {
                      "items": {
                        "allOf": [
                          {
                            "properties": {
                              "name": {
                                "type": "string"
                              }
                            },
                            "type": "object"
                          },
                          {
                            "$ref": "#/components/schemas/TrafficSplit"
                          }
                        ]
                      },
                      "type": "array"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Per-site totals, highest `person.views` first."
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "`all=1` requested by a non-admin"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Per-site traffic totals for every site you own",
        "tags": [
          "Analytics"
        ]
      }
    },
    "/v1/auth": {
      "post": {
        "description": "For Simple Host account owners and their agents, never for a site's visitors.",
        "operationId": "postAuth",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "email": {
                    "format": "email",
                    "type": "string"
                  },
                  "nonce_hash": {
                    "description": "Browser pages only. base64url SHA-256 of a random nonce the page keeps.",
                    "type": "string"
                  }
                },
                "required": [
                  "email"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "email": {
                      "type": "string"
                    },
                    "expires_in_seconds": {
                      "type": "integer"
                    },
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Code sent"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorResponse"
                    },
                    {
                      "properties": {
                        "code": {
                          "enum": [
                            "account_auth_unavailable",
                            "email_signin_off"
                          ],
                          "type": "string"
                        }
                      },
                      "type": "object"
                    }
                  ]
                }
              }
            },
            "description": "account_auth_unavailable: account sign-in answers only on the app's own address; a page's visitors use visitor sign-in (auth.js SH.mount). Errors: email_signin_off."
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        },
        "summary": "Request an account sign-in code (account owners only)",
        "tags": [
          "Auth"
        ]
      }
    },
    "/v1/auth/oauth/providers": {
      "get": {
        "description": "Public discovery for pages and the dashboard: auth.js reads it from a site to offer Google; it is not account sign-in and sets nothing.",
        "operationId": "getOAuthProviders",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "email_enabled": {
                      "description": "Whether email-code sign-in is configured and EMAIL_SIGNIN is not off",
                      "type": "boolean"
                    },
                    "oidc_label": {
                      "description": "The company sign-in button's name (OIDC_LABEL).",
                      "type": "string"
                    },
                    "password": {
                      "description": "Present only when password sign-in is enabled on this install.",
                      "properties": {
                        "enabled": {
                          "type": "boolean"
                        },
                        "self_signup": {
                          "type": "boolean"
                        }
                      },
                      "type": "object"
                    },
                    "providers": {
                      "items": {
                        "enum": [
                          "google",
                          "github",
                          "oidc"
                        ],
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "sso_enabled": {
                      "description": "Whether site Sign in should use the apex SSO hop",
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "providers",
                    "email_enabled"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Enabled providers"
          }
        },
        "summary": "List enabled sign-in methods (public discovery)",
        "tags": [
          "Auth"
        ]
      }
    },
    "/v1/auth/oauth/{provider}": {
      "get": {
        "description": "Account sign-in starts only on the app's own address.",
        "operationId": "startOAuth",
        "parameters": [
          {
            "in": "path",
            "name": "provider",
            "required": true,
            "schema": {
              "enum": [
                "google",
                "github",
                "oidc"
              ],
              "type": "string"
            }
          },
          {
            "description": "Absolute URL of the page to return to after sign-in",
            "in": "query",
            "name": "return_to",
            "required": true,
            "schema": {
              "format": "uri",
              "type": "string"
            }
          }
        ],
        "responses": {
          "302": {
            "description": "Redirect to the identity provider",
            "headers": {
              "Location": {
                "schema": {
                  "format": "uri",
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Invalid or missing return_to"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "account_auth_unavailable: on the app's address but from a page's origin."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Unknown or disabled provider"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "oidc_unavailable: company sign-in's identity provider could not be reached yet (lazy discovery); retry shortly."
          }
        },
        "summary": "Start account Google sign-in (account owners; a site sign-in is forwarded)",
        "tags": [
          "Auth"
        ]
      }
    },
    "/v1/auth/oauth/{provider}/callback": {
      "get": {
        "description": "Answers only on the app's own address (403 account_auth_unavailable elsewhere).",
        "operationId": "oauthCallback",
        "parameters": [
          {
            "in": "path",
            "name": "provider",
            "required": true,
            "schema": {
              "enum": [
                "google",
                "github",
                "oidc"
              ],
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "code",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "state",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "error",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "302": {
            "description": "Site purpose: redirect to /v1/visitor/establish on the stored host.",
            "headers": {
              "Location": {
                "schema": {
                  "format": "uri",
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "text/html": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "Bad, replayed, or expired state, or provider error"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "text/html": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "account_auth_unavailable (JSON): not on the app's own address."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Unknown or disabled provider"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "502": {
            "content": {
              "text/html": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "Token or userinfo failure"
          }
        },
        "summary": "OAuth callback (apex only)",
        "tags": [
          "Auth"
        ]
      }
    },
    "/v1/auth/password": {
      "post": {
        "description": "Available only when PASSWORD_SIGNIN=on.",
        "operationId": "passwordSignIn",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "login": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  },
                  "new_password": {
                    "format": "password",
                    "maxLength": 256,
                    "minLength": 8,
                    "type": "string"
                  },
                  "password": {
                    "format": "password",
                    "maxLength": 256,
                    "minLength": 8,
                    "type": "string"
                  },
                  "sso_state": {
                    "type": "string"
                  }
                },
                "required": [
                  "login",
                  "password"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuthResponse"
                }
              }
            },
            "description": "Authenticated"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "description": "Wrong username or password (bad_credentials), including unknown and passwordless accounts."
          },
          "403": {
            "description": "password_change_required: current password verified; resubmit with a different new_password. Errors: account_suspended."
          },
          "404": {
            "description": "not found: PASSWORD_SIGNIN is off."
          }
        },
        "security": [],
        "summary": "Sign in with a username or email and password",
        "tags": [
          "Auth"
        ]
      }
    },
    "/v1/auth/password/signup": {
      "post": {
        "description": "Available only when PASSWORD_SIGNIN=on.",
        "operationId": "passwordSignup",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "password": {
                    "format": "password",
                    "maxLength": 256,
                    "minLength": 8,
                    "type": "string"
                  },
                  "username": {
                    "maxLength": 254,
                    "minLength": 1,
                    "type": "string"
                  }
                },
                "required": [
                  "username",
                  "password"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuthResponse"
                }
              }
            },
            "description": "Authenticated"
          },
          "400": {
            "description": "invalid_username or invalid_password"
          },
          "403": {
            "description": "signup_unavailable_region"
          },
          "404": {
            "description": "not found: PASSWORD_SIGNIN off or PASSWORD_SELF_SIGNUP off"
          },
          "409": {
            "description": "username_taken"
          },
          "429": {
            "description": "rate_limited; Retry-After header"
          }
        },
        "security": [],
        "summary": "Create a password account and sign in",
        "tags": [
          "Auth"
        ]
      }
    },
    "/v1/auth/verify": {
      "post": {
        "description": "Exchange an emailed code or a sign-in link for an API key, on the app's own address only. The code expires in 15 minutes and allows 3 attempts.",
        "operationId": "postAuthVerify",
        "parameters": [
          {
            "description": "Optional same-visit attribution label (letters, digits, hyphens).",
            "in": "query",
            "name": "from",
            "schema": {
              "maxLength": 40,
              "type": "string"
            }
          },
          {
            "description": "Optional same-visit attribution; UTM values are bounded plain text, referrer is an outside hostname only.",
            "in": "query",
            "name": "utm_source",
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Optional same-visit attribution; UTM values are bounded plain text, referrer is an outside hostname only.",
            "in": "query",
            "name": "utm_medium",
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Optional same-visit attribution; UTM values are bounded plain text, referrer is an outside hostname only.",
            "in": "query",
            "name": "utm_campaign",
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Optional same-visit attribution; UTM values are bounded plain text, referrer is an outside hostname only.",
            "in": "query",
            "name": "utm_term",
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Optional same-visit attribution; UTM values are bounded plain text, referrer is an outside hostname only.",
            "in": "query",
            "name": "utm_content",
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Optional same-visit attribution; UTM values are bounded plain text, referrer is an outside hostname only.",
            "in": "query",
            "name": "referrer",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "choose_handle": {
                    "description": "When this sign-in would create a new account: create nothing yet and answer 409 with code choose_handle and a suggested_handle.",
                    "type": "boolean"
                  },
                  "code": {
                    "type": "string"
                  },
                  "email": {
                    "format": "email",
                    "type": "string"
                  },
                  "handle": {
                    "description": "The address (\u003chandle\u003e.stage.simple-host.site) a NEW account takes; ignored for an existing account. Errors: 400 invalid_handle, 409 handle_reserved, 409 handle_taken, choose_handle.",
                    "pattern": "^[a-z0-9-]{1,39}$",
                    "type": "string"
                  },
                  "name": {
                    "description": "Optional label for the key this sign-in issues, shown in the Keys list (GET /v1/me/keys).",
                    "maxLength": 60,
                    "type": "string"
                  },
                  "nonce": {
                    "description": "required with token — the nonce whose hash was sent when the link was requested",
                    "type": "string"
                  },
                  "sso_state": {
                    "description": "Optional server-issued hop state for visitor signup attribution",
                    "type": "string"
                  },
                  "token": {
                    "description": "magic-link token (alternative to email+code)",
                    "type": "string"
                  }
                },
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuthResponse"
                }
              }
            },
            "description": "Authenticated"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Invalid code. `code` stays invalid_code. `reason` is code_wrong, code_used_up, code_expired, or link_other_browser."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorResponse"
                    },
                    {
                      "properties": {
                        "code": {
                          "enum": [
                            "account_auth_unavailable",
                            "email_signin_off"
                          ],
                          "type": "string"
                        }
                      },
                      "type": "object"
                    }
                  ]
                }
              }
            },
            "description": "account_auth_unavailable: account sign-in answers only on the app's own address; a page's visitors use visitor sign-in (auth.js SH.mount). Errors: email_signin_off."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "address": {
                      "type": "string"
                    },
                    "code": {
                      "enum": [
                        "choose_handle",
                        "handle_taken",
                        "handle_reserved",
                        "password_account_exists"
                      ],
                      "type": "string"
                    },
                    "error": {
                      "type": "string"
                    },
                    "suggested_handle": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "code choose_handle (a new account: choose its address first. Errors: handle_taken, handle_reserved, password_account_exists."
          }
        },
        "summary": "Verify a code on the apex and get an account key",
        "tags": [
          "Auth"
        ]
      }
    },
    "/v1/export": {
      "get": {
        "description": "No API key: the signed `token` is the whole authorization, for one site, for 10 minutes.",
        "operationId": "downloadExport",
        "parameters": [
          {
            "in": "query",
            "name": "token",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/gzip": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              }
            },
            "description": "A gzipped tar archive"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "The link is not valid or has expired (code export_link_invalid)"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        },
        "security": [],
        "summary": "Download a site's export through a link from export-link",
        "tags": [
          "Sites"
        ]
      }
    },
    "/v1/handles/check": {
      "get": {
        "description": "Whether \u003chandle\u003e.stage.simple-host.site can be taken as an account's address: at sign-up (POST /v1/auth/verify with handle) or as a change.",
        "operationId": "getHandleCheck",
        "parameters": [
          {
            "in": "query",
            "name": "handle",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "address": {
                      "type": "string"
                    },
                    "available": {
                      "type": "boolean"
                    },
                    "code": {
                      "enum": [
                        "invalid_handle",
                        "handle_reserved",
                        "handle_taken"
                      ],
                      "type": "string"
                    },
                    "error": {
                      "type": "string"
                    },
                    "handle": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "handle",
                    "available",
                    "address"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "The verdict"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Cross-site browser request"
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Too many checks from this address"
          }
        },
        "summary": "Is this address (handle) free?",
        "tags": [
          "Auth"
        ]
      }
    },
    "/v1/me": {
      "delete": {
        "description": "Deletes the account at once and for good; nothing goes to Recently deleted and nothing can be restored.",
        "operationId": "deleteMe",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "confirm": {
                    "description": "The account's handle, or its email when it has no handle.",
                    "type": "string"
                  }
                },
                "required": [
                  "confirm"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "204": {
            "description": "Deleted"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "confirm missing (code confirm_required) or does not match (code confirm_mismatch)"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Suspended account (code account_suspended), a site of the account taken down (code site_suspended) or admin account (code admin_account)"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "The account still holds event hostnames (code event_hostnames)"
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Too many requests from this address"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Delete your account and all its data",
        "tags": [
          "Account"
        ]
      },
      "get": {
        "operationId": "getMe",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "address": {
                      "$ref": "#/components/schemas/AddressState"
                    },
                    "can_set_keep_versions": {
                      "description": "Account is allowed to change per-site retention",
                      "type": "boolean"
                    },
                    "display_name": {
                      "type": "string"
                    },
                    "file_usage": {
                      "description": "Website files and kept versions including the live copy and Recently deleted sites; saved data and storage resources excluded",
                      "properties": {
                        "limit_mb": {
                          "description": "0 means no account file cap",
                          "type": "integer"
                        },
                        "message": {
                          "type": "string"
                        },
                        "tips": {
                          "type": "string"
                        },
                        "used_bytes": {
                          "type": "integer"
                        }
                      },
                      "type": "object"
                    },
                    "handle": {
                      "description": "The \u003chandle\u003e in your addresses: sites at https://\u003csite\u003e.\u003chandle\u003e.stage.simple-host.site/ (newer accounts https://\u003csite\u003e--\u003chandle\u003e.stage.simple-host.site/), your page at https://\u003chandle\u003e.stage.simple-host.site/ (or .site)",
                      "type": "string"
                    },
                    "has_password": {
                      "description": "Whether this account has a password set.",
                      "type": "boolean"
                    },
                    "home_site": {
                      "description": "Chosen home site name; null means showcase.",
                      "nullable": true,
                      "type": "string"
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "is_admin": {
                      "type": "boolean"
                    },
                    "keep_versions": {
                      "description": "Account default retention; 0 means all",
                      "type": "integer"
                    },
                    "login": {
                      "description": "A password account's own login (account_passwords.login), present whenever has_password is true.",
                      "type": "string"
                    },
                    "max_site_mb": {
                      "description": "Largest site this account may deploy, in MB (an upload or its unpacked files over it is 413 site_too_large).",
                      "type": "integer"
                    },
                    "max_sites": {
                      "description": "Sites this account may hold (sites in Recently deleted count. Errors: 403 site_quota_reached.",
                      "type": "integer"
                    },
                    "public_page": {
                      "description": "The account's public page listing its public sites, e.g. https://\u003chandle\u003e.stage.simple-host.site/.",
                      "format": "uri",
                      "type": "string"
                    },
                    "signin_alerts": {
                      "description": "Whether an email follows each sign-in or app connection (PATCH /v1/me to change).",
                      "type": "boolean"
                    },
                    "username": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Current user"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Current user",
        "tags": [
          "Account"
        ]
      },
      "patch": {
        "description": "Change the display name or handle; once something is published the handle can change once every 30 days, and old addresses redirect.",
        "operationId": "patchMe",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "minProperties": 1,
                "properties": {
                  "display_name": {
                    "description": "Trimmed; empty clears the name.",
                    "maxLength": 100,
                    "type": "string"
                  },
                  "handle": {
                    "description": "The \u003chandle\u003e in your address https://\u003chandle\u003e.stage.simple-host.site/.",
                    "pattern": "^[a-z0-9-]{1,39}$",
                    "type": "string"
                  },
                  "signin_alerts": {
                    "description": "Sign-in alert emails (default true): one email after each sign-in or app connection, at most one per browser or app a day. Errors: 400 not_an_account_key.",
                    "type": "boolean"
                  }
                },
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Updated account profile"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Invalid profile, or signin_alerts sent without an account key (code not_an_account_key)"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "API key required"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "The handle cannot be had: code handle_taken (another account's handle or old handle, or a site's claimed free name. Errors: handle_reserved, 400 invalid_handle."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "next_change_after": {
                      "format": "date-time",
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "The handle already changed within the last 30 days after publishing"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Edit display name or change your handle",
        "tags": [
          "Account"
        ]
      }
    },
    "/v1/me/address-families": {
      "get": {
        "description": "Every address family of the account, pending or verified.",
        "operationId": "listAddressFamilies",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "address_families": {
                      "items": {
                        "$ref": "#/components/schemas/AddressFamily"
                      },
                      "type": "array"
                    },
                    "available": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "address_families",
                    "available"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "The account's families"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "The account's address families",
        "tags": [
          "Address families"
        ]
      },
      "post": {
        "description": "Connect `*.\u003csuffix\u003e` once so every matching site of the account answers under it. A pending family expires after 24 hours. Errors: use_custom_domain.",
        "operationId": "createAddressFamily",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AddressFamilyRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AddressFamily"
                }
              }
            },
            "description": "The account already has this family; it is returned unchanged"
          },
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AddressFamily"
                }
              }
            },
            "description": "Connected; pending until both DNS records are seen"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "invalid_domain (not a domain you can own, a public suffix, an internationalised name, or the platform's own, e.g. stage.simple-host.site). Errors: invalid_site_prefix, invalid_rank, cert_mode_unavailable, invalid_cert_mode."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "account_suspended"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "domain_taken (the name, or one over or under it, is connected to another account), address_family_limit. Errors: address_families_unavailable."
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Connect *.\u003cdomain\u003e so every site of the account answers under it",
        "tags": [
          "Address families"
        ]
      }
    },
    "/v1/me/address-families/{suffix}": {
      "delete": {
        "description": "Every site stops answering under the family at once and goes back to its own address (or its domain).",
        "operationId": "deleteAddressFamily",
        "responses": {
          "204": {
            "description": "Disconnected"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "no_address_family"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Disconnect an address family",
        "tags": [
          "Address families"
        ]
      },
      "get": {
        "description": "The family, with its DNS records, status and certificate.",
        "operationId": "getAddressFamily",
        "parameters": [
          {
            "description": "1: list every matching site and its address",
            "in": "query",
            "name": "sites",
            "required": false,
            "schema": {
              "enum": [
                "1"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AddressFamily"
                }
              }
            },
            "description": "The family"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "no_address_family"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "One address family",
        "tags": [
          "Address families"
        ]
      },
      "parameters": [
        {
          "$ref": "#/components/parameters/familySuffix"
        }
      ],
      "patch": {
        "description": "Send any of `site_prefix`, `rank` and `canonical`; the others stay.",
        "operationId": "patchAddressFamily",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "canonical": {
                    "type": "boolean"
                  },
                  "rank": {
                    "maximum": 1000,
                    "minimum": 0,
                    "type": "integer"
                  },
                  "site_prefix": {
                    "type": "string"
                  }
                },
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AddressFamily"
                }
              }
            },
            "description": "The family after the change"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "invalid_site_prefix or invalid_rank"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "no_address_family"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Change a family's site prefix, rank or main-address switch",
        "tags": [
          "Address families"
        ]
      }
    },
    "/v1/me/address-families/{suffix}/check": {
      "parameters": [
        {
          "$ref": "#/components/parameters/familySuffix"
        }
      ],
      "post": {
        "description": "Proves the family now (the TXT record, a random name under the wildcard resolving only to this server and, once live. Errors: 429 rate_limited.",
        "operationId": "checkAddressFamily",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AddressFamily"
                }
              }
            },
            "description": "The family after the check"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "no_address_family (none, or it was let go)"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Check an address family again now",
        "tags": [
          "Address families"
        ]
      }
    },
    "/v1/me/api-key/rotate": {
      "post": {
        "description": "The \"Sign out everywhere\" button.",
        "operationId": "postMeApiKeyRotate",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "api_key": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "api_key",
                    "message"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "API key rotated"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Sign out everywhere (rotate your API key)",
        "tags": [
          "Account"
        ]
      }
    },
    "/v1/me/bio": {
      "get": {
        "description": "Owner key or connector only, never deploy-only keys.",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "bio": {
                      "type": "string"
                    },
                    "max_length": {
                      "default": 280,
                      "maximum": 2000,
                      "minimum": 1,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "bio",
                    "max_length"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Plain-text bio and character limit"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Deploy-only key refused"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Showcase settings unavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Get your public showcase bio and its configured limit",
        "tags": [
          "Account"
        ]
      },
      "put": {
        "description": "Trimmed plain text, empty clears.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "bio": {
                    "type": "string"
                  }
                },
                "required": [
                  "bio"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "bio": {
                      "type": "string"
                    },
                    "max_length": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "bio",
                    "max_length"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Saved plain-text bio and configured limit"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Missing bio or bio_too_long"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Deploy-only key refused"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Showcase settings unavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Save your public showcase plain-text bio",
        "tags": [
          "Account"
        ]
      }
    },
    "/v1/me/connections": {
      "get": {
        "description": "The AI apps (ChatGPT, Claude, Grok, a GPT Action) this account has connected through the Simple Host connector.",
        "operationId": "getMeConnections",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "connections": {
                      "items": {
                        "properties": {
                          "client_id": {
                            "type": "string"
                          },
                          "connected_at": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "device": {
                            "description": "The browser the connection was approved on, summarised, to tell two connections of the same app apart.",
                            "type": "string"
                          },
                          "last_used_at": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "last_visitor_site": {
                            "description": "Last site address used by a visitor tool in this app.",
                            "type": "string"
                          },
                          "name": {
                            "description": "The name the app registered with",
                            "type": "string"
                          },
                          "teams": {
                            "description": "Only on a server that hosts events: the event teams this app publishes to; empty when it has not picked one.",
                            "items": {
                              "properties": {
                                "event": {
                                  "type": "string"
                                },
                                "team": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "event",
                                "team"
                              ],
                              "type": "object"
                            },
                            "type": "array"
                          }
                        },
                        "required": [
                          "client_id",
                          "name",
                          "connected_at",
                          "last_used_at"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "connections"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Connected apps, newest first"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "List connected apps",
        "tags": [
          "Account"
        ]
      }
    },
    "/v1/me/connections/{client_id}": {
      "delete": {
        "description": "Revokes every token this account granted to the app.",
        "operationId": "deleteMeConnection",
        "parameters": [
          {
            "in": "path",
            "name": "client_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Disconnected"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "No connected app with that id"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Disconnect an app",
        "tags": [
          "Account"
        ]
      }
    },
    "/v1/me/deleted-sites": {
      "get": {
        "description": "Sites this account deleted in the last 7 days.",
        "operationId": "getMeDeletedSites",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "retention_days": {
                      "type": "integer"
                    },
                    "sites": {
                      "items": {
                        "properties": {
                          "custom_domain": {
                            "type": "string"
                          },
                          "deleted_at": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "purge_at": {
                            "description": "When it is removed for good",
                            "format": "date-time",
                            "type": "string"
                          }
                        },
                        "required": [
                          "name",
                          "deleted_at",
                          "purge_at"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "sites",
                    "retention_days"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Recently deleted sites, most recently deleted first"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "List recently deleted sites",
        "tags": [
          "Account"
        ]
      }
    },
    "/v1/me/email": {
      "post": {
        "description": "Emails a 6-digit code to the new address and another to the current one (15 minutes, 3 tries).",
        "operationId": "requestEmailChange",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "email": {
                    "format": "email",
                    "type": "string"
                  }
                },
                "required": [
                  "email"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "current_email": {
                      "description": "The current address (current_code)",
                      "type": "string"
                    },
                    "email": {
                      "description": "The new address (code)",
                      "type": "string"
                    },
                    "expires_in_seconds": {
                      "type": "integer"
                    },
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Codes sent"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Not an account key (code not_an_account_key), not an email (code invalid_email), already the sign-in email. Errors: same_email, reserved_email."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "The reviewer, an admin, event or preview account, or one with no email to confirm from. Errors: admin_account, event_account."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Too many requests"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Change your sign-in email, step 1: send codes to the new and the current address",
        "tags": [
          "Account"
        ]
      }
    },
    "/v1/me/email/undo": {
      "get": {
        "description": "Shows the undo confirmation page and changes nothing; 404 when the link was used or is older than 7 days.",
        "operationId": "getEmailChangeUndo",
        "parameters": [
          {
            "in": "query",
            "name": "t",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "HTML confirmation page with the button"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "HTML page; the link was used or has expired"
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Too many requests"
          }
        },
        "security": [],
        "summary": "\"This wasn't me\" link from the old address's notice (confirmation page)",
        "tags": [
          "Account"
        ]
      },
      "post": {
        "description": "The confirmation page's button (with `peek=1`, only the confirmation page).",
        "operationId": "postEmailChangeUndo",
        "requestBody": {
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "properties": {
                  "peek": {
                    "enum": [
                      "1"
                    ],
                    "type": "string"
                  },
                  "t": {
                    "type": "string"
                  }
                },
                "required": [
                  "t"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "HTML page; the account signs in with the old address again"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "HTML page; the link was used or has expired"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "HTML page; another account signs in with the old address now"
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Too many requests"
          }
        },
        "security": [],
        "summary": "Undo a sign-in email change",
        "tags": [
          "Account"
        ]
      }
    },
    "/v1/me/email/verify": {
      "post": {
        "description": "Move the account to the new email; the old address gets a notice with an undo link valid for 7 days.",
        "operationId": "verifyEmailChange",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "code": {
                    "description": "The 6-digit code emailed to the new address",
                    "type": "string"
                  },
                  "current_code": {
                    "description": "The 6-digit code emailed to the current address",
                    "type": "string"
                  }
                },
                "required": [
                  "code",
                  "current_code"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "email": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    },
                    "username": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Changed"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Not an account key (code not_an_account_key), a code missing (code codes_required), no change waiting. Errors: reserved_email."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Wrong or expired code, or too many tries (code invalid_code)"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "The reviewer, an admin, event or preview account (see step 1)"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Another account signs in with that address (code email_taken)"
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Too many requests"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Change your sign-in email, step 2: confirm with both codes",
        "tags": [
          "Account"
        ]
      }
    },
    "/v1/me/export.tar.gz": {
      "get": {
        "deprecated": true,
        "description": "The address Download my data had before it became a .zip.",
        "operationId": "exportMeLegacy",
        "responses": {
          "200": {
            "content": {
              "application/zip": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              }
            },
            "description": "The same .zip as GET /v1/me/export.zip"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Not one of the account's own API keys (code not_an_account_key)"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "The account is suspended (code account_suspended)"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Download all your data (older address)",
        "tags": [
          "Account"
        ]
      }
    },
    "/v1/me/export.zip": {
      "get": {
        "description": "Streams one .zip of everything held about the account: README.txt.",
        "operationId": "exportMe",
        "responses": {
          "200": {
            "content": {
              "application/zip": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              }
            },
            "description": "A .zip file (Content-Disposition names it simple-host-\u003chandle\u003e-\u003cdate\u003e.zip)"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Not one of the account's own API keys (code not_an_account_key)"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "The account is suspended (code account_suspended); write to whoever runs this server for a copy of the data"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Download all your data (one .zip)",
        "tags": [
          "Account"
        ]
      }
    },
    "/v1/me/home": {
      "get": {
        "description": "Owner key or connector only; deploy-only keys refused.",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "site": {
                      "nullable": true,
                      "type": "string"
                    }
                  },
                  "required": [
                    "site"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Home-page choice"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Deploy-only key refused"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Personal homes unavailable in hosted events mode"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Get your home-page choice",
        "tags": [
          "Account"
        ]
      },
      "put": {
        "description": "The hosted person address serves the chosen site at root, with its passcode, sign-in and storage.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "site": {
                    "nullable": true,
                    "type": "string"
                  }
                },
                "required": [
                  "site"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "site": {
                      "nullable": true,
                      "type": "string"
                    }
                  },
                  "required": [
                    "site"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Saved choice"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Invalid choice"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Deploy-only key refused"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Site not owned or deleted, or hosted events mode"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Site requires the legacy content host"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Choose your showcase or one of your sites as home",
        "tags": [
          "Account"
        ]
      }
    },
    "/v1/me/identities": {
      "get": {
        "description": "Own API key only (400 not_an_account_key otherwise).",
        "operationId": "listIdentities",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "identities": {
                      "items": {
                        "properties": {
                          "email": {
                            "type": "string"
                          },
                          "id": {
                            "type": "string"
                          },
                          "linked_at": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "provider": {
                            "enum": [
                              "google",
                              "github"
                            ],
                            "type": "string"
                          }
                        },
                        "type": "object"
                      },
                      "type": "array"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "The linked sign-ins"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Not an account key (code not_an_account_key)"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Google and GitHub accounts that sign in to yours",
        "tags": [
          "Account"
        ]
      }
    },
    "/v1/me/identities/{id}": {
      "delete": {
        "description": "That Google or GitHub account no longer signs in to yours.",
        "operationId": "unlinkIdentity",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Unlinked"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Not an account key (code not_an_account_key)"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "No such sign-in on this account"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Unlink a Google or GitHub sign-in",
        "tags": [
          "Account"
        ]
      }
    },
    "/v1/me/keys": {
      "get": {
        "description": "Every key on the account, newest first. A key unused for 180 days stops working.",
        "operationId": "getMeKeys",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "keys": {
                      "items": {
                        "$ref": "#/components/schemas/APIKey"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "keys"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "The account's keys"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "List your API keys",
        "tags": [
          "Account"
        ]
      },
      "post": {
        "description": "Mint a named key, returned once; `scope: deploy` makes a deploy-only key. An account holds at most 50 keys (409 key_limit). Errors: 403 deploy_only_key, 400 not_an_account_key, 401 invalid_api_key.",
        "operationId": "postMeKey",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "expires_in_days": {
                    "description": "Optional fixed expiry, in days from now",
                    "maximum": 3650,
                    "minimum": 1,
                    "type": "integer"
                  },
                  "name": {
                    "description": "Any label except the names Simple Host gives its own keys.",
                    "maxLength": 60,
                    "minLength": 1,
                    "type": "string"
                  },
                  "scope": {
                    "default": "full",
                    "description": "deploy: create, update, roll back and list sites and make preview links, nothing else",
                    "enum": [
                      "full",
                      "deploy"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "name"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/APIKey"
                    },
                    {
                      "properties": {
                        "api_key": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "api_key"
                      ],
                      "type": "object"
                    }
                  ]
                }
              }
            },
            "description": "Key created. `api_key` is shown only here."
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "The account already holds 50 keys (code key_limit); revoke one first."
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Create a named API key",
        "tags": [
          "Account"
        ]
      }
    },
    "/v1/me/keys/{id}": {
      "delete": {
        "description": "The key stops working at once; the account's other keys and connected apps are untouched.",
        "operationId": "deleteMeKey",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Revoked"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Not one of the account's own keys (code not_an_account_key)"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "No key with that id on this account"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Revoke one API key",
        "tags": [
          "Account"
        ]
      }
    },
    "/v1/me/password": {
      "post": {
        "description": "Available only when PASSWORD_SIGNIN=on, for an account that already has a password (404 for one that does not).",
        "operationId": "changeOwnPassword",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "current_password": {
                    "format": "password",
                    "type": "string"
                  },
                  "new_password": {
                    "format": "password",
                    "maxLength": 256,
                    "minLength": 8,
                    "type": "string"
                  }
                },
                "required": [
                  "current_password",
                  "new_password"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "204": {
            "description": "Password changed"
          },
          "400": {
            "description": "invalid_password (too short, or same as current_password)"
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "403": {
            "description": "Wrong current password (code bad_credentials), or a connector access token. Errors: connector_not_allowed."
          },
          "404": {
            "description": "not found: PASSWORD_SIGNIN is off, or this account has no password"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Change your own password",
        "tags": [
          "Account"
        ]
      }
    },
    "/v1/me/sign-out": {
      "post": {
        "description": "Deletes the API key sent with this request and cascades to its apex SSO passes and every visitor session minted from them.",
        "operationId": "postMeSignOut",
        "responses": {
          "204": {
            "description": "Signed out; the key no longer works"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Not one of the account's own keys (code not_an_account_key)"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Sign out (end the key this request used)",
        "tags": [
          "Account"
        ]
      }
    },
    "/v1/me/team-invitations/{invitation}": {
      "post": {
        "operationId": "postMeTeamInvitation",
        "parameters": [
          {
            "in": "path",
            "name": "invitation",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "answer": {
                    "enum": [
                      "accept",
                      "decline"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "answer"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Answer an invitation",
        "tags": [
          "Teams"
        ]
      }
    },
    "/v1/notifications": {
      "get": {
        "description": "Owner credentials required on Host.",
        "operationId": "listNotifications",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotificationList"
                }
              }
            },
            "description": "List notifications across the account"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Missing or invalid owner credentials."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotificationError"
                }
              }
            },
            "description": "forbidden, or notification_access_ended when access no longer permits the operation."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotificationError"
                }
              }
            },
            "description": "not_found, or not_offered for an event account."
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "List notifications across the account",
        "tags": [
          "Notifications"
        ]
      }
    },
    "/v1/photo-links": {
      "get": {
        "description": "The create_upload_link photos_url opens /photos?site=\u003cname\u003e#t=\u003ctoken\u003e.",
        "operationId": "getPhotoLink",
        "parameters": [
          {
            "in": "header",
            "name": "X-Photo-Token",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "site": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "site"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "The site this link can add photos to"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Origin refused or creating sign-in revoked"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "This photo link has expired. Ask your chat for a new one."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "A save is in progress"
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Rate limit exceeded"
          }
        },
        "security": [],
        "summary": "Check a photo link and return its fixed site",
        "tags": [
          "Deploy"
        ]
      },
      "post": {
        "description": "Uses the same X-Photo-Token, sign-in recheck, Origin policy, and rate limit as GET.",
        "operationId": "savePhotoLink",
        "parameters": [
          {
            "in": "header",
            "name": "X-Photo-Token",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Set to 1 after an uncertain save to check matching live photo bytes without writing a version.",
            "in": "header",
            "name": "X-Photo-Reconcile",
            "schema": {
              "enum": [
                "1"
              ],
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "$ref": "#/paths/~1v1~1sites~1{sitename}~1photos/post/requestBody"
        },
        "responses": {
          "200": {
            "$ref": "#/paths/~1v1~1sites~1{sitename}~1photos/post/responses/200"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Origin or deploy permission refused, or creating sign-in revoked"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Site missing, or this photo link has expired."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "A save is in progress or a file/directory conflicts with the photo path"
          },
          "413": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Photo, site, account, or request size limit exceeded"
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Rate limit or photo save capacity exceeded; Retry-After advises when to retry"
          }
        },
        "security": [],
        "summary": "Add photos through a site-bound connector link",
        "tags": [
          "Deploy"
        ]
      }
    },
    "/v1/push/sw.js": {
      "get": {
        "description": "Unauthenticated, host-agnostic, and never gated by WEB_PUSH_ACCOUNTS (there is no site or account in this path at all).",
        "operationId": "webPushServiceWorker",
        "responses": {
          "200": {
            "content": {
              "text/javascript": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "The service worker's JavaScript source",
            "headers": {
              "Cache-Control": {
                "description": "public, max-age=3600",
                "schema": {
                  "type": "string"
                }
              },
              "Content-Type": {
                "description": "text/javascript; charset=utf-8",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "description": "The embedded file is unexpectedly missing (install misconfiguration)."
          }
        },
        "summary": "Generic Web Push service worker (SIM-360)",
        "tags": [
          "Notifications"
        ]
      },
      "head": {
        "description": "The browser's own conditional-registration check uses this; identical gating (none) and headers to GET, with no body.",
        "operationId": "webPushServiceWorkerHead",
        "responses": {
          "200": {
            "description": "Headers only, same as GET"
          },
          "404": {
            "description": "The embedded file is unexpectedly missing (install misconfiguration)."
          }
        },
        "summary": "Same as GET, headers only",
        "tags": [
          "Notifications"
        ]
      }
    },
    "/v1/site-signin": {
      "post": {
        "description": "The form on a named-viewers site's sign-in page posts here, on the site's own host; no key, no JavaScript. Errors: 403 origin_not_allowed.",
        "operationId": "postSiteSignin",
        "requestBody": {
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "properties": {
                  "code": {
                    "type": "string"
                  },
                  "email": {
                    "type": "string"
                  },
                  "next": {
                    "description": "A path on this host to return to (default /)",
                    "type": "string"
                  }
                },
                "required": [
                  "email"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "303": {
            "description": "Signed in; go back to `next`",
            "headers": {
              "Location": {
                "schema": {
                  "type": "string"
                }
              },
              "Set-Cookie": {
                "description": "The visitor session cookie __Host-sh_vsess for this host",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Not a form post"
          },
          "401": {
            "content": {
              "text/html": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "The code page, or the sign-in page again with the reason (text/html, noindex, no-store)"
          },
          "403": {
            "$ref": "#/components/responses/OriginMismatch"
          }
        },
        "summary": "Sign in from a named-viewers site's sign-in page",
        "tags": [
          "Visitor sign-in"
        ]
      }
    },
    "/v1/site-signout": {
      "post": {
        "description": "The Switch account and Sign out buttons on \"This site is private\" post here, on the site's own host.",
        "operationId": "postSiteSignout",
        "requestBody": {
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "properties": {
                  "next": {
                    "type": "string"
                  },
                  "then": {
                    "enum": [
                      "switch",
                      "out"
                    ],
                    "type": "string"
                  }
                },
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "303": {
            "description": "Signed out; go back to `next`",
            "headers": {
              "Location": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Not a form post"
          },
          "403": {
            "$ref": "#/components/responses/OriginMismatch"
          }
        },
        "summary": "Sign out from a named-viewers site's private page",
        "tags": [
          "Visitor sign-in"
        ]
      }
    },
    "/v1/site-unlock": {
      "post": {
        "description": "The form on the \"This site is protected\" page posts here, on the site's own host; no key. Errors: 403 origin_not_allowed.",
        "operationId": "postSiteUnlock",
        "requestBody": {
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "properties": {
                  "next": {
                    "description": "A path on this host to return to (default /)",
                    "type": "string"
                  },
                  "passcode": {
                    "type": "string"
                  }
                },
                "required": [
                  "passcode"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "303": {
            "description": "Right passcode; go back to `next`",
            "headers": {
              "Location": {
                "schema": {
                  "type": "string"
                }
              },
              "Set-Cookie": {
                "description": "The unlock cookie: __Host-sh_pass_\u003cid\u003e, HttpOnly, Secure, SameSite=Lax, Path=/, about 400 days",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Not a form post"
          },
          "401": {
            "content": {
              "text/html": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "Wrong passcode: the gate page again, saying so (text/html, noindex, no-store)"
          },
          "403": {
            "$ref": "#/components/responses/OriginMismatch"
          },
          "429": {
            "content": {
              "text/html": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "Too many wrong tries: the gate page saying when to try again (text/html)",
            "headers": {
              "Retry-After": {
                "description": "Seconds",
                "schema": {
                  "type": "integer"
                }
              }
            }
          }
        },
        "summary": "Enter a site's passcode (the \"This site is protected\" form)",
        "tags": [
          "Visitor sign-in"
        ]
      }
    },
    "/v1/sites": {
      "get": {
        "description": "Returns the authenticated account's own sites, newest edited first (updated_at desc, then created_at desc).",
        "operationId": "getSites",
        "parameters": [
          {
            "description": "Every word must match the name, domain or summary (case-insensitive substrings).",
            "in": "query",
            "name": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Created on or after RFC3339 or YYYY-MM-DD (UTC midnight).",
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Created on or before RFC3339 or YYYY-MM-DD (UTC whole day).",
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Updated on or after RFC3339 or YYYY-MM-DD (UTC midnight).",
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Updated on or before RFC3339 or YYYY-MM-DD (UTC whole day).",
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Sort key; default updated (last edited first).",
            "in": "query",
            "name": "order",
            "schema": {
              "enum": [
                "updated",
                "created",
                "name"
              ],
              "type": "string"
            }
          },
          {
            "description": "Maximum results, clamped to 500; default 200 when any filter or paging parameter is present.",
            "in": "query",
            "name": "limit",
            "schema": {
              "minimum": 0,
              "type": "integer"
            }
          },
          {
            "description": "Skip this many matching sites.",
            "in": "query",
            "name": "offset",
            "schema": {
              "default": 0,
              "minimum": 0,
              "type": "integer"
            }
          },
          {
            "description": "Admin only: every account's sites instead of just this one.",
            "in": "query",
            "name": "all",
            "schema": {
              "enum": [
                "1"
              ],
              "type": "string"
            }
          },
          {
            "description": "A site name; that site's entry also lists the files of its live version (files, absent when nothing is published).",
            "in": "query",
            "name": "files",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/Site"
                  },
                  "type": "array"
                }
              }
            },
            "description": "List of sites"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Invalid date (bad_date), order (bad_order), or non-negative integer required for limit/offset (bad_pagination)."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "all=1 from a non-admin."
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "List your sites",
        "tags": [
          "Sites"
        ]
      }
    },
    "/v1/sites/{sitename}": {
      "delete": {
        "description": "Takes the site offline at once; it stays in Recently deleted for 7 days with its name held, and restore brings it back. Errors: recently_deleted.",
        "operationId": "deleteSitesBySitename",
        "parameters": [
          {
            "$ref": "#/components/parameters/sitename"
          },
          {
            "description": "When given, must be the site's name (any case), or nothing is deleted. Errors: 400 confirm_name_mismatch.",
            "in": "query",
            "name": "confirm_name",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Site deleted (restorable for 7 days)"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "`confirm_name_mismatch`: confirm_name is not this site's name; nothing was deleted."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Delete your site",
        "tags": [
          "Sites"
        ]
      },
      "patch": {
        "description": "One change per request. With {\"offline\": true} the site is taken offline: every address answers a plain \"This site is offline\" page. Errors: 403 site_offline.",
        "operationId": "patchSitesBySitename",
        "parameters": [
          {
            "$ref": "#/components/parameters/sitename"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "description": "Exactly one of name or offline.",
                "properties": {
                  "name": {
                    "description": "The new name (renames the site).",
                    "type": "string"
                  },
                  "offline": {
                    "description": "true takes the site offline; false puts it back online.",
                    "type": "boolean"
                  }
                },
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Renamed (old_name, name, old_url, site_url, old_url_status) or switched (the site object with offline and note)"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "The operator has taken the site down (code site_suspended)"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Rename your site, or take it offline",
        "tags": [
          "Sites"
        ]
      },
      "post": {
        "description": "Upload a `.tar.gz` or `.zip` (for framework builds, binary assets, large sites). Max 100 MB.",
        "operationId": "postSitesBySitename",
        "parameters": [
          {
            "$ref": "#/components/parameters/sitename"
          },
          {
            "$ref": "#/components/parameters/createIdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/author"
          },
          {
            "$ref": "#/components/parameters/createAccess"
          },
          {
            "$ref": "#/components/parameters/createViewers"
          }
        ],
        "requestBody": {
          "content": {
            "application/gzip": {
              "schema": {
                "format": "binary",
                "type": "string"
              }
            },
            "application/zip": {
              "schema": {
                "format": "binary",
                "type": "string"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SiteWithNote"
                }
              }
            },
            "description": "Site created"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "site_exists, access_differs (create-or-update), named_viewers_unavailable, sign_in_unavailable, named_viewers_need_own_address. Errors: idempotency_key_reused."
          },
          "413": {
            "$ref": "#/components/responses/TooLarge"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Create a site from an archive",
        "tags": [
          "Deploy"
        ]
      },
      "put": {
        "description": "Upload a new version of an existing site you own. Errors: 400 invalid_request.",
        "operationId": "putSitesBySitename",
        "parameters": [
          {
            "$ref": "#/components/parameters/sitename"
          },
          {
            "$ref": "#/components/parameters/publish"
          },
          {
            "$ref": "#/components/parameters/create"
          },
          {
            "$ref": "#/components/parameters/author"
          },
          {
            "$ref": "#/components/parameters/createAccess"
          },
          {
            "$ref": "#/components/parameters/createViewers"
          }
        ],
        "requestBody": {
          "content": {
            "application/gzip": {
              "schema": {
                "format": "binary",
                "type": "string"
              }
            },
            "application/zip": {
              "schema": {
                "format": "binary",
                "type": "string"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SiteWithNote"
                }
              }
            },
            "description": "Site updated"
          },
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SiteWithNote"
                }
              }
            },
            "description": "Site created (?create=1 and no site of that name)"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "site_exists, access_differs (create-or-update), named_viewers_unavailable, sign_in_unavailable, named_viewers_need_own_address. Errors: idempotency_key_reused."
          },
          "413": {
            "$ref": "#/components/responses/TooLarge"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Update a site from an archive",
        "tags": [
          "Deploy"
        ]
      }
    },
    "/v1/sites/{sitename}/access": {
      "get": {
        "description": "Owner only (the owner's key or connector token; a deploy-only key is refused).",
        "operationId": "getSitesBySitenameAccess",
        "parameters": [
          {
            "$ref": "#/components/parameters/sitename"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SiteAccess"
                }
              }
            },
            "description": "Who can open the site"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "A deploy-only key (deploy_only_key)"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Who can open a site, and its named viewers",
        "tags": [
          "Sites"
        ]
      },
      "put": {
        "description": "Owner only. `{\"access\": \"specific\"}`: every address of the site. Errors: 403 site_private.",
        "operationId": "putSitesBySitenameAccess",
        "parameters": [
          {
            "$ref": "#/components/parameters/sitename"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "access": {
                    "enum": [
                      "anyone",
                      "specific"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "access"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SiteAccess"
                }
              }
            },
            "description": "Who can open the site now, with a plain `note`"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Body is not {\"access\": \"anyone\"} or {\"access\": \"specific\"} (invalid_request)"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "The operator has taken the site down (site_suspended), or a deploy-only key (deploy_only_key)"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "passcode_set (remove the passcode first), named_viewers_need_own_address."
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Choose who can open a site (anyone, or only named viewers)",
        "tags": [
          "Sites"
        ]
      }
    },
    "/v1/sites/{sitename}/active-version": {
      "put": {
        "description": "Re-point the live site at an existing version number: an earlier one, or one stored with publish=false (which then counts as live).",
        "operationId": "putSitesBySitenameActiveVersion",
        "parameters": [
          {
            "$ref": "#/components/parameters/sitename"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "version_number": {
                    "type": "integer"
                  }
                },
                "required": [
                  "version_number"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Active version changed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Roll back to a version, or make a stored version live",
        "tags": [
          "Versions"
        ]
      }
    },
    "/v1/sites/{sitename}/allowed-origins": {
      "put": {
        "description": "Whitelist extra origins (scheme://host, no path) that may call this site's API cross-origin.",
        "operationId": "putSitesBySitenameAllowedOrigins",
        "parameters": [
          {
            "$ref": "#/components/parameters/sitename"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "origins": {
                    "items": {
                      "type": "string"
                    },
                    "maxItems": 20,
                    "type": "array"
                  }
                },
                "required": [
                  "origins"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "allowed_origins": {
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "site": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Allowlist replaced"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Allow external origins to use this site's backend",
        "tags": [
          "Visitor sign-in"
        ]
      }
    },
    "/v1/sites/{sitename}/analytics": {
      "get": {
        "description": "Owner-scoped view and visitor counts derived server-side from the access log (no client beacon).",
        "operationId": "getSitesBySitenameAnalytics",
        "parameters": [
          {
            "$ref": "#/components/parameters/sitename"
          },
          {
            "description": "Number of UTC days to include (default 30, clamp 1..365)",
            "in": "query",
            "name": "days",
            "required": false,
            "schema": {
              "default": 30,
              "maximum": 365,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "Handle of the account that owns the site.",
            "in": "query",
            "name": "owner",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "classified_from": {
                      "description": "First UTC day for which the person/bot/infra split exists (the owner class starts later, with the first owner marks).",
                      "format": "date",
                      "type": "string"
                    },
                    "daily": {
                      "items": {
                        "allOf": [
                          {
                            "properties": {
                              "day": {
                                "format": "date",
                                "type": "string"
                              }
                            },
                            "type": "object"
                          },
                          {
                            "$ref": "#/components/schemas/TrafficSplit"
                          }
                        ]
                      },
                      "type": "array"
                    },
                    "hourly": {
                      "description": "Exactly 24 buckets, oldest → newest.",
                      "items": {
                        "allOf": [
                          {
                            "properties": {
                              "hour": {
                                "format": "date-time",
                                "type": "string"
                              }
                            },
                            "type": "object"
                          },
                          {
                            "$ref": "#/components/schemas/TrafficSplit"
                          }
                        ]
                      },
                      "type": "array"
                    },
                    "last_24h": {
                      "$ref": "#/components/schemas/TrafficSplit"
                    },
                    "range_days": {
                      "type": "integer"
                    },
                    "totals": {
                      "$ref": "#/components/schemas/TrafficSplit"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Analytics for the site"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Get per-site visitor analytics",
        "tags": [
          "Analytics"
        ]
      }
    },
    "/v1/sites/{sitename}/analytics/geo": {
      "get": {
        "description": "Per-country traffic for one site over the last `days` UTC days.",
        "operationId": "getSitesBySitenameAnalyticsGeo",
        "parameters": [
          {
            "$ref": "#/components/parameters/sitename"
          },
          {
            "description": "Number of UTC days to include (default 30, clamp 1..365)",
            "in": "query",
            "name": "days",
            "required": false,
            "schema": {
              "default": 30,
              "maximum": 365,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "Handle of the account that owns the site.",
            "in": "query",
            "name": "owner",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "countries": {
                      "items": {
                        "allOf": [
                          {
                            "properties": {
                              "country": {
                                "description": "ISO-3166 alpha-2, or \"XX\" when unresolved",
                                "type": "string"
                              },
                              "country_name": {
                                "type": "string"
                              }
                            },
                            "type": "object"
                          },
                          {
                            "$ref": "#/components/schemas/TrafficSplit"
                          }
                        ]
                      },
                      "type": "array"
                    },
                    "range_days": {
                      "type": "integer"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Per-country traffic, most real people first."
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Where a site's visitors are, by country",
        "tags": [
          "Analytics"
        ]
      }
    },
    "/v1/sites/{sitename}/analytics/top": {
      "get": {
        "description": "The 20 most viewed pages (path on the site, without the query string or fragment.",
        "operationId": "getSitesBySitenameAnalyticsTop",
        "parameters": [
          {
            "$ref": "#/components/parameters/sitename"
          },
          {
            "description": "Number of UTC days to include (default 30, clamp 1..365)",
            "in": "query",
            "name": "days",
            "required": false,
            "schema": {
              "default": 30,
              "maximum": 365,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "Handle of the account that owns the site (platform admin only; anyone else gets 404).",
            "in": "query",
            "name": "owner",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "pages": {
                      "items": {
                        "properties": {
                          "path": {
                            "type": "string"
                          },
                          "views": {
                            "description": "Views by people",
                            "type": "integer"
                          }
                        },
                        "required": [
                          "path",
                          "views"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "range_days": {
                      "type": "integer"
                    },
                    "referrers": {
                      "items": {
                        "properties": {
                          "domain": {
                            "type": "string"
                          },
                          "views": {
                            "description": "Views by people arriving from it",
                            "type": "integer"
                          }
                        },
                        "required": [
                          "domain",
                          "views"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "range_days",
                    "pages",
                    "referrers"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Top pages and referring domains"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "A site's top pages and where its visitors came from",
        "tags": [
          "Analytics"
        ]
      }
    },
    "/v1/sites/{sitename}/domain": {
      "delete": {
        "description": "Disconnects the domain GET shows.",
        "operationId": "deleteSitesBySitenameDomain",
        "parameters": [
          {
            "$ref": "#/components/parameters/sitename"
          },
          {
            "description": "The address you mean to disconnect. Errors: 409 domain_changed.",
            "in": "query",
            "name": "domain",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "site answers 200 with the site as it is now (its new live_url) instead of 204.",
            "in": "query",
            "name": "return",
            "required": false,
            "schema": {
              "enum": [
                "site"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Site"
                }
              }
            },
            "description": "Domain unbound (return=site)"
          },
          "204": {
            "description": "Domain unbound"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "`domain_changed`: the site's domain is not the one named in `domain`; nothing was changed."
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Disconnect this site's domain or free address",
        "tags": [
          "Custom domains"
        ]
      },
      "get": {
        "description": "Returns the bound domain and status, or `{domain:null,status:null}` when none is set.",
        "operationId": "getSitesBySitenameDomain",
        "parameters": [
          {
            "$ref": "#/components/parameters/sitename"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "bound_at": {
                      "description": "Binding timestamp stored as domain_bound_at; reset on bind",
                      "format": "date-time",
                      "type": "string"
                    },
                    "certificate_status": {
                      "description": "pending (DNS not pointed here yet), issuing, live, or failed (why in last_error; retried).",
                      "enum": [
                        "pending",
                        "issuing",
                        "live",
                        "failed"
                      ],
                      "type": "string"
                    },
                    "dns": {
                      "properties": {
                        "host": {
                          "type": "string"
                        },
                        "type": {
                          "type": "string"
                        },
                        "value": {
                          "type": "string"
                        }
                      },
                      "type": "object"
                    },
                    "dns_partner": {
                      "description": "The record that points the partner here too (A for a bare domain, CNAME for www).",
                      "properties": {
                        "host": {
                          "type": "string"
                        },
                        "type": {
                          "type": "string"
                        },
                        "value": {
                          "type": "string"
                        }
                      },
                      "type": "object"
                    },
                    "dns_txt": {
                      "description": "The ownership record: TXT _simple-host.\u003cdomain\u003e holding this site's token.",
                      "properties": {
                        "host": {
                          "type": "string"
                        },
                        "type": {
                          "type": "string"
                        },
                        "value": {
                          "type": "string"
                        }
                      },
                      "type": "object"
                    },
                    "domain": {
                      "nullable": true,
                      "type": "string"
                    },
                    "expires_at": {
                      "description": "bound_at plus 24 hours; included only while pending and never verified",
                      "format": "date-time",
                      "type": "string"
                    },
                    "failing_since": {
                      "description": "A verified domain that stopped passing its checks: the owner is emailed after 24 hours; after 72 hours it stops being the site's address.",
                      "format": "date-time",
                      "type": "string"
                    },
                    "last_error": {
                      "description": "Why the domain is not active, from the latest check",
                      "type": "string"
                    },
                    "partner_domain": {
                      "description": "The domain's www / bare partner (www.\u003cdomain\u003e for a bare domain, the bare domain for www.\u003cdomain\u003e).",
                      "type": "string"
                    },
                    "partner_note": {
                      "description": "Why the partner is not set up.",
                      "type": "string"
                    },
                    "partner_status": {
                      "description": "pending: the chosen name has no certificate yet (the partner is added with it).",
                      "enum": [
                        "pending",
                        "live",
                        "not_set_up"
                      ],
                      "type": "string"
                    },
                    "previous_domain": {
                      "description": "The site's earlier own address, still serving it until this domain is verified.",
                      "type": "string"
                    },
                    "status": {
                      "enum": [
                        "pending",
                        "active",
                        "error"
                      ],
                      "nullable": true,
                      "type": "string"
                    },
                    "verified_at": {
                      "format": "date-time",
                      "nullable": true,
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Current domain binding"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Get the custom domain binding for this site",
        "tags": [
          "Custom domains"
        ]
      },
      "post": {
        "description": "Give the site a free \u003cname\u003e.stage.simple-host.site (active at once) or a custom domain. A pending custom domain expires 24 hours after binding unless DNS already points here; if a verified one fails every check for 24 hours the owner is emailed, and after 72 hours it is disconnected; at most 5 new domain certificates per account per day.",
        "operationId": "postSitesBySitenameDomain",
        "parameters": [
          {
            "$ref": "#/components/parameters/sitename"
          },
          {
            "$ref": "#/components/parameters/createIdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "domain": {
                    "type": "string"
                  }
                },
                "required": [
                  "domain"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "bound_at": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "certificate_status": {
                      "description": "The custom domain's certificate: pending (DNS not pointed here yet), issuing, live, or failed (why in last_error; retried).",
                      "enum": [
                        "pending",
                        "issuing",
                        "live",
                        "failed"
                      ],
                      "type": "string"
                    },
                    "dns": {
                      "description": "The record that points the domain here, to add at the registrar; absent for a free \u003cname\u003e.stage.simple-host.site address",
                      "properties": {
                        "host": {
                          "type": "string"
                        },
                        "type": {
                          "type": "string"
                        },
                        "value": {
                          "type": "string"
                        }
                      },
                      "type": "object"
                    },
                    "dns_partner": {
                      "description": "The record that points the partner here too (A for a bare domain, CNAME for www).",
                      "properties": {
                        "host": {
                          "type": "string"
                        },
                        "type": {
                          "type": "string"
                        },
                        "value": {
                          "type": "string"
                        }
                      },
                      "type": "object"
                    },
                    "dns_txt": {
                      "description": "The ownership record: TXT _simple-host.\u003cdomain\u003e holding this site's token.",
                      "properties": {
                        "host": {
                          "type": "string"
                        },
                        "type": {
                          "type": "string"
                        },
                        "value": {
                          "type": "string"
                        }
                      },
                      "type": "object"
                    },
                    "domain": {
                      "type": "string"
                    },
                    "expires_at": {
                      "description": "bound_at plus 24 hours; included only while pending and never verified",
                      "format": "date-time",
                      "type": "string"
                    },
                    "partner_domain": {
                      "description": "The domain's www / bare partner (www.\u003cdomain\u003e for a bare domain, the bare domain for www.\u003cdomain\u003e).",
                      "type": "string"
                    },
                    "partner_note": {
                      "description": "Why the partner is not set up.",
                      "type": "string"
                    },
                    "partner_status": {
                      "description": "pending: the chosen name has no certificate yet (the partner is added with it).",
                      "enum": [
                        "pending",
                        "live",
                        "not_set_up"
                      ],
                      "type": "string"
                    },
                    "previous_domain": {
                      "description": "The site's earlier own address, still serving it until this domain is verified (then it redirects here).",
                      "type": "string"
                    },
                    "status": {
                      "enum": [
                        "pending",
                        "active",
                        "error"
                      ],
                      "type": "string"
                    },
                    "took_over_from": {
                      "description": "Previous holder as handle/site; included only on takeover of an unproven binding",
                      "type": "string"
                    },
                    "verified_at": {
                      "description": "Set at once for a free \u003cname\u003e.stage.simple-host.site address",
                      "format": "date-time",
                      "nullable": true,
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Domain bound — pending DNS for a custom domain, active at once for a free \u003cname\u003e.stage.simple-host.site address"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "code": {
                      "enum": [
                        "name_reserved",
                        "invalid_name",
                        "invalid_domain",
                        "use_address_family"
                      ],
                      "type": "string"
                    },
                    "error": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Invalid domain. For a \u003cname\u003e.stage.simple-host.site address, `code` is name_reserved or invalid_name. Errors: use_address_family."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "properties": {
                    "code": {
                      "enum": [
                        "domain_taken",
                        "domain_releasing"
                      ],
                      "type": "string"
                    },
                    "error": {
                      "enum": [
                        "domain is connected to another site",
                        "that address is taken by another site; pick another name",
                        "this domain was just disconnected and is still being released; try again in 10 minutes"
                      ],
                      "type": "string"
                    }
                  },
                  "required": [
                    "error",
                    "code"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "domain_taken: the domain is verified (or past its ownership proof) for another site, it is under another account's address family. Errors: domain_releasing."
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Give this site a nicer address (free \u003cname\u003e.stage.simple-host.site or a custom domain)",
        "tags": [
          "Custom domains"
        ]
      }
    },
    "/v1/sites/{sitename}/domain/check": {
      "post": {
        "description": "Re-prove the site's own domain now instead of waiting for the background check every two minutes. Errors: rate_limited.",
        "operationId": "checkSitesBySitenameDomain",
        "parameters": [
          {
            "$ref": "#/components/parameters/sitename"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "dns": {
                      "properties": {
                        "host": {
                          "type": "string"
                        },
                        "type": {
                          "type": "string"
                        },
                        "value": {
                          "type": "string"
                        }
                      },
                      "type": "object"
                    },
                    "dns_txt": {
                      "description": "The TXT ownership record (see GET .../domain)",
                      "properties": {
                        "host": {
                          "type": "string"
                        },
                        "type": {
                          "type": "string"
                        },
                        "value": {
                          "type": "string"
                        }
                      },
                      "type": "object"
                    },
                    "domain": {
                      "type": "string"
                    },
                    "expires_at": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "last_error": {
                      "type": "string"
                    },
                    "status": {
                      "enum": [
                        "pending",
                        "active",
                        "error"
                      ],
                      "type": "string"
                    },
                    "verified_at": {
                      "format": "date-time",
                      "nullable": true,
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "The domain binding after the check (same shape as GET .../domain)"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "No such site, or the site has no domain connected (no_domain)"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Check this site's domain again now",
        "tags": [
          "Custom domains"
        ]
      }
    },
    "/v1/sites/{sitename}/editors": {
      "get": {
        "description": "Editors publish, roll back and use the saved data of this one site with their own sign-in and ?owner=\u003caccount\u003e.",
        "operationId": "getSiteEditors",
        "parameters": [
          {
            "$ref": "#/components/parameters/sitename"
          },
          {
            "$ref": "#/components/parameters/owner"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "List a sites editors",
        "tags": [
          "Teams"
        ]
      },
      "post": {
        "operationId": "postSiteEditors",
        "parameters": [
          {
            "$ref": "#/components/parameters/sitename"
          },
          {
            "$ref": "#/components/parameters/owner"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "person": {
                    "description": "Their handle.",
                    "type": "string"
                  }
                },
                "required": [
                  "person"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Add an editor",
        "tags": [
          "Teams"
        ]
      }
    },
    "/v1/sites/{sitename}/editors/{person}": {
      "delete": {
        "operationId": "deleteSiteEditor",
        "parameters": [
          {
            "$ref": "#/components/parameters/sitename"
          },
          {
            "description": "The editor's handle.",
            "in": "path",
            "name": "person",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/owner"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Remove an editor",
        "tags": [
          "Teams"
        ]
      }
    },
    "/v1/sites/{sitename}/export-link": {
      "post": {
        "description": "Returns a link that downloads the site's export without an API key; it expires after 10 minutes.",
        "operationId": "createExportLink",
        "parameters": [
          {
            "$ref": "#/components/parameters/createIdempotencyKey"
          },
          {
            "in": "path",
            "name": "sitename",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "expires_at": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "expires_in": {
                      "description": "Seconds until it expires (600)",
                      "type": "integer"
                    },
                    "site": {
                      "type": "string"
                    },
                    "url": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "site",
                    "url",
                    "expires_at",
                    "expires_in"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "The link"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Idempotency-Key reused with a different body (idempotency_key_reused)."
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Make a 10-minute download link for a site's export",
        "tags": [
          "Sites"
        ]
      }
    },
    "/v1/sites/{sitename}/export.tar.gz": {
      "get": {
        "description": "Streams the site's published files (`files/`) and its saved data (`storage/`: KV values, SQLite databases and files) as one archive.",
        "operationId": "exportSite",
        "parameters": [
          {
            "in": "path",
            "name": "sitename",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/gzip": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              }
            },
            "description": "A gzipped tar archive"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Not found, or not yours"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Download a site as a tar.gz",
        "tags": [
          "Sites"
        ]
      }
    },
    "/v1/sites/{sitename}/files": {
      "post": {
        "description": "The LLM-friendly deploy path — send every file inline in one request, no archiving.",
        "operationId": "postSitesBySitenameFiles",
        "parameters": [
          {
            "$ref": "#/components/parameters/sitename"
          },
          {
            "$ref": "#/components/parameters/createIdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/author"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FilesBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SiteWithNote"
                }
              }
            },
            "description": "Site created"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "site_exists, access_differs (create-or-update), named_viewers_unavailable, sign_in_unavailable, named_viewers_need_own_address. Errors: idempotency_key_reused."
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Deploy a site from inline JSON files",
        "tags": [
          "Deploy"
        ]
      },
      "put": {
        "description": "Same as POST, but for an existing site you own. Errors: 400 invalid_request.",
        "operationId": "putSitesBySitenameFiles",
        "parameters": [
          {
            "$ref": "#/components/parameters/sitename"
          },
          {
            "$ref": "#/components/parameters/publish"
          },
          {
            "$ref": "#/components/parameters/create"
          },
          {
            "$ref": "#/components/parameters/author"
          },
          {
            "description": "Keep unchanged files from the live version; merged files use ordinary unpacked-file caps",
            "in": "query",
            "name": "keep",
            "schema": {
              "enum": [
                1
              ],
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FilesBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SiteWithNote"
                }
              }
            },
            "description": "Site updated"
          },
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SiteWithNote"
                }
              }
            },
            "description": "Site created (?create=1 and no site of that name)"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "site_exists, access_differs (create-or-update), named_viewers_unavailable, sign_in_unavailable, named_viewers_need_own_address. Errors: idempotency_key_reused."
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Update a site from inline JSON files",
        "tags": [
          "Deploy"
        ]
      }
    },
    "/v1/sites/{sitename}/keep": {
      "put": {
        "description": "Mark the site Keep (or clear the mark). An idle site not marked Keep moves to Recently deleted.",
        "operationId": "putSitesBySitenameKeep",
        "parameters": [
          {
            "$ref": "#/components/parameters/sitename"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "keep": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "keep"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "keep": {
                      "type": "boolean"
                    },
                    "name": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "The flag as set"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Body is not {\"keep\": true|false}"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "423": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "The site is taken down by the operator"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Keep a site up for good",
        "tags": [
          "Sites"
        ]
      }
    },
    "/v1/sites/{sitename}/keep-versions": {
      "put": {
        "description": "Every deploy stores a full copy of the site as a new version.",
        "operationId": "putSitesBySitenameKeepVersions",
        "parameters": [
          {
            "$ref": "#/components/parameters/sitename"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "keep_versions": {
                    "maximum": 1000,
                    "minimum": 0,
                    "type": "integer"
                  }
                },
                "required": [
                  "keep_versions"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "active_version": {
                      "type": "integer"
                    },
                    "effective_keep_versions": {
                      "description": "What applies to this site now; 0 = every version is kept",
                      "type": "integer"
                    },
                    "keep_versions": {
                      "description": "The site's own setting; 0 = this server's",
                      "type": "integer"
                    },
                    "name": {
                      "type": "string"
                    },
                    "removed_versions": {
                      "description": "Version numbers removed by this call (empty when none)",
                      "items": {
                        "type": "integer"
                      },
                      "type": "array"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "The setting as stored, and what it removed"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Body is not {\"keep_versions\": N} with N from 0 to 1000"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "A deploy-only key (deploy_only_key), or an account whose version count is fixed (keep_versions_fixed)"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "423": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "The site is taken down by the operator"
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Too many site changes from this address; try again shortly"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Set how many versions of a site are kept",
        "tags": [
          "Sites"
        ]
      }
    },
    "/v1/sites/{sitename}/lock": {
      "delete": {
        "description": "Owner only (the owner's key or connector token; a deploy-only key is refused).",
        "operationId": "deleteSitesBySitenameLock",
        "parameters": [
          {
            "$ref": "#/components/parameters/sitename"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SitePasscode"
                }
              }
            },
            "description": "The site has no passcode"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "A deploy-only key (deploy_only_key)"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Remove a site's passcode",
        "tags": [
          "Sites"
        ]
      },
      "get": {
        "description": "Owner only (the owner's key or connector token; a deploy-only key is refused).",
        "operationId": "getSitesBySitenameLock",
        "parameters": [
          {
            "$ref": "#/components/parameters/sitename"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SitePasscode"
                }
              }
            },
            "description": "The site's passcode state",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "A deploy-only key (deploy_only_key)"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Whether a site has a passcode, and the passcode",
        "tags": [
          "Sites"
        ]
      },
      "put": {
        "description": "Owner only (the owner's key or connector token; a deploy-only key is refused).",
        "operationId": "putSitesBySitenameLock",
        "parameters": [
          {
            "$ref": "#/components/parameters/sitename"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "description": "Exactly one of passcode or generate",
                "properties": {
                  "generate": {
                    "description": "true: the server picks 6 random digits",
                    "type": "boolean"
                  },
                  "passcode": {
                    "description": "At least PASSCODE_MIN_LENGTH characters (default 6)",
                    "maxLength": 128,
                    "type": "string"
                  }
                },
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SitePasscode"
                }
              }
            },
            "description": "The passcode is set (the answer carries it)",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Body is not {\"passcode\": \"...\"} or {\"generate\": true} (invalid_request), or the passcode is too short or too long (invalid_passcode)"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "The operator has taken the site down (site_suspended), or a deploy-only key (deploy_only_key)"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "passcodes_not_enabled (SITE_PASSCODES is off or PASSCODE_ENC_KEY is unset on this server), or passcode_needs_own_address."
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Put a passcode on a whole site, or change it",
        "tags": [
          "Sites"
        ]
      }
    },
    "/v1/sites/{sitename}/lock/sign-out-everyone": {
      "post": {
        "description": "Owner only (the owner's key or connector token; a deploy-only key is refused).",
        "operationId": "postSitesBySitenameLockSignOutEveryone",
        "parameters": [
          {
            "$ref": "#/components/parameters/sitename"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SitePasscode"
                }
              }
            },
            "description": "Everyone is signed out"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "A deploy-only key (deploy_only_key)"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "The site has no passcode (no_passcode)"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Sign every visitor out of a site with a passcode",
        "tags": [
          "Sites"
        ]
      }
    },
    "/v1/sites/{sitename}/me": {
      "get": {
        "description": "Pages call it same-origin on the site's own address.",
        "operationId": "getVisitorMe",
        "parameters": [
          {
            "$ref": "#/components/parameters/sitename"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "properties": {
                        "email": {
                          "description": "Latest verified OAuth identity email; users.username when no identity exists",
                          "type": "string"
                        },
                        "expires_at": {
                          "description": "Earlier of absolute and idle expiry (RFC3339)",
                          "format": "date-time",
                          "type": "string"
                        },
                        "provider": {
                          "description": "Google (more providers later); omitted when no OAuth identity exists",
                          "type": "string"
                        },
                        "signed_in": {
                          "enum": [
                            true
                          ],
                          "type": "boolean"
                        },
                        "site_owner": {
                          "description": "Simple Host: the site's owner, signed in on one of the site's own addresses (its site host, family address or own domain).",
                          "enum": [
                            true
                          ],
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "signed_in",
                        "expires_at"
                      ],
                      "type": "object"
                    },
                    {
                      "properties": {
                        "sign_in": {
                          "enum": [
                            "/v1/auth/oauth/providers"
                          ],
                          "type": "string"
                        },
                        "signed_in": {
                          "enum": [
                            false
                          ],
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "signed_in",
                        "sign_in"
                      ],
                      "type": "object"
                    },
                    {
                      "properties": {
                        "code": {
                          "enum": [
                            "custom_domain_required",
                            "use_custom_domain"
                          ],
                          "type": "string"
                        },
                        "domain": {
                          "description": "The site's bound custom domain; present only with code use_custom_domain",
                          "type": "string"
                        },
                        "sign_in_available": {
                          "enum": [
                            false
                          ],
                          "type": "boolean"
                        },
                        "signed_in": {
                          "enum": [
                            false
                          ],
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "signed_in",
                        "sign_in_available",
                        "code"
                      ],
                      "type": "object"
                    }
                  ]
                }
              }
            },
            "description": "Signed-in identity or anonymous visitor",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "enum": [
                    "private, no-store"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/OriginMismatch"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal server error"
          }
        },
        "summary": "Read the current site visitor session",
        "tags": [
          "Visitor sign-in"
        ]
      },
      "options": {
        "operationId": "optionsVisitorMe",
        "parameters": [
          {
            "$ref": "#/components/parameters/sitename"
          }
        ],
        "responses": {
          "204": {
            "description": "Origin allowed",
            "headers": {
              "Access-Control-Allow-Headers": {
                "schema": {
                  "enum": [
                    "Content-Type"
                  ],
                  "type": "string"
                }
              },
              "Access-Control-Allow-Methods": {
                "schema": {
                  "enum": [
                    "GET, OPTIONS"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/OriginMismatchOrSiteLocked"
          }
        },
        "summary": "Preflight for visitor session reads",
        "tags": [
          "Visitor sign-in"
        ]
      }
    },
    "/v1/sites/{sitename}/notifications": {
      "get": {
        "description": "Owner credentials required on Host.",
        "operationId": "listSiteNotifications",
        "parameters": [
          {
            "$ref": "#/components/parameters/sitename"
          },
          {
            "description": "Optional group slug for a site notification.",
            "in": "query",
            "name": "event",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotificationList"
                }
              }
            },
            "description": "List notifications for a site."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Missing or invalid owner credentials."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotificationError"
                }
              }
            },
            "description": "forbidden, or notification_access_ended when access no longer permits the operation."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotificationError"
                }
              }
            },
            "description": "not_found, or not_offered for an event account."
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "List notifications for a site",
        "tags": [
          "Notifications"
        ]
      },
      "post": {
        "description": "The owner-entered URL is accepted without an MCP verification challenge.",
        "operationId": "createNotification",
        "parameters": [
          {
            "$ref": "#/components/parameters/createIdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/sitename"
          },
          {
            "description": "Optional group slug for a site notification.",
            "in": "query",
            "name": "event",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NotificationCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotificationCreated"
                }
              }
            },
            "description": "Create an owner-made notification"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotificationError"
                }
              }
            },
            "description": "invalid_url, refused_address, invalid_events, invalid_secret, invalid_header, or storage_not_found."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Missing or invalid owner credentials."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotificationError"
                }
              }
            },
            "description": "forbidden, or notification_access_ended when access no longer permits the operation."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotificationError"
                }
              }
            },
            "description": "not_found, or not_offered for an event account."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotificationError"
                }
              }
            },
            "description": "too_many_notifications: the site subscription cap is reached. Errors: notifications_not_enabled."
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Create an owner-made notification",
        "tags": [
          "Notifications"
        ]
      }
    },
    "/v1/sites/{sitename}/notifications/{id}": {
      "delete": {
        "description": "Owner credentials required on Host.",
        "operationId": "deleteNotification",
        "parameters": [
          {
            "$ref": "#/components/parameters/sitename"
          },
          {
            "description": "Subscription ID from the notification list.",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Optional group slug for a site notification.",
            "in": "query",
            "name": "event",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotificationDeleted"
                }
              }
            },
            "description": "Remove a notification"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Missing or invalid owner credentials."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotificationError"
                }
              }
            },
            "description": "forbidden, or notification_access_ended when access no longer permits the operation."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotificationError"
                }
              }
            },
            "description": "not_found, or not_offered for an event account."
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Remove a notification",
        "tags": [
          "Notifications"
        ]
      },
      "patch": {
        "description": "false also resumes suspension and makes held deliveries due now.",
        "operationId": "pauseNotification",
        "parameters": [
          {
            "$ref": "#/components/parameters/sitename"
          },
          {
            "description": "Subscription ID from the notification list.",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Optional group slug for a site notification.",
            "in": "query",
            "name": "event",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NotificationPause"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotificationUpdated"
                }
              }
            },
            "description": "Pause or resume a notification"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Missing or invalid owner credentials."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotificationError"
                }
              }
            },
            "description": "forbidden, or notification_access_ended when access no longer permits the operation."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotificationError"
                }
              }
            },
            "description": "not_found, or not_offered for an event account."
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Pause or resume a notification",
        "tags": [
          "Notifications"
        ]
      }
    },
    "/v1/sites/{sitename}/notifications/{id}/deliveries": {
      "get": {
        "description": "Newest first, at most 200 within the configured history window (default 7 days).",
        "operationId": "listNotificationDeliveries",
        "parameters": [
          {
            "$ref": "#/components/parameters/sitename"
          },
          {
            "description": "Subscription ID from the notification list.",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Optional group slug for a site notification.",
            "in": "query",
            "name": "event",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotificationDeliveries"
                }
              }
            },
            "description": "List recent notification deliveries"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Missing or invalid owner credentials."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotificationError"
                }
              }
            },
            "description": "forbidden, or notification_access_ended when access no longer permits the operation."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotificationError"
                }
              }
            },
            "description": "not_found, or not_offered for an event account."
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "List recent notification deliveries",
        "tags": [
          "Notifications"
        ]
      }
    },
    "/v1/sites/{sitename}/notifications/{id}/rotate-secret": {
      "post": {
        "description": "Shows the new secret once. Deliveries carry signatures for both secrets for 24 hours, until previous_valid_until.",
        "operationId": "rotateNotificationSecret",
        "parameters": [
          {
            "$ref": "#/components/parameters/sitename"
          },
          {
            "description": "Subscription ID from the notification list.",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Optional group slug for a site notification.",
            "in": "query",
            "name": "event",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotificationRotatedSecret"
                }
              }
            },
            "description": "Rotate an owner-made signing secret"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Missing or invalid owner credentials."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotificationError"
                }
              }
            },
            "description": "forbidden, or notification_access_ended when access no longer permits the operation."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotificationError"
                }
              }
            },
            "description": "not_found, or not_offered for an event account."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotificationError"
                }
              }
            },
            "description": "client_secret: the client manages this MCP subscription secret. Errors: notifications_not_enabled."
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Rotate an owner-made signing secret",
        "tags": [
          "Notifications"
        ]
      }
    },
    "/v1/sites/{sitename}/notifications/{id}/test": {
      "post": {
        "description": "Sends notification.test with data {v:1, site, site_url, test:true}; webhook-id starts with evt_test_.",
        "operationId": "testNotification",
        "parameters": [
          {
            "$ref": "#/components/parameters/sitename"
          },
          {
            "description": "Subscription ID from the notification list.",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Optional group slug for a site notification.",
            "in": "query",
            "name": "event",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotificationTestResult"
                }
              }
            },
            "description": "Send a signed test notification"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Missing or invalid owner credentials."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotificationError"
                }
              }
            },
            "description": "forbidden, or notification_access_ended when access no longer permits the operation."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotificationError"
                }
              }
            },
            "description": "not_found, or not_offered for an event account."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotificationError"
                }
              }
            },
            "description": "client_subscription: test sends require an unexpired owner-made subscription."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotificationError"
                }
              }
            },
            "description": "busy: ten verification or test sends are already running."
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Send a signed test notification",
        "tags": [
          "Notifications"
        ]
      }
    },
    "/v1/sites/{sitename}/photos": {
      "post": {
        "description": "The Add photos page at /photos prepares images on the person's device. Errors: 409 photo_save_uncertain.",
        "operationId": "addSitePhotos",
        "parameters": [
          {
            "$ref": "#/components/parameters/sitename"
          },
          {
            "$ref": "#/components/parameters/createIdempotencyKey"
          },
          {
            "description": "Set to 1 after an uncertain save to check matching live photo bytes without writing a version.",
            "in": "header",
            "name": "X-Photo-Reconcile",
            "schema": {
              "enum": [
                "1"
              ],
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "properties": {
                  "photos": {
                    "items": {
                      "format": "binary",
                      "type": "string"
                    },
                    "maxItems": 30,
                    "minItems": 1,
                    "type": "array"
                  }
                },
                "required": [
                  "photos"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "photos": {
                      "items": {
                        "properties": {
                          "bytes": {
                            "type": "integer"
                          },
                          "height": {
                            "type": "integer"
                          },
                          "path": {
                            "type": "string"
                          },
                          "url": {
                            "format": "uri",
                            "type": "string"
                          },
                          "width": {
                            "type": "integer"
                          }
                        },
                        "required": [
                          "path",
                          "url",
                          "bytes",
                          "width",
                          "height"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "reconciled": {
                      "description": "Present and true when matching live photos were confirmed without a write",
                      "type": "boolean"
                    },
                    "site": {
                      "type": "string"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "site",
                    "version",
                    "photos"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Photos added in one new live version, or matching photos confirmed without a write"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Origin or deploy permission refused"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Site not found or feature not offered"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "A file or directory conflicts with the photo path, or reconciliation could not confirm all photos"
          },
          "413": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Photo, site, account, or request size limit exceeded"
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Deploy rate limit or photo save capacity exceeded; Retry-After advises when to retry"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Add prepared photos as one site version",
        "tags": [
          "Deploy"
        ]
      }
    },
    "/v1/sites/{sitename}/push/devices": {
      "delete": {
        "description": "Owner-only. Removes every web-push device on the site at once, the owner's and every visitor's.",
        "operationId": "webPushDisableSite",
        "parameters": [
          {
            "$ref": "#/components/parameters/sitename"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "deleted": {
                      "type": "integer"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Turn push off for this site"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Missing or invalid owner credentials."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "site_not_found, or not_offered when the flag does not cover this account."
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Turn push off for this site (SIM-360)",
        "tags": [
          "Notifications"
        ]
      },
      "get": {
        "description": "Owner-only. Never discloses one visitor's device to another; a visitor sees their own devices only through their own subscribe response.",
        "operationId": "webPushListDevices",
        "parameters": [
          {
            "$ref": "#/components/parameters/sitename"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "devices": {
                      "items": {
                        "additionalProperties": true,
                        "type": "object"
                      },
                      "type": "array"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "List every device subscribed on a site"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Missing or invalid owner credentials."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "site_not_found, or not_offered when the flag does not cover this account."
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "List every device subscribed on a site (SIM-360)",
        "tags": [
          "Notifications"
        ]
      }
    },
    "/v1/sites/{sitename}/push/devices/{id}": {
      "delete": {
        "description": "Owner-only. The generic DELETE /v1/sites/{sitename}/notifications/{id} cannot reach a visitor-role push row.",
        "operationId": "webPushDeleteDevice",
        "parameters": [
          {
            "$ref": "#/components/parameters/sitename"
          },
          {
            "description": "Device ID from the device list or a subscribe response.",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "deleted": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Remove one push device"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Missing or invalid owner credentials."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found (wrong site, not kind web-push, or no such id), or not_offered when the flag does not cover this account."
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Remove one push device, owner's or any visitor's (SIM-360)",
        "tags": [
          "Notifications"
        ]
      }
    },
    "/v1/sites/{sitename}/push/mute": {
      "post": {
        "description": "Replaces the device's per-resource mute list without unsubscribing it.",
        "operationId": "webPushMute",
        "parameters": [
          {
            "$ref": "#/components/parameters/sitename"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "resources": {
                    "items": {
                      "type": "string"
                    },
                    "type": "array"
                  }
                },
                "required": [
                  "id"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Mute one device for named resources"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "invalid_request, or too_many_resources."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden (sign in on this site first, for a visitor with no session)."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "site_not_found, not_offered, or not_found for an id that is not this caller's own device."
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Mute one device for named resources (SIM-360)",
        "tags": [
          "Notifications"
        ]
      }
    },
    "/v1/sites/{sitename}/push/rules": {
      "get": {
        "description": "Owner-only. Which events push and to whom (owner, the row's owner, both, or none) per resource.",
        "operationId": "webPushListRules",
        "parameters": [
          {
            "$ref": "#/components/parameters/sitename"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "rules": {
                      "items": {
                        "additionalProperties": true,
                        "type": "object"
                      },
                      "type": "array"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "List the owner's per-resource push controls"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Missing or invalid owner credentials."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "site_not_found, or not_offered when the flag does not cover this account."
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "List the owner's per-resource push controls (SIM-360)",
        "tags": [
          "Notifications"
        ]
      },
      "put": {
        "description": "Owner-only. The owner's recipients choice narrows (never widens) the hard boundary already enforced in the event fan-out itself.",
        "operationId": "webPushSetRule",
        "parameters": [
          {
            "$ref": "#/components/parameters/sitename"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "body_column": {
                    "type": "string"
                  },
                  "recipients": {
                    "enum": [
                      "owner",
                      "row_owner",
                      "both",
                      "none"
                    ],
                    "type": "string"
                  },
                  "resource": {
                    "type": "string"
                  },
                  "title": {
                    "type": "string"
                  }
                },
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Set one resource's push controls"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "invalid_request, storage_not_found, or invalid_recipients."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Missing or invalid owner credentials."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "site_not_found, or not_offered when the flag does not cover this account."
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Set one resource's push controls (SIM-360)",
        "tags": [
          "Notifications"
        ]
      }
    },
    "/v1/sites/{sitename}/push/subscribe": {
      "post": {
        "description": "The owner (API key or an owner cookie) may subscribe site-wide or to one resource, naming the events like a webhook subscription.",
        "operationId": "webPushSubscribe",
        "parameters": [
          {
            "$ref": "#/components/parameters/sitename"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "endpoint": {
                    "description": "The push service endpoint from the browser's PushSubscription.",
                    "type": "string"
                  },
                  "events": {
                    "description": "Owner only; a visitor's device is always the record/file events regardless of this field.",
                    "items": {
                      "type": "string"
                    },
                    "type": "array"
                  },
                  "keys": {
                    "properties": {
                      "auth": {
                        "type": "string"
                      },
                      "p256dh": {
                        "type": "string"
                      }
                    },
                    "type": "object"
                  },
                  "label": {
                    "type": "string"
                  },
                  "resource": {
                    "description": "Required for a visitor; optional for the owner (empty is site-wide).",
                    "type": "string"
                  }
                },
                "required": [
                  "endpoint",
                  "keys"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "public_key": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Subscribe one device to web push"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "invalid_request, invalid_events, storage_not_found, invalid_url, refused_address, or invalid_keys."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden (sign in on this site first, for a visitor with no session)."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "site_not_found, or not_offered when the flag does not cover this account."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "too_many_notifications: the site subscription cap is reached."
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Subscribe one device to web push (SIM-360)",
        "tags": [
          "Notifications"
        ]
      }
    },
    "/v1/sites/{sitename}/push/unsubscribe": {
      "post": {
        "description": "A visitor may only ever remove their own device (scoped by site and their own id); the owner may remove any device on their own site.",
        "operationId": "webPushUnsubscribe",
        "parameters": [
          {
            "$ref": "#/components/parameters/sitename"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "id": {
                    "type": "string"
                  }
                },
                "required": [
                  "id"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "deleted": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "End push for one device"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "invalid_request."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden (sign in on this site first, for a visitor with no session)."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "site_not_found, or not_offered when the flag does not cover this account."
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "End push for one device (SIM-360)",
        "tags": [
          "Notifications"
        ]
      }
    },
    "/v1/sites/{sitename}/push/vapid-key": {
      "get": {
        "description": "Behind WEB_PUSH_ACCOUNTS; 404 not_offered for an account the flag does not cover.",
        "operationId": "getWebPushVAPIDKey",
        "parameters": [
          {
            "$ref": "#/components/parameters/sitename"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "public_key": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Get the install's VAPID public key"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "site_not_found, or not_offered when the flag does not cover this account."
          }
        },
        "summary": "Get the install's VAPID public key (SIM-360)",
        "tags": [
          "Notifications"
        ]
      }
    },
    "/v1/sites/{sitename}/restore": {
      "post": {
        "description": "Brings a site back from Recently deleted under the same name and address, with every version, its saved data.",
        "operationId": "restoreSite",
        "parameters": [
          {
            "$ref": "#/components/parameters/sitename"
          }
        ],
        "responses": {
          "200": {
            "description": "The restored site, as in GET /v1/sites"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Site quota reached"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "No site with that name in Recently deleted"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "That site is live, not deleted"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Restore a recently deleted site",
        "tags": [
          "Sites"
        ]
      }
    },
    "/v1/sites/{sitename}/showcase": {
      "get": {
        "description": "Owner key or connector only, never deploy-only keys.",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "order": {
                      "maximum": 1000000,
                      "minimum": 0,
                      "type": "integer"
                    },
                    "pinned": {
                      "type": "boolean"
                    },
                    "site": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "site",
                    "pinned",
                    "order"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Pin and manual order"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Deploy-only key refused"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Site not owned or deleted, or showcase settings unavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Get an owned site's showcase pin and order",
        "tags": [
          "Account"
        ]
      },
      "parameters": [
        {
          "$ref": "#/components/parameters/sitename"
        }
      ],
      "put": {
        "description": "Send pinned and/or order; omitted fields stay unchanged.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "minProperties": 1,
                "properties": {
                  "order": {
                    "maximum": 1000000,
                    "minimum": 0,
                    "type": "integer"
                  },
                  "pinned": {
                    "type": "boolean"
                  }
                },
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "order": {
                      "maximum": 1000000,
                      "minimum": 0,
                      "type": "integer"
                    },
                    "pinned": {
                      "type": "boolean"
                    },
                    "site": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "site",
                    "pinned",
                    "order"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Saved pin and manual order"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Missing or invalid pinned/order"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Deploy-only key refused"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Site not owned or deleted, or showcase settings unavailable"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Pin or manually order an owned site on the showcase",
        "tags": [
          "Account"
        ]
      }
    },
    "/v1/sites/{sitename}/storage/files/{name}/download-link": {
      "post": {
        "operationId": "linkStorageFile",
        "parameters": [
          {
            "in": "path",
            "name": "sitename",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/createIdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "path": {
                    "type": "string"
                  }
                },
                "required": [
                  "path"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StorageDownloadLink"
                }
              }
            },
            "description": "{url,expires_at}; bearer URL remains private and is rechecked when used"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Idempotency-Key reused with a different body (idempotency_key_reused)."
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Mint a ten-minute scoped full-byte download link (owner only)",
        "tags": [
          "Storage resources"
        ]
      }
    },
    "/v1/sites/{sitename}/storage/files/{name}/objects": {
      "get": {
        "description": "Checked against the read value.",
        "operationId": "listStorageFiles",
        "parameters": [
          {
            "in": "path",
            "name": "sitename",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "prefix",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "after",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "maximum": 500,
              "minimum": 1,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "items: [{path,bytes,content_type,mine|visitor_id}], next_after cursor"
          }
        },
        "summary": "Page through durable file objects under the resource read policy",
        "tags": [
          "Storage resources"
        ]
      }
    },
    "/v1/sites/{sitename}/storage/files/{name}/objects/{path}": {
      "delete": {
        "description": "Checked against delete; own deletes only the author's file (404 otherwise); a caller who may only add gets 403 add_only.",
        "operationId": "deleteStorageFile",
        "parameters": [
          {
            "in": "path",
            "name": "sitename",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeletedResponse"
                }
              }
            },
            "description": "deleted: true"
          }
        },
        "summary": "Remove one durable file under the resource's delete value",
        "tags": [
          "Storage resources"
        ]
      },
      "get": {
        "description": "Own reads return only the signed-in visitor's file; other paths return 404.",
        "operationId": "getStorageFile",
        "parameters": [
          {
            "in": "path",
            "name": "sitename",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Raw file bytes"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "file_not_found"
          }
        },
        "summary": "Download complete file bytes under the resource read policy",
        "tags": [
          "Storage resources"
        ]
      },
      "put": {
        "description": "The server decides add (a new path, checked against add, published without replacing) or edit (an existing path, checked against edit. Errors: 409 file_exists, bucket_full.",
        "operationId": "putStorageFile",
        "parameters": [
          {
            "in": "path",
            "name": "sitename",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/octet-stream": {
              "schema": {
                "format": "binary",
                "type": "string"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "{path,bytes,content_type}"
          },
          "507": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "site_full"
          }
        },
        "summary": "Add or replace raw file bytes under the resource's add and edit values",
        "tags": [
          "Storage resources"
        ]
      }
    },
    "/v1/sites/{sitename}/storage/kv/{name}/keys": {
      "get": {
        "description": "Own lists return only the signed-in visitor's keys.",
        "operationId": "listStorageKV",
        "parameters": [
          {
            "in": "path",
            "name": "sitename",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "prefix",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "after",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "maximum": 500,
              "minimum": 1,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "items: [{key,value,mine|visitor_id}], next_after cursor"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden or site_locked"
          }
        },
        "summary": "Page through JSON KV entries under the resource read value",
        "tags": [
          "Storage resources"
        ]
      }
    },
    "/v1/sites/{sitename}/storage/kv/{name}/keys/{key}": {
      "delete": {
        "description": "Checked against delete. Own deletes carry visitor_id = caller in the statement and answer 404 for another person's key. Errors: 403 add_only.",
        "operationId": "deleteStorageKV",
        "parameters": [
          {
            "in": "path",
            "name": "sitename",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "key",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeletedResponse"
                }
              }
            },
            "description": "deleted: true"
          }
        },
        "summary": "Remove one KV key under the resource's delete value",
        "tags": [
          "Storage resources"
        ]
      },
      "get": {
        "description": "Own reads return only the signed-in visitor's key; other keys return 404.",
        "operationId": "getStorageKV",
        "parameters": [
          {
            "in": "path",
            "name": "sitename",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "key",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "{key,value}"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "key_not_found or resource_not_found"
          }
        },
        "summary": "Read one JSON value under the resource read value",
        "tags": [
          "Storage resources"
        ]
      },
      "put": {
        "description": "The server decides add (the key does not exist; checked against add, created with ON CONFLICT DO NOTHING) or edit (it exists. Errors: 409 key_exists, 503 storage_busy.",
        "operationId": "putStorageKV",
        "parameters": [
          {
            "in": "path",
            "name": "sitename",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "key",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "value": {}
                },
                "required": [
                  "value"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "{key,value}"
          },
          "507": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "site_full"
          }
        },
        "summary": "Add or edit one JSON value under the resource's add and edit values",
        "tags": [
          "Storage resources"
        ]
      }
    },
    "/v1/sites/{sitename}/storage/people": {
      "get": {
        "description": "Owner only: the owner's key or connector token, or the owner signed in on the site's own address (SH.me().site_owner.",
        "operationId": "getSiteStoragePeople",
        "parameters": [
          {
            "in": "path",
            "name": "sitename",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "people: [{visitor_id?, email?, named_viewer, has_data, signed_in}]"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden (not the owner)"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "The owner's pick list of this site's people (SIM-358, 2026-11-06)",
        "tags": [
          "Storage resources"
        ]
      }
    },
    "/v1/sites/{sitename}/storage/resources": {
      "get": {
        "description": "Every resource carries rules (StoragePolicySet), rules_status (rules or invalid), rules_errors and, for sqlite, tables ({table: {rules}}).",
        "operationId": "listStorageResources",
        "parameters": [
          {
            "in": "path",
            "name": "sitename",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "resources": {
                      "items": {
                        "$ref": "#/components/schemas/StorageResource"
                      },
                      "type": "array"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "resources: [{name,kind,site_passcode,rules,rules_status,rules_errors,tables}] (tables for sqlite only)"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "List a site's storage resources and policies (owner only)",
        "tags": [
          "Storage resources"
        ]
      }
    },
    "/v1/sites/{sitename}/storage/resources/{name}": {
      "delete": {
        "operationId": "deleteStorageResource",
        "parameters": [
          {
            "in": "path",
            "name": "sitename",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeletedResponse"
                }
              }
            },
            "description": "deleted: true"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Permanently delete a resource and its data (owner only)",
        "tags": [
          "Storage resources"
        ]
      },
      "put": {
        "description": "Kind is immutable. Every kind takes rules (StoragePolicySet).",
        "operationId": "setStorageResource",
        "parameters": [
          {
            "in": "path",
            "name": "sitename",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "kind": {
                    "enum": [
                      "kv",
                      "sqlite",
                      "files"
                    ],
                    "type": "string"
                  },
                  "rules": {
                    "$ref": "#/components/schemas/StoragePolicySet"
                  },
                  "site_passcode": {
                    "enum": [
                      "inherit",
                      "off"
                    ],
                    "type": "string"
                  },
                  "tables": {
                    "additionalProperties": {
                      "properties": {
                        "rules": {
                          "$ref": "#/components/schemas/StoragePolicySet"
                        }
                      },
                      "type": "object"
                    },
                    "description": "sqlite only; each table entry carries only rules",
                    "type": "object"
                  }
                },
                "required": [
                  "kind"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StorageResource"
                }
              }
            },
            "description": "Existing resource policy changed; the resource as listed"
          },
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StorageResource"
                }
              }
            },
            "description": "Resource created; the resource as listed"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "invalid_resource (including any field of the removed presets), visitor_id_required, invalid_rules. Errors: spam_check_unavailable."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "resource_kind_conflict"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Create a resource or set its rules (owner only)",
        "tags": [
          "Storage resources"
        ]
      }
    },
    "/v1/sites/{sitename}/storage/sqlite/{name}/execute": {
      "post": {
        "description": "Owner only; visitors receive 403 fixed_routes_required and use the table rows routes.",
        "operationId": "executeStorageSQLite",
        "parameters": [
          {
            "in": "path",
            "name": "sitename",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StorageSQL"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "{changes,last_insert_id}"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Every SQL refusal says what happened and what to do, under a stable code. Errors: sql_request, sql_params."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "fixed_routes_required (a visitor)"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "sql_unique_failed: a row with that unique value exists; the message names the column"
          },
          "507": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "site_full or sqlite_full"
          }
        },
        "summary": "Run one parameterized SQLite data-changing statement",
        "tags": [
          "Storage resources"
        ]
      }
    },
    "/v1/sites/{sitename}/storage/sqlite/{name}/query": {
      "post": {
        "description": "Owner only; visitors receive 403 fixed_routes_required and use the table rows routes.",
        "operationId": "queryStorageSQLite",
        "parameters": [
          {
            "in": "path",
            "name": "sitename",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StorageSQL"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "columns: [...], rows: [[...]]"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Every SQL refusal says what happened and what to do, under a stable code. Errors: sql_request, sql_params, result_too_large."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "fixed_routes_required (a visitor)"
          }
        },
        "summary": "Run one read-only parameterized SQLite statement",
        "tags": [
          "Storage resources"
        ]
      }
    },
    "/v1/sites/{sitename}/storage/sqlite/{name}/schema": {
      "post": {
        "description": "New tables whose rules name visitor_id or let visitors add receive visitor_id TEXT and its index.",
        "operationId": "schemaStorageSQLite",
        "parameters": [
          {
            "in": "path",
            "name": "sitename",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StorageSQL"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "changes: integer"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Every SQL refusal says what happened and what to do, under a stable code. Errors: sql_request, sql_params, visitor_id_required, server_column."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "table_preset_rename (a table with its own rules is renamed before the new name has rules)"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Run one SQLite schema statement (owner only)",
        "tags": [
          "Storage resources"
        ]
      }
    },
    "/v1/sites/{sitename}/storage/sqlite/{name}/tables/{table}/rows": {
      "get": {
        "description": "Checked against the table's read rules (its own rules, or the database's).",
        "operationId": "listStorageTableRows",
        "parameters": [
          {
            "in": "path",
            "name": "sitename",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "table",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "order",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "desc",
            "schema": {
              "enum": [
                0,
                1
              ],
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 100,
              "maximum": 500,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "after",
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "where.{column}=value, equality, at most three",
            "explode": true,
            "in": "query",
            "name": "where",
            "schema": {
              "additionalProperties": {
                "type": "string"
              },
              "type": "object"
            },
            "style": "deepObject"
          }
        ],
        "responses": {
          "200": {
            "description": "columns, rows, mine (visitors) and opaque next_after cursor; own reads include only the signed-in visitor’s rows"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "invalid_rows: unknown table, invalid/injected column, order, cursor or scalar value"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "sign_in_required"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, csrf_required or site_locked"
          }
        },
        "summary": "Read table rows with fixed server-built SQL",
        "tags": [
          "Storage resources"
        ]
      },
      "post": {
        "description": "Checked against the table's add rules. Errors: 403 spam_check_required, 403 spam_check_failed, 403 spam_check_unavailable, 413 post_too_large, 400 too_many_links.",
        "operationId": "addStorageTableRow",
        "parameters": [
          {
            "$ref": "#/components/parameters/createIdempotencyKey"
          },
          {
            "in": "path",
            "name": "sitename",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "table",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Owner (or owner-on-site) only.",
            "in": "query",
            "name": "for",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": {
                  "nullable": true,
                  "oneOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "number"
                    },
                    {
                      "type": "boolean"
                    }
                  ]
                },
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StorageRowCreated"
                }
              }
            },
            "description": "changes and last_insert_id"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "invalid_rows: unknown table, invalid/injected column, order, cursor or scalar value. Errors: visitor_email_ambiguous."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "sign_in_required"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, csrf_required, site_locked, or for_requires_own (for on a table whose read is not own)"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "invalid_reference (parent missing or belongs to another visitor. Errors: visitor_unknown."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "row_conflict (generic uniqueness or constraint refusal), written_by_blocked. Errors: written_by_tampered."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "rate_limited"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "storage_busy"
          },
          "507": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "site_full or sqlite_full: quota precheck or engine allocation failure"
          }
        },
        "summary": "Insert one table row with fixed server-built SQL",
        "tags": [
          "Storage resources"
        ]
      }
    },
    "/v1/sites/{sitename}/storage/sqlite/{name}/tables/{table}/rows/{id}": {
      "delete": {
        "description": "Checked against the table's delete value.",
        "operationId": "deleteStorageTableRow",
        "parameters": [
          {
            "in": "path",
            "name": "sitename",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "table",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "minimum": 1,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeletedResponse"
                }
              }
            },
            "description": "deleted: true"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, add_only, csrf_required or site_locked"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "row_not_found"
          }
        },
        "summary": "Delete one table row with fixed server-built SQL",
        "tags": [
          "Storage resources"
        ]
      },
      "get": {
        "description": "Checked against the table's read rules; own reads add visitor_id = caller, so another person's row is 404 like a missing one.",
        "operationId": "getStorageTableRow",
        "parameters": [
          {
            "in": "path",
            "name": "sitename",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "table",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "minimum": 1,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "{columns,row,mine}"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "row_not_found"
          }
        },
        "summary": "Read one table row by id with fixed server-built SQL",
        "tags": [
          "Storage resources"
        ]
      },
      "patch": {
        "description": "Checked against the table's edit rules.",
        "operationId": "editStorageTableRow",
        "parameters": [
          {
            "in": "path",
            "name": "sitename",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "table",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "minimum": 1,
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": {
                  "nullable": true,
                  "oneOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "number"
                    },
                    {
                      "type": "boolean"
                    }
                  ]
                },
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "{changes}"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "invalid_rows or server_column"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "sign_in_required"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, add_only, csrf_required or site_locked"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "row_not_found or invalid_reference"
          }
        },
        "summary": "Edit columns of one table row with fixed server-built SQL",
        "tags": [
          "Storage resources"
        ]
      }
    },
    "/v1/sites/{sitename}/storage/usage": {
      "get": {
        "description": "Host KV/SQLite share 10000000 bytes per website; files have a separate 10000000-byte allowance.",
        "operationId": "getSiteStorageUsage",
        "parameters": [
          {
            "in": "path",
            "name": "sitename",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "{used_bytes,limit_bytes,remaining_bytes,files_used_bytes,files_limit_bytes,files_remaining_bytes,breakdown:{kv_bytes,sqlite_bytes,files_bytes}…"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Read this site's KV/SQLite and separate file usage (owner only)",
        "tags": [
          "Storage resources"
        ]
      }
    },
    "/v1/sites/{sitename}/storage/visitors": {
      "get": {
        "description": "Owner only (key or connector).",
        "operationId": "getSiteStorageVisitors",
        "parameters": [
          {
            "in": "path",
            "name": "sitename",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "visitor_id values, comma-separated (or repeat id=)",
            "in": "query",
            "name": "id",
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Email addresses, comma-separated (or repeat email=).",
            "in": "query",
            "name": "email",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "visitors: [{visitor_id?, email?, found}], one entry per id then per email, in that order"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "invalid_visitor_id"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden (not the owner)"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Who sent a record, or the other way (visitor_id and email; owner only)",
        "tags": [
          "Storage resources"
        ]
      }
    },
    "/v1/sites/{sitename}/versions": {
      "get": {
        "description": "The versions this instance still holds, newest first.",
        "operationId": "getSitesBySitenameVersions",
        "parameters": [
          {
            "$ref": "#/components/parameters/sitename"
          },
          {
            "$ref": "#/components/parameters/pending"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "properties": {
                      "author": {
                        "description": "Who made the version, as given with ?author= on the deploy; empty when none was given",
                        "type": "string"
                      },
                      "created_at": {
                        "format": "date-time",
                        "type": "string"
                      },
                      "is_active": {
                        "type": "boolean"
                      },
                      "status": {
                        "description": "active: complete and live now or before; ready: stored with publish=false and never live yet",
                        "enum": [
                          "active",
                          "ready"
                        ],
                        "type": "string"
                      },
                      "version_number": {
                        "type": "integer"
                      }
                    },
                    "type": "object"
                  },
                  "type": "array"
                }
              }
            },
            "description": "Versions (newest first)"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "List a site's versions",
        "tags": [
          "Versions"
        ]
      }
    },
    "/v1/sites/{sitename}/versions/{version}": {
      "delete": {
        "description": "Removes a version stored with publish=false that nobody has made live since.",
        "operationId": "deleteSitesBySitenameVersion",
        "parameters": [
          {
            "$ref": "#/components/parameters/sitename"
          },
          {
            "$ref": "#/components/parameters/version"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "active_version": {
                      "description": "The version that is live",
                      "type": "integer"
                    },
                    "discarded_version": {
                      "type": "integer"
                    },
                    "site": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Discarded"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "A deploy-only key (deploy_only_key), a team key (team_key_scope), or a site that is taken down (site_suspended)"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Site not found, or no such kept version (version_not_found, including an upload that never finished)"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "The version is live (version_live: only a version that was never live can be discarded), or has been live before (version_published)"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Discard a version that was never live",
        "tags": [
          "Versions"
        ]
      }
    },
    "/v1/sites/{sitename}/versions/{version}/files": {
      "get": {
        "description": "Owner only. Walks the version directory; paths are relative, use forward slashes, and are sorted. With read, answers those files' text instead: each item then has content (text, at most 200 KB, truncated true when cut) or binary true, content_type, and error with status for a file that cannot be read.",
        "operationId": "getSitesBySitenameVersionFiles",
        "parameters": [
          {
            "$ref": "#/components/parameters/sitename"
          },
          {
            "description": "Version number, or live for the site's live version (404 no_live_version when nothing is published).",
            "in": "path",
            "name": "version",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "A file path to read (repeat for up to 50).",
            "explode": true,
            "in": "query",
            "name": "read",
            "required": false,
            "schema": {
              "items": {
                "type": "string"
              },
              "maxItems": 50,
              "type": "array"
            },
            "style": "form"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "created_at": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "files": {
                      "items": {
                        "properties": {
                          "binary": {
                            "description": "With read: not text, so no content.",
                            "type": "boolean"
                          },
                          "content": {
                            "description": "With read: the file's text.",
                            "type": "string"
                          },
                          "content_type": {
                            "description": "With read.",
                            "type": "string"
                          },
                          "error": {
                            "description": "With read: why this file could not be read.",
                            "type": "string"
                          },
                          "path": {
                            "type": "string"
                          },
                          "size": {
                            "description": "Size in bytes",
                            "format": "int64",
                            "type": "integer"
                          },
                          "status": {
                            "description": "With read: the status a single-file read would answer (400, 404).",
                            "type": "integer"
                          },
                          "truncated": {
                            "description": "With read: content holds the first 200 KB only.",
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "path"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "is_active": {
                      "type": "boolean"
                    },
                    "version_number": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "version_number",
                    "is_active",
                    "created_at",
                    "files"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Version metadata and files"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Invalid version, empty site name, invalid file path, or more than 50 read paths"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Site not found or version not found (including pruned versions)"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "List files in a retained version",
        "tags": [
          "Versions"
        ]
      }
    },
    "/v1/sites/{sitename}/versions/{version}/files/{path}": {
      "get": {
        "description": "Owner only. Streams raw bytes with a Content-Type based on the file extension (application/octet-stream fallback; HTML uses UTF-8).",
        "operationId": "getSitesBySitenameVersionFile",
        "parameters": [
          {
            "$ref": "#/components/parameters/sitename"
          },
          {
            "$ref": "#/components/parameters/version"
          },
          {
            "$ref": "#/components/parameters/path"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "*/*": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              }
            },
            "description": "Raw file bytes",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "enum": [
                    "private, no-store"
                  ],
                  "type": "string"
                }
              },
              "Content-Security-Policy": {
                "schema": {
                  "enum": [
                    "sandbox"
                  ],
                  "type": "string"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "enum": [
                    "nosniff"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Invalid version, empty site name, or invalid path"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Site not found, version not found, or file not found"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Read a file from a retained version",
        "tags": [
          "Versions"
        ]
      }
    },
    "/v1/sites/{sitename}/versions/{version}/preview-link": {
      "post": {
        "description": "Owner only: a link to one kept version for anyone who has it for one hour; it stops working after an hour or a server restart.",
        "operationId": "postSitesBySitenameVersionPreviewLink",
        "parameters": [
          {
            "$ref": "#/components/parameters/createIdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/sitename"
          },
          {
            "$ref": "#/components/parameters/version"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "expires_at": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "expires_in": {
                      "type": "integer"
                    },
                    "live": {
                      "description": "Whether visitors see this version now",
                      "type": "boolean"
                    },
                    "site": {
                      "type": "string"
                    },
                    "url": {
                      "format": "uri",
                      "type": "string"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "The preview link"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "The operator has taken the site down (code site_suspended)"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Site or version not found (including pruned versions)"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "No preview link (code preview_unavailable): the site has no address of its own yet, or the server gives sites none."
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Preview a kept version",
        "tags": [
          "Versions"
        ]
      }
    },
    "/v1/sites/{sitename}/viewers": {
      "post": {
        "description": "Owner only. Adds each email (trimmed and lower-cased; letters, digits and `._%+-` before the `@`.",
        "operationId": "postSitesBySitenameViewers",
        "parameters": [
          {
            "$ref": "#/components/parameters/sitename"
          },
          {
            "$ref": "#/components/parameters/createIdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "emails": {
                    "items": {
                      "type": "string"
                    },
                    "minItems": 1,
                    "type": "array"
                  }
                },
                "required": [
                  "emails"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SiteAccess"
                }
              }
            },
            "description": "Who can open the site now"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "invalid_request, invalid_email (names the address), or too_many_viewers (more than SITE_VIEWERS_MAX in one call)"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "site_suspended or deploy_only_key"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "too_many_viewers (the list would pass SITE_VIEWERS_MAX), passcode_set, named_viewers_need_own_address."
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Name viewers by email, and open the site only to them",
        "tags": [
          "Sites"
        ]
      }
    },
    "/v1/sites/{sitename}/viewers/{email}": {
      "delete": {
        "description": "Owner only. The person's next request is refused.",
        "operationId": "deleteSitesBySitenameViewersByEmail",
        "parameters": [
          {
            "$ref": "#/components/parameters/sitename"
          },
          {
            "in": "path",
            "name": "email",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SiteAccess"
                }
              }
            },
            "description": "Who can open the site now (`removed` names the email)"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "invalid_email"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "No such site, or the email is not a named viewer (viewer_not_found)"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Remove one named viewer",
        "tags": [
          "Sites"
        ]
      }
    },
    "/v1/sites/{sitename}/visibility": {
      "put": {
        "description": "List on my profile: `public` = on, the site shows on the owner's profile page at https://\u003chandle\u003e.stage.simple-host.site/.",
        "operationId": "putSitesBySitenameVisibility",
        "parameters": [
          {
            "$ref": "#/components/parameters/sitename"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "visibility": {
                    "enum": [
                      "public",
                      "unlisted"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "visibility"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Visibility updated"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Invalid visibility value"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "List on my profile",
        "tags": [
          "Sites"
        ]
      }
    },
    "/v1/sites/{sitename}/visitor/auth": {
      "options": {
        "operationId": "optionsRequestSiteVisitorEmail",
        "parameters": [
          {
            "$ref": "#/components/parameters/sitename"
          }
        ],
        "responses": {
          "204": {
            "description": "Origin-authorized preflight",
            "headers": {
              "Access-Control-Allow-Headers": {
                "schema": {
                  "enum": [
                    "Content-Type, X-SH-CSRF"
                  ],
                  "type": "string"
                }
              },
              "Access-Control-Allow-Methods": {
                "schema": {
                  "enum": [
                    "POST, OPTIONS"
                  ],
                  "type": "string"
                }
              },
              "Access-Control-Max-Age": {
                "schema": {
                  "enum": [
                    "600"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Missing site name"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Origin forbidden; or site_locked (the site has a passcode: send the unlock cookie from its page, or the owner's key)"
          }
        },
        "security": [],
        "summary": "Preflight site email sign-in",
        "tags": [
          "Visitor sign-in"
        ]
      },
      "post": {
        "description": "Send a 6-digit sign-in code valid for 15 minutes; works only on the site's own address or domain.",
        "operationId": "requestSiteVisitorEmail",
        "parameters": [
          {
            "$ref": "#/components/parameters/sitename"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "email": {
                    "format": "email",
                    "type": "string"
                  }
                },
                "required": [
                  "email"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "email": {
                      "format": "email",
                      "type": "string"
                    },
                    "expires_in_seconds": {
                      "enum": [
                        900
                      ],
                      "type": "integer"
                    },
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message",
                    "email",
                    "expires_in_seconds"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Code sent; no dashboard magic link."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "error": {
                      "type": "string"
                    },
                    "reason": {
                      "type": "string"
                    },
                    "tries_left": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Invalid request, missing fields, apex host, or the legacy path address (custom_domain_required)"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "error": {
                      "type": "string"
                    },
                    "reason": {
                      "type": "string"
                    },
                    "tries_left": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Invalid code. `code` stays invalid_code. `reason` is code_wrong, code_used_up, code_expired, or link_other_browser."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "error": {
                      "type": "string"
                    },
                    "reason": {
                      "type": "string"
                    },
                    "tries_left": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Origin forbidden or missing CSRF (verification)"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "error": {
                      "type": "string"
                    },
                    "reason": {
                      "type": "string"
                    },
                    "tries_left": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Site not found"
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "error": {
                      "type": "string"
                    },
                    "reason": {
                      "type": "string"
                    },
                    "tries_left": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "IP or shared per-email rate limit exceeded (code rate_limited)"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "error": {
                      "type": "string"
                    },
                    "reason": {
                      "type": "string"
                    },
                    "tries_left": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Internal error or email delivery failed"
          }
        },
        "security": [],
        "summary": "Request a site-scoped email sign-in code",
        "tags": [
          "Visitor sign-in"
        ]
      }
    },
    "/v1/sites/{sitename}/visitor/auth/verify": {
      "options": {
        "operationId": "optionsVerifySiteVisitorEmail",
        "parameters": [
          {
            "$ref": "#/components/parameters/sitename"
          }
        ],
        "responses": {
          "204": {
            "description": "Origin-authorized preflight",
            "headers": {
              "Access-Control-Allow-Headers": {
                "schema": {
                  "enum": [
                    "Content-Type, X-SH-CSRF"
                  ],
                  "type": "string"
                }
              },
              "Access-Control-Allow-Methods": {
                "schema": {
                  "enum": [
                    "POST, OPTIONS"
                  ],
                  "type": "string"
                }
              },
              "Access-Control-Max-Age": {
                "schema": {
                  "enum": [
                    "600"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Missing site name"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Origin forbidden; or site_locked (the site has a passcode: send the unlock cookie from its page, or the owner's key)"
          }
        },
        "security": [],
        "summary": "Preflight site email sign-in",
        "tags": [
          "Visitor sign-in"
        ]
      },
      "post": {
        "description": "Verify a site-scoped code on the site's own address and start a visitor session (never an API key). Session has 30-day absolute and 14-day idle lifetimes.",
        "operationId": "verifySiteVisitorEmail",
        "parameters": [
          {
            "$ref": "#/components/parameters/sitename"
          },
          {
            "$ref": "#/components/parameters/csrf"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "code": {
                    "description": "6-digit email code",
                    "type": "string"
                  },
                  "email": {
                    "format": "email",
                    "type": "string"
                  }
                },
                "required": [
                  "email",
                  "code"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "email": {
                      "format": "email",
                      "type": "string"
                    },
                    "expires_at": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "provider": {
                      "enum": [
                        "email"
                      ],
                      "type": "string"
                    },
                    "signed_in": {
                      "enum": [
                        true
                      ],
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "signed_in",
                    "expires_at"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Signed in; sets the existing host-only visitor session cookie. Errors: 400 custom_domain_required."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "error": {
                      "type": "string"
                    },
                    "reason": {
                      "type": "string"
                    },
                    "tries_left": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Invalid request, missing fields, apex host, or the legacy path address (custom_domain_required)"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "error": {
                      "type": "string"
                    },
                    "reason": {
                      "type": "string"
                    },
                    "tries_left": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Invalid code. `code` stays invalid_code. `reason` is code_wrong, code_used_up, code_expired, or link_other_browser."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "error": {
                      "type": "string"
                    },
                    "reason": {
                      "type": "string"
                    },
                    "tries_left": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Origin forbidden or missing CSRF (verification) (code csrf_required)"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "error": {
                      "type": "string"
                    },
                    "reason": {
                      "type": "string"
                    },
                    "tries_left": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Site not found"
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "error": {
                      "type": "string"
                    },
                    "reason": {
                      "type": "string"
                    },
                    "tries_left": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "IP or shared per-email rate limit exceeded (code rate_limited)"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "error": {
                      "type": "string"
                    },
                    "reason": {
                      "type": "string"
                    },
                    "tries_left": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Internal error or email delivery failed"
          }
        },
        "security": [],
        "summary": "Verify a site-scoped email sign-in code",
        "tags": [
          "Visitor sign-in"
        ]
      }
    },
    "/v1/skills": {
      "get": {
        "description": "Public catalog of the skills this server bundles (name + description + fetch URL), so any agent can search them over HTTP.",
        "operationId": "listSkills",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "count": {
                      "type": "integer"
                    },
                    "plugin": {
                      "type": "string"
                    },
                    "skills": {
                      "items": {
                        "properties": {
                          "description": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "url": {
                            "type": "string"
                          }
                        },
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "version": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Skill catalog"
          }
        },
        "summary": "Skills hub catalog — discover the bundled agent skills",
        "tags": [
          "Skills"
        ]
      }
    },
    "/v1/skills/{name}": {
      "get": {
        "description": "Returns the raw SKILL.md for the named skill.",
        "operationId": "getSkill",
        "parameters": [
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "text/markdown": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "The skill's SKILL.md"
          },
          "404": {
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "No such skill"
          }
        },
        "summary": "Fetch one skill's SKILL.md (markdown)",
        "tags": [
          "Skills"
        ]
      }
    },
    "/v1/skills/{name}/SKILL.md": {
      "get": {
        "description": "Same response as /v1/skills/{name}.",
        "operationId": "getSkillMarkdown",
        "parameters": [
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "text/markdown": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "The skill's SKILL.md"
          },
          "404": {
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "No such skill"
          }
        },
        "summary": "Fetch one skill's SKILL.md (markdown), same as /v1/skills/{name}",
        "tags": [
          "Skills"
        ]
      }
    },
    "/v1/skills/{name}/references/{file}": {
      "get": {
        "description": "A skill's SKILL.md routes to reference documents under its references/ directory.",
        "operationId": "getSkillReference",
        "parameters": [
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "The reference filename, e.g. backend.md",
            "in": "path",
            "name": "file",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "text/markdown": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "The reference document"
          },
          "400": {
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "Invalid skill or reference name"
          },
          "404": {
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "No such reference"
          }
        },
        "summary": "Fetch one of a skill's reference documents (markdown)",
        "tags": [
          "Skills"
        ]
      }
    },
    "/v1/sso/consent": {
      "post": {
        "description": "Same-origin form POST with Sec-Fetch-Site validation and a one-use form token bound to the current SSO pass and server-stored hop.",
        "operationId": "consentSSO",
        "requestBody": {
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "properties": {
                  "form_token": {
                    "type": "string"
                  },
                  "state": {
                    "type": "string"
                  }
                },
                "required": [
                  "state",
                  "form_token"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "302": {
            "description": "Consent remembered; navigate to the site's establish endpoint"
          },
          "400": {
            "description": "Invalid or expired hop"
          },
          "401": {
            "description": "Sign in on the apex first"
          },
          "403": {
            "description": "Invalid form token or origin"
          },
          "429": {
            "description": "IP rate limit exceeded"
          }
        },
        "security": [],
        "summary": "Remember consent and continue to a site",
        "tags": [
          "Visitor sign-in"
        ]
      }
    },
    "/v1/sso/consents/{site}": {
      "delete": {
        "description": "Same-origin account-key request.",
        "operationId": "forgetSSOConsent",
        "parameters": [
          {
            "description": "Site UUID",
            "in": "path",
            "name": "site",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Consent forgotten or already absent"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "Wrong origin or not a full account key"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Forget this person's consent for a site",
        "tags": [
          "Visitor sign-in"
        ]
      }
    },
    "/v1/sso/hop": {
      "get": {
        "description": "Uses only the apex SSO cookie.",
        "operationId": "hopSSO",
        "parameters": [
          {
            "in": "query",
            "name": "state",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Browser-bound owner provider token",
            "in": "query",
            "name": "token",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Provider browser nonce hash",
            "in": "query",
            "name": "cn",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Apex sign-in or consent card"
          },
          "302": {
            "description": "Navigate to the site's establish endpoint"
          },
          "400": {
            "description": "Missing, used, or expired state"
          },
          "403": {
            "description": "Wrong origin or non-document request"
          },
          "429": {
            "description": "IP rate limit exceeded"
          }
        },
        "security": [],
        "summary": "Continue site sign-in on the account apex",
        "tags": [
          "Visitor sign-in"
        ]
      }
    },
    "/v1/sso/session": {
      "post": {
        "description": "Same-origin apex POST authenticated by a live stored full account key.",
        "operationId": "bootstrapSSO",
        "responses": {
          "204": {
            "description": "Apex SSO cookie ready"
          },
          "401": {
            "description": "Missing, expired, suspended, or unsuitable account key"
          },
          "403": {
            "description": "Wrong host or origin"
          },
          "429": {
            "description": "Pass issuance rate limit exceeded"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Add the apex sign-in cookie to an existing dashboard session",
        "tags": [
          "Visitor sign-in"
        ]
      }
    },
    "/v1/sso/signed-out": {
      "get": {
        "description": "Rate-limited top-level navigation after site sign-out.",
        "operationId": "signedOutSSO",
        "parameters": [
          {
            "in": "query",
            "name": "token",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Confirmation form or final dashboard-key sign-out page"
          },
          "400": {
            "description": "Invalid, expired, or already used ticket"
          },
          "403": {
            "description": "Wrong host or non-document request"
          },
          "429": {
            "description": "IP rate limit exceeded"
          }
        },
        "security": [],
        "summary": "Complete browser sign-out at the apex and return to the site",
        "tags": [
          "Visitor sign-in"
        ]
      },
      "post": {
        "description": "Same-origin apex form POST with Origin and Fetch Metadata checks, a one-use form token bound to the cookie that opened the confirmation.",
        "operationId": "confirmSignedOutSSO",
        "requestBody": {
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "properties": {
                  "form_token": {
                    "type": "string"
                  },
                  "token": {
                    "type": "string"
                  }
                },
                "required": [
                  "token",
                  "form_token"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Final apex page revokes the stored dashboard key and returns to the site"
          },
          "400": {
            "description": "Invalid, expired, replayed, or mismatched ticket or form token"
          },
          "403": {
            "description": "Wrong host or origin"
          },
          "429": {
            "description": "IP rate limit exceeded"
          }
        },
        "security": [],
        "summary": "Confirm sign-out on this browser",
        "tags": [
          "Visitor sign-in"
        ]
      }
    },
    "/v1/sso/start": {
      "get": {
        "description": "Stores the validated return address and nonce hash server-side, sets the host-only nonce cookie, and redirects to the account apex.",
        "operationId": "startSSO",
        "parameters": [
          {
            "in": "query",
            "name": "return_to",
            "required": true,
            "schema": {
              "format": "uri",
              "type": "string"
            }
          }
        ],
        "responses": {
          "302": {
            "description": "Nonce cookie set; navigate to the apex hop"
          },
          "400": {
            "description": "Invalid site return address or navigation"
          },
          "403": {
            "description": "Site locked, offline, suspended, or non-navigation request"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        },
        "security": [],
        "summary": "Start a site sign-in hop on the site's own host",
        "tags": [
          "Visitor sign-in"
        ]
      }
    },
    "/v1/teams": {
      "get": {
        "description": "Your teams and the invitations waiting for your answer.",
        "operationId": "getTeams",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "List my teams",
        "tags": [
          "Teams"
        ]
      },
      "post": {
        "description": "You become its first member. The name is its address and follows the address rules. 409 name_taken, name_conflict, team_limit.",
        "operationId": "postTeams",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "name"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Created"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Create a team",
        "tags": [
          "Teams"
        ]
      }
    },
    "/v1/teams/{team}": {
      "delete": {
        "description": "Refused with 409 team_has_sites while it owns live sites; its sites in Recently deleted go for good with it. The name is never given out again.",
        "operationId": "deleteTeam",
        "parameters": [
          {
            "in": "path",
            "name": "team",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Delete a team",
        "tags": [
          "Teams"
        ]
      }
    },
    "/v1/teams/{team}/invitations/{invitation}": {
      "delete": {
        "operationId": "deleteTeamInvitation",
        "parameters": [
          {
            "in": "path",
            "name": "team",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "invitation",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Cancel an invitation",
        "tags": [
          "Teams"
        ]
      }
    },
    "/v1/teams/{team}/members": {
      "get": {
        "description": "Members and waiting invitations.",
        "operationId": "getTeamMembers",
        "parameters": [
          {
            "in": "path",
            "name": "team",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "List a teams members",
        "tags": [
          "Teams"
        ]
      },
      "post": {
        "description": "The same answer whether or not an account has that email; nothing is sent. Whoever signs in with it sees the invitation.",
        "operationId": "postTeamMembers",
        "parameters": [
          {
            "in": "path",
            "name": "team",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "email": {
                    "type": "string"
                  }
                },
                "required": [
                  "email"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "description": "Invitation recorded"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Invite someone by email",
        "tags": [
          "Teams"
        ]
      }
    },
    "/v1/teams/{team}/members/{member}": {
      "delete": {
        "description": "409 last_member: a team keeps one member.",
        "operationId": "deleteTeamMember",
        "parameters": [
          {
            "in": "path",
            "name": "team",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "The member's handle.",
            "in": "path",
            "name": "member",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Remove a member, or leave",
        "tags": [
          "Teams"
        ]
      }
    },
    "/v1/turnstile/frame": {
      "get": {
        "description": "Served on the app's own address only (PUBLIC_BASE_URL's host; 404 elsewhere, and 404 when Turnstile is not set up). Errors: spam_check_required.",
        "operationId": "turnstileFrame",
        "responses": {
          "200": {
            "description": "The frame page, text/html"
          },
          "404": {
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "Not the app's own address, or the spam check is off"
          }
        },
        "summary": "The spam check frame for spam-checked adds",
        "tags": [
          "Visitor sign-in"
        ]
      }
    },
    "/v1/u/{handle}/showcase.json": {
      "get": {
        "description": "Exactly the public showcase projection.",
        "parameters": [
          {
            "in": "path",
            "name": "handle",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "bio": {
                      "type": "string"
                    },
                    "handle": {
                      "type": "string"
                    },
                    "sites": {
                      "items": {
                        "properties": {
                          "description": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "order": {
                            "type": "integer"
                          },
                          "pinned": {
                            "type": "boolean"
                          },
                          "title": {
                            "type": "string"
                          },
                          "updated_at": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "url": {
                            "format": "uri",
                            "type": "string"
                          }
                        },
                        "required": [
                          "name",
                          "url",
                          "updated_at",
                          "pinned",
                          "order"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "handle",
                    "bio",
                    "sites"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Public showcase"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Handle not found or hosted event mode"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        },
        "security": [],
        "summary": "Live public showcase feed",
        "tags": [
          "Showcase"
        ]
      }
    },
    "/v1/u/{handle}/sites/{sitename}/me": {
      "get": {
        "description": "Pages call it same-origin on the site's own address.",
        "operationId": "getVisitorMeByHandle",
        "parameters": [
          {
            "$ref": "#/components/parameters/sitename"
          },
          {
            "in": "path",
            "name": "handle",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "properties": {
                        "email": {
                          "description": "Latest verified OAuth identity email; users.username when no identity exists",
                          "type": "string"
                        },
                        "expires_at": {
                          "description": "Earlier of absolute and idle expiry (RFC3339)",
                          "format": "date-time",
                          "type": "string"
                        },
                        "provider": {
                          "description": "Google (more providers later); omitted when no OAuth identity exists",
                          "type": "string"
                        },
                        "signed_in": {
                          "enum": [
                            true
                          ],
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "signed_in",
                        "expires_at"
                      ],
                      "type": "object"
                    },
                    {
                      "properties": {
                        "sign_in": {
                          "enum": [
                            "/v1/auth/oauth/providers"
                          ],
                          "type": "string"
                        },
                        "signed_in": {
                          "enum": [
                            false
                          ],
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "signed_in",
                        "sign_in"
                      ],
                      "type": "object"
                    },
                    {
                      "properties": {
                        "code": {
                          "enum": [
                            "custom_domain_required",
                            "use_custom_domain"
                          ],
                          "type": "string"
                        },
                        "domain": {
                          "description": "The site's bound custom domain; present only with code use_custom_domain",
                          "type": "string"
                        },
                        "sign_in_available": {
                          "enum": [
                            false
                          ],
                          "type": "boolean"
                        },
                        "signed_in": {
                          "enum": [
                            false
                          ],
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "signed_in",
                        "sign_in_available",
                        "code"
                      ],
                      "type": "object"
                    }
                  ]
                }
              }
            },
            "description": "Signed-in identity or anonymous visitor",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "enum": [
                    "private, no-store"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/OriginMismatch"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal server error"
          }
        },
        "summary": "Read the current site visitor session",
        "tags": [
          "Visitor sign-in"
        ]
      },
      "options": {
        "operationId": "optionsVisitorMeByHandle",
        "parameters": [
          {
            "$ref": "#/components/parameters/sitename"
          },
          {
            "in": "path",
            "name": "handle",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Origin allowed",
            "headers": {
              "Access-Control-Allow-Headers": {
                "schema": {
                  "enum": [
                    "Content-Type"
                  ],
                  "type": "string"
                }
              },
              "Access-Control-Allow-Methods": {
                "schema": {
                  "enum": [
                    "GET, OPTIONS"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/OriginMismatchOrSiteLocked"
          }
        },
        "summary": "Preflight for visitor session reads",
        "tags": [
          "Visitor sign-in"
        ]
      }
    },
    "/v1/u/{handle}/sites/{sitename}/visitor/auth": {
      "options": {
        "operationId": "optionsRequestUserSiteVisitorEmail",
        "parameters": [
          {
            "in": "path",
            "name": "handle",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/sitename"
          }
        ],
        "responses": {
          "204": {
            "description": "Origin-authorized preflight",
            "headers": {
              "Access-Control-Allow-Headers": {
                "schema": {
                  "enum": [
                    "Content-Type, X-SH-CSRF"
                  ],
                  "type": "string"
                }
              },
              "Access-Control-Allow-Methods": {
                "schema": {
                  "enum": [
                    "POST, OPTIONS"
                  ],
                  "type": "string"
                }
              },
              "Access-Control-Max-Age": {
                "schema": {
                  "enum": [
                    "600"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Missing site name"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Origin forbidden; or site_locked (the site has a passcode: send the unlock cookie from its page, or the owner's key)"
          }
        },
        "security": [],
        "summary": "Preflight site email sign-in",
        "tags": [
          "Visitor sign-in"
        ]
      },
      "post": {
        "description": "Send a 6-digit sign-in code valid for 15 minutes; works only on the site's own address or domain.",
        "operationId": "requestUserSiteVisitorEmail",
        "parameters": [
          {
            "in": "path",
            "name": "handle",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/sitename"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "email": {
                    "format": "email",
                    "type": "string"
                  }
                },
                "required": [
                  "email"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "email": {
                      "format": "email",
                      "type": "string"
                    },
                    "expires_in_seconds": {
                      "enum": [
                        900
                      ],
                      "type": "integer"
                    },
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message",
                    "email",
                    "expires_in_seconds"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Code sent; no dashboard magic link."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "error": {
                      "type": "string"
                    },
                    "reason": {
                      "type": "string"
                    },
                    "tries_left": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Invalid request, missing fields, apex host, or the legacy path address (custom_domain_required)"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "error": {
                      "type": "string"
                    },
                    "reason": {
                      "type": "string"
                    },
                    "tries_left": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Invalid code. `code` stays invalid_code. `reason` is code_wrong, code_used_up, code_expired, or link_other_browser."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "error": {
                      "type": "string"
                    },
                    "reason": {
                      "type": "string"
                    },
                    "tries_left": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Origin forbidden or missing CSRF (verification)"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "error": {
                      "type": "string"
                    },
                    "reason": {
                      "type": "string"
                    },
                    "tries_left": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Site not found"
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "error": {
                      "type": "string"
                    },
                    "reason": {
                      "type": "string"
                    },
                    "tries_left": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "IP or shared per-email rate limit exceeded (code rate_limited)"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "error": {
                      "type": "string"
                    },
                    "reason": {
                      "type": "string"
                    },
                    "tries_left": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Internal error or email delivery failed"
          }
        },
        "security": [],
        "summary": "Request a site-scoped email sign-in code",
        "tags": [
          "Visitor sign-in"
        ]
      }
    },
    "/v1/u/{handle}/sites/{sitename}/visitor/auth/verify": {
      "options": {
        "operationId": "optionsVerifyUserSiteVisitorEmail",
        "parameters": [
          {
            "in": "path",
            "name": "handle",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/sitename"
          }
        ],
        "responses": {
          "204": {
            "description": "Origin-authorized preflight",
            "headers": {
              "Access-Control-Allow-Headers": {
                "schema": {
                  "enum": [
                    "Content-Type, X-SH-CSRF"
                  ],
                  "type": "string"
                }
              },
              "Access-Control-Allow-Methods": {
                "schema": {
                  "enum": [
                    "POST, OPTIONS"
                  ],
                  "type": "string"
                }
              },
              "Access-Control-Max-Age": {
                "schema": {
                  "enum": [
                    "600"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Missing site name"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Origin forbidden; or site_locked (the site has a passcode: send the unlock cookie from its page, or the owner's key)"
          }
        },
        "security": [],
        "summary": "Preflight site email sign-in",
        "tags": [
          "Visitor sign-in"
        ]
      },
      "post": {
        "description": "Verify a site-scoped code on the site's own address and start a visitor session (never an API key). Session has 30-day absolute and 14-day idle lifetimes.",
        "operationId": "verifyUserSiteVisitorEmail",
        "parameters": [
          {
            "in": "path",
            "name": "handle",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/sitename"
          },
          {
            "$ref": "#/components/parameters/csrf"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "code": {
                    "description": "6-digit email code",
                    "type": "string"
                  },
                  "email": {
                    "format": "email",
                    "type": "string"
                  }
                },
                "required": [
                  "email",
                  "code"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "email": {
                      "format": "email",
                      "type": "string"
                    },
                    "expires_at": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "provider": {
                      "enum": [
                        "email"
                      ],
                      "type": "string"
                    },
                    "signed_in": {
                      "enum": [
                        true
                      ],
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "signed_in",
                    "expires_at"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Signed in; sets the existing host-only visitor session cookie. Errors: 400 custom_domain_required."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "error": {
                      "type": "string"
                    },
                    "reason": {
                      "type": "string"
                    },
                    "tries_left": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Invalid request, missing fields, apex host, or the legacy path address (custom_domain_required)"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "error": {
                      "type": "string"
                    },
                    "reason": {
                      "type": "string"
                    },
                    "tries_left": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Invalid code. `code` stays invalid_code. `reason` is code_wrong, code_used_up, code_expired, or link_other_browser."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "error": {
                      "type": "string"
                    },
                    "reason": {
                      "type": "string"
                    },
                    "tries_left": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Origin forbidden or missing CSRF (verification) (code csrf_required)"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "error": {
                      "type": "string"
                    },
                    "reason": {
                      "type": "string"
                    },
                    "tries_left": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Site not found"
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "error": {
                      "type": "string"
                    },
                    "reason": {
                      "type": "string"
                    },
                    "tries_left": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "IP or shared per-email rate limit exceeded (code rate_limited)"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "error": {
                      "type": "string"
                    },
                    "reason": {
                      "type": "string"
                    },
                    "tries_left": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Internal error or email delivery failed"
          }
        },
        "security": [],
        "summary": "Verify a site-scoped email sign-in code",
        "tags": [
          "Visitor sign-in"
        ]
      }
    },
    "/v1/uploads/{token}": {
      "post": {
        "description": "Use the private link returned by create_upload_link with archive true from a shell.",
        "operationId": "postUploadLink",
        "parameters": [
          {
            "in": "path",
            "name": "token",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/gzip": {
              "schema": {
                "format": "binary",
                "type": "string"
              }
            },
            "application/zip": {
              "schema": {
                "format": "binary",
                "type": "string"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SiteWithNote"
                }
              }
            },
            "description": "Site updated"
          },
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SiteWithNote"
                }
              }
            },
            "description": "Site created"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Sign-in ended, or deploy scope or team rules refused the upload (code upload_link_signed_out)"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Unknown, used or expired link (code upload_link_invalid)"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/TooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        },
        "security": [],
        "summary": "Publish an archive through a one-time connector upload link",
        "tags": [
          "Deploy"
        ]
      },
      "put": {
        "description": "Use the private link returned by create_upload_link with archive true from a shell.",
        "operationId": "putUploadLink",
        "parameters": [
          {
            "in": "path",
            "name": "token",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/gzip": {
              "schema": {
                "format": "binary",
                "type": "string"
              }
            },
            "application/zip": {
              "schema": {
                "format": "binary",
                "type": "string"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SiteWithNote"
                }
              }
            },
            "description": "Site updated"
          },
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SiteWithNote"
                }
              }
            },
            "description": "Site created"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Sign-in ended, or deploy scope or team rules refused the upload (code upload_link_signed_out)"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Unknown, used or expired link (code upload_link_invalid)"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/TooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        },
        "security": [],
        "summary": "Publish an archive through a one-time connector upload link",
        "tags": [
          "Deploy"
        ]
      }
    },
    "/v1/visitor/establish": {
      "get": {
        "description": "One-time hop on the site's own address (its `\u003csite\u003e.\u003chandle\u003e` host or domain).",
        "operationId": "establishVisitor",
        "parameters": [
          {
            "in": "query",
            "name": "once",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "302": {
            "description": "Cookie set; redirect to the stored return_to",
            "headers": {
              "Location": {
                "schema": {
                  "format": "uri",
                  "type": "string"
                }
              },
              "Set-Cookie": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "text/html": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "Bad, replayed, expired, host-mismatch, missing or wrong nonce cookie, or apex Host"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        },
        "summary": "Establish the visitor session cookie",
        "tags": [
          "Visitor sign-in"
        ]
      }
    },
    "/v1/visitor/logout": {
      "post": {
        "description": "For a hop session, deletes its parent dashboard key, apex pass, and all linked site sessions.",
        "operationId": "logoutVisitor",
        "parameters": [
          {
            "in": "header",
            "name": "X-SH-CSRF",
            "required": false,
            "schema": {
              "enum": [
                "1"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "redirect_url": {
                      "format": "uri",
                      "type": "string"
                    }
                  },
                  "required": [
                    "redirect_url"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Navigate the top-level window to redirect_url to clear the apex cookie"
          },
          "204": {
            "description": "Session deleted and cookie cleared"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "error": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Missing CSRF header (and not a JSON request) (code csrf_required)"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        },
        "summary": "Sign out this browser across linked sites",
        "tags": [
          "Visitor sign-in"
        ]
      }
    },
    "/v1/visitor/oauth/{provider}": {
      "get": {
        "description": "Visitor sign-in start, served on the site's own address (its `\u003csite\u003e.\u003chandle\u003e` host, person address, claimed name or bound domain).",
        "operationId": "startVisitorOAuth",
        "parameters": [
          {
            "in": "path",
            "name": "provider",
            "required": true,
            "schema": {
              "enum": [
                "google",
                "github",
                "oidc"
              ],
              "type": "string"
            }
          },
          {
            "description": "Absolute URL of a page on this host to return to after sign-in",
            "in": "query",
            "name": "return_to",
            "required": true,
            "schema": {
              "format": "uri",
              "type": "string"
            }
          }
        ],
        "responses": {
          "302": {
            "description": "Nonce cookie set; redirect to the identity provider",
            "headers": {
              "Location": {
                "schema": {
                  "format": "uri",
                  "type": "string"
                }
              },
              "Set-Cookie": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Missing return_to, or one that is not a page of the site on this host"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Unknown or disabled provider"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        },
        "summary": "Start visitor sign-in on the site's own host",
        "tags": [
          "Visitor sign-in"
        ]
      }
    }
  },
  "servers": [
    {
      "description": "Production API (agents, with an API key).",
      "url": "https://stage.simple-host.site"
    }
  ],
  "tags": [
    {
      "description": "Public product, connector, and API discovery.",
      "name": "Discovery"
    },
    {
      "description": "Account sign-in by emailed code or Google, for Simple Host account owners and the agents working for them. Errors: 403 account_auth_unavailable.",
      "name": "Auth"
    },
    {
      "description": "Account profile, credentials and connected apps.",
      "name": "Account"
    },
    {
      "description": "List, inspect and manage websites.",
      "name": "Sites"
    },
    {
      "description": "Accounts that own sites and that people join by an invitation to their email; members act with ?owner=\u003cteam\u003e.",
      "name": "Teams"
    },
    {
      "description": "Publish inline JSON files or a tar.gz/zip archive.",
      "name": "Deploy"
    },
    {
      "description": "Inspect retained deployments, preview and roll back.",
      "name": "Versions"
    },
    {
      "description": "Owner-scoped website traffic.",
      "name": "Analytics"
    },
    {
      "description": "Claim a free address or connect a custom domain.",
      "name": "Custom domains"
    },
    {
      "description": "Connect a wildcard address family for your sites.",
      "name": "Address families"
    },
    {
      "description": "Owner-declared KV, SQLite and durable file resources.",
      "name": "Storage resources"
    },
    {
      "description": "Signed HTTPS notifications for visitor storage writes on Simple Host.",
      "name": "Notifications"
    },
    {
      "description": "Site-scoped browser sessions for website visitors (customers, guests, members), on the site's own address.",
      "name": "Visitor sign-in"
    },
    {
      "description": "Discover and fetch this server’s agent skills and references.",
      "name": "Skills"
    },
    {
      "description": "Public feed of a person’s showcased sites.",
      "name": "Showcase"
    },
    {
      "description": "Service health and readiness.",
      "name": "Health"
    }
  ]
}