{
  "openapi": "3.1.0",
  "info": {
    "title": "prodlint Site Score API",
    "version": "1.0.0",
    "summary": "Score a public website's readiness for AI agents.",
    "description": "The two public endpoints behind https://prodlint.com/score. No key and no account. Scans are limited to 5 per minute per IP address. Only public hosts on ports 80 and 443 are scanned; private and internal addresses are refused. The same scan runs locally with `npx prodlint --web <url> --json`.",
    "license": { "name": "MIT", "identifier": "MIT" },
    "contact": { "name": "prodlint", "url": "https://github.com/prodlint/prodlint/issues" }
  },
  "servers": [{ "url": "https://prodlint.com" }],
  "externalDocs": { "description": "Full reference for agents", "url": "https://prodlint.com/llms-full.txt" },
  "paths": {
    "/api/scan-web": {
      "post": {
        "operationId": "scanWeb",
        "summary": "Scan a site",
        "description": "Fetches the site's homepage and a handful of well-known files (robots.txt, llms.txt, ai.txt, sitemap.xml, files under /.well-known/) and runs 14 checks. Takes up to about 15 seconds.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["url"],
                "properties": {
                  "url": {
                    "type": "string",
                    "maxLength": 2048,
                    "description": "The site to scan. A bare domain is fine; https:// is assumed. Only the origin is used.",
                    "examples": ["example.com"]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The scan result.",
            "headers": {
              "X-RateLimit-Remaining": { "description": "Scans left in the current minute.", "schema": { "type": "integer" } }
            },
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ScanResult" } } }
          },
          "400": {
            "description": "The body isn't JSON, the URL is missing, too long or invalid, or the host is private.",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
          },
          "429": {
            "description": "More than 5 scans in a minute from this IP address.",
            "headers": {
              "Retry-After": { "description": "Seconds to wait.", "schema": { "type": "integer" } }
            },
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
          },
          "500": {
            "description": "The scan failed.",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
          }
        }
      }
    },
    "/api/badge/{domain}": {
      "get": {
        "operationId": "getBadge",
        "summary": "Score badge",
        "description": "An SVG badge with the site's grade and score, for a README or a web page. Cached for an hour; an uncached request runs a scan.",
        "parameters": [
          {
            "name": "domain",
            "in": "path",
            "required": true,
            "description": "A hostname, without scheme or path.",
            "schema": { "type": "string", "maxLength": 253 },
            "example": "example.com"
          }
        ],
        "responses": {
          "200": {
            "description": "The badge. When the scan can't run, the badge says \"error\".",
            "content": { "image/svg+xml": { "schema": { "type": "string" } } }
          },
          "400": { "description": "Not a valid hostname.", "content": { "text/plain": { "schema": { "type": "string" } } } },
          "429": { "description": "Too many uncached badge requests from this IP address.", "content": { "image/svg+xml": { "schema": { "type": "string" } } } }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "ScanResult": {
        "type": "object",
        "required": ["url", "domain", "scannedAt", "overallScore", "grade", "checks", "summary"],
        "properties": {
          "url": { "type": "string", "description": "The origin that was scanned." },
          "domain": { "type": "string" },
          "scannedAt": { "type": "string", "format": "date-time" },
          "overallScore": { "type": "integer", "minimum": 0, "maximum": 100 },
          "grade": { "type": "string", "enum": ["A", "B", "C", "D", "F"], "description": "A from 80, B from 60, C from 40, D from 20." },
          "checks": { "type": "array", "items": { "$ref": "#/components/schemas/Check" } },
          "summary": {
            "type": "object",
            "required": ["passed", "failed", "warnings", "totalChecks"],
            "properties": {
              "passed": { "type": "integer" },
              "failed": { "type": "integer" },
              "warnings": { "type": "integer" },
              "totalChecks": { "type": "integer" }
            }
          }
        }
      },
      "Check": {
        "type": "object",
        "required": ["id", "name", "description", "status", "severity", "maturity", "points", "maxPoints"],
        "properties": {
          "id": {
            "type": "string",
            "enum": ["robots_txt", "robots_ai_directives", "content_usage", "llms_txt", "ai_txt", "tdmrep", "ai_disclosure", "agent_card", "webmcp", "http_signatures", "structured_data", "opengraph", "sitemap", "page_speed"]
          },
          "name": { "type": "string" },
          "description": { "type": "string" },
          "status": { "type": "string", "enum": ["pass", "fail", "warn", "info"], "description": "warn is a partial pass; info means the check couldn't run." },
          "severity": { "type": "string", "enum": ["critical", "high", "medium", "low"] },
          "maturity": { "type": "string", "enum": ["established", "emerging"] },
          "points": { "type": "integer", "description": "maxPoints for pass, half for warn, 0 otherwise." },
          "maxPoints": { "type": "integer" },
          "details": { "type": "string", "description": "What was found." }
        }
      },
      "Error": {
        "type": "object",
        "required": ["error"],
        "properties": { "error": { "type": "string" } }
      }
    }
  }
}
