DEVELOPER PORTAL / X402 V2
Liquidation Headroom API
Rare Frequency Works · Morpho Blue · Base · 0.05 USDC per paid request
Free preview
Try the free manual-simulation playground without a wallet. The sample API returns illustrative results, not live debt data.
GET https://radar-api.rarefrequencyworks.com/api/v1/preview GET https://radar-api.rarefrequencyworks.com/health
Paid endpoint
The paid Cloudflare Worker verifies the authorization, then completes calculations before settling any authorized payment. If on-chain RPC or the accrual SDK fails, no settlement is requested.
GET https://radar-api.rarefrequencyworks.com/api/v1/liquidation-headroom?collateralAmount=10&collateralPrice=3400&borrowAmount=22000&lltv=0.86 # Real live position (requires an actual Morpho market and borrower) GET https://radar-api.rarefrequencyworks.com/api/v1/liquidation-headroom?marketId=0x<64 hex>&borrower=0x<40 hex>
x402 v2 request lifecycle
Request without a payment header → HTTP 402 with a Base64-encoded PAYMENT-REQUIRED header. Your x402 v2 client signs an EIP-3009 USDC authorization to the configured recipient, then retries with PAYMENT-SIGNATURE. The successful response contains PAYMENT-RESPONSE and JSON results. No account, MetaMask or manual transfer is required from agent clients with a compatible payment wallet.
# Step 1: inspect the required payment terms; no charges curl -i 'https://radar-api.rarefrequencyworks.com/api/v1/liquidation-headroom?collateralAmount=10&collateralPrice=3400&borrowAmount=22000&lltv=0.86' # Step 2: let your x402 v2-compatible HTTP client sign the 402 requirements # Step 3: retry the same URL with PAYMENT-SIGNATURE: <base64-v2-payload> # Successful requests return PAYMENT-RESPONSE: <base64-v2-settlement> # Old v1 headers X-PAYMENT and X-PAYMENT-RESPONSE are NOT supported.
Response & discoverability
GET https://radar-api.rarefrequencyworks.com/discovery.json
GET https://radar-api.rarefrequencyworks.com/.well-known/x402
GET https://radar-api.rarefrequencyworks.com/openapi.json
GET https://radar-api.rarefrequencyworks.com/llms.txt
{
"network": "base",
"protocol": "morpho-blue",
"source": "onchain_accrued",
"input": { "...": "..." },
"result": { "healthFactor": 1.25, "liquidationPrice": 2750, "...": "..." },
"position": { "borrowAssets": "..." }
}Response above is illustrative. OpenAPI and llms.txt describe the API for software clients. Bazaar discovery metadata is advertised on the payment challenge. CDP indexing requires a successful paid call with that metadata; directory listing is not yet confirmed.
Connect a wallet
The playground offers Coinbase Wallet and detected browser wallets. When WalletConnect is enabled, mobile wallets can connect by QR or app link. This checkout currently supports standard EVM accounts with EIP-3009 signatures. Coinbase exchange balances and smart-account payment flows are separate integrations.
Correctness & payment safety
On-chain results use Morpho SDK accrued debt instead of stale raw totalBorrowAssets. The gateway validates recipient, token, network, amount, query URL, and authorization nonce. A D1 receipt ledger enforces one settlement per authorization and returns cached results on a verified duplicate. Uncertain settlement results are held for manual reconciliation; do not retry payment blindly. Results are informational, not liquidation execution instructions or financial advice.