{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/pagegoat-com/json-schema/pagegoat-com-site-schema.json",
  "title": "Site",
  "description": "A site, with the calling user's effective role on it.",
  "x-generated": "2026-11-20",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/pagegoat-com-openapi.yml#/components/schemas/Site",
  "required": [
    "captureOtp",
    "captureReverifyDays",
    "commentsEnabled",
    "currentVersion",
    "freeLink",
    "hiddenFromSearch",
    "name",
    "passwordSet",
    "reason",
    "role",
    "slug",
    "updatedAt",
    "visibility",
    "visitorCount"
  ],
  "type": "object",
  "properties": {
    "slug": {
      "type": "string",
      "description": "URL-safe identifier; the site's public path."
    },
    "name": {
      "type": "string",
      "description": "Display name."
    },
    "role": {
      "type": "string",
      "description": "The caller's effective role on this site.",
      "enum": [
        "viewer",
        "commenter",
        "admin"
      ]
    },
    "reason": {
      "type": "string",
      "description": "Why the caller has that role — ownership, a grant, or public access."
    },
    "commentsEnabled": {
      "type": "boolean",
      "description": "Whether new comments may be created."
    },
    "visibility": {
      "type": "string",
      "description": "Link-access mode. `password` means a visitor must enter the site's password before anything is served; `capture` means they must confirm an email address.",
      "enum": [
        "private",
        "password",
        "capture",
        "public"
      ]
    },
    "publicRole": {
      "type": [
        "string",
        "null"
      ],
      "description": "Role granted to anyone who gets in via the link — public, or password or capture once cleared.",
      "enum": [
        "viewer",
        "commenter"
      ]
    },
    "passwordSet": {
      "type": "boolean",
      "description": "Whether a link password is set. The password itself is never returned."
    },
    "hiddenFromSearch": {
      "type": "boolean",
      "description": "Advisory `noindex` on the viewer page. NOT access control."
    },
    "captureOtp": {
      "type": "boolean",
      "description": "Capture mode: whether visitors must confirm a six-digit code."
    },
    "captureReverifyDays": {
      "type": "integer",
      "description": "Capture mode: days a confirmed visitor stays confirmed; 0 means every visit.",
      "format": "int32"
    },
    "captureDomains": {
      "type": [
        "string",
        "null"
      ],
      "description": "Capture mode: comma-separated domains the gate accepts, or null for any."
    },
    "visitorCount": {
      "type": "integer",
      "description": "Addresses captured on this site, ever. The Visitors tab exists for as long as this is above zero, whatever the current mode.",
      "format": "int64"
    },
    "currentVersion": {
      "type": "integer",
      "description": "Version currently served. Incremented by each re-upload.",
      "format": "int32"
    },
    "format": {
      "type": [
        "string",
        "null"
      ],
      "description": "What the current version was uploaded as: `html`, `zip`, `md` (Markdown, rendered to a page), `txt` (plain text, rendered to a page) or `pdf` (shown in pagegoat's PDF viewer). Null for a site uploaded before formats were recorded, which is HTML or a ZIP.",
      "enum": [
        "html",
        "zip",
        "md",
        "txt",
        "pdf"
      ]
    },
    "sourceName": {
      "type": [
        "string",
        "null"
      ],
      "description": "The uploaded file's own name, for a Markdown, text or PDF site: what a download of the original is called. Its bytes are at `source.md`, `source.txt` or `document.pdf` among the site's files."
    },
    "updatedAt": {
      "type": "string",
      "description": "When the site was last changed (ISO-8601, UTC).",
      "format": "date-time"
    },
    "projectId": {
      "type": [
        "string",
        "null"
      ],
      "description": "Owning project, or null when unfiled.",
      "format": "uuid"
    },
    "suspendedAt": {
      "type": [
        "string",
        "null"
      ],
      "description": "When an operator suspended this site, or null. A suspended site is not served to visitors and cannot be edited or deleted until it is restored.",
      "format": "date-time"
    },
    "suspensionReason": {
      "type": [
        "string",
        "null"
      ],
      "description": "Why it was suspended, in the operator's words. Only returned to a site admin — the owner is who this is written for."
    },
    "freeLink": {
      "type": "boolean",
      "description": "True for a free link: a page made without an account that stops working at `expiresAt`. False for every site in an account, kept free links included."
    },
    "expiresAt": {
      "type": [
        "string",
        "null"
      ],
      "description": "When the site stops being served (ISO-8601, UTC), or null for never. Only free links have one.",
      "format": "date-time"
    },
    "owned": {
      "type": [
        "boolean",
        "null"
      ],
      "description": "True when the caller owns this site. Only on list endpoints."
    },
    "commentCount": {
      "type": [
        "integer",
        "null"
      ],
      "description": "Total comments on the site. Only on list endpoints.",
      "format": "int64"
    },
    "collaborators": {
      "type": [
        "array",
        "null"
      ],
      "description": "Owner plus direct user grants, deduped and capped at 5, for avatar chips. Only on list endpoints.",
      "items": {
        "type": "string",
        "description": "A token `sub`."
      }
    }
  }
}