{
  "openapi": "3.0.3",
  "info": {
    "title": "SlydeDeck API",
    "version": "1.1.0",
    "description": "AI-agent-friendly API for SlydeDeck presentations and managed publications. Public deck discovery is unauthenticated; restricted managed content requires an authorized browser identity or scoped integration credential. This spec is served at both /openapi.json and /api/docs.",
    "contact": { "name": "SlydeDeck Support", "url": "https://slydedeck.com/contact" },
    "license": { "name": "Proprietary", "url": "https://slydedeck.com/terms" }
  },
  "servers": [
    { "url": "https://slydedeck.com/api", "description": "Production" }
  ],
  "externalDocs": {
    "description": "AI agent integration guide",
    "url": "https://slydedeck.com/llms.txt"
  },
  "tags": [
    { "name": "Decks", "description": "Public presentations and their AI summaries" },
    { "name": "Publications", "description": "Scoped search and dataset reads over published managed content" },
    { "name": "System", "description": "Operational status endpoints" }
  ],
  "components": {
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "description": "Legacy application session authentication. Managed-publication MCP credentials use the separate audience-bound IntegrationBearerAuth scheme."
      },
      "IntegrationBearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "SlydeDeck integration credential",
        "description": "Opaque sd1_ integration credential issued for an accepted grant. It is audience-bound and restricted to the grant's release, resources, and scopes."
      }
    },
    "schemas": {
      "Deck": {
        "type": "object",
        "properties": {
          "id": { "type": "string", "description": "Unique deck identifier", "example": "ckz1a2b3c4d5" },
          "title": { "type": "string", "description": "Presentation title", "example": "Quarterly Product Review" },
          "description": { "type": "string", "nullable": true, "example": "Q3 roadmap and metrics" },
          "presentationCode": { "type": "string", "description": "Short public share code", "example": "ABC123" },
          "presenterName": { "type": "string", "example": "Jane Doe" },
          "tags": { "type": "array", "items": { "type": "string" }, "example": ["product", "roadmap"] },
          "isLive": { "type": "boolean", "example": true },
          "viewCount": { "type": "integer", "example": 142 },
          "createdAt": { "type": "string", "format": "date-time", "example": "2026-06-01T12:00:00.000Z" },
          "highLevelSummary": { "type": "string", "nullable": true, "description": "AI-generated overview", "example": "This deck covers the Q3 product roadmap..." }
        },
        "required": ["id", "title", "presentationCode", "isLive"]
      },
      "DeckList": {
        "type": "object",
        "properties": {
          "success": { "type": "boolean", "example": true },
          "data": {
            "type": "object",
            "properties": {
              "decks": { "type": "array", "items": { "$ref": "#/components/schemas/Deck" } },
              "total": { "type": "integer", "example": 57 },
              "limit": { "type": "integer", "example": 20 },
              "offset": { "type": "integer", "example": 0 }
            }
          }
        }
      },
      "Problem": {
        "type": "object",
        "description": "RFC 7807 Problem Details",
        "properties": {
          "type": { "type": "string", "format": "uri", "example": "https://slydedeck.com/errors/not-found" },
          "title": { "type": "string", "example": "Resource Not Found" },
          "status": { "type": "integer", "example": 404 },
          "detail": { "type": "string", "example": "No public deck found for the given ID or share code." },
          "instance": { "type": "string", "example": "/api/decks/UNKNOWN" }
        }
      },
      "Status": {
        "type": "object",
        "properties": {
          "status": { "type": "string", "enum": ["operational", "degraded", "down"], "example": "operational" },
          "api": { "type": "string", "example": "SlydeDeck API v1.0" },
          "timestamp": { "type": "string", "format": "date-time" }
        }
      },
      "ManagedDatasetRows": {
        "type": "object",
        "required": ["success", "data"],
        "properties": {
          "success": { "type": "boolean" },
          "data": {
            "type": "object",
            "required": ["columns", "rows", "rowCount", "nextCursor", "citation"],
            "properties": {
              "columns": { "type": "array", "items": { "type": "string" } },
              "rows": { "type": "array", "items": { "type": "array", "items": { "type": "string" } } },
              "rowCount": { "type": "integer", "minimum": 0 },
              "nextCursor": { "type": "string", "nullable": true },
              "citation": {
                "type": "object",
                "required": ["releaseId", "resourceId", "sourceSha256"],
                "properties": {
                  "releaseId": { "type": "string", "format": "uuid" },
                  "resourceId": { "type": "string", "format": "uuid" },
                  "sourceSha256": { "type": "string", "pattern": "^[0-9a-f]{64}$" }
                }
              }
            }
          }
        }
      },
      "ManagedSourcePage": {
        "type": "object",
        "required": ["success", "data"],
        "properties": {
          "success": { "type": "boolean" },
          "data": {
            "type": "object",
            "required": ["releaseId", "resource", "page", "citation"],
            "properties": {
              "releaseId": { "type": "string", "format": "uuid" },
              "resource": {
                "type": "object",
                "required": ["resourceId", "fileName", "mimeType", "byteLength", "sha256"],
                "properties": {
                  "resourceId": { "type": "string", "format": "uuid" },
                  "fileName": { "type": "string" },
                  "mimeType": { "type": "string" },
                  "byteLength": { "type": "integer", "minimum": 0 },
                  "sha256": { "type": "string", "pattern": "^[0-9a-f]{64}$" }
                }
              },
              "page": {
                "type": "object",
                "required": ["pageNumber", "text"],
                "properties": {
                  "pageNumber": { "type": "integer", "minimum": 1 },
                  "text": { "type": "string" }
                }
              },
              "citation": {
                "type": "object",
                "required": ["releaseId", "resourceId", "pageNumber", "sourceSha256"],
                "properties": {
                  "releaseId": { "type": "string", "format": "uuid" },
                  "resourceId": { "type": "string", "format": "uuid" },
                  "pageNumber": { "type": "integer", "minimum": 1 },
                  "sourceSha256": { "type": "string", "pattern": "^[0-9a-f]{64}$" }
                }
              }
            }
          }
        }
      }
    },
    "responses": {
      "Problem404": {
        "description": "Resource not found",
        "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } }
      },
      "Problem401": {
        "description": "Authentication required",
        "headers": {
          "WWW-Authenticate": { "schema": { "type": "string" }, "description": "Bearer challenge" }
        },
        "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } }
      },
      "Problem500": {
        "description": "Server error",
        "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } }
      }
    }
  },
  "paths": {
    "/v1/content-sessions": {
      "post": {
        "summary": "Create an authorized short-lived content session",
        "description": "Resolve an approved resource in a published release and return a same-origin content URL. Browser calls must be same-origin and receive an HttpOnly, Secure, SameSite=Lax cookie scoped to that representation path. API calls use an API-audience integration credential with read:resource and receive a short-lived capability in the response body. Capabilities expire within 120 seconds and must never be placed in a URL, shared link, or model prompt.",
        "operationId": "createContentSession",
        "tags": ["Publications"],
        "security": [{}, { "IntegrationBearerAuth": [] }],
        "requestBody": {
          "required": true,
          "content": { "application/json": { "schema": { "type": "object", "additionalProperties": false, "required": ["releaseId", "resourceVersionId", "representation"], "properties": { "releaseId": { "type": "string", "format": "uuid" }, "resourceVersionId": { "type": "string", "format": "uuid", "description": "Published resource ID bound to the release" }, "representation": { "type": "string", "enum": ["source", "pdf"] } } } } }
        },
        "responses": {
          "200": {
            "description": "Short-lived content URL; browser responses set a scoped cookie, API responses include credential",
            "headers": { "Cache-Control": { "schema": { "type": "string", "example": "private, no-store" } }, "Set-Cookie": { "schema": { "type": "string", "description": "Browser session only; HttpOnly, Secure, SameSite=Lax and representation-path scoped" } } },
            "content": { "application/json": { "schema": { "type": "object", "required": ["success", "data"], "properties": { "success": { "type": "boolean", "example": true }, "data": { "type": "object", "required": ["expiresAt", "contentUrl"], "properties": { "expiresAt": { "type": "string", "format": "date-time" }, "contentUrl": { "type": "string", "format": "uri" }, "credential": { "type": "string", "description": "Present only for API-audience integration callers; do not put in a URL" } } } } } } }
          },
          "401": { "$ref": "#/components/responses/Problem401" },
          "403": { "description": "Caller is not authorized for this release/resource/representation or browser request is not same-origin", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } },
          "413": { "description": "The content-session request body exceeds the limit", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } },
          "422": { "description": "Invalid release, resource, or representation input", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } },
          "500": { "$ref": "#/components/responses/Problem500" }
        }
      }
    },
    "/v1/publications/{id}/search": {
      "get": {
        "summary": "Search pages in an authorized publication release",
        "description": "Full-text searches page text only within the release and resource IDs bound to the integration credential. Requires the read:search scope. Search terms, snippets, counts, and results are limited to that scope.",
        "operationId": "searchPublicationPages",
        "tags": ["Publications"],
        "security": [{ "IntegrationBearerAuth": [] }],
        "x-ai-description": "Search pages in a managed publication using a scoped SlydeDeck integration credential. The credential limits results to its assigned release and resources.",
        "parameters": [
          { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "Publication ID" },
          { "name": "q", "in": "query", "required": true, "schema": { "type": "string", "minLength": 1, "maxLength": 200 }, "description": "Plain-text full-text search query" },
          { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "minimum": 1, "maximum": 20, "default": 10 }, "description": "Maximum page hits to return" }
        ],
        "responses": {
          "200": {
            "description": "Page hits from the authorized release/resource scope",
            "headers": { "Cache-Control": { "schema": { "type": "string", "example": "no-store, private" } } },
            "content": { "application/json": { "schema": { "type": "object", "required": ["success", "data"], "properties": { "success": { "type": "boolean", "example": true }, "data": { "type": "object", "required": ["hits", "totalCount"], "properties": { "hits": { "type": "array", "items": { "type": "object", "required": ["releaseId", "resourceId", "pageNumber", "snippet", "rank"], "properties": { "releaseId": { "type": "string" }, "resourceId": { "type": "string" }, "pageNumber": { "type": "integer", "minimum": 1 }, "snippet": { "type": "string" }, "rank": { "type": "number" } } } }, "totalCount": { "type": "integer", "minimum": 0 } } } } }, "example": { "success": true, "data": { "hits": [{ "releaseId": "release-id", "resourceId": "resource-id", "pageNumber": 2, "snippet": "Quarterly forecast and growth targets", "rank": 0.75 }], "totalCount": 1 } } } }
          },
          "401": { "$ref": "#/components/responses/Problem401" },
          "403": { "description": "Credential lacks the read:search scope", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } },
          "404": { "$ref": "#/components/responses/Problem404" },
          "422": { "description": "Invalid search query or result limit", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } },
          "500": { "$ref": "#/components/responses/Problem500" }
        }
      }
    },
    "/v1/releases/{releaseId}/resources/{resourceId}/pages/{pageNumber}": {
      "get": {
        "summary": "Read one page from an authorized release resource",
        "description": "Returns the exact extracted source page and source checksum citation. Requires read:page and membership in the credential's pinned published release.",
        "operationId": "readReleaseSourcePage",
        "tags": ["Publications"],
        "security": [{ "IntegrationBearerAuth": [] }],
        "parameters": [
          { "name": "releaseId", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } },
          { "name": "resourceId", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } },
          { "name": "pageNumber", "in": "path", "required": true, "schema": { "type": "integer", "minimum": 1, "maximum": 100000 } }
        ],
        "responses": {
          "200": { "description": "Exact source page and immutable citation", "headers": { "Cache-Control": { "schema": { "type": "string", "example": "no-store, private" } } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ManagedSourcePage" } } } },
          "401": { "$ref": "#/components/responses/Problem401" },
          "403": { "description": "Credential lacks read:page", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } },
          "404": { "$ref": "#/components/responses/Problem404" },
          "413": { "description": "The complete source page exceeds the response ceiling", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } },
          "422": { "description": "Invalid page number", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } },
          "500": { "$ref": "#/components/responses/Problem500" }
        }
      }
    },
    "/v1/releases/{releaseId}/datasets/{resourceId}/rows": {
      "get": {
        "summary": "Read bounded rows from an authorized release dataset",
        "description": "Returns exact string values, an optional ordered column projection, a signed continuation cursor bound to that projection, and source checksum citation from the credential's pinned published release. Requires read:rows.",
        "operationId": "readReleaseDatasetRows",
        "tags": ["Publications"],
        "security": [{ "IntegrationBearerAuth": [] }],
        "parameters": [
          { "name": "releaseId", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } },
          { "name": "resourceId", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } },
          { "name": "cursor", "in": "query", "required": false, "schema": { "type": "string", "maxLength": 2048 } },
          { "name": "columns", "in": "query", "required": false, "style": "form", "explode": false, "schema": { "type": "string", "maxLength": 799, "pattern": "^(?:0|[1-9][0-9]?|1[0-9]{2})(?:,(?:0|[1-9][0-9]?|1[0-9]{2}))*$" }, "description": "Optional ordered, unique zero-based column indexes (0-199); continuation cursors are bound to this selection" },
          { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "minimum": 1, "maximum": 100, "default": 100 } }
        ],
        "responses": {
          "200": { "description": "Whole string-valued rows and source citation", "headers": { "Cache-Control": { "schema": { "type": "string", "example": "no-store, private" } } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ManagedDatasetRows" } } } },
          "401": { "$ref": "#/components/responses/Problem401" },
          "403": { "description": "Credential lacks read:rows", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } },
          "404": { "$ref": "#/components/responses/Problem404" },
          "413": { "description": "A whole row exceeds the response ceiling", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } },
          "422": { "description": "Invalid cursor, column selection or page limit", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } },
          "500": { "$ref": "#/components/responses/Problem500" }
        }
      }
    },
    "/v1/releases/{releaseId}/datasets/{resourceId}/schema": {
      "get": {
        "summary": "Read schema for an authorized publication dataset",
        "description": "Returns string-preserving fields, empty-string missing-value semantics, logical row count and source checksum for a resource in the pinned published release. Units are null unless a source explicitly provides them. Requires read:rows.",
        "operationId": "readPublicationDatasetSchema",
        "tags": ["Publications"],
        "security": [{ "IntegrationBearerAuth": [] }],
        "parameters": [
          { "name": "releaseId", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } },
          { "name": "resourceId", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } }
        ],
        "responses": {
          "200": { "description": "Authorized string-valued dataset schema and source provenance", "headers": { "Cache-Control": { "schema": { "type": "string", "example": "no-store, private" } } }, "content": { "application/json": { "schema": { "type": "object", "required": ["success", "data"], "properties": { "success": { "type": "boolean" }, "data": { "type": "object", "required": ["releaseId", "resource", "fields", "missingValue", "rowCount"], "properties": { "releaseId": { "type": "string", "format": "uuid" }, "resource": { "type": "object", "required": ["resourceId", "fileName", "mimeType", "sha256"], "properties": { "resourceId": { "type": "string", "format": "uuid" }, "fileName": { "type": "string" }, "mimeType": { "type": "string" }, "sha256": { "type": "string", "pattern": "^[0-9a-f]{64}$" } } }, "fields": { "type": "array", "items": { "type": "object", "required": ["name", "type", "unit"], "properties": { "name": { "type": "string" }, "type": { "type": "string", "enum": ["string"] }, "unit": { "type": "string", "nullable": true } } } }, "missingValue": { "type": "string", "enum": [""] }, "rowCount": { "type": "integer", "minimum": 0 } } } } } } } },
          "401": { "$ref": "#/components/responses/Problem401" },
          "403": { "description": "Credential lacks the read:rows scope", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } },
          "404": { "$ref": "#/components/responses/Problem404" },
          "413": { "description": "The complete schema exceeds the response ceiling", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } },
          "500": { "$ref": "#/components/responses/Problem500" }
        }
      }
    },
    "/v1/publications/{id}/datasets/{resourceId}/rows": {
      "get": {
        "summary": "Read rows from an authorized publication dataset",
        "description": "Returns whole CSV rows as strings from the integration credential's pinned published release and resource scope. Optional ordered column selection is bound to signed cursors. Requires read:rows. REST responses are capped at 256 KiB; oversized complete rows receive 413 and are never truncated.",
        "operationId": "readPublicationDatasetRows",
        "tags": ["Publications"],
        "security": [{ "IntegrationBearerAuth": [] }],
        "x-ai-description": "Read exact string values from a managed publication CSV using the scoped integration credential. Optionally select unique zero-based columns; continue with a cursor bound to that selection. Each page stays within the REST response-size limit.",
        "parameters": [
          { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "Publication ID" },
          { "name": "resourceId", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "Authorized CSV resource ID" },
          { "name": "cursor", "in": "query", "required": false, "schema": { "type": "string", "maxLength": 2048 }, "description": "Opaque signed continuation cursor returned by the prior page" },
          { "name": "columns", "in": "query", "required": false, "style": "form", "explode": false, "schema": { "type": "string", "maxLength": 799, "pattern": "^(?:0|[1-9][0-9]?|1[0-9]{2})(?:,(?:0|[1-9][0-9]?|1[0-9]{2}))*$" }, "description": "Optional ordered, unique zero-based column indexes (0-199); continuation cursors are bound to this selection" },
          { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "minimum": 1, "maximum": 100, "default": 100 }, "description": "Maximum whole rows to return before applying the response byte ceiling" }
        ],
        "responses": {
          "200": {
            "description": "Whole string-valued rows in the authorized release/resource scope",
            "headers": { "Cache-Control": { "schema": { "type": "string", "example": "no-store, private" } } },
            "content": { "application/json": { "schema": { "type": "object", "required": ["success", "data"], "properties": { "success": { "type": "boolean" }, "data": { "type": "object", "required": ["columns", "rows", "rowCount", "nextCursor", "citation"], "properties": { "columns": { "type": "array", "items": { "type": "string" } }, "rows": { "type": "array", "items": { "type": "array", "items": { "type": "string" } } }, "rowCount": { "type": "integer", "minimum": 0 }, "nextCursor": { "type": "string", "nullable": true }, "citation": { "$ref": "#/components/schemas/ManagedDatasetRows/properties/data/properties/citation" } } } } } } }
          },
          "401": { "$ref": "#/components/responses/Problem401" },
          "403": { "description": "Credential lacks the read:rows scope", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } },
          "404": { "$ref": "#/components/responses/Problem404" },
          "413": { "description": "A single complete row exceeds the response ceiling", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } },
          "422": { "description": "Invalid cursor, column selection or page limit", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } },
          "500": { "$ref": "#/components/responses/Problem500" }
        }
      }
    },
    "/v1/publications/{id}/manifest": {
      "get": {
        "summary": "Read the credential's pinned publication manifest",
        "description": "Returns only resources joined to the integration credential's pinned published release and authorized resource scope. Requires read:metadata. Resource entries include counts, checksums and relative API locators; no object-store key or signed storage URL is returned. Use afterPosition and limit to continue through large manifests.",
        "operationId": "readPinnedPublicationManifest",
        "tags": ["Publications"],
        "security": [{ "IntegrationBearerAuth": [] }],
        "x-ai-description": "Discover only the files and derived representations authorized by this integration credential. Follow the relative page or dataset API locator using the same bearer credential.",
        "parameters": [
          { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "Publication ID" },
          { "name": "afterPosition", "in": "query", "required": false, "schema": { "type": "integer", "minimum": -1, "maximum": 100000, "default": -1 }, "description": "Return authorized release resources after this position" },
          { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "minimum": 1, "maximum": 100, "default": 20 }, "description": "Maximum resource entries to return before applying the 256 KiB response ceiling" }
        ],
        "responses": {
          "200": {
            "description": "Pinned publication metadata and authorized resource entries",
            "headers": { "Cache-Control": { "schema": { "type": "string", "example": "no-store, private" } } },
            "content": { "application/json": { "schema": { "type": "object", "required": ["success", "data"], "properties": { "success": { "type": "boolean" }, "data": { "type": "object", "required": ["publication", "release", "resourceCount", "resources", "nextAfterPosition"], "properties": { "publication": { "type": "object", "required": ["id", "title", "visibility"], "properties": { "id": { "type": "string", "format": "uuid" }, "title": { "type": "string" }, "description": { "type": "string", "nullable": true }, "visibility": { "type": "string" } } }, "release": { "type": "object", "required": ["id", "version", "publishedAt"], "properties": { "id": { "type": "string", "format": "uuid" }, "version": { "type": "integer", "minimum": 1 }, "publishedAt": { "type": "string", "format": "date-time", "nullable": true } } }, "resourceCount": { "type": "integer", "minimum": 0 }, "nextAfterPosition": { "type": "integer", "nullable": true }, "resources": { "type": "array", "items": { "type": "object", "required": ["resourceId", "position", "fileName", "mimeType", "byteLength", "sha256", "pages", "dataset"], "properties": { "resourceId": { "type": "string", "format": "uuid" }, "position": { "type": "integer", "minimum": 0 }, "fileName": { "type": "string" }, "mimeType": { "type": "string" }, "byteLength": { "type": "integer", "minimum": 0 }, "sha256": { "type": "string", "pattern": "^[0-9a-f]{64}$" }, "pages": { "type": "object", "nullable": true, "properties": { "count": { "type": "integer", "minimum": 1 }, "href": { "type": "string" } } }, "dataset": { "type": "object", "nullable": true, "properties": { "columns": { "type": "array", "items": { "type": "string" } }, "rowCount": { "type": "integer", "minimum": 0 }, "href": { "type": "string" }, "schemaHref": { "type": "string" } } } } } } } } } } } }
          },
          "401": { "$ref": "#/components/responses/Problem401" },
          "403": { "description": "Credential lacks the read:metadata scope", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } },
          "404": { "$ref": "#/components/responses/Problem404" },
          "413": { "description": "A complete resource entry exceeds the response ceiling", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } },
          "422": { "description": "Invalid manifest continuation or page limit", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } },
          "500": { "$ref": "#/components/responses/Problem500" }
        }
      }
    },
    "/v1/publications/{id}/manifest/current": {
      "get": {
        "summary": "Read the credential's current publication manifest",
        "description": "Returns the current release manifest only while the API credential's pinned release matches the publication current-release pointer. After publication advances, this path returns 404; the pinned manifest remains available for the original release. Requires read:metadata.",
        "operationId": "readCurrentPublicationManifest",
        "tags": ["Publications"],
        "security": [{ "IntegrationBearerAuth": [] }],
        "parameters": [
          { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "Publication ID" },
          { "name": "afterPosition", "in": "query", "required": false, "schema": { "type": "integer", "minimum": -1, "maximum": 100000, "default": -1 }, "description": "Return authorized release resources after this position" },
          { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "minimum": 1, "maximum": 100, "default": 20 }, "description": "Maximum resource entries before the 256 KiB response ceiling" }
        ],
        "responses": {
          "200": { "$ref": "#/paths/~1v1~1publications~1{id}~1manifest/get/responses/200" },
          "401": { "$ref": "#/components/responses/Problem401" },
          "403": { "description": "Credential lacks the read:metadata scope", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } },
          "404": { "$ref": "#/components/responses/Problem404" },
          "413": { "$ref": "#/paths/~1v1~1publications~1{id}~1manifest/get/responses/413" },
          "422": { "$ref": "#/paths/~1v1~1publications~1{id}~1manifest/get/responses/422" },
          "500": { "$ref": "#/components/responses/Problem500" }
        }
      }
    },
    "/v1/publications/{id}/resources/{resourceId}/pages": {
      "get": {
        "summary": "Read source pages from an authorized publication resource",
        "description": "Returns exact page text and immutable source provenance from the integration credential's pinned published release and resource scope. Requires read:page. Pages are continued by their page number; a single page that exceeds the response ceiling receives 413 without being truncated.",
        "operationId": "readPublicationSourcePages",
        "tags": ["Publications"],
        "security": [{ "IntegrationBearerAuth": [] }],
        "x-ai-description": "Read source text for a granted resource. Page numbers, checksum, file name, MIME type, and byte length are returned with each bounded page set.",
        "parameters": [
          { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "Publication ID" },
          { "name": "resourceId", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "Authorized resource ID" },
          { "name": "afterPage", "in": "query", "required": false, "schema": { "type": "integer", "minimum": 0, "maximum": 100000, "default": 0 }, "description": "Return pages after this page number" },
          { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "minimum": 1, "maximum": 20, "default": 10 }, "description": "Maximum whole pages to return before applying the 256 KiB response ceiling" }
        ],
        "responses": {
          "200": {
            "description": "Source pages and checksum provenance from the authorized release/resource scope",
            "headers": { "Cache-Control": { "schema": { "type": "string", "example": "no-store, private" } } },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["success", "data"],
                  "properties": {
                    "success": { "type": "boolean" },
                    "data": {
                      "type": "object",
                      "required": ["resource", "pageCount", "pages", "nextAfterPage"],
                      "properties": {
                        "resource": {
                          "type": "object",
                          "required": ["resourceId", "fileName", "mimeType", "byteLength", "sha256"],
                          "properties": {
                            "resourceId": { "type": "string", "format": "uuid" },
                            "fileName": { "type": "string" },
                            "mimeType": { "type": "string" },
                            "byteLength": { "type": "integer", "minimum": 0 },
                            "sha256": { "type": "string", "pattern": "^[0-9a-f]{64}$" }
                          }
                        },
                        "pageCount": { "type": "integer", "minimum": 1 },
                        "pages": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "required": ["pageNumber", "text"],
                            "properties": {
                              "pageNumber": { "type": "integer", "minimum": 1 },
                              "text": { "type": "string" }
                            }
                          }
                        },
                        "nextAfterPage": { "type": "integer", "nullable": true }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": { "$ref": "#/components/responses/Problem401" },
          "403": { "description": "Credential lacks the read:page scope", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } },
          "404": { "$ref": "#/components/responses/Problem404" },
          "413": { "description": "A whole source page exceeds the response ceiling", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } },
          "422": { "description": "Invalid page continuation or page limit", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } },
          "500": { "$ref": "#/components/responses/Problem500" }
        }
      }
    },
    "/decks": {
      "get": {
        "summary": "List public decks",
        "description": "Returns a paginated list of publicly live presentations. No authentication required.",
        "operationId": "listDecks",
        "tags": ["Decks"],
        "x-ai-description": "List public, live presentations. No auth required. Use to discover available decks before fetching one by ID.",
        "x-ai-example-prompt": "Show me the latest public presentations on SlydeDeck",
        "parameters": [
          { "name": "limit", "in": "query", "schema": { "type": "integer", "default": 20, "maximum": 100 }, "description": "Number of results to return" },
          { "name": "offset", "in": "query", "schema": { "type": "integer", "default": 0 }, "description": "Pagination offset" }
        ],
        "responses": {
          "200": {
            "description": "A paginated list of public decks",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/DeckList" },
                "example": {
                  "success": true,
                  "data": {
                    "decks": [
                      { "id": "ckz1a2b3c4d5", "title": "Quarterly Product Review", "description": "Q3 roadmap and metrics", "presentationCode": "ABC123", "presenterName": "Jane Doe", "tags": ["product", "roadmap"], "isLive": true, "viewCount": 142, "createdAt": "2026-06-01T12:00:00.000Z", "highLevelSummary": "This deck covers the Q3 product roadmap..." }
                    ],
                    "total": 57, "limit": 20, "offset": 0
                  }
                }
              }
            }
          },
          "500": { "$ref": "#/components/responses/Problem500" }
        }
      },
      "post": {
        "summary": "Create a deck",
        "description": "Upload a new presentation. Requires authentication.",
        "operationId": "createDeck",
        "tags": ["Decks"],
        "security": [{ "BearerAuth": [] }],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["title"],
                "properties": {
                  "title": { "type": "string", "example": "My Presentation" },
                  "description": { "type": "string", "example": "An overview deck" },
                  "tags": { "type": "array", "items": { "type": "string" }, "example": ["demo"] },
                  "isLive": { "type": "boolean", "default": false }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Deck created",
            "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean" }, "data": { "$ref": "#/components/schemas/Deck" } } } } }
          },
          "401": { "$ref": "#/components/responses/Problem401" },
          "422": { "$ref": "#/components/responses/Problem404" }
        }
      }
    },
    "/decks/{id}": {
      "get": {
        "summary": "Get a deck by ID or share code",
        "description": "Returns metadata and AI summary for a single public presentation. For plain-text, LLM-optimized content use ?format=llm or send header Accept: text/plain.",
        "operationId": "getDeck",
        "tags": ["Decks"],
        "x-ai-description": "Fetch one public deck by ID or share code, including its AI-generated summary. Append ?format=llm (or send Accept: text/plain) for readable plain text instead of JSON.",
        "x-ai-example-prompt": "Summarize the SlydeDeck presentation with share code ABC123",
        "parameters": [
          { "name": "id", "in": "path", "required": true, "schema": { "type": "string" }, "description": "Presentation ID or share code", "example": "ABC123" },
          { "name": "format", "in": "query", "schema": { "type": "string", "enum": ["json", "llm"] }, "description": "Use format=llm for plain-text AI-friendly content" },
          { "name": "Accept", "in": "header", "schema": { "type": "string", "enum": ["application/json", "text/plain"] }, "description": "Send text/plain to receive LLM-optimized plain text (same as ?format=llm)" }
        ],
        "responses": {
          "200": {
            "description": "Deck found",
            "content": {
              "application/json": {
                "schema": { "type": "object", "properties": { "success": { "type": "boolean" }, "data": { "$ref": "#/components/schemas/Deck" } } },
                "example": { "success": true, "data": { "id": "ckz1a2b3c4d5", "title": "Quarterly Product Review", "presentationCode": "ABC123", "presenterName": "Jane Doe", "tags": ["product"], "isLive": true, "viewCount": 142, "createdAt": "2026-06-01T12:00:00.000Z", "highLevelSummary": "This deck covers the Q3 product roadmap..." } }
              },
              "text/plain": {
                "schema": { "type": "string" },
                "example": "Title: Quarterly Product Review\nPresenter: Jane Doe\nTags: product\n\nSummary:\nThis deck covers the Q3 product roadmap..."
              }
            }
          },
          "404": { "$ref": "#/components/responses/Problem404" },
          "500": { "$ref": "#/components/responses/Problem500" }
        }
      }
    },
    "/status": {
      "get": {
        "summary": "API status",
        "description": "Returns current API operational status. No authentication required.",
        "operationId": "getStatus",
        "tags": ["System"],
        "x-ai-description": "Public operational status of the API. No auth required.",
        "responses": {
          "200": {
            "description": "API is operational",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Status" }, "example": { "status": "operational", "api": "SlydeDeck API v1.0", "timestamp": "2026-06-28T00:00:00.000Z" } } }
          }
        }
      }
    },
    "/docs": {
      "get": {
        "summary": "Machine-readable OpenAPI specification",
        "description": "Returns this OpenAPI 3 document as JSON.",
        "operationId": "getDocs",
        "tags": ["System"],
        "responses": { "200": { "description": "OpenAPI specification" } }
      }
    }
  }
}
