{"openapi":"3.1.0","info":{"title":"Ozmium Agent API","version":"1.0.0","description":"Do what a human does in the Ozmium app- from your agent's OWN wallet, for two cents a call. Skip browser automation and vision tokens: read and sign real Base mainnet (eip155:8453) DeFi as machine-readable, NON-CUSTODIAL calldata (no keys, no custody, no SDK). Live Coinbase spot prices, full wallet portfolio valuation (token balances + confidence-gated USD, never a fabricated 0), open Morpho Blue borrow / vault positions and Gains Network (gTrade) leveraged trades, Morpho vault and market catalogs with live APY / LLTV, the Gains pair universe with max leverage, and ready-to-sign calldata for swaps (CDP Trade API + permit2), ERC-4626 vault deposits / withdrawals, Morpho Blue collateralized loans, and Gains leveraged opens / closes. Every builder encodes the exact contracts, parameter scales, and market ids so the agent signs a correct transaction from its own wallet. PLUS live ALPHA: /v1/arbitrage ranks real, fee-netted cross-asset and DEX-vs- Coinbase arbitrage routes into any target (each executable via /v1/tx/swap), and /v1/ideas ranks scalp long / short setups across the pair universe with range-survival leverage (each executable via /v1/tx/risk/open). Refer other agents and humans with ?ref=<your-wallet> to earn a share of the paid volume you drive. Put in your two cents.","x-categories":["defi","trading","crypto","cryptocurrency","portfolio","wallet","prices","market data","lending","borrowing","loans","collateral","yield","vaults","earn","leverage","perpetuals","derivatives","swap","dex","base","usdc","ethereum","onchain","transaction builder","calldata","non-custodial","morpho","gains network","arbitrage","scalping","trading signals","trade ideas","alpha","technical analysis","market making","spread","cross-exchange","best execution","agent api","x402"],"contact":{"name":"Ozmium","url":"https://ozmium.org"},"license":{"name":"Proprietary"}},"servers":[{"url":"https://ozmium.org","description":"Base mainnet agent API."}],"x-payment":{"protocol":"x402","version":1,"scheme":"exact","network":"eip155:8453","asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","payTo":"0x53a05c0eed6cbf065f31aedbae7b0d8ce1a0f4db","hint":"Call any priced path without X-PAYMENT to get its 402 challenge, sign the EIP-3009 USDC authorization with your own wallet, then retry with the X-PAYMENT header.","discovery":"https://ozmium.org/.well-known/x402"},"paths":{"/v1/prices":{"get":{"operationId":"prices","summary":"Spot Prices","description":"Live Coinbase spot prices + 24h stats for any listed -USD products. GET /v1/prices?symbols=ETH,BTC,SOL. Returns { prices: { SYM: { usd, change24h, volume24h, high24h, low24h } } }.","x-x402":{"scheme":"exact","priceAtomicUsdc":"1000","priceUsd":0.001,"asset":"USDC"},"responses":{"200":{"description":"Success. JSON payload (data reads) or ordered { to, data, value } calldata steps (tx builders).","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Bad request- see the error message for the missing / malformed field."},"402":{"$ref":"#/components/responses/PaymentRequired"},"429":{"description":"Rate limited (unpaid traffic). Retry after the Retry-After header."}},"parameters":[{"name":"symbols","in":"query","required":true,"schema":{"type":"string"},"description":"Comma-separated tickers, e.g. ETH,BTC,SOL (max 30)."}]}},"/v1/signals":{"get":{"operationId":"signals","summary":"Technical Signal Bundle","description":"Professional technical-analysis bundle per symbol: RSI(14), MACD(12/26/9) histogram, Bollinger %B(20/2), VWAP position, SMA(20) trend, head-and-shoulders pattern read, and Fibonacci-structure confidence- blended into one directional sentiment (0..1), a long/short/neutral bias, and a conviction score, with every per-indicator part exposed. Works on crypto, forex, indices, stocks, commodities. GET /v1/signals?symbols=ETH,BTC (up to 10 per call; non-crypto via ?symbols=XAU&cls=Commodities). Cheapest TA feed on Base- a tenth of a cent per call.","x-x402":{"scheme":"exact","priceAtomicUsdc":"1000","priceUsd":0.001,"asset":"USDC"},"responses":{"200":{"description":"Success. JSON payload (data reads) or ordered { to, data, value } calldata steps (tx builders).","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Bad request- see the error message for the missing / malformed field."},"402":{"$ref":"#/components/responses/PaymentRequired"},"429":{"description":"Rate limited (unpaid traffic). Retry after the Retry-After header."}},"parameters":[{"name":"symbols","in":"query","required":true,"schema":{"type":"string"},"description":"Comma-separated tickers, e.g. ETH,BTC (max 10)."},{"name":"cls","in":"query","required":false,"schema":{"type":"string"},"description":"Non-crypto asset class: Commodities | Indices | Forex | Stocks."},{"name":"quote","in":"query","required":false,"schema":{"type":"string"},"description":"Quote currency for Forex symbols (default USD)."}]}},"/v1/arbitrage":{"get":{"operationId":"arbitrage","summary":"Arbitrage Scanner","description":"Ranked, fee-netted arbitrage routes into a target token on Base. For a USD budget we price the REAL executable swap (Coinbase CDP Trade API, no liquidity reserved) from every liquid input (USDC = the DEX-vs-Coinbase venue arb; ETH/WETH/cbETH/cbBTC/cbADA/cbXRP = cross-asset arbs), value the worst-case min-out against an INDEPENDENT Coinbase reference price, subtract gas + protocol fees, and rank by NET dollars captured. Each route is directly executable via POST /v1/tx/swap. GET /v1/arbitrage?target=cbBTC&budget=100&taker=0x..&slippageBps=100. Prices move- poll and act fast.","x-x402":{"scheme":"exact","priceAtomicUsdc":"10000","priceUsd":0.01,"asset":"USDC"},"responses":{"200":{"description":"Success. JSON payload (data reads) or ordered { to, data, value } calldata steps (tx builders).","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Bad request- see the error message for the missing / malformed field."},"402":{"$ref":"#/components/responses/PaymentRequired"},"429":{"description":"Rate limited (unpaid traffic). Retry after the Retry-After header."}},"parameters":[{"name":"target","in":"query","required":false,"schema":{"type":"string"},"description":"Token to acquire: USDC, ETH, WETH, cbETH, cbBTC, cbADA, cbXRP (default cbBTC)."},{"name":"budget","in":"query","required":false,"schema":{"type":"number","minimum":0},"description":"USD budget to deploy per route (default 100)."},{"name":"taker","in":"query","required":true,"schema":{"type":"string","pattern":"^0x[a-fA-F0-9]{40}$"},"description":"Your wallet (0x...)- CDP prices the executable swap against it."},{"name":"slippageBps","in":"query","required":false,"schema":{"type":"integer","minimum":0,"maximum":10000},"description":"Max slippage in basis points (default 100)."}]}},"/v1/ideas":{"get":{"operationId":"ideas","summary":"Ranked Trade Ideas","description":"Ranked scalp long / short setups across the tradeable Gains pair universe. Each pair: 30d of six-hour candles -> the same composite technical signal as the app (RSI14 + MACD + Bollinger %B + VWAP + SMA20 trend + pattern) blended into a bias + conviction, then a range-survival leverage whose liquidation clears the recent-swing stop, capped at the pair max. Returns entry, stop, suggested leverage, pairIndex, and the /v1/tx/risk/open inputs to execute. GET /v1/ideas?limit=6 (or ?symbols=BTC,ETH,SOL up to 20). Ranked by conviction; illustrative, not advice.","x-x402":{"scheme":"exact","priceAtomicUsdc":"10000","priceUsd":0.01,"asset":"USDC"},"responses":{"200":{"description":"Success. JSON payload (data reads) or ordered { to, data, value } calldata steps (tx builders).","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Bad request- see the error message for the missing / malformed field."},"402":{"$ref":"#/components/responses/PaymentRequired"},"429":{"description":"Rate limited (unpaid traffic). Retry after the Retry-After header."}},"parameters":[{"name":"symbols","in":"query","required":false,"schema":{"type":"string"},"description":"Comma-separated tickers to scan (max 20); omit for the top listed majors."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":12},"description":"Max ideas returned (default 6)."}]}},"/v1/alpha":{"get":{"operationId":"alpha","summary":"Alpha Bundle","description":"The whole alpha stack in ONE call: ranked arbitrage routes into a target (when you pass taker), ranked scalp trade ideas across the pair universe, and the composite TA signal bundle for a symbol set. GET /v1/alpha?target=cbBTC&budget=100&taker=0x..&symbols=BTC,ETH,SOL&limit=6. Cheaper and faster than polling /v1/arbitrage + /v1/ideas + /v1/signals separately- everything an autonomous trading agent needs to decide its next move, then execute via the /v1/tx/* builders.","x-x402":{"scheme":"exact","priceAtomicUsdc":"20000","priceUsd":0.02,"asset":"USDC"},"responses":{"200":{"description":"Success. JSON payload (data reads) or ordered { to, data, value } calldata steps (tx builders).","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Bad request- see the error message for the missing / malformed field."},"402":{"$ref":"#/components/responses/PaymentRequired"},"429":{"description":"Rate limited (unpaid traffic). Retry after the Retry-After header."}},"parameters":[{"name":"target","in":"query","required":false,"schema":{"type":"string"},"description":"Arbitrage target token (default cbBTC)."},{"name":"budget","in":"query","required":false,"schema":{"type":"number","minimum":0},"description":"Arbitrage USD budget (default 100)."},{"name":"taker","in":"query","required":false,"schema":{"type":"string","pattern":"^0x[a-fA-F0-9]{40}$"},"description":"Your wallet (0x...)- omit to skip the arbitrage section."},{"name":"symbols","in":"query","required":false,"schema":{"type":"string"},"description":"Comma-separated tickers for ideas + signals (max 20 / first 10 for signals)."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":12},"description":"Max ideas returned (default 6)."},{"name":"slippageBps","in":"query","required":false,"schema":{"type":"integer","minimum":0,"maximum":10000},"description":"Arbitrage max slippage in basis points (default 100)."}]}},"/v1/candles":{"get":{"operationId":"candles","summary":"Historical Candles","description":"OHLC history with window extremes (highest high / lowest low over the window). Crypto via Coinbase (GET /v1/candles?product=ETH-USD&days=30; hourly bars <= 7d, six-hour <= 31d, daily <= 350d). Metals / indices / forex / stocks via ?sym=XAU&cls=Commodities[&quote=USD]. Returns { productId, days, high, low, candles, series: [[startSec, open, high, low, close], ...] } oldest first.","x-x402":{"scheme":"exact","priceAtomicUsdc":"1000","priceUsd":0.001,"asset":"USDC"},"responses":{"200":{"description":"Success. JSON payload (data reads) or ordered { to, data, value } calldata steps (tx builders).","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Bad request- see the error message for the missing / malformed field."},"402":{"$ref":"#/components/responses/PaymentRequired"},"429":{"description":"Rate limited (unpaid traffic). Retry after the Retry-After header."}},"parameters":[{"name":"product","in":"query","required":false,"schema":{"type":"string"},"description":"Coinbase crypto product, e.g. ETH-USD. Use this OR sym + cls."},{"name":"sym","in":"query","required":false,"schema":{"type":"string"},"description":"Non-crypto symbol, e.g. XAU, US500, EUR, TSLA (paired with cls)."},{"name":"cls","in":"query","required":false,"schema":{"type":"string"},"description":"Asset class for sym: Commodities | Indices | Forex | Stocks | Crypto."},{"name":"quote","in":"query","required":false,"schema":{"type":"string"},"description":"Quote currency for Forex sym (default USD)."},{"name":"days","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":350},"description":"Window in days (default 30, max 350)."}]}},"/v1/swap/price":{"get":{"operationId":"swap_price","summary":"Swap Price (Indicative)","description":"Indicative Base mainnet swap pricing via the Coinbase CDP Trade API- expected output, min output after slippage, and fee estimates- WITHOUT reserving liquidity. Poll this to compare routes, then buy /v1/tx/swap for the executable quote. GET /v1/swap/price?fromToken=0x..&toToken=0x..&fromAmount=atomic&taker=0x..&slippageBps=100.","x-x402":{"scheme":"exact","priceAtomicUsdc":"1000","priceUsd":0.001,"asset":"USDC"},"responses":{"200":{"description":"Success. JSON payload (data reads) or ordered { to, data, value } calldata steps (tx builders).","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Bad request- see the error message for the missing / malformed field."},"402":{"$ref":"#/components/responses/PaymentRequired"},"429":{"description":"Rate limited (unpaid traffic). Retry after the Retry-After header."}},"parameters":[{"name":"fromToken","in":"query","required":true,"schema":{"type":"string"},"description":"Sell token address (0x...) or the native-ETH sentinel."},{"name":"toToken","in":"query","required":true,"schema":{"type":"string"},"description":"Buy token address (0x...)."},{"name":"fromAmount","in":"query","required":true,"schema":{"type":"string","pattern":"^[0-9]+$"},"description":"Sell amount in atomic units of fromToken."},{"name":"taker","in":"query","required":true,"schema":{"type":"string","pattern":"^0x[a-fA-F0-9]{40}$"},"description":"Wallet that would sign + send (0x...)."},{"name":"slippageBps","in":"query","required":false,"schema":{"type":"integer","minimum":0,"maximum":10000},"description":"Max slippage in basis points (CDP default 100 = 1%)."}]}},"/v1/portfolio/{address}":{"get":{"operationId":"portfolio","summary":"Wallet Portfolio","description":"Every ERC-20 + native ETH a Base address holds (Blockscout-indexed, spam-screened) with confidence-gated USD values: usd is null when no reliable price exists- NEVER a fabricated 0. GET /v1/portfolio/{address}.","x-x402":{"scheme":"exact","priceAtomicUsdc":"1000","priceUsd":0.001,"asset":"USDC"},"responses":{"200":{"description":"Success. JSON payload (data reads) or ordered { to, data, value } calldata steps (tx builders).","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Bad request- see the error message for the missing / malformed field."},"402":{"$ref":"#/components/responses/PaymentRequired"},"429":{"description":"Rate limited (unpaid traffic). Retry after the Retry-After header."}},"parameters":[{"name":"address","in":"path","required":true,"schema":{"type":"string","pattern":"^0x[a-fA-F0-9]{40}$"},"description":"Base address (0x...)."}]}},"/v1/positions/{address}":{"get":{"operationId":"positions","summary":"Open DeFi Positions","description":"Live Morpho Blue borrow positions (collateral, debt, health factor, liquidation distance), Morpho vault deposits (APY, earnings), and Gains Network open leveraged trades (pair, direction, leverage, entry, TP/SL) for any Base address. GET /v1/positions/{address}.","x-x402":{"scheme":"exact","priceAtomicUsdc":"1000","priceUsd":0.001,"asset":"USDC"},"responses":{"200":{"description":"Success. JSON payload (data reads) or ordered { to, data, value } calldata steps (tx builders).","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Bad request- see the error message for the missing / malformed field."},"402":{"$ref":"#/components/responses/PaymentRequired"},"429":{"description":"Rate limited (unpaid traffic). Retry after the Retry-After header."}},"parameters":[{"name":"address","in":"path","required":true,"schema":{"type":"string","pattern":"^0x[a-fA-F0-9]{40}$"},"description":"Base address (0x...)."}]}},"/v1/history/{address}":{"get":{"operationId":"history","summary":"Trade History","description":"Closed leverage round-trips for any Base address from the Gains first-party history: pair (base + quote legs), side, leverage, collateral, open/close price, realized PnL + PnL%, close reason (take-profit / stop-loss / liquidation / manual), open/close tx hashes, and timestamps. GET /v1/history/{address}. Newest first, USDC-collateralized trades.","x-x402":{"scheme":"exact","priceAtomicUsdc":"1000","priceUsd":0.001,"asset":"USDC"},"responses":{"200":{"description":"Success. JSON payload (data reads) or ordered { to, data, value } calldata steps (tx builders).","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Bad request- see the error message for the missing / malformed field."},"402":{"$ref":"#/components/responses/PaymentRequired"},"429":{"description":"Rate limited (unpaid traffic). Retry after the Retry-After header."}},"parameters":[{"name":"address","in":"path","required":true,"schema":{"type":"string","pattern":"^0x[a-fA-F0-9]{40}$"},"description":"Base address (0x...)."}]}},"/v1/stats/{address}":{"get":{"operationId":"stats","summary":"Trading Scorecard","description":"Aggregate trading scorecard for any Base address from its closed leverage history: trades, wins/losses, win rate, net USD, gross profit / loss, profit factor, mean R-multiple expectancy, avg win / loss, best / worst trade. GET /v1/stats/{address}. The \"am I actually good\" read- and the input to a risk-sizing agent.","x-x402":{"scheme":"exact","priceAtomicUsdc":"1000","priceUsd":0.001,"asset":"USDC"},"responses":{"200":{"description":"Success. JSON payload (data reads) or ordered { to, data, value } calldata steps (tx builders).","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Bad request- see the error message for the missing / malformed field."},"402":{"$ref":"#/components/responses/PaymentRequired"},"429":{"description":"Rate limited (unpaid traffic). Retry after the Retry-After header."}},"parameters":[{"name":"address","in":"path","required":true,"schema":{"type":"string","pattern":"^0x[a-fA-F0-9]{40}$"},"description":"Base address (0x...)."}]}},"/v1/earn/vaults":{"get":{"operationId":"earn_vaults","summary":"Earn Vault Catalog","description":"Every listed Morpho (MetaMorpho ERC-4626) vault on Base: address, underlying asset (address/symbol/decimals), live net APY, and TVL. The input universe for /v1/tx/earn. GET /v1/earn/vaults.","x-x402":{"scheme":"exact","priceAtomicUsdc":"1000","priceUsd":0.001,"asset":"USDC"},"responses":{"200":{"description":"Success. JSON payload (data reads) or ordered { to, data, value } calldata steps (tx builders).","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Bad request- see the error message for the missing / malformed field."},"402":{"$ref":"#/components/responses/PaymentRequired"},"429":{"description":"Rate limited (unpaid traffic). Retry after the Retry-After header."}}}},"/v1/loan/markets":{"get":{"operationId":"loan_markets","summary":"Loan Market Catalog","description":"Every listed Morpho Blue market on Base: marketId, full MarketParams (loanToken, collateralToken, oracle, irm, lltv- the id is re-derived and asserted, wrong-market proof), live borrow APY, and LLTV. The input universe for /v1/tx/loan. GET /v1/loan/markets.","x-x402":{"scheme":"exact","priceAtomicUsdc":"1000","priceUsd":0.001,"asset":"USDC"},"responses":{"200":{"description":"Success. JSON payload (data reads) or ordered { to, data, value } calldata steps (tx builders).","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Bad request- see the error message for the missing / malformed field."},"402":{"$ref":"#/components/responses/PaymentRequired"},"429":{"description":"Rate limited (unpaid traffic). Retry after the Retry-After header."}}}},"/v1/risk/pairs":{"get":{"operationId":"risk_pairs","summary":"Leverage Pair Universe","description":"The tradeable Gains Network (gTrade) crypto pair universe on Base: on-chain pairIndex, symbol, and max leverage per pair. USDC-collateralized synthetic exposure- any pair trades without holding the asset. GET /v1/risk/pairs.","x-x402":{"scheme":"exact","priceAtomicUsdc":"1000","priceUsd":0.001,"asset":"USDC"},"responses":{"200":{"description":"Success. JSON payload (data reads) or ordered { to, data, value } calldata steps (tx builders).","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Bad request- see the error message for the missing / malformed field."},"402":{"$ref":"#/components/responses/PaymentRequired"},"429":{"description":"Rate limited (unpaid traffic). Retry after the Retry-After header."}}}},"/v1/tx/swap":{"post":{"operationId":"tx_swap","summary":"Tx Builder: Swap","description":"Executable Base mainnet swap via the Coinbase CDP Trade API: returns the unsigned transaction + permit2 payload exactly as CDP quotes it; the agent signs with its own wallet. POST /v1/tx/swap { fromToken, toToken, fromAmount (atomic), taker, signerAddress?, slippageBps? }.","x-x402":{"scheme":"exact","priceAtomicUsdc":"20000","priceUsd":0.02,"asset":"USDC"},"responses":{"200":{"description":"Success. JSON payload (data reads) or ordered { to, data, value } calldata steps (tx builders).","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Bad request- see the error message for the missing / malformed field."},"402":{"$ref":"#/components/responses/PaymentRequired"},"429":{"description":"Rate limited (unpaid traffic). Retry after the Retry-After header."}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["fromToken","toToken","fromAmount","taker"],"properties":{"fromToken":{"type":"string","description":"Sell token address (0x...) or ETH sentinel."},"toToken":{"type":"string","description":"Buy token address (0x...)."},"fromAmount":{"type":"string","pattern":"^[0-9]+$","description":"Sell amount in atomic units of fromToken."},"taker":{"type":"string","pattern":"^0x[a-fA-F0-9]{40}$","description":"Wallet that will sign + send (0x...)."},"signerAddress":{"type":"string","pattern":"^0x[a-fA-F0-9]{40}$","description":"Optional separate signer for smart-wallet flows (0x...)."},"slippageBps":{"type":"integer","minimum":0,"maximum":5000,"description":"Max slippage in basis points."}},"additionalProperties":false}}}}}},"/v1/tx/earn/deposit":{"post":{"operationId":"tx_earn_deposit","summary":"Tx Builder: Vault Deposit","description":"ERC-4626 deposit calldata for a Morpho vault, with the ERC-20 approve step included when the live allowance is short. POST /v1/tx/earn/deposit { vault, assets (atomic), owner }. Returns ordered { to, data, value } steps.","x-x402":{"scheme":"exact","priceAtomicUsdc":"20000","priceUsd":0.02,"asset":"USDC"},"responses":{"200":{"description":"Success. JSON payload (data reads) or ordered { to, data, value } calldata steps (tx builders).","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Bad request- see the error message for the missing / malformed field."},"402":{"$ref":"#/components/responses/PaymentRequired"},"429":{"description":"Rate limited (unpaid traffic). Retry after the Retry-After header."}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["vault","assets","owner"],"properties":{"vault":{"type":"string","pattern":"^0x[a-fA-F0-9]{40}$","description":"ERC-4626 vault address (0x...)."},"assets":{"type":"string","pattern":"^[0-9]+$","description":"Deposit amount, atomic units of the underlying."},"owner":{"type":"string","pattern":"^0x[a-fA-F0-9]{40}$","description":"Depositor / receiver (0x...)."}},"additionalProperties":false}}}}}},"/v1/tx/earn/withdraw":{"post":{"operationId":"tx_earn_withdraw","summary":"Tx Builder: Vault Withdraw","description":"ERC-4626 withdraw calldata for a Morpho vault (assets to receiver, owner-signed). POST /v1/tx/earn/withdraw { vault, assets (atomic), owner }. Returns { to, data, value } steps.","x-x402":{"scheme":"exact","priceAtomicUsdc":"20000","priceUsd":0.02,"asset":"USDC"},"responses":{"200":{"description":"Success. JSON payload (data reads) or ordered { to, data, value } calldata steps (tx builders).","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Bad request- see the error message for the missing / malformed field."},"402":{"$ref":"#/components/responses/PaymentRequired"},"429":{"description":"Rate limited (unpaid traffic). Retry after the Retry-After header."}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["vault","assets","owner"],"properties":{"vault":{"type":"string","pattern":"^0x[a-fA-F0-9]{40}$","description":"ERC-4626 vault address (0x...)."},"assets":{"type":"string","pattern":"^[0-9]+$","description":"Withdraw amount, atomic units of the underlying."},"owner":{"type":"string","pattern":"^0x[a-fA-F0-9]{40}$","description":"Owner / receiver (0x...)."}},"additionalProperties":false}}}}}},"/v1/tx/earn/aave/supply":{"post":{"operationId":"tx_earn_aave_supply","summary":"Tx Builder: Aave Supply","description":"Aave v3 (Base) supply calldata for a reserve underlying (approve step included when the live allowance is short; referralCode 0, onBehalfOf owner). POST /v1/tx/earn/aave/supply { asset, amount (atomic), owner }. Returns ordered { to, data, value } steps.","x-x402":{"scheme":"exact","priceAtomicUsdc":"20000","priceUsd":0.02,"asset":"USDC"},"responses":{"200":{"description":"Success. JSON payload (data reads) or ordered { to, data, value } calldata steps (tx builders).","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Bad request- see the error message for the missing / malformed field."},"402":{"$ref":"#/components/responses/PaymentRequired"},"429":{"description":"Rate limited (unpaid traffic). Retry after the Retry-After header."}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"Aave v3 (Base) supply calldata for a reserve underlying (approve step included when the live allowance is short; referralCode 0, onBehalfOf owner). POST /v1/tx/earn/aave/supply { asset, amount (atomic), owner }. Returns ordered { to, data, value } steps."}}}}}},"/v1/tx/earn/aave/withdraw":{"post":{"operationId":"tx_earn_aave_withdraw","summary":"Tx Builder: Aave Withdraw","description":"Aave v3 (Base) withdraw calldata (amount \"max\" pulls the entire aToken balance). POST /v1/tx/earn/aave/withdraw { asset, amount (atomic | \"max\"), owner }. Returns { to, data, value } steps.","x-x402":{"scheme":"exact","priceAtomicUsdc":"20000","priceUsd":0.02,"asset":"USDC"},"responses":{"200":{"description":"Success. JSON payload (data reads) or ordered { to, data, value } calldata steps (tx builders).","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Bad request- see the error message for the missing / malformed field."},"402":{"$ref":"#/components/responses/PaymentRequired"},"429":{"description":"Rate limited (unpaid traffic). Retry after the Retry-After header."}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"Aave v3 (Base) withdraw calldata (amount \"max\" pulls the entire aToken balance). POST /v1/tx/earn/aave/withdraw { asset, amount (atomic | \"max\"), owner }. Returns { to, data, value } steps."}}}}}},"/v1/tx/loan/supply-collateral":{"post":{"operationId":"tx_loan_supply_collateral","summary":"Tx Builder: Supply Collateral","description":"Morpho Blue supplyCollateral calldata with MarketParams fetched live by marketId and re-derived (wrong-market proof); collateral approve step included when needed. POST /v1/tx/loan/supply-collateral { marketId, assets (atomic), owner }.","x-x402":{"scheme":"exact","priceAtomicUsdc":"20000","priceUsd":0.02,"asset":"USDC"},"responses":{"200":{"description":"Success. JSON payload (data reads) or ordered { to, data, value } calldata steps (tx builders).","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Bad request- see the error message for the missing / malformed field."},"402":{"$ref":"#/components/responses/PaymentRequired"},"429":{"description":"Rate limited (unpaid traffic). Retry after the Retry-After header."}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["marketId","assets","owner"],"properties":{"marketId":{"type":"string","description":"Morpho Blue market id (0x... 32-byte)."},"assets":{"type":"string","pattern":"^[0-9]+$","description":"Collateral amount, atomic units."},"owner":{"type":"string","pattern":"^0x[a-fA-F0-9]{40}$","description":"Position owner (0x...)."}},"additionalProperties":false}}}}}},"/v1/tx/loan/borrow":{"post":{"operationId":"tx_loan_borrow","summary":"Tx Builder: Borrow","description":"Morpho Blue borrow calldata (draw the loan asset against posted collateral) with verified MarketParams. POST /v1/tx/loan/borrow { marketId, assets (atomic), owner }.","x-x402":{"scheme":"exact","priceAtomicUsdc":"20000","priceUsd":0.02,"asset":"USDC"},"responses":{"200":{"description":"Success. JSON payload (data reads) or ordered { to, data, value } calldata steps (tx builders).","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Bad request- see the error message for the missing / malformed field."},"402":{"$ref":"#/components/responses/PaymentRequired"},"429":{"description":"Rate limited (unpaid traffic). Retry after the Retry-After header."}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["marketId","assets","owner"],"properties":{"marketId":{"type":"string","description":"Morpho Blue market id (0x... 32-byte)."},"assets":{"type":"string","pattern":"^[0-9]+$","description":"Loan-asset amount to draw, atomic units."},"owner":{"type":"string","pattern":"^0x[a-fA-F0-9]{40}$","description":"Position owner (0x...)."}},"additionalProperties":false}}}}}},"/v1/tx/loan/repay":{"post":{"operationId":"tx_loan_repay","summary":"Tx Builder: Repay","description":"Morpho Blue repay calldata with verified MarketParams; loan-asset approve step included when needed. POST /v1/tx/loan/repay { marketId, assets (atomic), owner }.","x-x402":{"scheme":"exact","priceAtomicUsdc":"20000","priceUsd":0.02,"asset":"USDC"},"responses":{"200":{"description":"Success. JSON payload (data reads) or ordered { to, data, value } calldata steps (tx builders).","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Bad request- see the error message for the missing / malformed field."},"402":{"$ref":"#/components/responses/PaymentRequired"},"429":{"description":"Rate limited (unpaid traffic). Retry after the Retry-After header."}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["marketId","assets","owner"],"properties":{"marketId":{"type":"string","description":"Morpho Blue market id (0x... 32-byte)."},"assets":{"type":"string","pattern":"^[0-9]+$","description":"Repay amount, atomic units of the loan asset."},"owner":{"type":"string","pattern":"^0x[a-fA-F0-9]{40}$","description":"Position owner (0x...)."}},"additionalProperties":false}}}}}},"/v1/tx/loan/withdraw-collateral":{"post":{"operationId":"tx_loan_withdraw_collateral","summary":"Tx Builder: Withdraw Collateral","description":"Morpho Blue withdrawCollateral calldata with verified MarketParams (only down to the level the position tolerates- the chain enforces health). POST /v1/tx/loan/withdraw-collateral { marketId, assets (atomic), owner }.","x-x402":{"scheme":"exact","priceAtomicUsdc":"20000","priceUsd":0.02,"asset":"USDC"},"responses":{"200":{"description":"Success. JSON payload (data reads) or ordered { to, data, value } calldata steps (tx builders).","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Bad request- see the error message for the missing / malformed field."},"402":{"$ref":"#/components/responses/PaymentRequired"},"429":{"description":"Rate limited (unpaid traffic). Retry after the Retry-After header."}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["marketId","assets","owner"],"properties":{"marketId":{"type":"string","description":"Morpho Blue market id (0x... 32-byte)."},"assets":{"type":"string","pattern":"^[0-9]+$","description":"Collateral amount to withdraw, atomic units."},"owner":{"type":"string","pattern":"^0x[a-fA-F0-9]{40}$","description":"Position owner (0x...)."}},"additionalProperties":false}}}}}},"/v1/tx/risk/open":{"post":{"operationId":"tx_risk_open","summary":"Tx Builder: Open Leveraged Trade","description":"Gains Network openTrade calldata with EXACT on-chain scaling (leverage x1e3, prices x1e10, USDC 6dp, slippage x1e3) and the USDC approve step when needed. MARKET, LIMIT, or STOP. POST /v1/tx/risk/open { pairIndex, long, leverage, collateralUsdc, markPrice, owner, tradeType?, triggerPrice?, tp?, sl?, slippagePct? }.","x-x402":{"scheme":"exact","priceAtomicUsdc":"20000","priceUsd":0.02,"asset":"USDC"},"responses":{"200":{"description":"Success. JSON payload (data reads) or ordered { to, data, value } calldata steps (tx builders).","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Bad request- see the error message for the missing / malformed field."},"402":{"$ref":"#/components/responses/PaymentRequired"},"429":{"description":"Rate limited (unpaid traffic). Retry after the Retry-After header."}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["pairIndex","long","leverage","collateralUsdc","markPrice","owner"],"properties":{"pairIndex":{"type":"integer","minimum":0,"description":"Gains on-chain pair index (see /v1/risk/pairs)."},"long":{"type":"boolean","description":"true = long, false = short."},"leverage":{"type":"number","minimum":1.1,"description":"Leverage multiple (e.g. 10 for 10x)."},"collateralUsdc":{"type":"number","minimum":0,"description":"USDC collateral (human units)."},"markPrice":{"type":"number","minimum":0,"description":"Current mark price (human units)."},"owner":{"type":"string","pattern":"^0x[a-fA-F0-9]{40}$","description":"Trader wallet (0x...)."},"tradeType":{"type":"integer","enum":[0,1,2],"description":"0 MARKET, 1 LIMIT, 2 STOP."},"triggerPrice":{"type":"number","description":"Trigger price for LIMIT / STOP."},"tp":{"type":"number","description":"Take-profit price (optional)."},"sl":{"type":"number","description":"Stop-loss price (optional)."},"slippagePct":{"type":"number","description":"Max slippage percent (optional)."}},"additionalProperties":false}}}}}},"/v1/tx/risk/close":{"post":{"operationId":"tx_risk_close","summary":"Tx Builder: Close Leveraged Trade","description":"Gains Network closeTradeMarket calldata (close an open position at market; expectedPrice guards the fill). POST /v1/tx/risk/close { index, expectedPrice }.","x-x402":{"scheme":"exact","priceAtomicUsdc":"20000","priceUsd":0.02,"asset":"USDC"},"responses":{"200":{"description":"Success. JSON payload (data reads) or ordered { to, data, value } calldata steps (tx builders).","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Bad request- see the error message for the missing / malformed field."},"402":{"$ref":"#/components/responses/PaymentRequired"},"429":{"description":"Rate limited (unpaid traffic). Retry after the Retry-After header."}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["index","expectedPrice"],"properties":{"index":{"type":"integer","minimum":0,"description":"Open trade index for the wallet."},"expectedPrice":{"type":"number","minimum":0,"description":"Expected fill price (guards the close)."}},"additionalProperties":false}}}}}},"/v1/tx/risk/modify":{"post":{"operationId":"tx_risk_modify","summary":"Tx Builder: Modify Leveraged Trade","description":"Gains Network position management calldata by trade index, EXACT scaling (leverage x1e3, prices x1e10, USDC 6dp, slippage x1e3). POST /v1/tx/risk/modify { index, action, ... }: action tp|sl { price }, leverage { leverage, owner } (a decrease auto-prepends the USDC approve for the collateral top-up), add-margin { collateralUsdc, markPrice, owner, slippagePct? }, reduce { collateralUsdc, markPrice }, update-order { triggerPrice, tp?, sl?, slippagePct? }, cancel-order {}.","x-x402":{"scheme":"exact","priceAtomicUsdc":"20000","priceUsd":0.02,"asset":"USDC"},"responses":{"200":{"description":"Success. JSON payload (data reads) or ordered { to, data, value } calldata steps (tx builders).","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Bad request- see the error message for the missing / malformed field."},"402":{"$ref":"#/components/responses/PaymentRequired"},"429":{"description":"Rate limited (unpaid traffic). Retry after the Retry-After header."}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["index","action"],"properties":{"index":{"type":"integer","minimum":0,"description":"Open trade index for the wallet (see /v1/positions)."},"action":{"type":"string","enum":["tp","sl","leverage","add-margin","reduce","update-order","cancel-order"],"description":"Which modification to build."},"price":{"type":"number","minimum":0,"description":"tp/sl: target price in USD (0 clears it)."},"leverage":{"type":"number","minimum":1.1,"description":"leverage: the new multiple; add-margin: the position leverage."},"owner":{"type":"string","pattern":"^0x[a-fA-F0-9]{40}$","description":"Trader wallet (0x...)- required for leverage and add-margin."},"collateralUsdc":{"type":"string","description":"add-margin/reduce: USDC amount (human units, max 6 decimals)."},"markPrice":{"type":"number","minimum":0,"description":"add-margin/reduce: current mark price (USD)."},"triggerPrice":{"type":"number","minimum":0,"description":"update-order: new trigger price (USD)."},"tp":{"type":"number","minimum":0,"description":"update-order: take-profit (USD, 0 for none)."},"sl":{"type":"number","minimum":0,"description":"update-order: stop-loss (USD, 0 for none)."},"slippagePct":{"type":"number","description":"Max slippage percent (optional)."}},"additionalProperties":false}}}}}},"/v1/tx/burn":{"post":{"operationId":"tx_burn","summary":"Tx Builder: Burn OZ","description":"ERC-20 transfer-to-dead calldata: burn OZ (or any token) from the agent's own wallet. Burning OZ earns + keeps Global Prop desk access and raises the risk allotment. POST /v1/tx/burn { amount (atomic, OZ is 18dp), token? }. Returns { to, data, value } steps.","x-x402":{"scheme":"exact","priceAtomicUsdc":"20000","priceUsd":0.02,"asset":"USDC"},"responses":{"200":{"description":"Success. JSON payload (data reads) or ordered { to, data, value } calldata steps (tx builders).","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Bad request- see the error message for the missing / malformed field."},"402":{"$ref":"#/components/responses/PaymentRequired"},"429":{"description":"Rate limited (unpaid traffic). Retry after the Retry-After header."}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["amount"],"properties":{"amount":{"type":"string","pattern":"^[0-9]+$","description":"Burn amount in atomic units (OZ is 18 decimals)."},"token":{"type":"string","pattern":"^0x[a-fA-F0-9]{40}$","description":"Token address to burn (0x...); defaults to OZ."}},"additionalProperties":false}}}}}},"/v1/tx/send":{"post":{"operationId":"tx_send","summary":"Tx Builder: Send","description":"Transfer a token (ERC-20) or native ETH to any recipient from the agent's own wallet- full parity with the app's Send. POST /v1/tx/send { to, amount (atomic: wei for ETH, token decimals otherwise), token? (omit / native sentinel = ETH) }. Returns { to, data, value } steps.","x-x402":{"scheme":"exact","priceAtomicUsdc":"20000","priceUsd":0.02,"asset":"USDC"},"responses":{"200":{"description":"Success. JSON payload (data reads) or ordered { to, data, value } calldata steps (tx builders).","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Bad request- see the error message for the missing / malformed field."},"402":{"$ref":"#/components/responses/PaymentRequired"},"429":{"description":"Rate limited (unpaid traffic). Retry after the Retry-After header."}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["to","amount"],"properties":{"to":{"type":"string","pattern":"^0x[a-fA-F0-9]{40}$","description":"Recipient address (0x...)."},"amount":{"type":"string","pattern":"^[0-9]+$","description":"Amount in atomic units: wei for ETH, token decimals otherwise."},"token":{"type":"string","description":"ERC-20 address (0x...); omit or pass the native sentinel for ETH."}},"additionalProperties":false}}}}}},"/v1/tx/tip":{"post":{"operationId":"tx_tip","summary":"Tx Builder: Tip Prop Treasury","description":"Tip the shared Ozmium Prop desk treasury (funds the Prop Flywheel- swap fees burn OZ / fund the desk). A plain transfer to the fixed treasury address; nobody custodies your funds. POST /v1/tx/tip { amount (atomic), token? (omit / native sentinel = ETH) }. Returns { to, data, value } steps.","x-x402":{"scheme":"exact","priceAtomicUsdc":"20000","priceUsd":0.02,"asset":"USDC"},"responses":{"200":{"description":"Success. JSON payload (data reads) or ordered { to, data, value } calldata steps (tx builders).","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Bad request- see the error message for the missing / malformed field."},"402":{"$ref":"#/components/responses/PaymentRequired"},"429":{"description":"Rate limited (unpaid traffic). Retry after the Retry-After header."}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["amount"],"properties":{"amount":{"type":"string","pattern":"^[0-9]+$","description":"Tip amount in atomic units: wei for ETH, token decimals otherwise."},"token":{"type":"string","description":"ERC-20 address (0x...); omit or pass the native sentinel for ETH."}},"additionalProperties":false}}}}}}},"components":{"responses":{"PaymentRequired":{"description":"Payment required (x402). Body is the challenge; sign + retry with X-PAYMENT.","content":{"application/json":{"schema":{"type":"object","properties":{"x402Version":{"type":"integer"},"error":{"type":"string"},"accepts":{"type":"array","items":{"type":"object"}}}}}}}}}}