{
  "openapi": "3.1.0",
  "info": {
    "title": "Agent Payment Guard API",
    "version": "2.0.0",
    "description": "A stateful x402 payment firewall for AI agents with budget policy, merchant and domain risk, transaction simulation, human approval, replay protection, delivery evidence, webhooks, MCP, and twenty-five underlying safety tools."
  },
  "servers": [
    {
      "url": "https://base-agent-preflight.bytoken2023.workers.dev"
    }
  ],
  "paths": {
    "/v1/x402/base/address-preflight": {
      "get": {
        "operationId": "buyBaseAddressPreflight",
        "summary": "Inspect a Base address before an autonomous payment or contract interaction.",
        "parameters": [
          {
            "name": "address",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^0x[a-fA-F0-9]{40}$",
              "description": "Base address to inspect before an autonomous payment."
            }
          }
        ],
        "x-payment-protocol": "x402",
        "x-price-usdc": "$0.02",
        "responses": {
          "200": {
            "description": "Paid safety intelligence response"
          },
          "400": {
            "description": "Invalid input"
          },
          "402": {
            "description": "x402 payment required"
          },
          "502": {
            "description": "Public-chain data provider unavailable"
          }
        }
      }
    },
    "/v1/x402/base/token-preflight": {
      "get": {
        "operationId": "buyBaseTokenPreflight",
        "summary": "Inspect a Base token contract, public reputation, holder count, and DEX liquidity before trading.",
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^0x[a-fA-F0-9]{40}$",
              "description": "Base ERC-20 token contract to inspect."
            }
          }
        ],
        "x-payment-protocol": "x402",
        "x-price-usdc": "$0.02",
        "responses": {
          "200": {
            "description": "Paid safety intelligence response"
          },
          "400": {
            "description": "Invalid input"
          },
          "402": {
            "description": "x402 payment required"
          },
          "502": {
            "description": "Public-chain data provider unavailable"
          }
        }
      }
    },
    "/v1/x402/base/merchant-trust": {
      "get": {
        "operationId": "buyX402MerchantTrust",
        "summary": "Summarize a Base merchant's public USDC receipt history and payer concentration.",
        "parameters": [
          {
            "name": "address",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^0x[a-fA-F0-9]{40}$",
              "description": "Base merchant payment recipient address."
            }
          }
        ],
        "x-payment-protocol": "x402",
        "x-price-usdc": "$0.03",
        "responses": {
          "200": {
            "description": "Paid safety intelligence response"
          },
          "400": {
            "description": "Invalid input"
          },
          "402": {
            "description": "x402 payment required"
          },
          "502": {
            "description": "Public-chain data provider unavailable"
          }
        }
      }
    },
    "/v1/x402/base/payment-proof": {
      "get": {
        "operationId": "buyBasePaymentProof",
        "summary": "Verify a Base transaction contains the expected canonical USDC payment.",
        "parameters": [
          {
            "name": "tx",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^0x[a-fA-F0-9]{64}$",
              "description": "Base transaction hash."
            }
          },
          {
            "name": "recipient",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^0x[a-fA-F0-9]{40}$",
              "description": "Expected USDC recipient."
            }
          },
          {
            "name": "amount",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+(?:\\.[0-9]{1,6})?$",
              "description": "Expected USDC amount in decimal units."
            }
          }
        ],
        "x-payment-protocol": "x402",
        "x-price-usdc": "$0.01",
        "responses": {
          "200": {
            "description": "Paid safety intelligence response"
          },
          "400": {
            "description": "Invalid input"
          },
          "402": {
            "description": "x402 payment required"
          },
          "502": {
            "description": "Public-chain data provider unavailable"
          }
        }
      }
    },
    "/v1/x402/base/wallet-activity-delta": {
      "get": {
        "operationId": "buyBaseWalletActivityDelta",
        "summary": "Return recent Base ERC-20 activity for a wallet after a caller-supplied timestamp.",
        "parameters": [
          {
            "name": "address",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^0x[a-fA-F0-9]{40}$",
              "description": "Base wallet to monitor."
            }
          },
          {
            "name": "since",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}T.+Z$",
              "description": "Return transfers observed at or after this timestamp."
            }
          }
        ],
        "x-payment-protocol": "x402",
        "x-price-usdc": "$0.01",
        "responses": {
          "200": {
            "description": "Paid safety intelligence response"
          },
          "400": {
            "description": "Invalid input"
          },
          "402": {
            "description": "x402 payment required"
          },
          "502": {
            "description": "Public-chain data provider unavailable"
          }
        }
      }
    },
    "/v1/x402/base/approval-risk": {
      "get": {
        "operationId": "buyBaseApprovalRisk",
        "summary": "Read a live ERC-20 allowance on Base and flag unlimited or unusually large approvals.",
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^0x[a-fA-F0-9]{40}$",
              "description": "ERC-20 token contract."
            }
          },
          {
            "name": "owner",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^0x[a-fA-F0-9]{40}$",
              "description": "Token owner that granted the allowance."
            }
          },
          {
            "name": "spender",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^0x[a-fA-F0-9]{40}$",
              "description": "Address authorized to spend the owner's tokens."
            }
          }
        ],
        "x-payment-protocol": "x402",
        "x-price-usdc": "$0.005",
        "responses": {
          "200": {
            "description": "Paid safety intelligence response"
          },
          "400": {
            "description": "Invalid input"
          },
          "402": {
            "description": "x402 payment required"
          },
          "502": {
            "description": "Public-chain data provider unavailable"
          }
        }
      }
    },
    "/v1/x402/base/contract-verification": {
      "get": {
        "operationId": "buyBaseContractVerification",
        "summary": "Inspect Base source verification, compiler metadata, proxy type, and resolved implementations.",
        "parameters": [
          {
            "name": "address",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^0x[a-fA-F0-9]{40}$",
              "description": "Base contract address to verify."
            }
          }
        ],
        "x-payment-protocol": "x402",
        "x-price-usdc": "$0.005",
        "responses": {
          "200": {
            "description": "Paid safety intelligence response"
          },
          "400": {
            "description": "Invalid input"
          },
          "402": {
            "description": "x402 payment required"
          },
          "502": {
            "description": "Public-chain data provider unavailable"
          }
        }
      }
    },
    "/v1/x402/base/usdc-receipt": {
      "get": {
        "operationId": "buyBaseUsdcReceipt",
        "summary": "Extract canonical Base USDC transfers and transaction finality from a transaction hash.",
        "parameters": [
          {
            "name": "tx",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^0x[a-fA-F0-9]{64}$",
              "description": "Base transaction hash."
            }
          }
        ],
        "x-payment-protocol": "x402",
        "x-price-usdc": "$0.003",
        "responses": {
          "200": {
            "description": "Paid safety intelligence response"
          },
          "400": {
            "description": "Invalid input"
          },
          "402": {
            "description": "x402 payment required"
          },
          "502": {
            "description": "Public-chain data provider unavailable"
          }
        }
      }
    },
    "/v1/x402/base/wallet-counterparty": {
      "get": {
        "operationId": "buyBaseWalletCounterparty",
        "summary": "Rank counterparties in a Base wallet's recent transactions and ERC-20 transfers.",
        "parameters": [
          {
            "name": "address",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^0x[a-fA-F0-9]{40}$",
              "description": "Base wallet or contract to analyze."
            }
          }
        ],
        "x-payment-protocol": "x402",
        "x-price-usdc": "$0.005",
        "responses": {
          "200": {
            "description": "Paid safety intelligence response"
          },
          "400": {
            "description": "Invalid input"
          },
          "402": {
            "description": "x402 payment required"
          },
          "502": {
            "description": "Public-chain data provider unavailable"
          }
        }
      }
    },
    "/v1/x402/base/event-log-monitor": {
      "get": {
        "operationId": "buyBaseEventLogMonitor",
        "summary": "Return recent decoded Base event logs at or after a caller-supplied block.",
        "parameters": [
          {
            "name": "address",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^0x[a-fA-F0-9]{40}$",
              "description": "Base address whose emitted logs should be monitored."
            }
          },
          {
            "name": "from_block",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$",
              "description": "Return logs from this Base block onward."
            }
          }
        ],
        "x-payment-protocol": "x402",
        "x-price-usdc": "$0.003",
        "responses": {
          "200": {
            "description": "Paid safety intelligence response"
          },
          "400": {
            "description": "Invalid input"
          },
          "402": {
            "description": "x402 payment required"
          },
          "502": {
            "description": "Public-chain data provider unavailable"
          }
        }
      }
    },
    "/v1/x402/base/gas-fee-quote": {
      "get": {
        "operationId": "buyBaseGasFeeQuote",
        "summary": "Return live Base gas fees and an estimated transaction cost for a caller-supplied gas limit.",
        "parameters": [
          {
            "name": "gas_limit",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$",
              "description": "Expected transaction gas limit."
            }
          }
        ],
        "x-payment-protocol": "x402",
        "x-price-usdc": "$0.003",
        "responses": {
          "200": {
            "description": "Paid safety intelligence response"
          },
          "400": {
            "description": "Invalid input"
          },
          "402": {
            "description": "x402 payment required"
          },
          "502": {
            "description": "Public-chain data provider unavailable"
          }
        }
      }
    },
    "/v1/x402/base/nonce-readiness": {
      "get": {
        "operationId": "buyBaseNonceReadiness",
        "summary": "Compare confirmed and pending Base nonces before an autonomous transaction is signed.",
        "parameters": [
          {
            "name": "address",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^0x[a-fA-F0-9]{40}$",
              "description": "Base account whose transaction nonce should be checked."
            }
          }
        ],
        "x-payment-protocol": "x402",
        "x-price-usdc": "$0.003",
        "responses": {
          "200": {
            "description": "Paid safety intelligence response"
          },
          "400": {
            "description": "Invalid input"
          },
          "402": {
            "description": "x402 payment required"
          },
          "502": {
            "description": "Public-chain data provider unavailable"
          }
        }
      }
    },
    "/v1/x402/base/stablecoin-balance": {
      "get": {
        "operationId": "buyBaseStablecoinBalance",
        "summary": "Return live Base USDC, USDT, and DAI balances with public USD reference rates.",
        "parameters": [
          {
            "name": "address",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^0x[a-fA-F0-9]{40}$",
              "description": "Base wallet or contract whose stablecoin balances should be read."
            }
          }
        ],
        "x-payment-protocol": "x402",
        "x-price-usdc": "$0.003",
        "responses": {
          "200": {
            "description": "Paid safety intelligence response"
          },
          "400": {
            "description": "Invalid input"
          },
          "402": {
            "description": "x402 payment required"
          },
          "502": {
            "description": "Public-chain data provider unavailable"
          }
        }
      }
    },
    "/v1/x402/base/dex-market-monitor": {
      "get": {
        "operationId": "buyBaseDexMarketMonitor",
        "summary": "Monitor Base DEX price, liquidity, volume, and trade activity for a token.",
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^0x[a-fA-F0-9]{40}$",
              "description": "Base token contract to monitor across DEX pairs."
            }
          }
        ],
        "x-payment-protocol": "x402",
        "x-price-usdc": "$0.005",
        "responses": {
          "200": {
            "description": "Paid safety intelligence response"
          },
          "400": {
            "description": "Invalid input"
          },
          "402": {
            "description": "x402 payment required"
          },
          "502": {
            "description": "Public-chain data provider unavailable"
          }
        }
      }
    },
    "/v1/x402/prediction/market-snapshot": {
      "get": {
        "operationId": "buyPredictionMarketSnapshot",
        "summary": "Return a public Kalshi prediction-market quote, volume, open interest, and orderbook snapshot.",
        "parameters": [
          {
            "name": "ticker",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9._-]{3,160}$",
              "description": "Kalshi market ticker."
            }
          }
        ],
        "x-payment-protocol": "x402",
        "x-price-usdc": "$0.005",
        "responses": {
          "200": {
            "description": "Paid safety intelligence response"
          },
          "400": {
            "description": "Invalid input"
          },
          "402": {
            "description": "x402 payment required"
          },
          "502": {
            "description": "Public-chain data provider unavailable"
          }
        }
      }
    },
    "/v1/x402/web/endpoint-preflight": {
      "get": {
        "operationId": "buyX402EndpointPreflight",
        "summary": "Inspect an unpaid x402 endpoint, decode its payment requirements, and flag unsafe or malformed commerce metadata.",
        "parameters": [
          {
            "name": "url",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^https?://",
              "maxLength": 2048,
              "description": "Public HTTP(S) x402 resource URL to inspect without paying."
            }
          }
        ],
        "x-payment-protocol": "x402",
        "x-price-usdc": "$0.005",
        "responses": {
          "200": {
            "description": "Paid safety intelligence response"
          },
          "400": {
            "description": "Invalid input"
          },
          "402": {
            "description": "x402 payment required"
          },
          "502": {
            "description": "Public-chain data provider unavailable"
          }
        }
      }
    },
    "/v1/x402/software/npm-package-preflight": {
      "get": {
        "operationId": "buyNpmPackagePreflight",
        "summary": "Check npm package metadata, maintenance signals, deprecation, license, dependencies, and OSV vulnerabilities.",
        "parameters": [
          {
            "name": "package",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 214,
              "description": "npm package name, including an optional scope."
            }
          },
          {
            "name": "version",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 80,
              "description": "Exact npm version or latest. Defaults to latest."
            }
          }
        ],
        "x-payment-protocol": "x402",
        "x-price-usdc": "$0.005",
        "responses": {
          "200": {
            "description": "Paid safety intelligence response"
          },
          "400": {
            "description": "Invalid input"
          },
          "402": {
            "description": "x402 payment required"
          },
          "502": {
            "description": "Public-chain data provider unavailable"
          }
        }
      }
    },
    "/v1/x402/software/github-repository-health": {
      "get": {
        "operationId": "buyGithubRepositoryHealth",
        "summary": "Score a public GitHub repository using maintenance, release, license, archive, issue, and popularity signals.",
        "parameters": [
          {
            "name": "owner",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9](?:[A-Za-z0-9-]{0,37}[A-Za-z0-9])?$",
              "description": "GitHub repository owner or organization."
            }
          },
          {
            "name": "repo",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9._-]{1,100}$",
              "description": "Public GitHub repository name."
            }
          }
        ],
        "x-payment-protocol": "x402",
        "x-price-usdc": "$0.005",
        "responses": {
          "200": {
            "description": "Paid safety intelligence response"
          },
          "400": {
            "description": "Invalid input"
          },
          "402": {
            "description": "x402 payment required"
          },
          "502": {
            "description": "Public-chain data provider unavailable"
          }
        }
      }
    },
    "/v1/x402/web/url-change-fingerprint": {
      "get": {
        "operationId": "buyUrlChangeFingerprint",
        "summary": "Fetch a public URL and return redirect, metadata, cache validators, and a SHA-256 content fingerprint.",
        "parameters": [
          {
            "name": "url",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^https?://",
              "maxLength": 2048,
              "description": "Public HTTP(S) document URL to fingerprint."
            }
          }
        ],
        "x-payment-protocol": "x402",
        "x-price-usdc": "$0.003",
        "responses": {
          "200": {
            "description": "Paid safety intelligence response"
          },
          "400": {
            "description": "Invalid input"
          },
          "402": {
            "description": "x402 payment required"
          },
          "502": {
            "description": "Public-chain data provider unavailable"
          }
        }
      }
    },
    "/v1/x402/web/feed-snapshot": {
      "get": {
        "operationId": "buyFeedSnapshot",
        "summary": "Normalize the latest entries from a public RSS or Atom feed with stable item fingerprints.",
        "parameters": [
          {
            "name": "url",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^https?://",
              "maxLength": 2048,
              "description": "Public RSS or Atom feed URL."
            }
          }
        ],
        "x-payment-protocol": "x402",
        "x-price-usdc": "$0.003",
        "responses": {
          "200": {
            "description": "Paid safety intelligence response"
          },
          "400": {
            "description": "Invalid input"
          },
          "402": {
            "description": "x402 payment required"
          },
          "502": {
            "description": "Public-chain data provider unavailable"
          }
        }
      }
    },
    "/v1/x402/base/transaction-intent": {
      "get": {
        "operationId": "buyEvmTransactionIntent",
        "summary": "Decode Base transaction calldata before signing and flag token transfers, approvals, unlimited spending, and unknown selectors.",
        "parameters": [
          {
            "name": "to",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^0x[a-fA-F0-9]{40}$",
              "description": "Base destination contract or account."
            }
          },
          {
            "name": "data",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^0x(?:[a-fA-F0-9]{2})*$",
              "maxLength": 8194,
              "description": "Hex-encoded EVM calldata."
            }
          },
          {
            "name": "value",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$",
              "description": "Native ETH value in wei. Defaults to zero."
            }
          }
        ],
        "x-payment-protocol": "x402",
        "x-price-usdc": "$0.005",
        "responses": {
          "200": {
            "description": "Paid safety intelligence response"
          },
          "400": {
            "description": "Invalid input"
          },
          "402": {
            "description": "x402 payment required"
          },
          "502": {
            "description": "Public-chain data provider unavailable"
          }
        }
      }
    },
    "/v1/x402/agent/a2a-card-preflight": {
      "get": {
        "operationId": "buyA2aAgentCardPreflight",
        "summary": "Discover and validate a public A2A Agent Card, its skills, provider, authentication, endpoint consistency, and unsafe URLs.",
        "parameters": [
          {
            "name": "url",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^https?://",
              "maxLength": 2048,
              "description": "Public agent origin or direct Agent Card URL."
            }
          }
        ],
        "x-payment-protocol": "x402",
        "x-price-usdc": "$0.005",
        "responses": {
          "200": {
            "description": "Paid safety intelligence response"
          },
          "400": {
            "description": "Invalid input"
          },
          "402": {
            "description": "x402 payment required"
          },
          "502": {
            "description": "Public-chain data provider unavailable"
          }
        }
      }
    },
    "/v1/x402/web/openapi-preflight": {
      "get": {
        "operationId": "buyOpenapiSpecPreflight",
        "summary": "Validate a public OpenAPI JSON or YAML document, server URLs, authentication declarations, operation coverage, and content fingerprint.",
        "parameters": [
          {
            "name": "url",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^https?://",
              "maxLength": 2048,
              "description": "Public OpenAPI JSON or YAML document URL."
            }
          }
        ],
        "x-payment-protocol": "x402",
        "x-price-usdc": "$0.005",
        "responses": {
          "200": {
            "description": "Paid safety intelligence response"
          },
          "400": {
            "description": "Invalid input"
          },
          "402": {
            "description": "x402 payment required"
          },
          "502": {
            "description": "Public-chain data provider unavailable"
          }
        }
      }
    },
    "/v1/x402/web/domain-trust-preflight": {
      "get": {
        "operationId": "buyDomainTrustPreflight",
        "summary": "Inspect public DNS, DNSSEC, mail, CNAME resolution, RDAP registration age, expiration, and domain trust signals.",
        "parameters": [
          {
            "name": "domain",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^(?=.{1,253}$)(?:[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?\\.)+[A-Za-z]{2,63}$",
              "description": "Registrable or delegated public DNS domain name."
            }
          }
        ],
        "x-payment-protocol": "x402",
        "x-price-usdc": "$0.005",
        "responses": {
          "200": {
            "description": "Paid safety intelligence response"
          },
          "400": {
            "description": "Invalid input"
          },
          "402": {
            "description": "x402 payment required"
          },
          "502": {
            "description": "Public-chain data provider unavailable"
          }
        }
      }
    },
    "/v1/x402/software/pypi-package-preflight": {
      "get": {
        "operationId": "buyPypiPackagePreflight",
        "summary": "Check PyPI package metadata, release age, yanked status, Python requirements, dependencies, license, and OSV vulnerabilities.",
        "parameters": [
          {
            "name": "package",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9](?:[A-Za-z0-9._-]{0,198}[A-Za-z0-9])?$",
              "description": "PyPI project name."
            }
          },
          {
            "name": "version",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^(?:latest|[A-Za-z0-9][A-Za-z0-9._+!-]{0,99})$",
              "description": "Exact PyPI version or latest. Defaults to latest."
            }
          }
        ],
        "x-payment-protocol": "x402",
        "x-price-usdc": "$0.005",
        "responses": {
          "200": {
            "description": "Paid safety intelligence response"
          },
          "400": {
            "description": "Invalid input"
          },
          "402": {
            "description": "x402 payment required"
          },
          "502": {
            "description": "Public-chain data provider unavailable"
          }
        }
      }
    },
    "/v1/x402/payment-guard/evaluate": {
      "get": {
        "operationId": "buyAgentPaymentGuard",
        "summary": "AI agent x402 payment firewall: enforce budgets and mandates, simulate transactions, score merchant and domain risk, prevent replay, require human approval, and audit delivery before autonomous spending.",
        "parameters": [
          {
            "name": "url",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^https?://",
              "maxLength": 2048,
              "description": "Public x402 resource URL to evaluate before payment."
            }
          },
          {
            "name": "session_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9._:-]{1,96}$",
              "description": "Caller-defined budget and audit scope."
            }
          },
          {
            "name": "request_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9._:-]{1,128}$",
              "description": "Caller-defined idempotency key."
            }
          },
          {
            "name": "max_single_usdc",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+(?:\\.[0-9]{1,6})?$",
              "description": "Maximum allowed price for one payment."
            }
          },
          {
            "name": "session_budget_usdc",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+(?:\\.[0-9]{1,6})?$",
              "description": "Maximum reserved spend for this session."
            }
          },
          {
            "name": "daily_budget_usdc",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+(?:\\.[0-9]{1,6})?$",
              "description": "Maximum reserved spend for this session in one UTC day."
            }
          },
          {
            "name": "allow_pay_to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 2048,
              "description": "Optional comma-separated recipient allowlist."
            }
          },
          {
            "name": "block_pay_to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 2048,
              "description": "Optional comma-separated recipient blocklist."
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^0x[a-fA-F0-9]{40}$",
              "description": "Optional transaction destination for intent decoding."
            }
          },
          {
            "name": "data",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^0x(?:[a-fA-F0-9]{2})*$",
              "maxLength": 8194,
              "description": "Optional EVM calldata."
            }
          },
          {
            "name": "value",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$",
              "description": "Optional native ETH value in wei."
            }
          }
        ],
        "x-payment-protocol": "x402",
        "x-price-usdc": "$0.01",
        "responses": {
          "200": {
            "description": "Paid safety intelligence response"
          },
          "400": {
            "description": "Invalid input"
          },
          "402": {
            "description": "x402 payment required"
          },
          "502": {
            "description": "Public-chain data provider unavailable"
          }
        }
      },
      "post": {
        "operationId": "evaluateAgentPaymentGuardJson",
        "summary": "Evaluate a payment using a JSON body and an optional owner-controlled policy profile.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri"
                  },
                  "session_id": {
                    "type": "string"
                  },
                  "request_id": {
                    "type": "string"
                  },
                  "profile_id": {
                    "type": "string"
                  },
                  "agent_token": {
                    "type": "string"
                  },
                  "max_single_usdc": {
                    "type": "string"
                  },
                  "session_budget_usdc": {
                    "type": "string"
                  },
                  "daily_budget_usdc": {
                    "type": "string"
                  },
                  "reservation_ttl_seconds": {
                    "type": "integer",
                    "minimum": 30,
                    "maximum": 3600
                  },
                  "retention_days": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 365
                  },
                  "human_review_above_usdc": {
                    "type": "string"
                  },
                  "fail_closed": {
                    "type": "boolean",
                    "default": true
                  },
                  "allowed_domains": {
                    "oneOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    ]
                  },
                  "allowed_tools": {
                    "oneOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    ]
                  },
                  "allowed_purposes": {
                    "oneOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    ]
                  },
                  "active_from_hour_utc": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 23
                  },
                  "active_until_hour_utc": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 24
                  },
                  "tool_id": {
                    "type": "string"
                  },
                  "purpose": {
                    "type": "string"
                  },
                  "allow_pay_to": {
                    "type": "string"
                  },
                  "block_pay_to": {
                    "type": "string"
                  },
                  "to": {
                    "type": "string"
                  },
                  "data": {
                    "type": "string"
                  },
                  "value": {
                    "type": "string"
                  }
                },
                "required": [
                  "url",
                  "session_id",
                  "request_id"
                ]
              }
            }
          }
        },
        "x-payment-protocol": "x402",
        "x-price-usdc": "$0.01",
        "responses": {
          "200": {
            "description": "Signed Payment Guard decision"
          },
          "400": {
            "description": "Invalid request"
          },
          "402": {
            "description": "x402 payment required"
          },
          "403": {
            "description": "Policy authentication failed"
          }
        }
      }
    },
    "/v1/x402/payment-guard/policies": {
      "post": {
        "operationId": "createPaymentGuardPolicy",
        "summary": "Create an owner-controlled policy profile and one-time owner and agent tokens.",
        "x-payment-protocol": "x402",
        "x-price-usdc": "$0.01",
        "responses": {
          "200": {
            "description": "Policy profile and one-time tokens"
          },
          "402": {
            "description": "x402 payment required"
          }
        }
      }
    },
    "/v1/payment-guard/lifecycle": {
      "post": {
        "operationId": "updatePaymentGuardReservation",
        "summary": "Commit a reservation with a verified Base USDC transaction or release it.",
        "responses": {
          "200": {
            "description": "Updated reservation state"
          },
          "400": {
            "description": "Invalid or expired decision token"
          }
        }
      }
    },
    "/v1/payment-guard/policies/manage": {
      "post": {
        "operationId": "managePaymentGuardPolicy",
        "summary": "Update or revoke a policy profile and rotate owner or agent credentials.",
        "responses": {
          "200": {
            "description": "Updated policy or credentials"
          },
          "403": {
            "description": "Owner authentication failed"
          }
        }
      }
    },
    "/v1/payment-guard/status": {
      "post": {
        "operationId": "getPaymentGuardStatus",
        "summary": "Read authenticated policy budget, reservation, and recent audit status.",
        "responses": {
          "200": {
            "description": "Authenticated policy status"
          },
          "403": {
            "description": "Owner authentication failed"
          }
        }
      }
    },
    "/v1/payment-guard/approvals": {
      "post": {
        "operationId": "decidePaymentGuardApproval",
        "summary": "Approve or deny a REVIEW decision using the policy owner token.",
        "responses": {
          "200": {
            "description": "Approval decision and optional signed reservation"
          },
          "400": {
            "description": "Approval failed"
          }
        }
      }
    },
    "/v1/payment-guard/delivery": {
      "post": {
        "operationId": "reportPaymentGuardDelivery",
        "summary": "Attach client-reported post-payment delivery evidence to a committed payment.",
        "responses": {
          "200": {
            "description": "Delivery evidence recorded"
          },
          "400": {
            "description": "Invalid delivery evidence"
          }
        }
      }
    },
    "/v1/payment-guard/webhooks": {
      "post": {
        "operationId": "managePaymentGuardWebhook",
        "summary": "Create or disable a signed policy webhook.",
        "responses": {
          "200": {
            "description": "Webhook configuration"
          },
          "400": {
            "description": "Webhook configuration failed"
          }
        }
      }
    },
    "/mcp": {
      "post": {
        "operationId": "paymentGuardMcp",
        "summary": "MCP JSON-RPC endpoint for Payment Guard discovery and status.",
        "responses": {
          "200": {
            "description": "MCP JSON-RPC response"
          }
        }
      }
    }
  }
}