{
  "openapi": "3.1.0",
  "info": {
    "title": "PitchBoost API",
    "version": "1.0.0",
    "summary": "Make hosted, shareable presentations from a single prompt.",
    "description": "PitchBoost turns a plain-English prompt into a hosted, shareable presentation (a lesson or lecture, a report, a talk, or a sales or investor pitch), one-sheeter, or buyer FAQ and returns a stable share URL. Use POST /api/v1/decks/sample with no authentication to create a watermarked demo deck (ideal for agents helping a user who has not signed up yet), or mint an API key for full-quality, unwatermarked, exportable decks. Generation takes up to ~60 seconds. For an agent-oriented guide, see https://app.pitchboost.ai/llms.txt.",
    "contact": { "name": "PitchBoost Support", "email": "support@pitchboost.ai", "url": "https://pitchboost.ai" },
    "termsOfService": "https://pitchboost.ai/terms",
    "license": { "name": "Proprietary", "url": "https://pitchboost.ai/terms" }
  },
  "servers": [
    { "url": "https://app.pitchboost.ai", "description": "PitchBoost production" }
  ],
  "tags": [
    { "name": "Decks", "description": "Generate and read presentations, one-sheeters, and FAQs." }
  ],
  "paths": {
    "/api/v1/decks/sample": {
      "post": {
        "operationId": "createSampleDeck",
        "tags": ["Decks"],
        "summary": "Generate a demo deck (no authentication)",
        "description": "Create a watermarked demo deck from a prompt and return a hosted share URL. No authentication required, so an agent can deliver a working deck link to a user who has not signed up. Rate limited to 3 per day per IP, with a 1,000 character prompt cap. The returned claim_token lets the user later transfer the deck into their own account via /api/v1/decks/claim, which removes the watermark and unlocks editing (downloads come with a paid plan or a one-time purchase).",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/SampleDeckRequest" },
              "example": { "prompt": "Pitch deck for ClientFuse selling white-label social media tools to the Houston Association of REALTORS. Focus on member savings and easy white-label setup." }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Deck generated.",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SampleDeckResponse" } } }
          },
          "400": { "$ref": "#/components/responses/Error" },
          "429": {
            "description": "Rate limit or daily demo budget exhausted. Sign up for unlimited generation.",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
          },
          "500": { "$ref": "#/components/responses/Error" },
          "502": { "$ref": "#/components/responses/Error" }
        }
      }
    },
    "/api/v1/decks": {
      "post": {
        "operationId": "createDeck",
        "tags": ["Decks"],
        "summary": "Generate a full-quality deck (API key)",
        "description": "Create a full-quality, unwatermarked, exportable deck billed to the API key's team. Requires a Bearer API key. Use this when the user has a PitchBoost account and wants their best work.",
        "security": [{ "bearerAuth": [] }],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/CreateDeckRequest" },
              "example": { "prompt": "Pitch deck for Acme Robotics selling warehouse automation to mid-market 3PLs. Emphasize 30% labor savings and 6-month payback.", "kind": "pitch_deck" }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Deck generated.",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateDeckResponse" } } }
          },
          "400": { "$ref": "#/components/responses/Error" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "500": { "$ref": "#/components/responses/Error" }
        }
      }
    },
    "/api/v1/decks/claim": {
      "post": {
        "operationId": "claimDeck",
        "tags": ["Decks"],
        "summary": "Transfer a demo deck into an account",
        "description": "Claim a demo deck (created via /api/v1/decks/sample) into the caller's team. Removes the watermark and unlocks editing (downloads come with a paid plan or a one-time purchase). Authenticate with a Bearer API key (or a logged-in session on the web). Provide either the claim_token returned by the sample endpoint, or a public deck slug.",
        "security": [{ "bearerAuth": [] }],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/ClaimDeckRequest" },
              "example": { "claim_token": "8f3aA1nQ..." }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Deck claimed.",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ClaimDeckResponse" } } }
          },
          "400": { "$ref": "#/components/responses/Error" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/Error" },
          "429": { "$ref": "#/components/responses/Error" }
        }
      }
    },
    "/api/v1/decks/{slug}": {
      "get": {
        "operationId": "getDeck",
        "tags": ["Decks"],
        "summary": "Get public deck metadata",
        "description": "Return JSON metadata for a published deck without scraping its HTML: title, kind, share URL, slide outline, and thumbnail. No authentication required; only published decks are exposed. Token-gated or password-protected decks return metadata with requires_token / requires_password set and omit slides and thumbnail.",
        "security": [],
        "parameters": [
          { "name": "slug", "in": "path", "required": true, "schema": { "type": "string" }, "description": "The deck's public slug (the last path segment of its share URL)." }
        ],
        "responses": {
          "200": {
            "description": "Deck metadata.",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/DeckMetadataResponse" } } }
          },
          "404": { "$ref": "#/components/responses/Error" }
        }
      }
    },
    "/api/v1/decks/{slug}/oembed": {
      "get": {
        "operationId": "getDeckOembed",
        "tags": ["Decks"],
        "summary": "oEmbed response for a deck",
        "description": "Return an oEmbed (type: rich) response for a published deck, for rich link previews and embeds.",
        "security": [],
        "parameters": [
          { "name": "slug", "in": "path", "required": true, "schema": { "type": "string" } }
        ],
        "responses": {
          "200": {
            "description": "oEmbed payload.",
            "content": { "application/json": { "schema": { "type": "object", "additionalProperties": true } } }
          },
          "404": { "$ref": "#/components/responses/Error" }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "A PitchBoost API key (pb_live_...) minted at https://app.pitchboost.ai/dashboard/settings/api-keys, sent as `Authorization: Bearer <key>`."
      }
    },
    "responses": {
      "Error": {
        "description": "Error.",
        "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
      },
      "Unauthorized": {
        "description": "Missing or invalid Bearer API key.",
        "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
      }
    },
    "schemas": {
      "DeliverableKind": {
        "type": "string",
        "enum": ["pitch_deck", "one_sheeter", "faq"],
        "description": "pitch_deck is a full slide presentation for any purpose; one_sheeter is a single-page printable summary; faq is a structured buyer Q&A."
      },
      "SampleDeckRequest": {
        "type": "object",
        "required": ["prompt"],
        "properties": {
          "prompt": { "type": "string", "maxLength": 1000, "description": "What the presentation is about, who will see it, and what it should achieve. For a pitch, include the company, the offer and the prospect." }
        }
      },
      "SampleDeckResponse": {
        "type": "object",
        "required": ["share_url", "deck_id", "claim_token", "expires_at", "watermark"],
        "properties": {
          "share_url": { "type": "string", "format": "uri", "description": "Hosted, shareable deck URL to give the user." },
          "deck_id": { "type": "integer" },
          "claim_token": { "type": "string", "description": "Single-use token to transfer this demo into an account via /api/v1/decks/claim." },
          "expires_at": { "type": "string", "format": "date-time", "description": "Unclaimed demo decks expire 7 days after creation." },
          "watermark": { "type": "boolean", "const": true },
          "meta": {
            "type": "object",
            "properties": {
              "model": { "type": "string" },
              "cost_cents": { "type": "number" },
              "daily_budget_remaining_cents": { "type": "number" }
            }
          }
        }
      },
      "CreateDeckRequest": {
        "type": "object",
        "required": ["prompt"],
        "properties": {
          "prompt": { "type": "string", "maxLength": 4000, "description": "What the deck should cover. The more specific (target company, differentiators, key claims, CTA), the better the output." },
          "kind": { "$ref": "#/components/schemas/DeliverableKind" },
          "deal_id": { "type": "integer", "description": "Optional existing deal id to attach the deck to. If omitted, a deal is created from the prompt." }
        }
      },
      "CreateDeckResponse": {
        "type": "object",
        "required": ["share_url", "edit_url", "deck_id", "deal_id"],
        "properties": {
          "share_url": { "type": "string", "format": "uri", "description": "Hosted, shareable deck URL." },
          "edit_url": { "type": "string", "format": "uri", "description": "Authenticated URL to edit the deck in the PitchBoost app." },
          "deck_id": { "type": "integer" },
          "deal_id": { "type": "integer" },
          "meta": {
            "type": "object",
            "properties": {
              "model": { "type": "string" },
              "input_tokens": { "type": "integer" },
              "output_tokens": { "type": "integer" },
              "elapsed_ms": { "type": "integer" }
            }
          }
        }
      },
      "ClaimDeckRequest": {
        "type": "object",
        "description": "Provide exactly one of claim_token or slug.",
        "properties": {
          "claim_token": { "type": "string", "description": "The token returned by /api/v1/decks/sample." },
          "slug": { "type": "string", "description": "A public deck slug. Any authenticated caller can claim an unclaimed demo deck by slug." }
        }
      },
      "ClaimDeckResponse": {
        "type": "object",
        "properties": {
          "share_url": { "type": "string", "format": "uri" },
          "edit_url": { "type": "string", "format": "uri" },
          "deck_id": { "type": "integer" },
          "deal_id": { "type": "integer" }
        }
      },
      "DeckMetadataResponse": {
        "type": "object",
        "properties": {
          "deck": {
            "type": "object",
            "properties": {
              "id": { "type": "integer" },
              "slug": { "type": "string" },
              "title": { "type": "string" },
              "kind": { "$ref": "#/components/schemas/DeliverableKind" },
              "share_url": { "type": "string", "format": "uri" },
              "created_at": { "type": "string", "format": "date-time" },
              "updated_at": { "type": "string", "format": "date-time" },
              "slide_count": { "type": ["integer", "null"] },
              "thumbnail_url": { "type": ["string", "null"], "format": "uri" },
              "is_demo": { "type": "boolean" },
              "demo_claimed": { "type": "boolean" },
              "requires_token": { "type": "boolean" },
              "requires_password": { "type": "boolean" },
              "slides": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "n": { "type": "integer" },
                    "title": { "type": ["string", "null"] },
                    "summary": { "type": ["string", "null"] },
                    "layout": { "type": ["string", "null"] }
                  }
                }
              }
            }
          }
        }
      },
      "Error": {
        "type": "object",
        "required": ["error"],
        "properties": {
          "error": {
            "type": "object",
            "required": ["code", "message"],
            "properties": {
              "code": { "type": "string", "description": "Stable machine-readable error code." },
              "message": { "type": "string", "description": "Human-readable explanation." }
            }
          }
        }
      }
    }
  }
}
