{
  "openapi": "3.1.0",
  "info": {
    "title": "AgentReady API",
    "version": "1.16.0",
    "description": "Free website readiness triage plus pay-per-request AEO/GEO audits with AI-crawler access evidence, robots-aware preflight, remediation, web-page-to-text or Markdown extraction, source-grounded copy, x402 payment trust inspection, Base USDC settlement receipt verification, and AI-discovery utilities.",
    "x-guidance": "Start with GET /api/audit/preview?url=... for a free score, top fixes, and paidNextSteps ordered from targeted low-cost transformations to broader reports. Use POST /api/preflight/url-check before a fetch, POST /api/x402/inspect to inspect a live x402 endpoint challenge and enforce the buyer budget before paying, and POST /api/x402/receipt after payment to verify the Base USDC settlement. Other paid POST routes provide audits, benchmarks, remediation files, agent-readable text, structured metadata, llms.txt, or source-grounded citation copy. Each paid route returns an x402 challenge; retry with PAYMENT-SIGNATURE.",
    "contact": {
      "name": "AgentReady",
      "url": "https://agentready-audit.seshiccse023.chatgpt.site/"
    }
  },
  "servers": [{ "url": "/" }],
  "security": [],
  "tags": [
    { "name": "Audit", "description": "Free and paid agent-readiness analysis" },
    { "name": "Extraction", "description": "Low-cost deterministic web transformations for agents" },
    { "name": "Marketing", "description": "Source-grounded copywriting outputs for AI discovery" },
    { "name": "Verification", "description": "Live x402 endpoint preflight, supplied challenge inspection, on-chain settlement receipt verification, and buyer safeguards" },
    { "name": "Service", "description": "Free service metadata" }
  ],
  "paths": {
    "/api/health": {
      "get": {
        "operationId": "getServiceHealth",
        "summary": "Get service and payment configuration",
        "tags": ["Service"],
        "security": [],
        "responses": {
          "200": {
            "description": "Service is available",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Health" }
              }
            }
          }
        }
      }
    },
    "/api/audit/preview": {
      "get": {
        "operationId": "previewWebsite",
        "summary": "Preview a website's agent-readiness score for free",
        "description": "Returns the 100-point score, category breakdown, three highest-priority fixes, and executable paid next steps with exact methods, request bodies, prices, and x402 retry instructions—without requiring payment or an account.",
        "tags": ["Audit"],
        "security": [],
        "parameters": [
          {
            "name": "url",
            "in": "query",
            "required": true,
            "description": "Public HTTP or HTTPS website URL to preview",
            "schema": { "type": "string", "format": "uri" },
            "example": "https://example.com"
          }
        ],
        "responses": {
          "200": {
            "description": "Completed free preview",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/PreviewReport" }
              }
            }
          },
          "400": {
            "description": "Invalid or unreachable public URL",
            "content": {
              "application/json": { "schema": { "$ref": "#/components/schemas/Error" } }
            }
          }
        }
      }
    },
    "/api/audit": {
      "post": {
        "operationId": "auditWebsiteAiSearchVisibilityAeoGeoAgentReadiness",
        "summary": "Audit a website for AI-search visibility (AEO/GEO) and agent readiness",
        "description": "A deterministic 100-point audit for agents choosing sources for ChatGPT search, Perplexity, Google AI Overviews, Claude, and autonomous workflows. Scores crawlability, llms.txt, structured data, content clarity, and trust signals, then returns a robots.txt access matrix for 7 major AI crawlers, optional llms-full.txt evidence, and ranked fixes.",
        "tags": ["Audit", "AEO", "GEO", "AI Search"],
        "security": [],
        "x-x402-price": "$0.10",
        "x-payment-info": {
          "price": { "mode": "fixed", "currency": "USD", "amount": "0.10" },
          "protocols": [{ "x402": {} }]
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/AuditRequest" },
              "example": { "url": "https://example.com" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Completed audit",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/AuditReport" }
              }
            }
          },
          "400": {
            "description": "Invalid or unreachable public URL",
            "content": {
              "application/json": { "schema": { "$ref": "#/components/schemas/Error" } }
            }
          },
          "402": { "description": "x402 payment required" },
          "413": { "description": "Request body is too large" }
        }
      }
    },
    "/api/audit/compare": {
      "post": {
        "operationId": "compareWebsiteAgainstCompetitorsForAiVisibility",
        "summary": "Compare two to four websites for AI-search visibility and citations",
        "description": "Compares two to four public websites for AI-search visibility, citation readiness, AEO/GEO, and agent access with the same deterministic 100-point audit. Returns a ranked competitor benchmark, category leaders, gaps, priority fixes, and every underlying evidence-backed audit.",
        "tags": ["Audit", "Compare Websites", "Competitor Benchmark", "Competitive Analysis", "AI Search Visibility", "Citation Readiness", "AEO", "GEO"],
        "security": [],
        "x-x402-price": "$0.75",
        "x-payment-info": {
          "price": { "mode": "fixed", "currency": "USD", "amount": "0.75" },
          "protocols": [{ "x402": {} }]
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/CompetitiveAuditRequest" },
              "example": { "urls": ["https://example.com", "https://www.iana.org"] }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Completed competitive benchmark",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/CompetitiveAuditReport" }
              }
            }
          },
          "400": {
            "description": "Invalid, duplicate, or unreachable public URLs",
            "content": {
              "application/json": { "schema": { "$ref": "#/components/schemas/Error" } }
            }
          },
          "402": { "description": "x402 payment required" },
          "413": { "description": "Request body is too large" }
        }
      }
    },
    "/api/audit/fix-pack": {
      "post": {
        "operationId": "generateDeployableWebsiteFixesJsonLdMetadataLlmsTxtCrawlerPolicy",
        "summary": "Generate deployable website fixes: JSON-LD, metadata, llms.txt, crawler policy, headers, and rollout plan",
        "description": "Generate deployable website fixes from one public URL: run the full audit, then return tailored, copy-ready llms.txt, robots crawler policy, metadata, JSON-LD structured data, security headers, projected score, and a safe rollout and verification plan.",
        "tags": ["Audit"],
        "security": [],
        "externalDocs": {
          "description": "Runnable buyer example with live challenge validation and a strict 1.50 USDC cap",
          "url": "https://agentready-audit.seshiccse023.chatgpt.site/examples/buy-fix-pack.mjs"
        },
        "x-buyer-example": "https://agentready-audit.seshiccse023.chatgpt.site/examples/buy-fix-pack.mjs",
        "x-x402-price": "$1.50",
        "x-payment-info": {
          "price": { "mode": "fixed", "currency": "USD", "amount": "1.50" },
          "protocols": [{ "x402": {} }]
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/AuditRequest" },
              "example": { "url": "https://example.com" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Completed deployment fix pack",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/FixPackReport" }
              }
            }
          },
          "400": {
            "description": "Invalid or unreachable public URL",
            "content": {
              "application/json": { "schema": { "$ref": "#/components/schemas/Error" } }
            }
          },
          "402": { "description": "x402 payment required" },
          "413": { "description": "Request body is too large" }
        }
      }
    },
    "/api/extract/agent-text": {
      "post": {
        "operationId": "convertWebpageUrlToCleanMarkdownOrAgentText",
        "summary": "Convert a webpage URL to clean Markdown or token-efficient agent text",
        "description": "Extract clean, LLM-ready Markdown or token-efficient text from webpages, articles, documentation, and news pages for RAG ingestion, research, summarization, or agent context. Strips navigation, ads, scripts, forms, and repeated boilerplate; preserves headings and resolved links; labels fetched content as untrusted; and returns at most 50,000 characters.",
        "tags": ["Extraction"],
        "security": [],
        "x-x402-price": "$0.005",
        "x-payment-info": {
          "price": { "mode": "fixed", "currency": "USD", "amount": "0.005" },
          "protocols": [{ "x402": {} }]
        },
        "requestBody": {
          "required": true,
          "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AgentTextRequest" }, "example": { "url": "https://example.com", "format": "markdown" } } }
        },
        "responses": {
          "200": { "description": "Extracted page text or Markdown", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AgentTextReport" } } } },
          "400": { "description": "Invalid or unreachable public URL", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
          "402": { "description": "x402 payment required" },
          "413": { "description": "Request body is too large" }
        }
      }
    },
    "/api/extract/metadata": {
      "post": {
        "operationId": "extractUrlMetadataJsonLdOpenGraph",
        "summary": "Extract URL metadata, JSON-LD, Open Graph, and canonical links",
        "description": "Returns technical-SEO and link-preview data from a public URL: title, description, canonical URL, language, robots policy, Open Graph and Twitter Card metadata, parsed JSON-LD, headings, and selected response headers. Use for research, URL enrichment, indexing, classification, or link unfurling.",
        "tags": ["Extraction"],
        "security": [],
        "x-x402-price": "$0.005",
        "x-payment-info": {
          "price": { "mode": "fixed", "currency": "USD", "amount": "0.005" },
          "protocols": [{ "x402": {} }]
        },
        "requestBody": {
          "required": true,
          "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AuditRequest" }, "example": { "url": "https://example.com" } } }
        },
        "responses": {
          "200": { "description": "Extracted page metadata", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PageMetadataReport" } } } },
          "400": { "description": "Invalid or unreachable public URL", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
          "402": { "description": "x402 payment required" },
          "413": { "description": "Request body is too large" }
        }
      }
    },
    "/api/generate/llms-txt": {
      "post": {
        "operationId": "generateLlmsTxt",
        "summary": "Generate a tailored llms.txt from a public website",
        "description": "Builds a ready-to-review llms.txt from the site's public title, description, content outline, and same-origin canonical links.",
        "tags": ["Extraction"],
        "security": [],
        "x-x402-price": "$0.05",
        "x-payment-info": {
          "price": { "mode": "fixed", "currency": "USD", "amount": "0.05" },
          "protocols": [{ "x402": {} }]
        },
        "requestBody": {
          "required": true,
          "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AuditRequest" }, "example": { "url": "https://example.com" } } }
        },
        "responses": {
          "200": { "description": "Generated llms.txt", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/LlmsTxtReport" } } } },
          "400": { "description": "Invalid or unreachable public URL", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
          "402": { "description": "x402 payment required" },
          "413": { "description": "Request body is too large" }
        }
      }
    },
    "/api/generate/citation-copy": {
      "post": {
        "operationId": "generateCitationCopyPack",
        "summary": "Generate source-grounded copy for AI citations",
        "description": "Transforms one public page into a hero block, answer-engine summary, meta description, citation cards, and FAQ drafts. Factual drafts come only from the fetched page and are marked for review.",
        "tags": ["Marketing", "AEO", "GEO"],
        "security": [],
        "x-x402-price": "$0.02",
        "x-payment-info": {
          "price": { "mode": "fixed", "currency": "USD", "amount": "0.02" },
          "protocols": [{ "x402": {} }]
        },
        "requestBody": {
          "required": true,
          "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AuditRequest" }, "example": { "url": "https://example.com" } } }
        },
        "responses": {
          "200": { "description": "Generated source-grounded citation copy pack", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CitationCopyPackReport" } } } },
          "400": { "description": "Invalid or unreachable public URL", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
          "402": { "description": "x402 payment required" },
          "413": { "description": "Request body is too large" }
        }
      }
    },
    "/api/preflight/url-check": {
      "post": {
        "operationId": "checkRobotsTxtAllowsCrawlingUrlBeforeFetching",
        "summary": "Check whether robots.txt allows crawling a URL before fetching",
        "description": "Checks whether robots.txt allows a specific crawler to access the supplied URL before fetching it, then requests only page headers when access is allowed. Use this robots-aware URL preflight before paid extraction, scraping, or crawling to avoid blocked or unreachable targets.",
        "tags": ["Robots.txt", "Crawler Access", "URL Preflight", "Extraction"],
        "security": [],
        "x-x402-price": "$0.005",
        "x-payment-info": {
          "price": { "mode": "fixed", "currency": "USD", "amount": "0.005" },
          "protocols": [{ "x402": {} }]
        },
        "requestBody": {
          "required": true,
          "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PreflightRequest" }, "example": { "url": "https://example.com/private", "userAgent": "GPTBot" } } }
        },
        "responses": {
          "200": { "description": "Completed robots-aware URL preflight", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UrlPreflightReport" } } } },
          "400": { "description": "Invalid public URL or user-agent value", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
          "402": { "description": "x402 payment required" },
          "413": { "description": "Request body is too large" }
        }
      }
    },
    "/api/x402/inspect": {
      "post": {
        "operationId": "inspectLiveX402EndpointChallengeBeforePaying",
        "summary": "x402 payment trust preflight: inspect a live endpoint challenge and enforce the buyer budget before paying",
        "description": "A live x402 payment trust preflight for buyers. Accepts a public GET or POST endpoint URL and fetches its unpaid HTTP 402 PAYMENT-REQUIRED challenge, or validates a decoded/base64 challenge supplied directly. Normalizes canonical Base USDC prices, checks the buyer budget, and reports protocol, network, asset, recipient, timeout, HTTPS, and discovery risks without signing or sending payment or forwarding caller authorization headers.",
        "tags": ["Verification"],
        "security": [],
        "x-x402-price": "$0.02",
        "x-payment-info": {
          "price": { "mode": "fixed", "currency": "USD", "amount": "0.02" },
          "protocols": [{ "x402": {} }]
        },
        "requestBody": {
          "required": true,
          "content": { "application/json": { "schema": { "$ref": "#/components/schemas/X402InspectionRequest" }, "example": { "url": "https://example.com/api/x402/data", "method": "POST", "targetBody": { "query": "example" }, "buyerBudgetUsd": 0.05 } } }
        },
        "responses": {
          "200": { "description": "Completed live endpoint or supplied challenge trust inspection", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/X402InspectionReport" } } } },
          "400": { "description": "Malformed challenge or invalid budget", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
          "402": { "description": "x402 payment required" },
          "413": { "description": "Request body is too large" }
        }
      }
    },
    "/api/x402/receipt": {
      "post": {
        "operationId": "verifyBaseUsdcSettlementReceipt",
        "summary": "Verify a Base USDC x402 settlement receipt after payment",
        "description": "Reads public Base JSON-RPC data to verify transaction success, confirmation count, and canonical USDC Transfer logs. Optional expected payer, recipient, and amount constraints must all match the same transfer. This endpoint never sends a transaction.",
        "tags": ["Verification"],
        "security": [],
        "x-x402-price": "$0.01",
        "x-payment-info": {
          "price": { "mode": "fixed", "currency": "USD", "amount": "0.01" },
          "protocols": [{ "x402": {} }]
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/X402ReceiptRequest" },
              "example": {
                "txHash": "0x1111111111111111111111111111111111111111111111111111111111111111",
                "expectedPayTo": "0xEB165195661d2f867259cCd2cbc29a8FcD9984cf",
                "expectedAmountUsd": "0.10",
                "minConfirmations": 2
              }
            }
          }
        },
        "responses": {
          "200": { "description": "Completed Base USDC settlement receipt verification", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/X402ReceiptReport" } } } },
          "400": { "description": "Malformed transaction hash or invalid expectation", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
          "402": { "description": "x402 payment required" },
          "413": { "description": "Request body is too large" },
          "502": { "description": "Public Base RPC is temporarily unavailable", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "AuditRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": ["url"],
        "properties": {
          "url": {
            "type": "string",
            "format": "uri",
            "description": "Public HTTP or HTTPS website URL to audit"
          }
        }
      },
      "AgentTextRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": ["url"],
        "properties": {
          "url": { "type": "string", "format": "uri", "description": "Public HTTP or HTTPS page URL to extract" },
          "format": { "type": "string", "enum": ["text", "markdown"], "default": "text", "description": "Requested output format" }
        }
      },
      "CompetitiveAuditRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": ["urls"],
        "properties": {
          "urls": {
            "type": "array",
            "minItems": 2,
            "maxItems": 4,
            "uniqueItems": true,
            "items": { "type": "string", "format": "uri" },
            "description": "Distinct public website URLs to benchmark"
          }
        }
      },
      "PreflightRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": ["url"],
        "properties": {
          "url": { "type": "string", "format": "uri", "description": "Public HTTP or HTTPS URL to check" },
          "userAgent": { "type": "string", "maxLength": 120, "description": "Optional crawler product token; defaults to *" }
        }
      },
      "X402InspectionRequest": {
        "type": "object",
        "additionalProperties": false,
        "oneOf": [{ "required": ["challenge"] }, { "required": ["url"] }],
        "properties": {
          "challenge": {
            "description": "Decoded x402 PaymentRequired object or base64 PAYMENT-REQUIRED header value",
            "oneOf": [{ "type": "object", "additionalProperties": true }, { "type": "string", "maxLength": 140000 }]
          },
          "url": { "type": "string", "format": "uri", "description": "Public x402 endpoint URL to probe without sending payment" },
          "method": { "type": "string", "enum": ["GET", "POST"], "default": "POST" },
          "targetBody": { "description": "Optional JSON body forwarded only to a POST probe; maximum serialized size is 16 KB" },
          "buyerBudgetUsd": { "type": "number", "minimum": 0, "maximum": 100000 }
        }
      },
      "X402ReceiptRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": ["txHash"],
        "properties": {
          "txHash": { "type": "string", "pattern": "^0x[a-fA-F0-9]{64}$", "description": "Base transaction hash to verify" },
          "expectedPayTo": { "type": "string", "pattern": "^0x[a-fA-F0-9]{40}$", "description": "Optional expected USDC recipient" },
          "expectedFrom": { "type": "string", "pattern": "^0x[a-fA-F0-9]{40}$", "description": "Optional expected USDC payer" },
          "expectedAmountUsd": {
            "description": "Optional exact USDC amount with at most six decimals",
            "oneOf": [
              { "type": "number", "minimum": 0, "maximum": 1000000000 },
              { "type": "string", "pattern": "^(0|[1-9]\\d{0,9})(\\.\\d{1,6})?$" }
            ]
          },
          "minConfirmations": { "type": "integer", "minimum": 1, "maximum": 10000, "default": 1 }
        }
      },
      "CategoryScore": {
        "type": "object",
        "required": ["score", "max"],
        "properties": {
          "score": { "type": "integer", "minimum": 0 },
          "max": { "type": "integer", "minimum": 1 }
        }
      },
      "Finding": {
        "type": "object",
        "required": ["severity", "check", "status", "evidence", "fix"],
        "properties": {
          "severity": { "type": "string", "enum": ["high", "medium", "low", "pass"] },
          "check": { "type": "string" },
          "status": { "type": "string", "enum": ["pass", "missing", "weak", "blocked"] },
          "evidence": { "type": "string" },
          "fix": { "type": ["string", "null"] }
        }
      },
      "AuditReport": {
        "type": "object",
        "required": ["url", "finalUrl", "auditedAt", "score", "grade", "summary", "categories", "findings", "facts"],
        "properties": {
          "url": { "type": "string", "format": "uri" },
          "finalUrl": { "type": "string", "format": "uri" },
          "auditedAt": { "type": "string", "format": "date-time" },
          "score": { "type": "integer", "minimum": 0, "maximum": 100 },
          "grade": { "type": "string", "enum": ["A", "B", "C", "D", "F"] },
          "summary": { "type": "string" },
          "categories": {
            "type": "object",
            "required": ["discoverability", "structuredData", "content", "trust"],
            "properties": {
              "discoverability": { "$ref": "#/components/schemas/CategoryScore" },
              "structuredData": { "$ref": "#/components/schemas/CategoryScore" },
              "content": { "$ref": "#/components/schemas/CategoryScore" },
              "trust": { "$ref": "#/components/schemas/CategoryScore" }
            }
          },
          "findings": { "type": "array", "items": { "$ref": "#/components/schemas/Finding" } },
          "facts": {
            "type": "object",
            "description": "Observed page and discovery facts, including crawler-specific access booleans or null when robots.txt is unreachable.",
            "properties": {
              "llmsFullStatus": { "type": "integer" },
              "aiCrawlerAccessPath": { "type": "string" },
              "aiCrawlersChecked": { "type": "integer", "const": 7 },
              "aiCrawlersAllowed": { "type": ["integer", "null"], "minimum": 0, "maximum": 7 },
              "gptBotAllowed": { "type": ["boolean", "null"] },
              "oaiSearchBotAllowed": { "type": ["boolean", "null"] },
              "chatGptUserAllowed": { "type": ["boolean", "null"] },
              "claudeBotAllowed": { "type": ["boolean", "null"] },
              "claudeUserAllowed": { "type": ["boolean", "null"] },
              "perplexityBotAllowed": { "type": ["boolean", "null"] },
              "googleExtendedAllowed": { "type": ["boolean", "null"] }
            },
            "additionalProperties": true
          }
        }
      },
      "PreviewReport": {
        "type": "object",
        "required": ["url", "finalUrl", "auditedAt", "score", "grade", "summary", "categories", "topFixes", "fullAudit", "paidNextSteps", "payment"],
        "properties": {
          "url": { "type": "string", "format": "uri" },
          "finalUrl": { "type": "string", "format": "uri" },
          "auditedAt": { "type": "string", "format": "date-time" },
          "score": { "type": "integer", "minimum": 0, "maximum": 100 },
          "grade": { "type": "string", "enum": ["A", "B", "C", "D", "F"] },
          "summary": { "type": "string" },
          "categories": { "type": "object", "additionalProperties": { "$ref": "#/components/schemas/CategoryScore" } },
          "topFixes": { "type": "array", "maxItems": 3, "items": { "type": "object", "additionalProperties": true } },
          "fullAudit": {
            "type": "object",
            "required": ["endpoint", "url", "method", "price", "priceUsdc", "requestBody", "paymentProtocol", "retryHeader"],
            "properties": {
              "endpoint": { "type": "string", "const": "/api/audit" },
              "url": { "type": "string", "format": "uri" },
              "method": { "type": "string", "const": "POST" },
              "price": { "type": "string", "const": "0.10 USDC" },
              "priceUsdc": { "type": "string", "const": "0.10" },
              "requestBody": { "$ref": "#/components/schemas/AuditRequest" },
              "paymentProtocol": { "type": "string", "const": "x402-v2" },
              "retryHeader": { "type": "string", "const": "PAYMENT-SIGNATURE" }
            }
          },
          "paidNextSteps": {
            "type": "array",
            "minItems": 2,
            "maxItems": 4,
            "items": { "$ref": "#/components/schemas/PreviewPaidNextStep" }
          },
          "payment": { "$ref": "#/components/schemas/PreviewPaymentInstructions" }
        }
      },
      "PreviewPaidNextStep": {
        "type": "object",
        "required": ["id", "endpoint", "url", "method", "priceUsdc", "recommended", "whenToUse", "requestBody"],
        "properties": {
          "id": { "type": "string", "enum": ["citation-copy", "full-audit", "llms-txt", "fix-pack"] },
          "endpoint": { "type": "string" },
          "url": { "type": "string", "format": "uri" },
          "method": { "type": "string", "const": "POST" },
          "priceUsdc": { "type": "string", "pattern": "^[0-9]+(?:\\.[0-9]+)?$" },
          "recommended": { "type": "boolean" },
          "whenToUse": { "type": "string" },
          "requestBody": { "$ref": "#/components/schemas/AuditRequest" }
        }
      },
      "PreviewPaymentInstructions": {
        "type": "object",
        "required": ["protocol", "network", "asset", "firstResponse", "retryHeader"],
        "properties": {
          "protocol": { "type": "string", "const": "x402-v2" },
          "network": { "type": "string", "const": "eip155:8453" },
          "asset": { "type": "string", "const": "USDC" },
          "firstResponse": { "type": "string", "const": "HTTP 402 with PAYMENT-REQUIRED" },
          "retryHeader": { "type": "string", "const": "PAYMENT-SIGNATURE" }
        }
      },
      "FixPackArtifact": {
        "type": "object",
        "required": ["path", "purpose", "content", "reviewBeforeDeploy"],
        "properties": {
          "path": { "type": "string" },
          "purpose": { "type": "string" },
          "content": { "type": "string" },
          "reviewBeforeDeploy": { "type": "boolean" }
        }
      },
      "FixPackReport": {
        "type": "object",
        "required": ["url", "generatedAt", "currentScore", "projectedScore", "fixesAddressed", "artifacts", "implementationPlan", "audit"],
        "properties": {
          "url": { "type": "string", "format": "uri" },
          "generatedAt": { "type": "string", "format": "date-time" },
          "currentScore": { "type": "integer", "minimum": 0, "maximum": 100 },
          "projectedScore": { "type": "integer", "minimum": 0, "maximum": 100 },
          "fixesAddressed": { "type": "array", "items": { "type": "string" } },
          "artifacts": { "type": "array", "minItems": 4, "items": { "$ref": "#/components/schemas/FixPackArtifact" } },
          "implementationPlan": { "type": "array", "items": { "type": "object", "additionalProperties": true } },
          "audit": { "$ref": "#/components/schemas/AuditReport" }
        }
      },
      "CompetitiveAuditReport": {
        "type": "object",
        "required": ["auditedAt", "summary", "ranking", "benchmarks", "opportunities", "audits"],
        "properties": {
          "auditedAt": { "type": "string", "format": "date-time" },
          "summary": { "type": "string" },
          "ranking": {
            "type": "array",
            "items": {
              "type": "object",
              "required": ["rank", "url", "score", "grade"],
              "properties": {
                "rank": { "type": "integer", "minimum": 1 },
                "url": { "type": "string", "format": "uri" },
                "score": { "type": "integer", "minimum": 0, "maximum": 100 },
                "grade": { "type": "string", "enum": ["A", "B", "C", "D", "F"] }
              }
            }
          },
          "benchmarks": { "type": "object", "additionalProperties": true },
          "opportunities": { "type": "array", "items": { "type": "object", "additionalProperties": true } },
          "audits": { "type": "array", "items": { "$ref": "#/components/schemas/AuditReport" } }
        }
      },
      "AgentTextReport": {
        "type": "object",
        "required": ["url", "finalUrl", "extractedAt", "format", "untrustedContent", "contentWarning", "title", "description", "language", "wordCount", "characterCount", "truncated", "headings", "links", "text"],
        "properties": {
          "url": { "type": "string", "format": "uri" },
          "finalUrl": { "type": "string", "format": "uri" },
          "extractedAt": { "type": "string", "format": "date-time" },
          "format": { "type": "string", "enum": ["text", "markdown"] },
          "untrustedContent": { "type": "boolean", "const": true },
          "contentWarning": { "type": "string" },
          "title": { "type": ["string", "null"] },
          "description": { "type": ["string", "null"] },
          "language": { "type": ["string", "null"] },
          "wordCount": { "type": "integer", "minimum": 0 },
          "characterCount": { "type": "integer", "minimum": 0 },
          "truncated": { "type": "boolean" },
          "headings": { "type": "array", "items": { "type": "object", "additionalProperties": true } },
          "links": { "type": "array", "items": { "type": "object", "additionalProperties": true } },
          "text": { "type": "string" }
        }
      },
      "PageMetadataReport": {
        "type": "object",
        "required": ["url", "finalUrl", "extractedAt", "title", "description", "canonical", "language", "robots", "openGraph", "twitter", "jsonLd", "headings", "responseHeaders"],
        "properties": {
          "url": { "type": "string", "format": "uri" },
          "finalUrl": { "type": "string", "format": "uri" },
          "extractedAt": { "type": "string", "format": "date-time" },
          "title": { "type": ["string", "null"] },
          "description": { "type": ["string", "null"] },
          "canonical": { "type": ["string", "null"], "format": "uri" },
          "language": { "type": ["string", "null"] },
          "robots": { "type": ["string", "null"] },
          "openGraph": { "type": "object", "additionalProperties": { "type": "string" } },
          "twitter": { "type": "object", "additionalProperties": { "type": "string" } },
          "jsonLd": { "type": "array", "items": {} },
          "headings": { "type": "array", "items": { "type": "object", "additionalProperties": true } },
          "responseHeaders": { "type": "object", "additionalProperties": { "type": ["string", "null"] } }
        }
      },
      "LlmsTxtReport": {
        "type": "object",
        "required": ["url", "generatedAt", "suggestedPath", "content", "source", "reviewNotes"],
        "properties": {
          "url": { "type": "string", "format": "uri" },
          "generatedAt": { "type": "string", "format": "date-time" },
          "suggestedPath": { "type": "string", "const": "/llms.txt" },
          "content": { "type": "string" },
          "source": { "type": "object", "additionalProperties": true },
          "reviewNotes": { "type": "array", "items": { "type": "string" } }
        }
      },
      "CitationCopyPackReport": {
        "type": "object",
        "required": ["url", "generatedAt", "source", "copy", "citationCards", "faqPlan", "reviewNotes"],
        "properties": {
          "url": { "type": "string", "format": "uri" },
          "generatedAt": { "type": "string", "format": "date-time" },
          "source": {
            "type": "object",
            "required": ["title", "description", "language", "headingsUsed", "sentencesUsed"],
            "properties": {
              "title": { "type": ["string", "null"] },
              "description": { "type": ["string", "null"] },
              "language": { "type": ["string", "null"] },
              "headingsUsed": { "type": "integer", "minimum": 0 },
              "sentencesUsed": { "type": "integer", "minimum": 1 }
            }
          },
          "copy": {
            "type": "object",
            "required": ["hero", "answerEngineSummary", "metaDescription"],
            "properties": {
              "hero": { "type": "object", "additionalProperties": { "type": "string" } },
              "answerEngineSummary": { "type": "string" },
              "metaDescription": { "type": "string", "maxLength": 156 }
            }
          },
          "citationCards": {
            "type": "array",
            "minItems": 1,
            "maxItems": 5,
            "items": {
              "type": "object",
              "required": ["topic", "draft", "sourceUrl", "basis", "reviewRequired"],
              "properties": {
                "topic": { "type": "string" },
                "draft": { "type": "string" },
                "sourceUrl": { "type": "string", "format": "uri" },
                "basis": { "type": "string", "const": "public-page-text" },
                "reviewRequired": { "type": "boolean", "const": true }
              }
            }
          },
          "faqPlan": { "type": "array", "minItems": 1, "maxItems": 4, "items": { "type": "object", "additionalProperties": true } },
          "reviewNotes": { "type": "array", "items": { "type": "string" } }
        }
      },
      "UrlPreflightReport": {
        "type": "object",
        "required": ["url", "checkedAt", "userAgent", "allowedByRobots", "fetchable", "matchedRule", "robots", "page", "notes"],
        "properties": {
          "url": { "type": "string", "format": "uri" },
          "checkedAt": { "type": "string", "format": "date-time" },
          "userAgent": { "type": "string" },
          "allowedByRobots": { "type": "boolean" },
          "fetchable": { "type": "boolean" },
          "matchedRule": {
            "type": ["object", "null"],
            "properties": {
              "directive": { "type": "string", "enum": ["allow", "disallow"] },
              "path": { "type": "string" }
            }
          },
          "robots": {
            "type": "object",
            "required": ["url", "status", "state", "sitemaps"],
            "properties": {
              "url": { "type": "string", "format": "uri" },
              "status": { "type": "integer" },
              "state": { "type": "string", "enum": ["available", "unavailable", "unreachable"] },
              "sitemaps": { "type": "array", "items": { "type": "string", "format": "uri" } }
            }
          },
          "page": { "type": ["object", "null"], "additionalProperties": true },
          "notes": { "type": "array", "items": { "type": "string" } }
        }
      },
      "X402InspectionReport": {
        "type": "object",
        "required": ["inspectedAt", "source", "probe", "x402Version", "resource", "recommendation", "score", "budget", "paymentOptions", "checks", "limitations"],
        "properties": {
          "inspectedAt": { "type": "string", "format": "date-time" },
          "source": { "type": "string", "enum": ["supplied-challenge", "live-url"] },
          "probe": { "type": ["object", "null"], "additionalProperties": true },
          "x402Version": { "type": ["integer", "null"] },
          "resource": { "type": "object", "additionalProperties": true },
          "recommendation": { "type": "string", "enum": ["proceed", "review", "reject"] },
          "score": { "type": "integer", "minimum": 0, "maximum": 100 },
          "budget": { "type": "object", "additionalProperties": true },
          "paymentOptions": { "type": "array", "maxItems": 20, "items": { "type": "object", "additionalProperties": true } },
          "checks": {
            "type": "array",
            "items": {
              "type": "object",
              "required": ["status", "check", "evidence"],
              "properties": {
                "status": { "type": "string", "enum": ["pass", "warn", "fail"] },
                "check": { "type": "string" },
                "evidence": { "type": "string" }
              }
            }
          },
          "limitations": { "type": "array", "items": { "type": "string" } }
        }
      },
      "X402ReceiptReport": {
        "type": "object",
        "required": ["verifiedAt", "network", "asset", "txHash", "found", "successful", "blockNumber", "latestBlock", "confirmations", "minConfirmations", "recommendation", "matchedTransfer", "usdcTransfers", "expectations", "checks", "limitations"],
        "properties": {
          "verifiedAt": { "type": "string", "format": "date-time" },
          "network": { "type": "string", "const": "eip155:8453" },
          "asset": { "type": "object", "additionalProperties": true },
          "txHash": { "type": "string" },
          "found": { "type": "boolean" },
          "successful": { "type": ["boolean", "null"] },
          "blockNumber": { "type": ["string", "null"] },
          "latestBlock": { "type": "string" },
          "confirmations": { "type": "integer", "minimum": 0 },
          "minConfirmations": { "type": "integer", "minimum": 1 },
          "recommendation": { "type": "string", "enum": ["confirmed", "pending", "review", "reject"] },
          "matchedTransfer": { "type": ["object", "null"], "additionalProperties": true },
          "usdcTransfers": { "type": "array", "items": { "type": "object", "additionalProperties": true } },
          "expectations": { "type": "object", "additionalProperties": true },
          "checks": { "type": "array", "items": { "type": "object", "additionalProperties": true } },
          "limitations": { "type": "array", "items": { "type": "string" } }
        }
      },
      "Health": {
        "type": "object",
        "required": ["status", "service", "offers", "network", "payTo", "protocol"],
        "properties": {
          "status": { "type": "string", "const": "ok" },
          "service": { "type": "string" },
          "offers": { "type": "object", "additionalProperties": true },
          "network": { "type": "string" },
          "payTo": { "type": "string" },
          "protocol": { "type": "string" }
        }
      },
      "Error": {
        "type": "object",
        "required": ["error"],
        "properties": { "error": { "type": "string" } }
      }
    }
  }
}
