{
  "openapi": "3.1.0",
  "info": {
    "title": "AfterDeploy QA",
    "version": "0.2.1",
    "description": "Post-deployment static HTML checks for one public HTTPS page and at most four same-origin links and four images. Beta; live payment settlement has not been verified. Does not render JavaScript."
  },
  "servers": [
    {
      "url": "https://check.sheya7.com"
    }
  ],
  "paths": {
    "/api/v1/check": {
      "get": {
        "operationId": "checkWebsite",
        "summary": "Check a public website",
        "description": "x402 v2: 0.02 native USDC on Base. Query strings in the target URL, IP literals, private hosts, authentication and custom ports are unsupported. Completed error reports are billable. Handler failures are not settled. If payment settlement is uncertain, do not send a new payment; retain the original signed authorization for reconciliation.",
        "parameters": [
          {
            "name": "url",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uri",
              "maxLength": 2048
            },
            "example": "https://example.com/"
          },
          {
            "name": "PAYMENT-SIGNATURE",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Use an x402 v2 client; do not send a wallet key."
          },
          {
            "name": "X-Sitecheck-Recovery",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{43,128}$"
            },
            "description": "Generate a cryptographically random 32-byte base64url token before paying. Retain it; only its hash is stored. Reuse the same token and original signed payment when retrying. Required whenever PAYMENT-SIGNATURE is present."
          }
        ],
        "responses": {
          "200": {
            "description": "Completed check. PAYMENT-RESPONSE contains facilitator settlement data.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Report"
                }
              }
            }
          },
          "202": {
            "description": "Original operation pending. No report released. Keep the original authorization and token; use the returned status/recovery URLs and Retry-After. Do not authorize another payment."
          },
          "400": {
            "description": "Missing or malformed recovery token; no verification or settlement requested."
          },
          "402": {
            "description": "Payment required or rejected. PAYMENT-REQUIRED contains the x402 v2 challenge."
          },
          "409": {
            "description": "Payment reused for different input, checking interrupted without settlement, or manual reconciliation required. Inspect error code."
          },
          "422": {
            "description": "Unsupported input or HTML; no settlement requested by this handler."
          },
          "503": {
            "description": "Dependency unavailable. If payment was submitted, reconcile the original authorization before retrying with a new one."
          },
          "504": {
            "description": "Checking time limit reached; no settlement requested by this handler."
          }
        },
        "x-payment": {
          "protocol": "x402",
          "version": 2,
          "network": "eip155:8453",
          "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
          "amount": "20000",
          "payTo": "0x789deab8c53f8f70f396e695daf05a8064897601",
          "facilitator": "https://facilitator.payai.network"
        }
      }
    },
    "/api/v1/reports/{id}": {
      "get": {
        "operationId": "getSavedReport",
        "summary": "Read an existing report or pending status without another payment",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "X-Sitecheck-Recovery",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{43,128}$"
            },
            "description": "Generate a cryptographically random 32-byte base64url token before paying. Retain it; only its hash is stored. Reuse the same token and original signed payment when retrying."
          }
        ],
        "responses": {
          "200": {
            "description": "Original settled report; PAYMENT-RESPONSE is the stored facilitator receipt."
          },
          "202": {
            "description": "Original operation pending; respect Retry-After."
          },
          "404": {
            "description": "Unknown report or incorrect recovery token; no existence information is disclosed."
          },
          "409": {
            "description": "Checking failed before settlement or operation needs manual reconciliation."
          }
        }
      }
    },
    "/api/v1/reports/{id}/recover": {
      "post": {
        "operationId": "recoverOriginalPayment",
        "summary": "Reconcile the exact original authorized payment and retrieve its saved report",
        "description": "Resubmits the original stored payload and requirements to the same facilitator, protected by a database lease. Never creates a new authorization or reruns the website check. At most ten settlement attempts within 24 hours; afterward use retained evidence for manual reconciliation. No body required.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "X-Sitecheck-Recovery",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{43,128}$"
            },
            "description": "Generate a cryptographically random 32-byte base64url token before paying. Retain it; only its hash is stored. Reuse the same token and original signed payment when retrying."
          }
        ],
        "responses": {
          "200": {
            "description": "Original report recovered."
          },
          "202": {
            "description": "Still pending or another recovery is in progress; respect Retry-After."
          },
          "404": {
            "description": "Unknown report or incorrect token."
          },
          "409": {
            "description": "No settlement requested for interrupted checking, or manual reconciliation required."
          }
        }
      }
    },
    "/api/example": {
      "get": {
        "operationId": "getExample",
        "summary": "Free synthetic report; no live target or payment",
        "responses": {
          "200": {
            "description": "Example report from the same checking engine"
          }
        }
      }
    },
    "/api/health": {
      "get": {
        "operationId": "health",
        "responses": {
          "200": {
            "description": "Process health, not a settlement guarantee"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Report": {
        "type": "object",
        "required": [
          "schemaVersion",
          "checkedAt",
          "requestedUrl",
          "page",
          "resources",
          "findings",
          "coverage"
        ],
        "properties": {
          "schemaVersion": {
            "const": "1.0"
          },
          "checkedAt": {
            "type": "string",
            "format": "date-time"
          },
          "requestedUrl": {
            "type": "string",
            "format": "uri"
          },
          "finalUrl": {
            "type": "string",
            "format": "uri"
          },
          "page": {
            "type": "object"
          },
          "metadata": {
            "type": [
              "object",
              "null"
            ]
          },
          "resources": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "findings": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "coverage": {
            "type": "object"
          }
        }
      }
    }
  }
}