# Agent Desk — Public API & Streamable HTTP MCP Quickstart Base URL: https://druidcircle.app API Version: v1 Interactive Playground: https://druidcircle.app/developers Protocol Docs: https://druidcircle.app/docs (raw Markdown: https://druidcircle.app/docs/{slug}.md) Live Solvency Dashboard: https://druidcircle.app/stats Full AI-SEO Dossier: https://druidcircle.app/llms-full.txt OpenAPI 3.1: https://druidcircle.app/v1/openapi.json Streamable HTTP MCP: https://druidcircle.app/mcp (JSON-RPC 2.0, protocolVersion: 2025-03-26) Agent Skills Manifest: https://druidcircle.app/.well-known/agent-skills/index.json Sitemap: https://druidcircle.app/sitemap.xml ## Core Trading Conventions - Carry sign convention: - NEGATIVE rate_per_day = house pays trader (you earn carry). - POSITIVE rate_per_day = trader pays house (you pay carry). - Settlement model: - 30-min TWAP spot settlement (no thin-book exit slippage). - Perps can be closed anytime when the 30-min TWAP window is covered. - Take-Profit / Stop-Loss seals evaluate strictly on 30-min TWAP spot (zero 1-second wick stop-outs). - Options are 7-day European options settled at expiry on 30-min TWAP spot. - Authentication: - Public market-data reads (/v1/meta, /v1/omens, /v1/leaderboard, /v1/markets/search, /v1/markets/{chain}/{address}, /v1/markets/{chain}/{address}/bars) require no auth when public reads are enabled. - Account & execution routes accept `X-API-Key: ` or `Authorization: Bearer ` when DESK_API_KEYS is configured (open in local dev mode when unset). - Idempotency (CRITICAL for agents & bots): - Always send `Idempotency-Key: ` on `POST /v1/orders` and `POST /v1/positions/{position_id}/close` (or `idempotency_key` in MCP `place_order` / `close_position`). - Replaying the same key + identical payload returns the exact stored fill with header `X-Idempotency-Replay: true` (never double-executes). - Reusing a key with a DIFFERENT payload returns `409 Conflict` (`IDEMPOTENCY_KEY_CONFLICT`). - Error envelope (all /v1/* errors): {"ok": false, "error": {"code": "ERROR_CODE", "message": "...", "details": null}} ## REST Endpoints (/v1/*) - GET /v1/meta Exchange metadata, caps, carry convention, settlement model - GET /v1/omens Live ranked Short-Omen Board (?sort=score|pump|carry|mcap&chain=all|solana|base|ethereum) - GET /v1/leaderboard Live trader leaderboard (?traveller_name=...&limit=50) - GET /v1/markets/search?q= Search tradable markets (optional repeated &chain=solana) - GET /v1/markets/{chain}/{address} Full market snapshot (spot, 30m TWAP, carry rates, vault room) - GET /v1/markets/{chain}/{address}/bars OHLCV price bars, closes, spot, and 30m TWAP (?window=1h|4h|24h) - POST /v1/quotes/perp Lock 60s perp quote: {chain, address, side, size_usd, leverage} - POST /v1/quotes/option Lock 60s option quote: {chain, address, kind, size_usd, horizon_days} - POST /v1/orders Execute quote: {quote_id, instrument} (+ Idempotency-Key header) - POST /v1/positions/{position_id}/tpsl Set/clear TWAP30 TP/SL seals: {take_profit_px, stop_loss_px} (null clears) - POST /v1/positions/{position_id}/close Close perp at 30m TWAP (+ Idempotency-Key header) - GET /v1/positions List open & settled perp/option positions - GET /v1/account Normalized account & house summary - POST /v1/keys Create scoped API key with optional builder_id & builder_fee_bps (<= 50 bps) - GET /v1/builders/{builder_id}/stats Builder volume, fills, and accrued builder fees - GET /v1/stream/positions SSE stream (text/event-stream) of live position/account snapshots, diffs & heartbeats - GET /v1/stream/omens SSE stream (text/event-stream) of live Short-Omen Board diffs & heartbeats - GET /v1/stream/book SSE stream (text/event-stream) of live book & house updates - GET /v1/openapi.json Scoped OpenAPI 3.1 JSON for /v1/* and /mcp - GET /developers Interactive dark API & MCP playground + copyable client configs ## Quick curl Examples ```bash # 1. Exchange metadata & live Short-Omen Board curl -s https://druidcircle.app/v1/meta | jq curl -s "https://druidcircle.app/v1/omens?sort=carry&chain=all" | jq # 2. Search markets & fetch 4h OHLCV bars curl -s "https://druidcircle.app/v1/markets/search?q=BONK" | jq curl -s "https://druidcircle.app/v1/markets/solana//bars?window=4h" | jq # 3. Quote, execute with Idempotency-Key, and carve TWAP30 TP/SL seals QUOTE_ID=$(curl -s -X POST https://druidcircle.app/v1/quotes/perp \ -H "Content-Type: application/json" \ -d '{"chain":"solana","address":"","side":"short","size_usd":50,"leverage":2}' | jq -r .quote_id) POS_ID=$(curl -s -X POST https://druidcircle.app/v1/orders \ -H "Content-Type: application/json" \ -H "Idempotency-Key: $(uuidgen)" \ -d "{\"quote_id\":\"$QUOTE_ID\",\"instrument\":\"perp\"}" | jq -r .position.position_id) curl -s -X POST https://druidcircle.app/v1/positions/$POS_ID/tpsl \ -H "Content-Type: application/json" \ -d '{"take_profit_px":0.008,"stop_loss_px":0.013}' | jq ``` ## Streamable HTTP MCP (POST /mcp) Tools (13): search_markets, get_market, get_market_bars, get_meta, list_short_omens, get_leaderboard, quote_perp, quote_option, place_order, set_tpsl, close_position, get_positions, get_account. ```bash # Initialize MCP session curl -s -X POST https://druidcircle.app/mcp \ -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{},"clientInfo":{"name":"curl","version":"1.0"}}}' # List MCP tools curl -s -X POST https://druidcircle.app/mcp \ -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}' ```