{
  "openapi": "3.1.0",
  "info": {
    "title": "AI Store Optimiser public API",
    "version": "1.0.0",
    "description": "The genuinely public, unauthenticated endpoints of storeoptimiser.ai. Account-bound endpoints (catalogue optimisation, publishing to stores) are not public API and require a Clerk-authenticated session; see /auth.md. AI agents get the same capabilities more conveniently via the MCP server at /mcp.",
    "contact": { "email": "support@storeoptimiser.ai" }
  },
  "servers": [{ "url": "https://storeoptimiser.ai" }],
  "paths": {
    "/mcp": {
      "post": {
        "summary": "MCP server (JSON-RPC 2.0 over streamable HTTP)",
        "description": "Model Context Protocol endpoint. Methods: initialize, ping, tools/list, tools/call. Tools: grade_page_seo, generate_product_description, list_blog_articles, get_plans_and_pricing. Anonymous; 60 requests/hour/IP, generation 5/hour. Server card: /.well-known/mcp/server-card.json",
        "requestBody": {
          "required": true,
          "content": { "application/json": { "schema": { "type": "object", "description": "A JSON-RPC 2.0 request object" } } }
        },
        "responses": { "200": { "description": "JSON-RPC 2.0 response" }, "429": { "description": "Rate limit reached" } }
      }
    },
    "/api/blog": {
      "get": {
        "summary": "List published blog articles, or fetch one",
        "parameters": [
          { "name": "slug", "in": "query", "required": false, "schema": { "type": "string" }, "description": "Return a single article (with full markdown body) instead of the list" }
        ],
        "responses": { "200": { "description": "{ok, posts:[...]} or {ok, post}" }, "404": { "description": "Unknown slug" } }
      }
    },
    "/feed.xml": {
      "get": { "summary": "RSS 2.0 feed of the 30 newest articles", "responses": { "200": { "description": "application/rss+xml" } } }
    },
    "/llms-full.txt": {
      "get": { "summary": "The whole public site as one markdown document, generated live", "responses": { "200": { "description": "text/plain markdown" } } }
    },
    "/api/seo-grader": {
      "post": {
        "summary": "Free SEO grade of a public page, with emailed report (browser flow)",
        "description": "Intended for the human flow at /seo-grader: requires an email address and a Cloudflare Turnstile token, so it is awkward for agents. Agents should use the grade_page_seo MCP tool instead, which needs neither.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": { "type": "string" },
                  "email": { "type": "string", "format": "email" },
                  "turnstile": { "type": "string", "description": "Cloudflare Turnstile token from the browser widget" }
                },
                "required": ["url", "email", "turnstile"]
              }
            }
          }
        },
        "responses": { "200": { "description": "{ok, score, checks, improved}" }, "400": { "description": "Validation or fetch failure, with a plain-English error" }, "429": { "description": "Rate limit" } }
      }
    },
    "/api/tools/generate": {
      "post": {
        "summary": "Free sample generators (browser flow)",
        "description": "Powers the free tools pages; requires a Turnstile token, 3 free outputs per day. Agents should use the generate_product_description MCP tool instead.",
        "responses": { "200": { "description": "{ok, output}" }, "400": { "description": "Validation failure" }, "429": { "description": "Daily cap reached" } }
      }
    }
  },
  "externalDocs": { "description": "Agent access guide", "url": "https://storeoptimiser.ai/auth.md" }
}
