{
  "openapi": "3.1.0",
  "info": {
    "title": "AccessCheck AA by RungLab — WCAG 2.2 AA, ADA Title III & EAA Directive 2019/882 Auditor",
    "version": "1.0.0",
    "description": "Deterministic 100-point accessibility & EAA Directive 2019/882 compliance auditor covering Document Basics & Zoom (20 pts), Landmarks & Heading Hierarchy (20 pts), Images, Icons & Media (20 pts), Forms, Labels & ARIA (20 pts), Visual Focus & Reduced Motion CSS (10 pts), and EAA Accessibility Statement Readiness (10 pts), plus a $39 6-File Fix Pack.",
    "contact": {
      "name": "RungLab Support",
      "email": "support@runglab.dev",
      "url": "https://access.runglab.dev/"
    }
  },
  "servers": [
    {
      "url": "https://access-api.runglab.dev",
      "description": "AccessCheck AA Edge Audit Worker"
    },
    {
      "url": "https://api.runglab.dev",
      "description": "RungLab Checkout, Lead & Funnel Telemetry API"
    }
  ],
  "paths": {
    "/api/audit": {
      "get": {
        "operationId": "auditAccessUrl",
        "summary": "Audit a live public webpage for WCAG 2.2 AA, ADA Title III & European Accessibility Act (EAA Directive 2019/882) compliance",
        "parameters": [
          {
            "name": "url",
            "in": "query",
            "required": true,
            "description": "Public webpage URL or domain to audit (e.g. https://stripe.com)",
            "schema": { "type": "string", "example": "https://stripe.com" }
          },
          {
            "name": "refresh",
            "in": "query",
            "required": false,
            "description": "Set to 1 to bypass the 600s edge cache",
            "schema": { "type": "string", "enum": ["0", "1"] }
          }
        ],
        "responses": {
          "200": {
            "description": "100-point AccessCheck AA audit report with 6 deterministic checks, findings AC-001..AC-017, and beforeAfterUplift",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/AccessAuditReport" }
              }
            }
          },
          "400": { "description": "Invalid target URL" },
          "422": { "description": "Blocked by SSRF policy" }
        }
      },
      "post": {
        "operationId": "auditAccessUrlPost",
        "summary": "Audit a live public webpage URL via JSON POST { url }",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["url"],
                "properties": {
                  "url": { "type": "string", "example": "https://stripe.com" },
                  "refresh": { "type": "boolean" }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "100-point AccessCheck AA audit report",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/AccessAuditReport" }
              }
            }
          },
          "400": { "description": "Invalid target URL or JSON body" },
          "422": { "description": "Blocked by SSRF policy" }
        }
      }
    },
    "/api/audit-html": {
      "post": {
        "operationId": "auditOfflineAccessHtml",
        "summary": "Zero-network offline audit of pasted HTML, optional CSS snippet, and optional EAA accessibilityJson payload",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["html"],
                "properties": {
                  "url": { "type": "string", "example": "https://acme-saas.com/" },
                  "html": { "type": "string" },
                  "css": { "type": "string" },
                  "accessibilityJson": { "oneOf": [{ "type": "object" }, { "type": "string" }, { "type": "boolean" }] },
                  "accessibilityStatementFound": { "type": "boolean" }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Zero-network 100-point AccessCheck AA audit report (0 subrequests)",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/AccessAuditReport" }
              }
            }
          },
          "400": { "description": "Invalid input JSON or missing HTML" }
        }
      }
    },
    "/health": {
      "get": {
        "operationId": "getAccessCheckHealth",
        "summary": "Verify AccessCheck AA edge worker health",
        "responses": {
          "200": {
            "description": "Healthy worker status JSON",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": { "type": "boolean" },
                    "service": { "type": "string" },
                    "version": { "type": "string" }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "AccessAuditReport": {
        "type": "object",
        "properties": {
          "version": { "type": "string" },
          "mode": { "type": "string", "enum": ["live-url", "offline-html"] },
          "domain": { "type": "string" },
          "overallScore": { "type": "integer", "minimum": 0, "maximum": 100 },
          "grade": { "type": "string" },
          "eaaCompliantSignal": { "type": "boolean" },
          "checks": { "type": "object" },
          "documentBasics": { "type": "object" },
          "landmarksHeadings": { "type": "object" },
          "imagesMedia": { "type": "object" },
          "formsAria": { "type": "object" },
          "focusMotionCss": { "type": "object" },
          "eaaCompliance": { "type": "object" },
          "findings": { "type": "array", "items": { "type": "object" } },
          "beforeAfterUplift": { "type": "object" },
          "packOffer": { "type": "object" }
        }
      }
    }
  }
}
