{"openapi":"3.1.0","info":{"title":"EventTrader Public API","version":"1.0.0","description":"Curated public API surface for outside AI agents: register, get an API key, discover the asset universe, trade, clone bots, and read your portfolio. Auth: X-API-Key header (self-serve via POST /mcp/v1/register or POST /auth/api-key) or OAuth 2.0 bearer with read/portfolio/trade scopes. Start at https://cymetica.com/build and https://cymetica.com/llms.txt."},"servers":[{"url":"https://cymetica.com"}],"paths":{"/auth/register":{"post":{"tags":["authentication"],"summary":"Register","description":"Register a new user account.\n\nArgs:\n    request: FastAPI request object\n    user_data: User registration data\n    background_tasks: FastAPI background tasks for sending emails\n    db: Database session\n\nReturns:\n    Access and refresh tokens with user data\n\nRaises:\n    HTTPException: If email or username already exists, or rate limit exceeded","operationId":"register_auth_register_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserRegister"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[]}},"/auth/login":{"post":{"tags":["authentication"],"summary":"Login","description":"Login with email or username and password.\n\nArgs:\n    request: FastAPI request object\n    login_data: Login credentials (email or username + password)\n    background_tasks: FastAPI background tasks for cache warming\n    db: Database session\n\nReturns:\n    Access and refresh tokens with user data\n\nRaises:\n    HTTPException: If credentials are invalid or rate limit exceeded","operationId":"login_auth_login_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserLogin"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[]}},"/auth/api-key":{"post":{"tags":["authentication"],"summary":"Bootstrap Api Key","description":"Login and generate an API key in one call.\n\nDesigned for SDK/API/bot developers who need programmatic key generation\nwithout a browser session. Authenticates with email/password, then creates\nand returns an evt_ API key with read+trade permissions.\n\nThe API key and secret are shown ONCE in this response — store them securely.","operationId":"bootstrap_api_key_auth_api_key_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIKeyBootstrapRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIKeyBootstrapResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"BearerJWT":[]}]}},"/oauth/register":{"post":{"tags":["oauth"],"summary":"Register Client","description":"Open dynamic client registration. Returns client_id (+ client_secret for\nconfidential clients, shown once).","operationId":"register_client_oauth_register_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegisterRequest"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[]}},"/oauth/token":{"post":{"tags":["oauth"],"summary":"Token","description":"OAuth 2.0 token endpoint (form-encoded). Supports authorization_code (PKCE)\nand refresh_token rotation.","operationId":"token_oauth_token_post","requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/Body_token_oauth_token_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[]}},"/oauth/userinfo":{"get":{"tags":["oauth"],"summary":"Userinfo","description":"OIDC-style userinfo — proves an issued OAuth token authenticates against a\nreal protected resource. Requires scope 'read'.","operationId":"userinfo_oauth_userinfo_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/portfolio/summary":{"get":{"tags":["Portfolio"],"summary":"Get Portfolio Summary","description":"Get aggregated portfolio P&L summary.\n\nReturns trading statistics calculated from on-chain verified data only.\nStats are cached for 5 minutes.","operationId":"get_portfolio_summary_api_v1_portfolio_summary_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PortfolioSummaryResponse"}}}}},"security":[{"HTTPBearer":[]},{"APIKeyHeader":[]}]}},"/api/v1/portfolio/positions":{"get":{"tags":["Portfolio"],"summary":"Get Portfolio Positions","description":"Get user's open and closed positions.\n\nAll positions are from on-chain verified transactions only.","operationId":"get_portfolio_positions_api_v1_portfolio_positions_get","security":[{"HTTPBearer":[]},{"APIKeyHeader":[]}],"parameters":[{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter: active or closed","title":"Status"},"description":"Filter: active or closed"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":20,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PositionsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/api-keys":{"get":{"tags":["API Keys"],"summary":"List Api Keys","description":"List all API keys for the current user (keys are masked).","operationId":"list_api_keys_api_v1_api_keys_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/APIKeyListItem"},"type":"array","title":"Response List Api Keys Api V1 Api Keys Get"}}}}},"security":[{"BearerJWT":[]}]},"post":{"tags":["API Keys"],"summary":"Create Api Key","description":"Generate a new API key. The plaintext key is returned ONCE.","operationId":"create_api_key_api_v1_api_keys_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAPIKeyRequest"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIKeyCreatedResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"BearerJWT":[]}]}},"/api/v1/api-keys/{key_id}":{"delete":{"tags":["API Keys"],"summary":"Revoke Api Key","description":"Revoke (deactivate) an API key.","operationId":"revoke_api_key_api_v1_api_keys__key_id__delete","security":[{"BearerJWT":[]}],"parameters":[{"name":"key_id","in":"path","required":true,"schema":{"type":"string","title":"Key Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["API Keys"],"summary":"Update Api Key","description":"Update an API key's name, permissions, or IP whitelist.","operationId":"update_api_key_api_v1_api_keys__key_id__patch","security":[{"BearerJWT":[]}],"parameters":[{"name":"key_id","in":"path","required":true,"schema":{"type":"string","title":"Key Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAPIKeyRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIKeyListItem"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/markets":{"post":{"tags":["markets"],"summary":"Create Market","description":"Create a new prediction market with duplicate detection.","operationId":"create_market_api_v1_markets_post","parameters":[{"name":"x-api-key","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Api-Key"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarketCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarketResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[]},"get":{"tags":["markets"],"summary":"List Markets","description":"List all prediction markets with optional filters (Kalshi-compatible API).\n\nSupports pagination via cursor and multiple filter parameters.","operationId":"list_markets_api_v1_markets_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":1000,"minimum":1,"description":"Number of results per page","default":100,"title":"Limit"},"description":"Number of results per page"},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Pagination cursor for next page","title":"Cursor"},"description":"Pagination cursor for next page"},{"name":"tickers","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Comma-separated contract addresses","title":"Tickers"},"description":"Comma-separated contract addresses"},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by status: pending, active, completed","title":"Status"},"description":"Filter by status: pending, active, completed"},{"name":"asset_type","in":"query","required":false,"schema":{"anyOf":[{"$ref":"#/components/schemas/AssetType"},{"type":"null"}],"description":"Filter by asset type","title":"Asset Type"},"description":"Filter by asset type"},{"name":"min_created_ts","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Minimum creation timestamp (Unix)","title":"Min Created Ts"},"description":"Minimum creation timestamp (Unix)"},{"name":"max_created_ts","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Maximum creation timestamp (Unix)","title":"Max Created Ts"},"description":"Maximum creation timestamp (Unix)"},{"name":"min_close_ts","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Minimum close timestamp (Unix)","title":"Min Close Ts"},"description":"Minimum close timestamp (Unix)"},{"name":"max_close_ts","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Maximum close timestamp (Unix)","title":"Max Close Ts"},"description":"Maximum close timestamp (Unix)"},{"name":"x-api-key","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Api-Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[]}},"/api/v1/event-cards":{"get":{"tags":["event-cards"],"summary":"List Event Cards","description":"List Event Cards (defaults to live cards), newest first.\n\n``origin='aib_rally'`` (the Rally Cards deck) is ordered by SPIKE SIZE\ninstead — biggest measured move at the top, either direction — with\nnewest-first as the tiebreak for cards that predate the measurement.\n\nUser-submitted cards are filtered out by default; toggle\n``include_user_submitted=true`` to see the full firehose.","operationId":"list_event_cards_api_v1_event_cards_get","security":[],"parameters":[{"name":"status","in":"query","required":false,"schema":{"type":"string","default":"live","title":"Status"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"origin","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter to a single card origin (e.g. 'aib_rally' for the Rally Cards deck). Omitted → the full curated feed.","title":"Origin"},"description":"Filter to a single card origin (e.g. 'aib_rally' for the Rally Cards deck). Omitted → the full curated feed."},{"name":"include_user_submitted","in":"query","required":false,"schema":{"type":"boolean","description":"If true, include user-submitted cards in the result. Default is false so the curated system feed stays clean — user-submitted cards are reachable via the user's own /positions or by passing this flag explicitly.","default":false,"title":"Include User Submitted"},"description":"If true, include user-submitted cards in the result. Default is false so the curated system feed stays clean — user-submitted cards are reachable via the user's own /positions or by passing this flag explicitly."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/event-cards/symbols/search":{"get":{"tags":["event-cards"],"summary":"Search Symbols","description":"Search tradable symbols for basket customization across the FULL global\ntrading-vehicle catalog (stocks, ETFs, ADRs, REITs, crypto, …), optionally\nfiltered to one asset type (``asset_type`` = an ``ontology_class`` such as\n'etf', 'common-stock', 'crypto-assets', 'leveraged-etf', 'reit'). Crypto rows\nkeep their CoinGecko price/image; non-crypto rows come from the ontology and\nare priced live by the builder's preview-basket step. Only PRICEABLE vehicles\nare returned (a vehicle explicitly flagged extra.priceable=false — no live\nquote — is excluded so a card can never contain an unquotable leg).","operationId":"search_symbols_api_v1_event_cards_symbols_search_get","parameters":[{"name":"q","in":"query","required":false,"schema":{"type":"string","maxLength":30,"default":"","title":"Q"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":50,"minimum":1,"default":20,"title":"Limit"}},{"name":"asset_type","in":"query","required":false,"schema":{"type":"string","maxLength":40,"default":"","title":"Asset Type"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[]}},"/api/v1/event-cards/{card_id}":{"get":{"tags":["event-cards"],"summary":"Get Event Card","description":"Full detail for one Event Card.","operationId":"get_event_card_api_v1_event_cards__card_id__get","security":[],"parameters":[{"name":"card_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Card Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/event-cards/{card_id}/buy":{"post":{"tags":["event-cards"],"summary":"Buy Event Card","description":"Open (or add to) a bull position on an Event Card.\n\nA Trend Card / custom-basket card (backed by a tokenized AIB) routes the buy\nto AIB SHARE ISSUANCE (mint at NAV+spread) instead of per-leg basket\nexecution. Ordinary Event Cards keep the bull-position path below.\n\nPaper mode resolution order:\n  1. ``body.paper`` (explicit per-trade override)\n  2. ``user.simulation_mode`` (per-user setting)\n  3. ``EVENT_CARDS_TRADING_ENABLED`` env (platform-wide gate)","operationId":"buy_event_card_api_v1_event_cards__card_id__buy_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"card_id","in":"path","required":true,"schema":{"type":"string","title":"Card Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BuyRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/event-cards/{card_id}/sell":{"post":{"tags":["event-cards"],"summary":"Sell Event Card","description":"Close (or partially close) a spot position (bull OR bear) on an Event Card.\n\nNote: close-side paper/live mode is derived from the position's stored\nis_paper flag (set at open time) — body.paper is accepted for\nforward-compat but ignored. The mode of a close MUST match the open\nto avoid mixed accounting.\n\nDispatches by the position's stored side: the frontend Close button sends\nevery SPOT position here, but bear rows previously dead-ended on\nclose_bull_position's \"Not a bull position\" guard — a user could hold a\nshort (bot/NEXUS-opened) they could never exit from the UI (2026-08-04).\nBear closes are full-position only (the service has no partial bear close),\nso a fraction < 1 on a bear is rejected rather than silently over-closing.","operationId":"sell_event_card_api_v1_event_cards__card_id__sell_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"card_id","in":"path","required":true,"schema":{"type":"string","title":"Card Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SellRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/event-cards/{card_id}/short":{"post":{"tags":["event-cards"],"summary":"Short Event Card","description":"Open a perpetual position (long or short) on an Event Card index.\n\nCash-settled perp contract. Platform is the counterparty.\nFunding rate anchors perp price to NAV (1h cycle).","operationId":"short_event_card_api_v1_event_cards__card_id__short_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"card_id","in":"path","required":true,"schema":{"type":"string","title":"Card Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShortRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clob/orders":{"post":{"tags":["CLOB"],"summary":"Place Order","description":"Place an order on the CLOB.","operationId":"place_order_api_v1_clob_orders_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/src__api__routes__clob__PlaceOrderRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]},{"APIKeyHeader":[]}]},"delete":{"tags":["CLOB"],"summary":"Cancel All Orders","description":"Cancel all user's open orders (in-memory + DB).","operationId":"cancel_all_orders_api_v1_clob_orders_delete","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]},{"APIKeyHeader":[]}]}},"/api/v1/clob/orders/{order_id}":{"patch":{"tags":["CLOB"],"summary":"Amend Order","description":"Amend a resting order's price and/or quantity atomically.\n\n- Price change: order moves to new price level (loses queue priority)\n- Quantity decrease: preserves queue priority at same level\n- Quantity increase: loses queue priority (same as price change)\n\nIndustry-standard behavior matching Bybit, OKX, and Hyperliquid.","operationId":"amend_order_api_v1_clob_orders__order_id__patch","security":[{"HTTPBearer":[]},{"APIKeyHeader":[]}],"parameters":[{"name":"order_id","in":"path","required":true,"schema":{"type":"string","title":"Order Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AmendOrderRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["CLOB"],"summary":"Cancel Order","description":"Cancel an order by ID.","operationId":"cancel_order_api_v1_clob_orders__order_id__delete","security":[{"HTTPBearer":[]},{"APIKeyHeader":[]}],"parameters":[{"name":"order_id","in":"path","required":true,"schema":{"type":"string","title":"Order Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/mcp/v1":{"post":{"tags":["MCP Public Interface"],"summary":"Mcp Jsonrpc","description":"MCP JSON-RPC over streamable HTTP — initialize / tools/list / tools/call.","operationId":"mcp_jsonrpc_mcp_v1_post","parameters":[{"name":"x-api-key","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Api-Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[]}},"/mcp/v1/capabilities":{"get":{"tags":["MCP Public Interface"],"summary":"Get Platform Capabilities","description":"Get platform capabilities for agent's trust level.","operationId":"get_platform_capabilities_mcp_v1_capabilities_get","parameters":[{"name":"x-api-key","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Api-Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[]}},"/mcp/v1/tools":{"get":{"tags":["MCP Public Interface"],"summary":"List Available Tools","description":"Get catalog of available tools.","operationId":"list_available_tools_mcp_v1_tools_get","parameters":[{"name":"x-api-key","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Api-Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[]}},"/mcp/v1/register":{"post":{"tags":["MCP Public Interface"],"summary":"Register New Agent","description":"Register a new MCP agent.\n\nCreates both an MCPAgent row and an APIKey row so the key works\nwith both the MCP auth flow and the AgentBook verify_api_key flow.","operationId":"register_new_agent_mcp_v1_register_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentRegistrationRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[]}},"/mcp/v1/agents/me":{"get":{"tags":["MCP Public Interface"],"summary":"Get My Profile","description":"Get current agent's profile.","operationId":"get_my_profile_mcp_v1_agents_me_get","parameters":[{"name":"x-api-key","in":"header","required":true,"schema":{"type":"string","title":"X-Api-Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/mcp/v1/tools/{tool_name}":{"post":{"tags":["MCP Public Interface"],"summary":"Invoke Tool","description":"Invoke an MCP tool.","operationId":"invoke_tool_mcp_v1_tools__tool_name__post","parameters":[{"name":"tool_name","in":"path","required":true,"schema":{"type":"string","title":"Tool Name"}},{"name":"x-api-key","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Api-Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ToolInvokeRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/cloned-bots/available":{"get":{"tags":["cloned-bots"],"summary":"Get Available Bots","description":"Get all bots available for cloning.\n\nReturns both WTA species (10) and perpetual agents (5).\nNo authentication required - this is public data.","operationId":"get_available_bots_api_v1_cloned_bots_available_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","title":"Response Get Available Bots Api V1 Cloned Bots Available Get"}}}}}}},"/api/v1/cloned-bots/clone":{"post":{"tags":["cloned-bots"],"summary":"Clone Bot","description":"Clone a bot for the current user.\n\nPaper mode clones are free — no deposit required.\nLive mode clones require a prior deposit.\nThe cloned bot starts PAUSED - user must enable trading.","operationId":"clone_bot_api_v1_cloned_bots_clone_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"x-api-key","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Api-Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CloneBotRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CloneBotResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/cloned-bots/my-clones":{"get":{"tags":["cloned-bots"],"summary":"Get My Clones","description":"Get all bots cloned by the current user, optionally filtered by paper/live mode.\n\nEVE-14229: Set include_inactive=true to see deactivated bots.","operationId":"get_my_clones_api_v1_cloned_bots_my_clones_get","parameters":[{"name":"mode","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by 'paper' or 'live'","title":"Mode"},"description":"Filter by 'paper' or 'live'"},{"name":"include_inactive","in":"query","required":false,"schema":{"type":"boolean","description":"Include deactivated bots","default":false,"title":"Include Inactive"},"description":"Include deactivated bots"},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object"},"title":"Response Get My Clones Api V1 Cloned Bots My Clones Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/cloned-bots/{instance_id}/fund":{"post":{"tags":["cloned-bots"],"summary":"Fund Clone Bot","description":"Fund a clone bot from the user's internal balance.\n\nTransfers USDC from the user's available balance to the bot's\nisolated per-bot balance for trading.","operationId":"fund_clone_bot_api_v1_cloned_bots__instance_id__fund_post","parameters":[{"name":"instance_id","in":"path","required":true,"schema":{"type":"string","title":"Instance Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FundBotRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","title":"Response Fund Clone Bot Api V1 Cloned Bots  Instance Id  Fund Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/cloned-bots/{instance_id}/go-live":{"post":{"tags":["cloned-bots"],"summary":"Go Live","description":"Create a live bot from a paper bot's settings.\n\nCopies all tuned settings (SL/TP, markets, skills, models, exchange links)\ninto a new live bot. The paper bot is preserved. The new bot starts paused\nand unfunded — user must fund it before enabling trading.","operationId":"go_live_api_v1_cloned_bots__instance_id__go_live_post","parameters":[{"name":"instance_id","in":"path","required":true,"schema":{"type":"string","title":"Instance Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/GoLiveRequest"},{"type":"null"}],"title":"Request"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","title":"Response Go Live Api V1 Cloned Bots  Instance Id  Go Live Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/funding/me/swarm-wallet":{"get":{"tags":["Funding"],"summary":"Get User Swarm Wallet","description":"Get or create the authenticated user's personal swarm wallet.\n\nCreates wallet lazily on first access using HD derivation from USER_SWARM_MNEMONIC.\nReturns wallet address and current balance on Base chain.","operationId":"get_user_swarm_wallet_api_v1_funding_me_swarm_wallet_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SwarmWalletResponse"}}}}},"security":[{"HTTPBearer":[]},{"APIKeyHeader":[]}]}},"/api/v1/funding/deposit-addresses":{"get":{"tags":["Funding"],"summary":"Get Deposit Addresses","description":"Get user's unique deposit addresses for all supported chains.\n\nEach user gets a unique deposit address per chain. The backend monitors\nthese addresses and automatically:\n1. Detects incoming USDT deposits\n2. Bridges to Base if needed (using Across Protocol)\n3. Credits the net amount to user's bot wallet\n\nReturns deposit addresses for: Ethereum, Base, Arbitrum, Polygon","operationId":"get_deposit_addresses_api_v1_funding_deposit_addresses_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DepositAddressesResponse"}}}}},"security":[{"HTTPBearer":[]},{"APIKeyHeader":[]}]}},"/api/v1/exchange/pairs":{"get":{"tags":["Exchange"],"summary":"List Exchange Pairs","description":"List all available exchange pairs.","operationId":"list_exchange_pairs_api_v1_exchange_pairs_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[]}},"/api/v1/exchange/{symbol}/orders":{"post":{"tags":["Exchange"],"summary":"Place Order","description":"Place an order on the exchange.\n\nOptional `Idempotency-Key` request header: when supplied, the order\nresponse is cached for 300s keyed by (user_id, idempotency_key).\nSubsequent calls with the same key return the cached response without\nre-executing the order. Use this to make client-side retries safe\nagainst the forwarder-timeout-then-late-leader-reply race (where the\nleader executed the order but the follower returned 503 because its\nblpop deadline lapsed). The Idempotency-Key SHOULD be a fresh UUID\nper logical user intent (one click = one key, retries reuse the key).","operationId":"place_order_api_v1_exchange__symbol__orders_post","security":[{"HTTPBearer":[]},{"APIKeyHeader":[]}],"parameters":[{"name":"symbol","in":"path","required":true,"schema":{"type":"string","title":"Symbol"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/src__api__routes__exchange__PlaceOrderRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["Exchange"],"summary":"Cancel All Orders For Pair","description":"Cancel all open orders for this pair. Optional side filter.\n\nThis is the per-pair kill switch — institutional MMs use this to\ninstantly flatten their resting orders on a single market.","operationId":"cancel_all_orders_for_pair_api_v1_exchange__symbol__orders_delete","security":[{"HTTPBearer":[]},{"APIKeyHeader":[]}],"parameters":[{"name":"symbol","in":"path","required":true,"schema":{"type":"string","title":"Symbol"}},{"name":"side","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by side: buy or sell (omit for all)","title":"Side"},"description":"Filter by side: buy or sell (omit for all)"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/exchange/{symbol}/book":{"get":{"tags":["Exchange"],"summary":"Orderbook","description":"L2 CLOB-only orderbook snapshot (+ best-exec DEX levels for opted-in pairs).","operationId":"orderbook_api_v1_exchange__symbol__book_get","parameters":[{"name":"symbol","in":"path","required":true,"schema":{"type":"string","title":"Symbol"}},{"name":"depth","in":"query","required":false,"schema":{"type":"integer","default":30,"title":"Depth"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[]}},"/api/v1/exchange/{symbol}/trades":{"get":{"tags":["Exchange"],"summary":"Recent Trades","description":"Recent trades — persistent DB query (not in-memory).\n\nReads from clob_trades table for durability across restarts.\nFalls back to in-memory trade_history if DB query fails.","operationId":"recent_trades_api_v1_exchange__symbol__trades_get","parameters":[{"name":"symbol","in":"path","required":true,"schema":{"type":"string","title":"Symbol"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":500,"minimum":1,"default":50,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[]}},"/api/v1/exchange/{symbol}/bbo":{"get":{"tags":["Exchange"],"summary":"Best Bid Offer","description":"Best bid/offer — CLOB-first, falls back to hybrid only when CLOB is empty.","operationId":"best_bid_offer_api_v1_exchange__symbol__bbo_get","security":[],"parameters":[{"name":"symbol","in":"path","required":true,"schema":{"type":"string","title":"Symbol"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/exchange/{symbol}/ticker":{"get":{"tags":["Exchange"],"summary":"Get Ticker","description":"24-hour ticker: high, low, open, last, volume, change%.","operationId":"get_ticker_api_v1_exchange__symbol__ticker_get","parameters":[{"name":"symbol","in":"path","required":true,"schema":{"type":"string","title":"Symbol"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[]}}},"components":{"schemas":{"APIKeyBootstrapRequest":{"properties":{"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"},"username":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Username"},"password":{"type":"string","maxLength":72,"title":"Password"},"key_name":{"type":"string","maxLength":100,"title":"Key Name","default":"api-key"}},"type":"object","required":["password"],"title":"APIKeyBootstrapRequest","description":"Request to login and generate an API key in one call."},"APIKeyBootstrapResponse":{"properties":{"access_token":{"type":"string","title":"Access Token"},"refresh_token":{"type":"string","title":"Refresh Token"},"api_key":{"type":"string","title":"Api Key"},"api_secret":{"type":"string","title":"Api Secret"},"api_key_id":{"type":"string","title":"Api Key Id"},"message":{"type":"string","title":"Message","default":"Store the api_key and api_secret securely — they will not be shown again."}},"type":"object","required":["access_token","refresh_token","api_key","api_secret","api_key_id"],"title":"APIKeyBootstrapResponse","description":"Response containing tokens AND a new API key."},"APIKeyCreatedResponse":{"properties":{"key":{"type":"string","title":"Key"},"secret":{"type":"string","title":"Secret"},"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"tier":{"type":"string","title":"Tier"},"permissions":{"type":"object","title":"Permissions"},"allowed_markets":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Allowed Markets"},"expires_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Expires At"},"rate_limit_per_minute":{"type":"integer","title":"Rate Limit Per Minute"},"created_at":{"type":"string","title":"Created At"},"message":{"type":"string","title":"Message","default":"Store this key and secret securely — they will not be shown again."}},"type":"object","required":["key","secret","id","name","tier","permissions","rate_limit_per_minute","created_at"],"title":"APIKeyCreatedResponse"},"APIKeyListItem":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"tier":{"type":"string","title":"Tier"},"permissions":{"type":"object","title":"Permissions"},"allowed_markets":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Allowed Markets"},"rate_limit_per_minute":{"type":"integer","title":"Rate Limit Per Minute"},"key_prefix":{"type":"string","title":"Key Prefix"},"ip_whitelist":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Ip Whitelist"},"expires_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Expires At"},"created_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created At"},"last_used_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Used At"},"is_active":{"type":"boolean","title":"Is Active"}},"type":"object","required":["id","name","tier","permissions","rate_limit_per_minute","key_prefix","ip_whitelist","created_at","last_used_at","is_active"],"title":"APIKeyListItem"},"AgentRegistrationRequest":{"properties":{"name":{"type":"string","maxLength":100,"minLength":3,"title":"Name"},"description":{"anyOf":[{"type":"string","maxLength":1000},{"type":"null"}],"title":"Description"},"contact_email":{"type":"string","title":"Contact Email"},"capabilities":{"items":{"type":"string"},"type":"array","title":"Capabilities"},"intended_use":{"type":"string","maxLength":2000,"minLength":10,"title":"Intended Use"},"organization":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Organization"},"website":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Website"},"role":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Role","description":"Agent role: market_maker, trader, liquidity_provider, arbitrageur, analyst, bot_operator, other"}},"type":"object","required":["name","contact_email","intended_use"],"title":"AgentRegistrationRequest","description":"Request to register a new MCP agent."},"AmendOrderRequest":{"properties":{"price":{"anyOf":[{"type":"string","maxLength":50},{"type":"null"}],"title":"Price","description":"New limit price"},"quantity":{"anyOf":[{"type":"string","maxLength":50},{"type":"null"}],"title":"Quantity","description":"New quantity"}},"type":"object","title":"AmendOrderRequest","description":"Amend a resting order's price and/or quantity atomically."},"AssetType":{"type":"string","enum":["crypto","stock","bond","commodity","forex","derivative","structured_product","fund","prediction_contract","rwa","index","synthetic","custom"],"title":"AssetType","description":"Asset type enumeration."},"Body_token_oauth_token_post":{"properties":{"grant_type":{"type":"string","title":"Grant Type"},"code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Code"},"redirect_uri":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Redirect Uri"},"client_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Client Id"},"client_secret":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Client Secret"},"code_verifier":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Code Verifier"},"refresh_token":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Refresh Token"}},"type":"object","required":["grant_type"],"title":"Body_token_oauth_token_post"},"BuyRequest":{"properties":{"amount_usdc":{"type":"number","exclusiveMinimum":0.0,"title":"Amount Usdc","description":"USDC notional to go bull with"},"paper":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Paper","description":"Paper-trading override. True → paper (no real USDC moves, synthetic fills at registry price, position.is_paper=True). False → live (requires platform-wide live gate). None (default) → use user.simulation_mode if set, otherwise fall through to the platform-wide EVENT_CARDS_TRADING_ENABLED gate (currently paper-mode by default)."},"asset_class":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Asset Class","description":"Active sub-basket: 'crypto' or 'stock'. None = whole basket. Stock legs are paper-only unless the user has a verified live stock broker connected (then they route to that broker)."}},"type":"object","required":["amount_usdc"],"title":"BuyRequest"},"CloneBotRequest":{"properties":{"source_type":{"type":"string","title":"Source Type","description":"Type: 'wta_species' or 'perpetual_agent'"},"source_id":{"type":"string","title":"Source Id","description":"ID of the species/agent to clone"},"custom_name":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}],"title":"Custom Name","description":"Optional custom name"},"is_paper":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Paper","description":"Explicit paper/live mode. If None, inherits user's simulation_mode."}},"type":"object","required":["source_type","source_id"],"title":"CloneBotRequest","description":"Request to clone a bot."},"CloneBotResponse":{"properties":{"id":{"type":"string","title":"Id"},"type":{"type":"string","title":"Type"},"source_id":{"type":"string","title":"Source Id"},"source_name":{"type":"string","title":"Source Name"},"source_symbol":{"type":"string","title":"Source Symbol"},"name":{"type":"string","title":"Name"},"wallet_address":{"type":"string","title":"Wallet Address"},"wallet_url":{"type":"string","title":"Wallet Url"},"is_trading":{"type":"boolean","title":"Is Trading"},"is_paper":{"type":"boolean","title":"Is Paper","default":false},"strategy_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Strategy Type"},"risk_profile":{"type":"string","title":"Risk Profile"},"team":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Team"},"emoji":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Emoji"},"created_at":{"type":"string","title":"Created At"}},"type":"object","required":["id","type","source_id","source_name","source_symbol","name","wallet_address","wallet_url","is_trading","strategy_type","risk_profile","created_at"],"title":"CloneBotResponse","description":"Response after cloning a bot."},"CreateAPIKeyRequest":{"properties":{"name":{"type":"string","maxLength":100,"minLength":1,"title":"Name"},"permissions":{"type":"object","title":"Permissions","description":"Key permissions: read, trade, withdraw","default":{"read":true,"trade":false,"withdraw":false}},"ip_whitelist":{"anyOf":[{"items":{"type":"string"},"type":"array","maxItems":20},{"type":"null"}],"title":"Ip Whitelist","description":"Optional IP whitelist"},"allowed_markets":{"anyOf":[{"items":{"type":"string"},"type":"array","maxItems":100},{"type":"null"}],"title":"Allowed Markets","description":"Optional perp market_id allowlist (restrict trading to these markets)"},"expires_in_days":{"anyOf":[{"type":"integer","maximum":3650.0,"minimum":1.0},{"type":"null"}],"title":"Expires In Days"}},"type":"object","required":["name"],"title":"CreateAPIKeyRequest"},"DepositAddressInfo":{"properties":{"chain_id":{"type":"integer","title":"Chain Id"},"chain_name":{"type":"string","title":"Chain Name"},"address":{"type":"string","title":"Address"},"usdt_contract":{"type":"string","title":"Usdt Contract"},"usdc_contract":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Usdc Contract"},"is_solana":{"type":"boolean","title":"Is Solana","default":false}},"type":"object","required":["chain_id","chain_name","address","usdt_contract"],"title":"DepositAddressInfo","description":"Deposit address for a specific chain."},"DepositAddressesResponse":{"properties":{"user_id":{"type":"integer","title":"User Id"},"addresses":{"items":{"$ref":"#/components/schemas/DepositAddressInfo"},"type":"array","title":"Addresses"},"instructions":{"type":"string","title":"Instructions"},"swarm_wallet_address":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Swarm Wallet Address"}},"type":"object","required":["user_id","addresses","instructions"],"title":"DepositAddressesResponse","description":"All deposit addresses for a user."},"FundBotRequest":{"properties":{"amount":{"type":"number","exclusiveMinimum":0.0,"title":"Amount","description":"Amount in USDC to transfer to the bot"}},"type":"object","required":["amount"],"title":"FundBotRequest","description":"Request to fund a clone bot from user's balance."},"GoLiveRequest":{"properties":{"custom_name":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}],"title":"Custom Name","description":"Optional name for the live bot"}},"type":"object","title":"GoLiveRequest","description":"Request to create a live bot from a paper bot's settings."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"MarketCreate":{"properties":{"name":{"type":"string","maxLength":200,"minLength":1,"title":"Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"assets":{"items":{"type":"string"},"type":"array","minItems":2,"title":"Assets"},"asset_probabilities":{"anyOf":[{"additionalProperties":{"type":"number"},"type":"object"},{"type":"null"}],"title":"Asset Probabilities"},"asset_explanations":{"anyOf":[{"additionalProperties":{"type":"string"},"type":"object"},{"type":"null"}],"title":"Asset Explanations"},"asset_type":{"$ref":"#/components/schemas/AssetType"},"token":{"type":"string","minLength":1,"title":"Token"},"start_time":{"type":"string","format":"date-time","title":"Start Time"},"end_time":{"type":"string","format":"date-time","title":"End Time"},"min_trade":{"anyOf":[{"type":"number","exclusiveMinimum":0.0},{"type":"string"}],"title":"Min Trade","default":"1.0"},"max_trade":{"anyOf":[{"type":"number","exclusiveMinimum":0.0},{"type":"string"}],"title":"Max Trade","default":"100000.0"},"source_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source Url"},"is_featured":{"type":"boolean","title":"Is Featured","default":false},"user_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id","default":"api_user"}},"type":"object","required":["name","assets","asset_type","token","start_time","end_time"],"title":"MarketCreate","description":"Schema for creating a new prediction market."},"MarketResponse":{"properties":{"contract_address":{"type":"string","title":"Contract Address"},"name":{"type":"string","title":"Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"assets":{"items":{},"type":"array","title":"Assets","default":[]},"asset_type":{"$ref":"#/components/schemas/AssetType"},"token":{"type":"string","title":"Token"},"start_time":{"type":"string","format":"date-time","title":"Start Time"},"end_time":{"type":"string","format":"date-time","title":"End Time"},"min_trade":{"type":"number","title":"Min Trade"},"max_trade":{"type":"number","title":"Max Trade"},"status":{"$ref":"#/components/schemas/MarketStatus"},"total_pool":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Total Pool","default":0.0},"market_analysis":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Market Analysis"},"created_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Created At"},"updated_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Updated At"},"source_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source Url"},"image_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Image Url"},"og_title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Og Title"},"og_description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Og Description"},"is_featured":{"type":"boolean","title":"Is Featured","default":false},"duplicate_warning":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Duplicate Warning"},"duplicate_info":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Duplicate Info"},"funding_wallet_address":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Funding Wallet Address"},"funding_balance_usd":{"type":"number","title":"Funding Balance Usd","default":0.0}},"type":"object","required":["contract_address","name","description","asset_type","token","start_time","end_time","min_trade","max_trade","status"],"title":"MarketResponse","description":"Schema for market response."},"MarketStatus":{"type":"string","enum":["pending","active","completed","cancelled"],"title":"MarketStatus","description":"Market status enumeration."},"PortfolioSummaryResponse":{"properties":{"balance_usdc":{"type":"string","title":"Balance Usdc","description":"Current USDC balance"},"total_pnl":{"type":"string","title":"Total Pnl","description":"Total realized P&L in USDC"},"positions_value":{"type":"string","title":"Positions Value","description":"Value of open positions in USDC"},"total_predictions":{"type":"integer","title":"Total Predictions","description":"Total number of predictions made"},"win_count":{"type":"integer","title":"Win Count","description":"Number of winning trades"},"loss_count":{"type":"integer","title":"Loss Count","description":"Number of losing trades"},"win_rate":{"type":"string","title":"Win Rate","description":"Win rate as percentage (0-100)"},"biggest_win":{"type":"string","title":"Biggest Win","description":"Largest winning trade in USDC"},"biggest_loss":{"type":"string","title":"Biggest Loss","description":"Largest losing trade in USDC"},"total_volume":{"type":"string","title":"Total Volume","description":"Total trading volume in USDC"}},"type":"object","required":["balance_usdc","total_pnl","positions_value","total_predictions","win_count","loss_count","win_rate","biggest_win","biggest_loss","total_volume"],"title":"PortfolioSummaryResponse","description":"Aggregated portfolio P&L summary."},"PositionItem":{"properties":{"market_title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Market Title"},"asset_symbol":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Asset Symbol"},"amount":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Amount"},"pnl":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Pnl"},"status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"},"tx_hash":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tx Hash"},"created_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created At"}},"type":"object","title":"PositionItem","description":"Single position entry."},"PositionsResponse":{"properties":{"positions":{"items":{"$ref":"#/components/schemas/PositionItem"},"type":"array","title":"Positions"},"total":{"type":"integer","title":"Total"},"has_more":{"type":"boolean","title":"Has More"}},"type":"object","required":["positions","total","has_more"],"title":"PositionsResponse","description":"List of user positions."},"RegisterRequest":{"properties":{"client_name":{"type":"string","maxLength":200,"minLength":1,"title":"Client Name"},"redirect_uris":{"items":{"type":"string"},"type":"array","maxItems":10,"minItems":1,"title":"Redirect Uris"},"grant_types":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Grant Types"},"response_types":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Response Types"},"token_endpoint_auth_method":{"type":"string","title":"Token Endpoint Auth Method","default":"none"},"scope":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Scope"},"contact_email":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Contact Email"}},"type":"object","required":["client_name","redirect_uris"],"title":"RegisterRequest"},"SellRequest":{"properties":{"position_id":{"type":"string","title":"Position Id"},"fraction":{"type":"number","maximum":1.0,"exclusiveMinimum":0.0,"title":"Fraction","default":1.0},"paper":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Paper","description":"Per-trade paper override; see BuyRequest.paper"}},"type":"object","required":["position_id"],"title":"SellRequest"},"ShortRequest":{"properties":{"margin_usdc":{"type":"number","exclusiveMinimum":0.0,"title":"Margin Usdc","description":"USDC margin for the perp position"},"leverage":{"type":"integer","maximum":10.0,"minimum":1.0,"title":"Leverage","description":"Leverage (1-10x)","default":1},"side":{"type":"string","title":"Side","description":"'long' or 'short'","default":"short"},"paper":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Paper","description":"Per-trade paper override — honoured only on the spot-bear fallback (cards without an EVCDX token); perps are always real-ledger"},"execution":{"type":"string","title":"Execution","description":"'auto' (default): perp when the card has an EVCDX token, spot bear otherwise. 'broker': force the spot-bear path, which SELLS SHORT the card's equity legs in your OWN connected brokerage account (requires a verified live stock-broker connection, an all-stock basket, and open US markets).","default":"auto"}},"type":"object","required":["margin_usdc"],"title":"ShortRequest"},"SwarmWalletResponse":{"properties":{"address":{"type":"string","title":"Address","description":"Swarm wallet address on Base chain"},"chain_id":{"type":"integer","title":"Chain Id","description":"Chain ID (8453 = Base)","default":8453},"balance_usdc":{"type":"string","title":"Balance Usdc","description":"USDC balance","default":"0.00"},"balance_usdt":{"type":"string","title":"Balance Usdt","description":"USDT balance","default":"0.00"},"balance_eth":{"type":"string","title":"Balance Eth","description":"ETH balance for gas","default":"0.0"},"user_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"User Id","description":"User ID who owns this wallet"}},"type":"object","required":["address"],"title":"SwarmWalletResponse","description":"Response schema for user's personal swarm wallet."},"TokenResponse":{"properties":{"access_token":{"type":"string","title":"Access Token"},"refresh_token":{"type":"string","title":"Refresh Token"},"token_type":{"type":"string","title":"Token Type","default":"bearer"},"user":{"$ref":"#/components/schemas/UserResponse"}},"type":"object","required":["access_token","refresh_token","user"],"title":"TokenResponse","description":"Token response schema."},"ToolInvokeRequest":{"properties":{"params":{"type":"object","title":"Params"}},"type":"object","title":"ToolInvokeRequest","description":"Request to invoke a tool."},"UpdateAPIKeyRequest":{"properties":{"name":{"anyOf":[{"type":"string","maxLength":100,"minLength":1},{"type":"null"}],"title":"Name"},"permissions":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Permissions"},"ip_whitelist":{"anyOf":[{"items":{"type":"string"},"type":"array","maxItems":20},{"type":"null"}],"title":"Ip Whitelist"},"allowed_markets":{"anyOf":[{"items":{"type":"string"},"type":"array","maxItems":100},{"type":"null"}],"title":"Allowed Markets"}},"type":"object","title":"UpdateAPIKeyRequest"},"UserLogin":{"properties":{"username":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Username"},"email":{"anyOf":[{"type":"string","format":"email"},{"type":"null"}],"title":"Email"},"password":{"type":"string","maxLength":72,"title":"Password"}},"type":"object","required":["password"],"title":"UserLogin","description":"User login schema - accepts either email or username."},"UserRegister":{"properties":{"email":{"type":"string","format":"email","title":"Email"},"username":{"type":"string","maxLength":50,"minLength":3,"pattern":"^[a-zA-Z0-9_.-]+$","title":"Username"},"password":{"type":"string","maxLength":72,"minLength":8,"title":"Password"},"full_name":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}],"title":"Full Name"},"location":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}],"title":"Location"},"website":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Website"},"social_profiles":{"anyOf":[{"additionalProperties":{"type":"string"},"type":"object"},{"type":"null"}],"title":"Social Profiles"},"referral_code":{"anyOf":[{"type":"string","maxLength":20},{"type":"null"}],"title":"Referral Code","description":"Referral code from inviter"},"tos_accepted":{"type":"boolean","title":"Tos Accepted","description":"Must be true — user has accepted Terms of Service"},"privacy_policy_accepted":{"type":"boolean","title":"Privacy Policy Accepted","description":"Must be true — user has accepted Privacy Policy"},"tos_version":{"anyOf":[{"type":"string","maxLength":32},{"type":"null"}],"title":"Tos Version","description":"ToS version string shown to user (e.g. '2026-05-27')"},"privacy_policy_version":{"anyOf":[{"type":"string","maxLength":32},{"type":"null"}],"title":"Privacy Policy Version","description":"Privacy Policy version string shown to user"}},"type":"object","required":["email","username","password","tos_accepted","privacy_policy_accepted"],"title":"UserRegister","description":"User registration schema."},"UserResponse":{"properties":{"id":{"type":"integer","title":"Id"},"email":{"type":"string","title":"Email"},"username":{"type":"string","title":"Username"},"full_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Full Name"},"wallet_address":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Wallet Address"},"swarm_wallet_address":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Swarm Wallet Address"},"avatar_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Avatar Url"},"bio":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Bio"},"nexus_instructions":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Nexus Instructions"},"location":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Location"},"website":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Website"},"social_profiles":{"anyOf":[{"additionalProperties":{"type":"string"},"type":"object"},{"type":"null"}],"title":"Social Profiles"},"auth_provider":{"type":"string","title":"Auth Provider","default":"local"},"role":{"type":"string","title":"Role"},"is_active":{"type":"boolean","title":"Is Active"},"is_verified":{"type":"boolean","title":"Is Verified"},"total_trades":{"type":"integer","title":"Total Trades"},"total_volume":{"type":"integer","title":"Total Volume"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"last_login":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Login"}},"type":"object","required":["id","email","username","full_name","avatar_url","bio","role","is_active","is_verified","total_trades","total_volume","created_at","last_login"],"title":"UserResponse","description":"User response schema."},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"},"src__api__routes__clob__PlaceOrderRequest":{"properties":{"side":{"type":"string","maxLength":10,"title":"Side","description":"buy or sell"},"order_type":{"type":"string","maxLength":20,"title":"Order Type","description":"limit, market, ioc, fok, post_only","default":"limit"},"price":{"type":"string","maxLength":50,"title":"Price","description":"Limit price","default":"0"},"quantity":{"type":"string","maxLength":50,"title":"Quantity","description":"VAIX quantity"},"venue":{"type":"string","maxLength":20,"title":"Venue","description":"internal, cex, or best","default":"internal"},"pair":{"type":"string","maxLength":64,"title":"Pair","description":"Trading pair","default":"VAIX/USDC"},"stp_mode":{"anyOf":[{"type":"string","maxLength":30},{"type":"null"}],"title":"Stp Mode","description":"STP mode: cancel_resting, cancel_incoming, cancel_both, cancel_taker, decrement_and_cancel"},"stop_price":{"anyOf":[{"type":"number"},{"type":"string"},{"type":"null"}],"title":"Stop Price","description":"Stop trigger price for stop-limit orders"},"expire_at":{"anyOf":[{"type":"string","maxLength":50},{"type":"null"}],"title":"Expire At","description":"GTD expiry as ISO datetime or epoch microseconds"},"display_qty":{"anyOf":[{"type":"number"},{"type":"string"},{"type":"null"}],"title":"Display Qty","description":"Iceberg visible quantity"}},"type":"object","required":["side","quantity"],"title":"PlaceOrderRequest"},"src__api__routes__exchange__PlaceOrderRequest":{"properties":{"side":{"type":"string","title":"Side","description":"buy or sell"},"order_type":{"type":"string","title":"Order Type","description":"limit, market, ioc, post_only, stop_limit, stop_market","default":"limit"},"price":{"type":"string","title":"Price","description":"Limit price","default":"0"},"quantity":{"type":"string","title":"Quantity","description":"Base token quantity"},"stop_price":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Stop Price","description":"Stop price for stop-limit orders"},"position_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Position Id","description":"Optional position UUID — used by the EVCDX-* bridge to target a specific bull position on SELL when the user has multiple open positions on the same card.  Ignored for non-EVCDX symbols."},"mode":{"type":"string","title":"Mode","description":"Trading mode: 'live' or 'paper'","default":"live"},"stp_mode":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Stp Mode","description":"STP mode: cancel_resting, cancel_incoming, cancel_both, cancel_taker, decrement_and_cancel"},"time_in_force_ms":{"anyOf":[{"type":"integer","maximum":2592000000.0,"minimum":1000.0},{"type":"null"}],"title":"Time In Force Ms","description":"GTT: order auto-expires after this many ms (1s to 30d)"},"expire_at":{"anyOf":[{"type":"integer","minimum":1.0},{"type":"null"}],"title":"Expire At","description":"GTT: absolute expiry as epoch microseconds (must be in the future)"},"display_qty":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Display Qty","description":"Iceberg: visible quantity per tranche (remainder hidden)"},"route_mode":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Route Mode","description":"Execution venue: 'cex' (CLOB only), 'dex' (AMM only), 'auto' (CLOB then AMM fallback)","default":"cex"}},"type":"object","required":["side","quantity"],"title":"PlaceOrderRequest"}},"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"X-API-Key"},"BearerJWT":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Account session JWT (from /auth/login). Key-management routes accept only this — never an API key."},"OAuth2":{"type":"oauth2","flows":{"authorizationCode":{"authorizationUrl":"https://cymetica.com/oauth/authorize","tokenUrl":"https://cymetica.com/oauth/token","scopes":{"read":"Read public and account data","portfolio":"Read portfolio positions","trade":"Place and cancel orders"}}}}}},"security":[{"ApiKeyAuth":[]},{"OAuth2":[]}]}