{
  "openapi": "3.0.3",
  "info": {
    "title": "Sumly AI Readiness API",
    "description": "Machine-readable API for the Sumly AI Readiness Standard — check any website's readiness for AI search, agents and large language models.",
    "version": "1.0.0",
    "contact": {
      "name": "Sumly AI Readiness",
      "email": "sumly@qq.com",
      "url": "https://www.sumly.com/"
    },
    "license": { "name": "Proprietary", "url": "https://www.sumly.com/" }
  },
  "servers": [
    { "url": "https://www.sumly.com", "description": "Production" }
  ],
  "tags": [
    { "name": "Analysis", "description": "AI Readiness analysis endpoints" },
    { "name": "Reports", "description": "Public report retrieval" }
  ],
  "paths": {
    "/check": {
      "get": {
        "tags": ["Analysis"],
        "summary": "Run an AI Readiness check",
        "description": "Runs a quick analysis for a given URL and redirects to the public report.",
        "parameters": [
          {
            "name": "url",
            "in": "query",
            "required": true,
            "description": "Website URL to analyze, e.g. https://example.com",
            "schema": { "type": "string", "format": "uri" }
          }
        ],
        "responses": {
          "302": { "description": "Redirect to the public report" },
          "400": { "description": "Invalid URL or blocked address" },
          "403": { "description": "Human verification (Turnstile) required" }
        }
      }
    },
    "/api/analyze": {
      "post": {
        "tags": ["Analysis"],
        "summary": "Analyze a website (asynchronous)",
        "description": "Enqueues a deep analysis for a website and returns job status.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": { "type": "object", "properties": { "url": { "type": "string", "format": "uri" } }, "required": ["url"] }
            }
          }
        },
        "responses": {
          "200": { "description": "Job accepted" },
          "403": { "description": "Human verification required" }
        }
      }
    },
    "/report/{domain}": {
      "get": {
        "tags": ["Reports"],
        "summary": "Get the public AI Readiness report for a domain",
        "parameters": [
          {
            "name": "domain",
            "in": "path",
            "required": true,
            "description": "Domain of the analyzed website with dots as underscores, e.g. example_com (for example.com).",
            "schema": { "type": "string" }
          }
        ],
        "responses": {
          "200": { "description": "Public report HTML" },
          "404": { "description": "Report not found" }
        }
      }
    },
    "/health": {
      "get": {
        "tags": ["Analysis"],
        "summary": "Service health",
        "responses": { "200": { "description": "OK" } }
      }
    }
  },
  "components": {
    "schemas": {
      "Report": {
        "type": "object",
        "properties": {
          "domain": { "type": "string" },
          "score": { "type": "integer" },
          "grade": { "type": "string" },
          "dimensions": { "type": "object" },
          "findings": { "type": "array", "items": { "type": "object" } },
          "recommendations": { "type": "array", "items": { "type": "object" } }
        }
      }
    }
  }
}
