"""RugMunch Intelligence API Docs — written for normal developers. No blockchain knowledge required. No crypto wallet needed. No USDC. The product is token intelligence and scam detection. The payment infrastructure (x402) is invisible backend plumbing. """ from __future__ import annotations from fastapi import APIRouter from fastapi.responses import HTMLResponse router = APIRouter(tags=["API-Docs"]) SEO_KEYWORDS = "x402 protocol, crypto intelligence API, blockchain token scanner, rug pull detection, USDC payment gateway, crypto scam detection API, web3 security API, on-chain analysis API, token risk assessment, wallet forensics API, blockchain API pay-per-call, MCP crypto tools, DeFi security API, smart contract scam detector" def _page(title: str, body: str) -> str: return f""" {title} — RugMunch Intelligence API

RugMunch Intelligence API

BETA docs.rugmunch.io
{body}
""" @router.get("/docs") @router.get("/docs/v2/landing") async def landing_page(): """Landing page — the product is token intelligence, not x402.""" return HTMLResponse(content=_page("RugMunch Intelligence API", """

Token Intelligence for Every Developer

Scan tokens for rug pulls. Analyze wallets for risk. Detect scams before they steal. No blockchain knowledge needed. Just an API call. Built on the x402 protocol — the open standard for pay-per-call blockchain API access with USDC settlement.

🔍 Token Scanning

Detect honeypots, rug pulls, fake liquidity, wash trading, and social engineering in any token contract.

👛 Wallet Analysis

Score any wallet for risk, trace fund flows, identify scam connections, and detect suspicious patterns.

📊 Market Intelligence

Real-time token prices, holder concentration, liquidity changes, and whale movement alerts.

🚨 Alert Pipeline

Get webhook notifications when tokens get flagged, liquidity drops, or suspicious activity detected.

Free tier: 100 API calls free every month. No credit card required.
Pay as you go: $0.01-$0.05 per call after that. Pay with any credit card.

Get Started Free → API Reference

Works With Any Language

curl -X POST https://api.rugmunch.io/v1/token/scan \\
  -H "X-API-Key: your-key" \\
  -H "Content-Type: application/json" \\
  -d '{"address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", "chain": "ethereum"}'

# → {"risk_score": 12, "risk_level": "low", "liquidity_usd": 50000000}
No crypto wallet? No problem. Pay with a credit card or USDC. The x402 protocol handles USDC settlement on Base, Solana, Ethereum, and Polygon. Your API key is all you need. We handle the blockchain.
""")) @router.get("/docs/v2/quickstart") async def quickstart(): return HTMLResponse(content=_page("Quickstart", """

Quickstart — Try It in 30 Seconds

No crypto wallet needed. No USDC. Just a credit card or free API key.

1 Get a free API key

Send a POST request with your email. We'll send you a key instantly.

curl https://api.rugmunch.io/v1/auth/signup \\
  -H "Content-Type: application/json" \\
  -d '{"email": "you@example.com"}'
# Response: {"api_key": "rm_free_abc123...", "free_calls_remaining": 100}
2 Scan a token (free — 100 calls included)

Use your API key to scan any token for rug pull indicators. No payment needed for your first 100 calls.

curl https://api.rugmunch.io/v1/token/scan \\
  -H "X-API-Key: rm_free_abc123" \\
  -H "Content-Type: application/json" \\
  -d '{"address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", "chain": "ethereum"}'
# Response: {"risk_score": 12, "risk_level": "low", "flags": [], "liquidity_usd": 50000000}
3 Buy more calls ($0.01 each)

When you run out of free calls, buy credits with a credit card or USDC on-chain. Starts at $10 for 1,000 calls. The x402 protocol settles payments automatically on Base, Solana, Ethereum, BSC, Arbitrum, Polygon, and Optimism.

curl https://api.rugmunch.io/v1/credits/buy \\
  -H "X-API-Key: rm_free_abc123" \\
  -H "Content-Type: application/json" \\
  -d '{"amount_usd": 10, "payment_method": "card"}'
# Response: {"credits_added": 1000, "total_balance": 1000, "price_per_call": "$0.01"}
No crypto knowledge required to get started. Pay with any credit card. Advanced users can pay with USDC via the x402 protocol for on-chain settlement. Your API key tracks your balance across both payment methods. No wallet, no gas fees, no seed phrases to lose.
""")) @router.get("/docs/v2/api-reference") async def api_reference(): return HTMLResponse(content=_page("API Reference", """

API Reference

All endpoints accept JSON and return JSON. Authenticate with X-API-Key header.

Token Scanning

EndpointMethodCostDescription
/v1/token/scanPOST$0.02Full token risk analysis (honeypot, liquidity, holders)
/v1/token/priceGET$0.01Current price + 24h change
/v1/token/holdersGET$0.01Top holders and concentration

Wallet Analysis

EndpointMethodCostDescription
/v1/wallet/analyzePOST$0.03Full wallet risk assessment
/v1/wallet/balanceGET$0.01Wallet balance across chains
/v1/wallet/historyGET$0.05Transaction history + patterns

Examples

# Python — pip install requests
import requests

API_KEY = "rm_free_abc123"
api = "https://api.rugmunch.io/v1"

# Scan a token
resp = requests.post(f"{api}/token/scan",
    headers={"X-API-Key": API_KEY},
    json={"address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", "chain": "ethereum"}
)
print(resp.json())

# Check remaining credits
resp = requests.get(f"{api}/credits/balance",
    headers={"X-API-Key": API_KEY}
)
print(f"Credits remaining: {resp.json()['balance']}")
# JavaScript — fetch
const API_KEY = "rm_free_abc123";

const resp = await fetch("https://api.rugmunch.io/v1/token/scan", {
  method: "POST",
  headers: { "X-API-Key": API_KEY, "Content-Type": "application/json" },
  body: JSON.stringify({ address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", chain: "ethereum" })
});
const data = await resp.json();
console.log(data);
""")) @router.get("/old-docs") async def redirect_old_docs(): """Redirect old x402 docs to the new developer-friendly docs.""" from fastapi.responses import RedirectResponse return RedirectResponse(url="/docs")