{
  "openapi": "3.0.3",
  "info": {
    "title": "Site Analyzer AI Agent API",
    "description": "Programmatic Machine-to-Machine API for AI Agents to purchase and run technical SEO audits and website health checkups.",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://siteanalyzerfree.com",
      "description": "Production Server"
    }
  ],
  "paths": {
    "/api/v1/agent/checkup.php": {
      "post": {
        "summary": "Quick Technical SEO Checkup (1 Credit)",
        "description": "Runs a quick technical health checkup on any website domain. Deducts 1 credit from the agent's API balance.",
        "operationId": "runQuickCheckup",
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["domain"],
                "properties": {
                  "domain": {
                    "type": "string",
                    "example": "example.com",
                    "description": "Target website domain or URL to audit."
                  },
                  "format": {
                    "type": "string",
                    "enum": ["json", "markdown"],
                    "default": "json",
                    "description": "Output format: 'json' for raw structured data or 'markdown' for LLM-formatted summaries."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "SEO Checkup completed successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": { "type": "boolean" },
                    "product": { "type": "string", "example": "quick_checkup" },
                    "charged_usd": { "type": "number", "example": 7.0 },
                    "remaining_balance_usd": { "type": "number", "example": 43.0 },
                    "report_code": { "type": "string", "example": "CC15AC90" },
                    "domain": { "type": "string", "example": "example.com" },
                    "health_score": { "type": "integer", "example": 85 },
                    "scan_duration_ms": { "type": "integer", "example": 1450 },
                    "total_issues": { "type": "integer", "example": 12 },
                    "total_passes": { "type": "integer", "example": 89 },
                    "issues": { "type": "array" },
                    "passes": { "type": "array" },
                    "report_url": { "type": "string" }
                  }
                }
              }
            }
          },
          "401": { "description": "Missing or invalid Bearer API key." },
          "402": { "description": "Payment Required. Insufficient agent credit balance." }
        }
      }
    },
    "/api/v1/agent/full-audit.php": {
      "post": {
        "summary": "Deep Full SEO Audit Report ($39 USD)",
        "description": "Executes a deep, multi-page 30+ check technical SEO audit report. Deducts $39 USD from the agent's API balance.",
        "operationId": "runFullAudit",
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["domain"],
                "properties": {
                  "domain": {
                    "type": "string",
                    "example": "example.com",
                    "description": "Target website domain or URL to audit."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Full SEO Audit completed successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": { "type": "boolean" },
                    "product": { "type": "string", "example": "full_audit" },
                    "charged_usd": { "type": "number", "example": 39.0 },
                    "remaining_balance_usd": { "type": "number", "example": 11.0 },
                    "report_code": { "type": "string", "example": "A92F1B01" },
                    "domain": { "type": "string", "example": "example.com" },
                    "summary_score": { "type": "integer", "example": 92 },
                    "scan_duration_ms": { "type": "integer", "example": 4500 },
                    "audit_summary": { "type": "object" },
                    "report_url": { "type": "string" }
                  }
                }
              }
            }
          },
          "401": { "description": "Missing or invalid Bearer API key." },
          "402": { "description": "Payment Required. Insufficient agent credit balance." }
        }
      }
    },
    "/api/v1/agent/word-counter.php": {
      "post": {
        "summary": "Web Page & Section Word Counter (Free $0.00)",
        "description": "Analyzes total page words vs main article content section words, reading time, readability score, and top keywords for a URL or direct text input.",
        "operationId": "analyzeWordCount",
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "example": "https://example.com/article",
                    "description": "Target web page URL to analyze."
                  },
                  "text": {
                    "type": "string",
                    "example": "Sample plain text content to analyze.",
                    "description": "Direct text string to count words for (if url is omitted)."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Word count analysis completed successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": { "type": "boolean" },
                    "product": { "type": "string", "example": "word_counter" },
                    "charged_usd": { "type": "number", "example": 0.0 },
                    "report_code": { "type": "string", "example": "WC1DCE75C4" },
                    "url": { "type": "string" },
                    "total_words": { "type": "integer", "example": 1250 },
                    "content_words": { "type": "integer", "example": 980 },
                    "reading_time_minutes": { "type": "integer", "example": 5 },
                    "readability_score": { "type": "number", "example": 68.5 },
                    "readability_grade": { "type": "string", "example": "Standard / 8th-9th Grade" },
                    "top_keywords": { "type": "array" },
                    "report_url": { "type": "string" }
                  }
                }
              }
            }
          },
          "400": { "description": "Invalid input. Please provide either a valid URL or text content." }
        }
      }
    },
    "/api/v1/agent/url-checker.php": {
      "post": {
        "summary": "URL Status & Redirect Checker ($0.001 USD)",
        "description": "Follows HTTP redirects, measures hop timings, and returns final status code and response headers.",
        "operationId": "checkUrlStatus",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["url"],
                "properties": {
                  "url": { "type": "string", "example": "https://example.com/page" }
                }
              }
            }
          }
        },
        "responses": {
          "200": { "description": "URL check successful." },
          "402": { "description": "Payment Required ($0.001 USD via x402)." }
        }
      }
    },
    "/api/v1/agent/metadata-extractor.php": {
      "post": {
        "summary": "Website Metadata & OpenGraph Extractor ($0.002 USD)",
        "description": "Extracts title, meta description, OpenGraph, Twitter Cards, canonical URL, JSON-LD types, and headings structure.",
        "operationId": "extractWebsiteMetadata",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["url"],
                "properties": {
                  "url": { "type": "string", "example": "https://example.com" }
                }
              }
            }
          }
        },
        "responses": {
          "200": { "description": "Metadata extraction successful." },
          "402": { "description": "Payment Required ($0.002 USD via x402)." }
        }
      }
    },
    "/api/v1/agent/dns-auth.php": {
      "post": {
        "summary": "DNS & Email Authentication Checker ($0.003 USD)",
        "description": "Resolves DNS records (A, AAAA, MX, TXT), SPF directives, DMARC policies, and mail server connectivity.",
        "operationId": "checkDnsEmailAuth",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["domain"],
                "properties": {
                  "domain": { "type": "string", "example": "example.com" }
                }
              }
            }
          }
        },
        "responses": {
          "200": { "description": "DNS authentication check successful." },
          "402": { "description": "Payment Required ($0.003 USD via x402)." }
        }
      }
    },
    "/api/v1/agent/change-detector.php": {
      "post": {
        "summary": "Website Change & Snapshot Detector ($0.005 USD)",
        "description": "Compares page DOM content hash against historical snapshots to report changes.",
        "operationId": "detectWebsiteChanges",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["url"],
                "properties": {
                  "url": { "type": "string", "example": "https://example.com" },
                  "action": { "type": "string", "enum": ["check", "store"], "default": "check" }
                }
              }
            }
          }
        },
        "responses": {
          "200": { "description": "Change detection successful." },
          "402": { "description": "Payment Required ($0.005 USD via x402)." }
        }
      }
    },
    "/api/v1/agent/ai-readiness.php": {
      "post": {
        "summary": "Website AI Readiness & Indexability Checker ($0.005 USD)",
        "description": "Checks robots.txt AI rules, llms.txt availability, sitemap access, and AI indexability score.",
        "operationId": "checkAiReadiness",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["domain"],
                "properties": {
                  "domain": { "type": "string", "example": "example.com" }
                }
              }
            }
          }
        },
        "responses": {
          "200": { "description": "AI readiness check successful." },
          "402": { "description": "Payment Required ($0.005 USD via x402)." }
        }
      }
    },
    "/api/v1/agent/contact-extractor.php": {
      "post": {
        "summary": "Website Business Contact Info Extractor ($0.005 USD)",
        "description": "Extracts publicly listed emails, phone numbers, social media profiles, and contact links.",
        "operationId": "extractContactInfo",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["url"],
                "properties": {
                  "url": { "type": "string", "example": "https://example.com" }
                }
              }
            }
          }
        },
        "responses": {
          "200": { "description": "Contact info extraction successful." },
          "402": { "description": "Payment Required ($0.005 USD via x402)." }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "API_KEY"
      }
    }
  }
}
