{
  "openapi": "3.1.0",
  "info": { "title": "Shortbread public API", "version": "0.1.0", "description": "Endpoints an agent or script can call without an account. The dashboard API (sites, consents, billing) needs a session." },
  "servers": [{ "url": "https://tryshortbread.com" }],
  "paths": {
    "/api/sites/provision": {
      "post": {
        "summary": "Create or find a free Shortbread site for a domain",
        "description": "Idempotent per domain. Returns the install snippet with a site key and, while unclaimed, a private claim URL. If owner is given the claim link is emailed.",
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["domain"], "properties": { "domain": { "type": "string", "example": "example.com" }, "owner": { "type": "string", "format": "email" }, "via": { "type": "string", "example": "claude-code" } } } } } },
        "responses": {
          "200": { "description": "Existing site" },
          "201": { "description": "Created", "content": { "application/json": { "schema": { "type": "object", "properties": { "domain": { "type": "string" }, "key": { "type": "string" }, "created": { "type": "boolean" }, "claimed": { "type": "boolean" }, "snippet": { "type": "string" }, "claimUrl": { "type": ["string", "null"] }, "dashboardUrl": { "type": "string" }, "next": { "type": "array", "items": { "type": "string" } } } } } } },
          "422": { "description": "Local or private host" },
          "429": { "description": "Rate limited" }
        }
      }
    },
    "/api/c/auto": {
      "get": {
        "summary": "Banner config for a hostname (keyless)",
        "description": "Called by shortbread.js when the tag has no data-site. Creates an unclaimed site on first sight of a public hostname.",
        "parameters": [
          { "name": "h", "in": "query", "required": true, "schema": { "type": "string" }, "description": "Hostname" },
          { "name": "o", "in": "query", "schema": { "type": "string", "format": "email" }, "description": "Owner email, gets the claim link" },
          { "name": "v", "in": "query", "schema": { "type": "string" }, "description": "Installing tool" }
        ],
        "responses": { "200": { "description": "Config JSON including key, byline, unclaimed, cookies" } }
      }
    },
    "/api/c/{key}": {
      "get": { "summary": "Banner config for a site key", "parameters": [{ "name": "key", "in": "path", "required": true, "schema": { "type": "string" } }], "responses": { "200": { "description": "Config JSON" }, "404": { "description": "Unknown key" } } }
    },
    "/api/consent": {
      "post": {
        "summary": "Record a consent decision (sent by shortbread.js)",
        "requestBody": { "content": { "text/plain": { "schema": { "type": "object", "properties": { "k": { "type": "string", "description": "site key" }, "m": { "type": "string", "enum": ["explicit", "implied", "carried", "gpc"] }, "c": { "type": "object", "properties": { "p": { "type": "boolean" }, "s": { "type": "boolean" }, "m": { "type": "boolean" } } }, "r": { "type": "string", "description": "country code" } } } } } },
        "responses": { "200": { "description": "ok" } }
      }
    },
    "/api/calc": {
      "post": {
        "summary": "Scan a site and compare Cookiebot's price with Shortbread",
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["url"], "properties": { "url": { "type": "string" }, "domains": { "type": "integer", "default": 1 } } } } } },
        "responses": { "200": { "description": "scan and compare objects" } }
      }
    },
    "/api/mcp": { "post": { "summary": "MCP server (Streamable HTTP)", "description": "Tools: provision_site, get_snippet, scan_site, compare_cookiebot_cost, check_install.", "responses": { "200": { "description": "MCP response" } } } }
  }
}
