{
  "openapi": "3.1.0",
  "info": {
    "title": "URL Safety Preflight by Agentropolis",
    "version": "0.1.0",
    "summary": "URL → safe/caution/block (redirects, domain age, TLS, lookalike, PhishTank).",
    "description": "$0.005 USDC per call via x402 on Base. $0.005 USDC per call on Base mainnet.",
    "contact": {
      "name": "Agentropolis",
      "url": "https://agentropolis.io",
      "email": "hello@agentropolis.io"
    },
    "x-guidance": "POST /api/url-check with {url, expected_domain?}. Branch on verdict: block = do not open/pay/enter credentials; caution = second check first; safe = no high-risk signal (not a guarantee). signals[] explains why."
  },
  "servers": [
    {
      "url": "https://seenly-pay-guard.vercel.app"
    }
  ],
  "paths": {
    "/api/url-check": {
      "post": {
        "operationId": "checkUrlSafety",
        "summary": "Pre-flight a URL before opening, paying or sending credentials",
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.005"
          },
          "protocols": [
            {
              "x402": {}
            }
          ],
          "rails": [
            {
              "protocol": "x402",
              "version": 2,
              "scheme": "exact",
              "network": "eip155:8453",
              "networkName": "Base mainnet",
              "asset": "USDC",
              "assetAddress": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
              "amount": "5000",
              "priceUsd": "0.005",
              "payTo": "0xeE6239F3E17bEBe5e89F21F29D74D68CAa0d78CE",
              "facilitator": "Coinbase CDP (gas sponsored; payer needs no ETH)",
              "header": "PAYMENT-SIGNATURE"
            }
          ]
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UrlCheckRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Verdict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UrlCheckResult"
                }
              }
            }
          },
          "402": {
            "description": "x402 payment required"
          },
          "422": {
            "description": "Invalid or private target (not charged)"
          }
        }
      },
      "get": {
        "operationId": "checkUrlSafetyGet",
        "summary": "Same check via query string",
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.005"
          },
          "protocols": [
            {
              "x402": {}
            }
          ],
          "rails": [
            {
              "protocol": "x402",
              "version": 2,
              "scheme": "exact",
              "network": "eip155:8453",
              "networkName": "Base mainnet",
              "asset": "USDC",
              "assetAddress": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
              "amount": "5000",
              "priceUsd": "0.005",
              "payTo": "0xeE6239F3E17bEBe5e89F21F29D74D68CAa0d78CE",
              "facilitator": "Coinbase CDP (gas sponsored; payer needs no ETH)",
              "header": "PAYMENT-SIGNATURE"
            }
          ]
        },
        "parameters": [
          {
            "name": "url",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "expected_domain",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Verdict"
          },
          "402": {
            "description": "x402 payment required"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "UrlCheckRequest": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "maxLength": 2048
          },
          "expected_domain": {
            "type": "string"
          },
          "requestKey": {
            "type": "string",
            "maxLength": 128
          }
        },
        "required": [
          "url"
        ]
      },
      "UrlCheckResult": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string"
          },
          "verdict": {
            "type": "string",
            "enum": [
              "safe",
              "caution",
              "block"
            ]
          },
          "risk": {
            "type": "number",
            "minimum": 0,
            "maximum": 100
          },
          "advice": {
            "type": "string"
          },
          "final": {
            "type": "object"
          },
          "redirect_chain": {
            "type": "array"
          },
          "redirects": {
            "type": "integer"
          },
          "tls": {
            "type": [
              "object",
              "null"
            ]
          },
          "domain_age": {
            "type": [
              "object",
              "null"
            ]
          },
          "lookalikes": {
            "type": "array"
          },
          "lists": {
            "type": "object"
          },
          "signals": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "code": {
                  "type": "string"
                },
                "severity": {
                  "type": "string"
                },
                "detail": {
                  "type": "string"
                }
              }
            }
          },
          "coverage": {
            "type": "object"
          },
          "check_version": {
            "type": "string"
          }
        },
        "required": [
          "verdict",
          "risk",
          "final",
          "signals"
        ]
      }
    }
  }
}