{
  "openapi": "3.1.0",
  "info": {
    "title": "ArbiPulse — Cross-Market Arbitrage Intelligence API",
    "version": "1.0.0",
    "description": "12 endpoints scanning arbitrage opportunities across DeFi yield spreads, DEX price differentials, perpetual funding rates, sports surebets, ETF/NAV gaps, and commodity regional pricing. Execution-tier calldata for AI agents. Payments via x402 protocol on Base mainnet (USDC $0.05–$0.20 per query). Part of PulseNetwork.",
    "contact": { "email": "info@theaslangroupllc.com" },
    "x-payment-protocol": "x402",
    "x-payment-network": "eip155:8453",
    "x-payment-asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
    "x-agent-use-case": "arbitrage-intelligence",
    "x-pulse-network": "https://pulsenetwork.vercel.app"
  },
  "servers": [{ "url": "https://arbipulse.vercel.app" }],
  "paths": {
    "/api/scanner": {
      "get": {
        "summary": "Unified Arbitrage Scanner",
        "description": "Meta-endpoint ranking all live arbitrage opportunities across DeFi, DEX, perps, ETF, commodity, and sports markets. Returns top opportunities with profit estimates, complexity scores, and execution endpoint links. x-agent-use-case: poll-every-15-minutes to find high-value opportunities.",
        "operationId": "getScanner",
        "x-price-usdc": "0.10",
        "x-agent-use-case": "poll-every-15-minutes",
        "parameters": [
          { "name": "category", "in": "query", "schema": { "type": "string", "enum": ["all","defi","dex","perps","sports","etf","commodity"], "default": "all" } },
          { "name": "min_profit_usd", "in": "query", "schema": { "type": "number", "description": "Minimum net profit per $1,000 stake" } },
          { "name": "chain", "in": "query", "schema": { "type": "string", "enum": ["all","ethereum","base","arbitrum","optimism"], "default": "all" } }
        ],
        "security": [{ "x402": [] }],
        "responses": {
          "200": { "description": "Ranked arbitrage opportunities", "content": { "application/json": { "schema": { "type": "object" } } } },
          "402": { "description": "Payment required — see PAYMENT-REQUIRED header" }
        }
      }
    },
    "/api/defi": {
      "get": {
        "summary": "DeFi Yield Arbitrage",
        "description": "Cross-protocol borrow/deposit spread analysis via DeFi Llama (10,000+ pools). Identifies Aave→Morpho, Compound→Yearn and similar cross-protocol yield arbs. Flash loan eligible — zero capital required. x-agent-use-case: poll-hourly.",
        "operationId": "getDefiArb",
        "x-price-usdc": "0.10",
        "x-agent-use-case": "poll-hourly",
        "parameters": [
          { "name": "asset", "in": "query", "schema": { "type": "string", "enum": ["all","USDC","USDT","ETH","WBTC","DAI"], "default": "all" } },
          { "name": "chain", "in": "query", "schema": { "type": "string", "enum": ["all","ethereum","base","arbitrum","optimism","polygon"], "default": "all" } },
          { "name": "min_spread_bps", "in": "query", "schema": { "type": "integer" } },
          { "name": "stablecoin_only", "in": "query", "schema": { "type": "boolean", "default": false } }
        ],
        "security": [{ "x402": [] }],
        "responses": {
          "200": { "description": "DeFi yield spread opportunities", "content": { "application/json": { "schema": { "type": "object" } } } },
          "402": { "description": "Payment required" }
        }
      }
    },
    "/api/perps": {
      "get": {
        "summary": "Perpetual Futures Funding Rate Carry",
        "description": "Delta-neutral carry strategies across Hyperliquid (no KYC wallet-only), Binance, Bybit, GMX, dYdX. Live 8h funding rates. x-agent-use-case: poll-every-8-hours.",
        "operationId": "getPerpsArb",
        "x-price-usdc": "0.10",
        "x-agent-use-case": "poll-every-8-hours",
        "parameters": [
          { "name": "asset", "in": "query", "schema": { "type": "string", "enum": ["all","BTC","ETH","SOL","ARB","OP"], "default": "all" } },
          { "name": "min_apy", "in": "query", "schema": { "type": "number" } },
          { "name": "platform", "in": "query", "schema": { "type": "string", "enum": ["all","hyperliquid","binance","bybit","gmx","dydx"], "default": "all" } }
        ],
        "security": [{ "x402": [] }],
        "responses": {
          "200": { "description": "Funding rate carry opportunities", "content": { "application/json": { "schema": { "type": "object" } } } },
          "402": { "description": "Payment required" }
        }
      }
    },
    "/api/flash": {
      "get": {
        "summary": "Flash Loan Strategy Builder",
        "description": "ABI-encoded calldata for Aave V3 (0.09% fee) and Balancer (0% fee) flash loans. Includes Solidity executor interface, gas estimates, step-by-step execution. Zero capital required. x-agent-use-case: on-demand before execution.",
        "operationId": "getFlashLoan",
        "x-price-usdc": "0.75",
        "x-agent-use-case": "on-demand",
        "parameters": [
          { "name": "protocol", "in": "query", "schema": { "type": "string", "enum": ["aave","balancer"], "default": "aave" } },
          { "name": "asset", "in": "query", "schema": { "type": "string", "enum": ["USDC","USDT","WETH","WBTC","DAI"], "default": "USDC" } },
          { "name": "amount", "in": "query", "schema": { "type": "number" } },
          { "name": "chain", "in": "query", "schema": { "type": "string", "enum": ["ethereum","base","arbitrum","optimism","polygon"], "default": "base" } },
          { "name": "strategy", "in": "query", "schema": { "type": "string", "enum": ["dex-arb","yield-arb","liquidation","custom"], "default": "dex-arb" } },
          { "name": "receiver", "in": "query", "schema": { "type": "string" } }
        ],
        "security": [{ "x402": [] }],
        "responses": {
          "200": { "description": "Flash loan calldata and execution plan", "content": { "application/json": { "schema": { "type": "object" } } } },
          "402": { "description": "Payment required" }
        }
      }
    },
    "/api/sports": {
      "get": {
        "summary": "Sports Surebet Scanner",
        "description": "Mathematical guaranteed-profit arbitrage across 80+ global bookmakers. Exact stake allocation per outcome. Soccer, basketball, tennis, cricket, MMA globally. x-agent-use-case: poll-every-30-minutes.",
        "operationId": "getSportsSurebets",
        "x-price-usdc": "0.10",
        "x-agent-use-case": "poll-every-30-minutes",
        "parameters": [
          { "name": "sport", "in": "query", "schema": { "type": "string", "enum": ["soccer","basketball","tennis","american_football","baseball","cricket","rugby_union","mma","all"], "default": "soccer" } },
          { "name": "region", "in": "query", "schema": { "type": "string" } },
          { "name": "min_profit_pct", "in": "query", "schema": { "type": "number" } }
        ],
        "security": [{ "x402": [] }],
        "responses": {
          "200": { "description": "Surebet opportunities with exact stakes", "content": { "application/json": { "schema": { "type": "object" } } } },
          "402": { "description": "Payment required" }
        }
      }
    },
    "/api/crypto": {
      "get": {
        "summary": "CEX Spot Price Arbitrage",
        "description": "Live price comparison across Binance, Coinbase, Kraken, Bybit. Net profit after fees and transfer time. x-agent-use-case: on-demand.",
        "operationId": "getCexArb",
        "x-price-usdc": "0.07",
        "x-agent-use-case": "on-demand",
        "parameters": [
          { "name": "pair", "in": "query", "schema": { "type": "string", "default": "BTC/USDT" } },
          { "name": "amount_usd", "in": "query", "schema": { "type": "number" } },
          { "name": "exchanges", "in": "query", "schema": { "type": "string" } }
        ],
        "security": [{ "x402": [] }],
        "responses": {
          "200": { "description": "CEX price comparison and arb viability", "content": { "application/json": { "schema": { "type": "object" } } } },
          "402": { "description": "Payment required" }
        }
      }
    },
    "/api/dex": {
      "get": {
        "summary": "DEX Price Arbitrage",
        "description": "Cross-pool and cross-chain price differentials. Uniswap, Curve, Aerodrome, Trader Joe. MEV competition flagged. Flash loan eligible for same-chain. x-agent-use-case: on-demand.",
        "operationId": "getDexArb",
        "x-price-usdc": "0.10",
        "x-agent-use-case": "on-demand",
        "parameters": [
          { "name": "token", "in": "query", "schema": { "type": "string", "enum": ["WETH","USDC","WBTC","ARB","OP","DAI","LINK","UNI"], "default": "WETH" } },
          { "name": "amount_usd", "in": "query", "schema": { "type": "number" } },
          { "name": "chains", "in": "query", "schema": { "type": "string" } }
        ],
        "security": [{ "x402": [] }],
        "responses": {
          "200": { "description": "DEX price differentials and execution paths", "content": { "application/json": { "schema": { "type": "object" } } } },
          "402": { "description": "Payment required" }
        }
      }
    },
    "/api/execute": {
      "get": {
        "summary": "Execution Package Builder",
        "description": "Complete agent-executable plan: calldata, gas params, financial summary, risk assessment, abort conditions. Designed for autonomous agent execution. x-agent-use-case: on-demand before execution.",
        "operationId": "getExecutionPackage",
        "x-price-usdc": "0.75",
        "x-agent-use-case": "on-demand",
        "parameters": [
          { "name": "opportunity_type", "in": "query", "required": true, "schema": { "type": "string", "enum": ["perps","flash","defi","dex","sports"] } },
          { "name": "asset", "in": "query", "schema": { "type": "string" } },
          { "name": "amount_usd", "in": "query", "schema": { "type": "number" } },
          { "name": "wallet_address", "in": "query", "schema": { "type": "string" } },
          { "name": "chain", "in": "query", "schema": { "type": "string", "enum": ["ethereum","base","arbitrum","optimism"], "default": "base" } },
          { "name": "slippage_bps", "in": "query", "schema": { "type": "integer", "default": 50 } },
          { "name": "long_venue", "in": "query", "schema": { "type": "string" } },
          { "name": "short_venue", "in": "query", "schema": { "type": "string" } }
        ],
        "security": [{ "x402": [] }],
        "responses": {
          "200": { "description": "Complete execution package with calldata", "content": { "application/json": { "schema": { "type": "object" } } } },
          "402": { "description": "Payment required" }
        }
      }
    },
    "/api/calculator": {
      "get": {
        "summary": "Arbitrage Profit Calculator",
        "description": "Pure computation — instant response, no AI. Itemizes taker fees, gas, slippage, flash loan fees, bridge costs, withdrawal fees. Break-even analysis. Scale analysis at 5x/10x/50x. x-agent-use-case: on-demand.",
        "operationId": "getCalculator",
        "x-price-usdc": "0.05",
        "x-agent-use-case": "on-demand",
        "parameters": [
          { "name": "trade_size_usd", "in": "query", "schema": { "type": "number", "default": 10000 } },
          { "name": "entry_price", "in": "query", "schema": { "type": "number" } },
          { "name": "exit_price", "in": "query", "schema": { "type": "number" } },
          { "name": "arb_type", "in": "query", "schema": { "type": "string", "enum": ["spot","yield","perps","flash","sports"], "default": "spot" } },
          { "name": "taker_fee_bps", "in": "query", "schema": { "type": "number", "default": 10 } },
          { "name": "gas_usd", "in": "query", "schema": { "type": "number", "default": 0.5 } },
          { "name": "slippage_bps", "in": "query", "schema": { "type": "number", "default": 5 } },
          { "name": "flash_fee_bps", "in": "query", "schema": { "type": "number", "default": 0 } },
          { "name": "bridge_fee_usd", "in": "query", "schema": { "type": "number", "default": 0 } },
          { "name": "withdrawal_fee_usd", "in": "query", "schema": { "type": "number", "default": 0 } },
          { "name": "days", "in": "query", "schema": { "type": "number", "default": 1 } }
        ],
        "security": [{ "x402": [] }],
        "responses": {
          "200": { "description": "Profit/loss breakdown with break-even analysis", "content": { "application/json": { "schema": { "type": "object" } } } },
          "402": { "description": "Payment required" }
        }
      }
    },
    "/api/etf": {
      "get": {
        "summary": "ETF/NAV Premium-Discount Tracker",
        "description": "Arbitrage mechanics for US, EU, Asian ETFs. Crypto ETFs (IBIT, FBTC) vs BTC spot. Closed-end fund discount arb. Global scope. x-agent-use-case: poll-daily.",
        "operationId": "getEtfArb",
        "x-price-usdc": "0.10",
        "x-agent-use-case": "poll-daily",
        "parameters": [
          { "name": "ticker", "in": "query", "schema": { "type": "string", "default": "IBIT" } },
          { "name": "region", "in": "query", "schema": { "type": "string", "enum": ["us","eu","asia","all"], "default": "us" } },
          { "name": "type", "in": "query", "schema": { "type": "string", "enum": ["equity","bond","crypto","commodity","any"], "default": "any" } }
        ],
        "security": [{ "x402": [] }],
        "responses": {
          "200": { "description": "ETF NAV premium/discount analysis", "content": { "application/json": { "schema": { "type": "object" } } } },
          "402": { "description": "Payment required" }
        }
      }
    },
    "/api/commodity": {
      "get": {
        "summary": "Commodity Regional Arbitrage",
        "description": "Cross-regional price differentials with transport cost breakdown. Oil (WTI/Brent/Dubai), natural gas (Henry Hub/TTF/JKM), metals (LME/COMEX/SHFE), agri (CBOT/EURONEXT). Global MENA/LatAm/SEA coverage. x-agent-use-case: poll-daily.",
        "operationId": "getCommodityArb",
        "x-price-usdc": "0.10",
        "x-agent-use-case": "poll-daily",
        "parameters": [
          { "name": "commodity", "in": "query", "schema": { "type": "string", "enum": ["oil","natural-gas","copper","gold","wheat","corn","soybeans","coffee","cocoa","cotton","lng","coal"], "default": "natural-gas" } },
          { "name": "unit", "in": "query", "schema": { "type": "string", "enum": ["bbl","mmbtu","ton","oz","bushel","auto"], "default": "auto" } },
          { "name": "regions", "in": "query", "schema": { "type": "string" } }
        ],
        "security": [{ "x402": [] }],
        "responses": {
          "200": { "description": "Commodity regional price differentials", "content": { "application/json": { "schema": { "type": "object" } } } },
          "402": { "description": "Payment required" }
        }
      }
    },
    "/api/pairs": {
      "get": {
        "summary": "Statistical Arbitrage (Pairs Trading)",
        "description": "Cointegrated pairs analysis with z-score signals. Crypto (BTC/ETH), equities (SPY/QQQ, Asian pairs), forex (AUD/copper), DeFi (ETH/stETH). Entry/exit triggers, hedge ratio, size guidance. x-agent-use-case: poll-daily.",
        "operationId": "getPairsArb",
        "x-price-usdc": "0.15",
        "x-agent-use-case": "poll-daily",
        "parameters": [
          { "name": "asset_a", "in": "query", "schema": { "type": "string" } },
          { "name": "asset_b", "in": "query", "schema": { "type": "string" } },
          { "name": "asset_class", "in": "query", "schema": { "type": "string", "enum": ["crypto","equities","forex","defi"], "default": "crypto" } },
          { "name": "lookback_days", "in": "query", "schema": { "type": "integer", "default": 30 } }
        ],
        "security": [{ "x402": [] }],
        "responses": {
          "200": { "description": "Pairs trading z-score signal", "content": { "application/json": { "schema": { "type": "object" } } } },
          "402": { "description": "Payment required" }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "x402": {
        "type": "apiKey",
        "in": "header",
        "name": "PAYMENT-SIGNATURE",
        "description": "x402 micropayment on Base mainnet. USDC $0.05–$0.20 per request. Sign with any EVM wallet. See https://x402.org"
      }
    }
  }
}
