API reference
Base URL https://defi.venym.io/api. Responses use a { success, data, timestamp } envelope (a few data endpoints return a raw array). Execution endpoints accept an Idempotency-Key header.
Market data
Public — no key required.
/full and /metrics variants available./metrics for windowed flow stats.curl "https://defi.venym.io/api/aggregated/routing?symbol=ETH&side=BUY"Streaming (SSE)
Content-Type: text/event-stream. Named events book · bar · trade, with : heartbeat comments every 5s. Target the backend directly to avoid proxy buffering, or just use the SDK / MCP watch_* tools.
curl -N "https://venym-defi-backend.fly.dev/api/aggregated/stream/trades?symbol=BTC"Account
Requires a key with scope account:read. Keyed to the key's subject wallet.
Orders & positions
Requires scope orders:execute and policy.executionEnabled = true.
{ symbol, side: "BUY"|"SELL", type: "MARKET"|"LIMIT"|"STOP_MARKET"|"STOP_LIMIT", quantity, price?, triggerPrice?, reduceOnly?, preferredExchange? }{ symbol, direction: "LONG"|"SHORT", size, leverage?, orderType, limitPrice?, preferredExchange? }{ symbol, direction, size, orderType?, limitPrice? }curl -X POST https://defi.venym.io/api/agent/orders \
-H "Authorization: Bearer $VENYM_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{ "symbol": "BTC", "side": "BUY", "type": "MARKET", "quantity": "0.01" }'Pair trades
Requires scope pairs:execute. A single position split into balanced long/short perp legs.
{ longSymbol, shortSymbol, notionalUsd, leverage, slippage?, venue? } — or the engine-native { pearMarketId, usdValue, longAssets, shortAssets }.Swaps
Cross-chain via LiFi/SideShift (EVM + Solana). quote and prepare need swap:quote; headless execute needs swap:execute. (EVM headless execution is live; Solana headless is operator-gated — use the non-custodial prepare path. See recipes.)
{ fromChain, toChain, fromToken, toToken, fromAmount, fromAddress?, toAddress? }. Returns quotes + a quoteId.Key management
Authenticated with your Venym (Dynamic) session JWT — see authentication.
{ success: false, error, code }. See the safety model for the full error and rate-limit catalog.- —Machine-readable spec: /openapi.json.
- —Compact index for LLMs: /llms.txt.