{"openapi":"3.1.0","info":{"title":"Orderly One API","version":"1.0.0","description":"Orderly One DEX Creator API - Create and manage decentralized exchanges\n\n**Agent quickstart — full graduation without a browser:**\n\n1. Create an EVM wallet, then authenticate: `POST /api/auth/nonce` → sign the returned message with the wallet → `POST /api/auth/verify` → keep the Bearer token.\n2. Create your DEX: `POST /api/dex` (multipart form; `integrationType: \"custom\"` is enough — no hosted frontend needed).\n3. Pay the one-time fee **and** create your broker in a single x402 request: `POST /api/graduation/graduate?brokerId=...&makerFee=...&takerFee=...&rwaMakerFee=...&rwaTakerFee=...` with your Bearer token — see that endpoint for the payment protocol (402 → sign EIP-3009 → retry with `payment-signature`).\n4. Finish graduation by registering your wallet as the broker admin: follow the recipe in `POST /api/graduation/finalize-admin-wallet`.\n5. Confirm with `GET /api/graduation/graduation-status` — done when `isGraduated: true`."},"servers":[{"url":"https://testnet-dex-api.orderly.network","description":"API Server"}],"tags":[{"name":"Authentication","description":"Authentication endpoints"},{"name":"DEX","description":"DEX management endpoints"},{"name":"Admin","description":"Admin-only endpoints"},{"name":"Theme","description":"Theme customization endpoints"},{"name":"Graduation","description":"DEX graduation endpoints"},{"name":"Leaderboard","description":"Trading leaderboards"},{"name":"Stats","description":"Platform statistics"}],"components":{"schemas":{"DexNotFoundResponse":{"type":"object","properties":{"exists":{"type":"boolean","enum":[false],"description":"Indicates no DEX exists for this user"}},"required":["exists"]},"DexResponse":{"type":"object","properties":{"id":{"type":"string","description":"DEX ID"},"userId":{"type":"string","description":"User ID"},"brokerId":{"type":"string","description":"Broker ID"},"brokerName":{"type":"string","description":"Display name of the DEX"},"repoUrl":{"type":"string","nullable":true,"description":"GitHub repository URL"},"customDomain":{"type":"string","nullable":true,"description":"Custom domain for the DEX"},"description":{"type":"string","nullable":true,"description":"DEX description"},"banner":{"type":"string","nullable":true,"description":"Banner image URL"},"logo":{"type":"string","nullable":true,"description":"Logo image URL"},"primaryLogo":{"type":"string","nullable":true,"description":"Primary logo asset URL"},"secondaryLogo":{"type":"string","nullable":true,"description":"Secondary logo asset URL"},"favicon":{"type":"string","nullable":true,"description":"Favicon URL"},"tokenAddress":{"type":"string","nullable":true,"description":"Token contract address"},"tokenChain":{"type":"string","nullable":true,"description":"Token blockchain network"},"telegramLink":{"type":"string","nullable":true,"description":"Telegram group link"},"discordLink":{"type":"string","nullable":true,"description":"Discord invite link"},"xLink":{"type":"string","nullable":true,"description":"X (Twitter) profile link"},"websiteUrl":{"type":"string","nullable":true,"description":"Official website URL"},"isGraduated":{"type":"boolean","description":"Whether the DEX has graduated from demo"},"integrationType":{"type":"string","description":"Integration type: 'low_code' for hosted DEX, 'custom' for custom SDK/API integration"},"showOnBoard":{"type":"boolean","description":"Whether to expose DEX identity on the public leaderboard"},"createdAt":{"type":"string","format":"date-time","description":"Creation timestamp"},"updatedAt":{"type":"string","format":"date-time","description":"Last update timestamp"}},"required":["id","userId","brokerId","brokerName","repoUrl","customDomain","description","banner","logo","primaryLogo","secondaryLogo","favicon","tokenAddress","tokenChain","telegramLink","discordLink","xLink","websiteUrl","isGraduated","integrationType","showOnBoard","createdAt","updatedAt"]},"BrokerNameUpdateSuccess":{"type":"object","properties":{"message":{"type":"string","description":"Success message"},"dex":{"type":"object","properties":{"id":{"type":"string","description":"DEX ID"},"userId":{"type":"string","description":"User ID"},"brokerId":{"type":"string","description":"Broker ID"},"brokerName":{"type":"string","description":"Display name of the DEX"},"repoUrl":{"type":"string","nullable":true,"description":"GitHub repository URL"},"customDomain":{"type":"string","nullable":true,"description":"Custom domain for the DEX"},"description":{"type":"string","nullable":true,"description":"DEX description"},"banner":{"type":"string","nullable":true,"description":"Banner image URL"},"logo":{"type":"string","nullable":true,"description":"Logo image URL"},"primaryLogo":{"type":"string","nullable":true,"description":"Primary logo asset URL"},"secondaryLogo":{"type":"string","nullable":true,"description":"Secondary logo asset URL"},"favicon":{"type":"string","nullable":true,"description":"Favicon URL"},"tokenAddress":{"type":"string","nullable":true,"description":"Token contract address"},"tokenChain":{"type":"string","nullable":true,"description":"Token blockchain network"},"telegramLink":{"type":"string","nullable":true,"description":"Telegram group link"},"discordLink":{"type":"string","nullable":true,"description":"Discord invite link"},"xLink":{"type":"string","nullable":true,"description":"X (Twitter) profile link"},"websiteUrl":{"type":"string","nullable":true,"description":"Official website URL"},"isGraduated":{"type":"boolean","description":"Whether the DEX has graduated from demo"},"integrationType":{"type":"string","description":"Integration type: 'low_code' for hosted DEX, 'custom' for custom SDK/API integration"},"showOnBoard":{"type":"boolean","description":"Whether to expose DEX identity on the public leaderboard"},"createdAt":{"type":"string","format":"date-time","description":"Creation timestamp"},"updatedAt":{"type":"string","format":"date-time","description":"Last update timestamp"}},"required":["id","userId","brokerId","brokerName","repoUrl","customDomain","description","banner","logo","primaryLogo","secondaryLogo","favicon","tokenAddress","tokenChain","telegramLink","discordLink","xLink","websiteUrl","isGraduated","integrationType","showOnBoard","createdAt","updatedAt"]}},"required":["message","dex"]},"NotFoundError":{"type":"object","properties":{"message":{"type":"string","description":"Not found error message"}},"required":["message"]},"BrokerNameUpdate":{"type":"object","properties":{"brokerName":{"type":"string","minLength":3,"maxLength":30,"pattern":"^[a-zA-Z0-9 .\\-_]*$"}},"required":["brokerName"]},"UnauthorizedError":{"type":"object","properties":{"message":{"type":"string","description":"Unauthorized error message"}},"required":["message"]},"ConflictError":{"type":"object","properties":{"error":{"type":"string","description":"Conflict error message"}},"required":["error"]},"SocialCardUpdate":{"type":"object","properties":{"message":{"type":"string","description":"Success message"},"dex":{"type":"object","properties":{"id":{"type":"string"},"brokerName":{"type":"string","minLength":3,"maxLength":30,"pattern":"^[a-zA-Z0-9 .\\-_]*$"},"description":{"type":"string","nullable":true},"banner":{"type":"string","nullable":true},"logo":{"type":"string","nullable":true},"tokenAddress":{"type":"string","nullable":true},"tokenChain":{"type":"string","nullable":true},"telegramLink":{"type":"string","nullable":true},"discordLink":{"type":"string","nullable":true},"xLink":{"type":"string","nullable":true},"websiteUrl":{"type":"string","nullable":true}},"required":["id","brokerName","description","banner","logo","tokenAddress","tokenChain","telegramLink","discordLink","xLink","websiteUrl"]}},"required":["message","dex"]},"DeleteSuccess":{"type":"object","properties":{"message":{"type":"string","description":"Success message"},"dex":{"type":"object","properties":{"id":{"type":"string","description":"DEX ID"},"userId":{"type":"string","description":"User ID"},"brokerId":{"type":"string","description":"Broker ID"},"brokerName":{"type":"string","description":"Display name of the DEX"},"repoUrl":{"type":"string","nullable":true,"description":"GitHub repository URL"},"customDomain":{"type":"string","nullable":true,"description":"Custom domain for the DEX"},"description":{"type":"string","nullable":true,"description":"DEX description"},"banner":{"type":"string","nullable":true,"description":"Banner image URL"},"logo":{"type":"string","nullable":true,"description":"Logo image URL"},"primaryLogo":{"type":"string","nullable":true,"description":"Primary logo asset URL"},"secondaryLogo":{"type":"string","nullable":true,"description":"Secondary logo asset URL"},"favicon":{"type":"string","nullable":true,"description":"Favicon URL"},"tokenAddress":{"type":"string","nullable":true,"description":"Token contract address"},"tokenChain":{"type":"string","nullable":true,"description":"Token blockchain network"},"telegramLink":{"type":"string","nullable":true,"description":"Telegram group link"},"discordLink":{"type":"string","nullable":true,"description":"Discord invite link"},"xLink":{"type":"string","nullable":true,"description":"X (Twitter) profile link"},"websiteUrl":{"type":"string","nullable":true,"description":"Official website URL"},"isGraduated":{"type":"boolean","description":"Whether the DEX has graduated from demo"},"integrationType":{"type":"string","description":"Integration type: 'low_code' for hosted DEX, 'custom' for custom SDK/API integration"},"showOnBoard":{"type":"boolean","description":"Whether to expose DEX identity on the public leaderboard"},"createdAt":{"type":"string","format":"date-time","description":"Creation timestamp"},"updatedAt":{"type":"string","format":"date-time","description":"Last update timestamp"}},"required":["id","userId","brokerId","brokerName","repoUrl","customDomain","description","banner","logo","primaryLogo","secondaryLogo","favicon","tokenAddress","tokenChain","telegramLink","discordLink","xLink","websiteUrl","isGraduated","integrationType","showOnBoard","createdAt","updatedAt"]}},"required":["message","dex"]},"UpgradeSuccess":{"type":"object","properties":{"message":{"type":"string","description":"Success message"},"success":{"type":"boolean"}},"required":["message","success"]},"CustomDomainSuccess":{"type":"object","properties":{"message":{"type":"string","description":"Success message"},"dex":{"type":"object","properties":{"id":{"type":"string","description":"DEX ID"},"userId":{"type":"string","description":"User ID"},"brokerId":{"type":"string","description":"Broker ID"},"brokerName":{"type":"string","description":"Display name of the DEX"},"repoUrl":{"type":"string","nullable":true,"description":"GitHub repository URL"},"customDomain":{"type":"string","nullable":true,"description":"Custom domain for the DEX"},"description":{"type":"string","nullable":true,"description":"DEX description"},"banner":{"type":"string","nullable":true,"description":"Banner image URL"},"logo":{"type":"string","nullable":true,"description":"Logo image URL"},"primaryLogo":{"type":"string","nullable":true,"description":"Primary logo asset URL"},"secondaryLogo":{"type":"string","nullable":true,"description":"Secondary logo asset URL"},"favicon":{"type":"string","nullable":true,"description":"Favicon URL"},"tokenAddress":{"type":"string","nullable":true,"description":"Token contract address"},"tokenChain":{"type":"string","nullable":true,"description":"Token blockchain network"},"telegramLink":{"type":"string","nullable":true,"description":"Telegram group link"},"discordLink":{"type":"string","nullable":true,"description":"Discord invite link"},"xLink":{"type":"string","nullable":true,"description":"X (Twitter) profile link"},"websiteUrl":{"type":"string","nullable":true,"description":"Official website URL"},"isGraduated":{"type":"boolean","description":"Whether the DEX has graduated from demo"},"integrationType":{"type":"string","description":"Integration type: 'low_code' for hosted DEX, 'custom' for custom SDK/API integration"},"showOnBoard":{"type":"boolean","description":"Whether to expose DEX identity on the public leaderboard"},"createdAt":{"type":"string","format":"date-time","description":"Creation timestamp"},"updatedAt":{"type":"string","format":"date-time","description":"Last update timestamp"}},"required":["id","userId","brokerId","brokerName","repoUrl","customDomain","description","banner","logo","primaryLogo","secondaryLogo","favicon","tokenAddress","tokenChain","telegramLink","discordLink","xLink","websiteUrl","isGraduated","integrationType","showOnBoard","createdAt","updatedAt"]}},"required":["message","dex"]},"SwapFeeSuccess":{"type":"object","properties":{"message":{"type":"string","description":"Success message"},"dex":{"type":"object","properties":{"id":{"type":"string","description":"DEX ID"},"userId":{"type":"string","description":"User ID"},"brokerId":{"type":"string","description":"Broker ID"},"brokerName":{"type":"string","description":"Display name of the DEX"},"repoUrl":{"type":"string","nullable":true,"description":"GitHub repository URL"},"customDomain":{"type":"string","nullable":true,"description":"Custom domain for the DEX"},"description":{"type":"string","nullable":true,"description":"DEX description"},"banner":{"type":"string","nullable":true,"description":"Banner image URL"},"logo":{"type":"string","nullable":true,"description":"Logo image URL"},"primaryLogo":{"type":"string","nullable":true,"description":"Primary logo asset URL"},"secondaryLogo":{"type":"string","nullable":true,"description":"Secondary logo asset URL"},"favicon":{"type":"string","nullable":true,"description":"Favicon URL"},"tokenAddress":{"type":"string","nullable":true,"description":"Token contract address"},"tokenChain":{"type":"string","nullable":true,"description":"Token blockchain network"},"telegramLink":{"type":"string","nullable":true,"description":"Telegram group link"},"discordLink":{"type":"string","nullable":true,"description":"Discord invite link"},"xLink":{"type":"string","nullable":true,"description":"X (Twitter) profile link"},"websiteUrl":{"type":"string","nullable":true,"description":"Official website URL"},"isGraduated":{"type":"boolean","description":"Whether the DEX has graduated from demo"},"integrationType":{"type":"string","description":"Integration type: 'low_code' for hosted DEX, 'custom' for custom SDK/API integration"},"showOnBoard":{"type":"boolean","description":"Whether to expose DEX identity on the public leaderboard"},"createdAt":{"type":"string","format":"date-time","description":"Creation timestamp"},"updatedAt":{"type":"string","format":"date-time","description":"Last update timestamp"}},"required":["id","userId","brokerId","brokerName","repoUrl","customDomain","description","banner","logo","primaryLogo","secondaryLogo","favicon","tokenAddress","tokenChain","telegramLink","discordLink","xLink","websiteUrl","isGraduated","integrationType","showOnBoard","createdAt","updatedAt"]}},"required":["message","dex"]},"NonceResponse":{"type":"object","properties":{"message":{"type":"string","description":"Message to sign"},"nonce":{"type":"string","description":"Authentication nonce"}},"required":["message","nonce"]},"AuthErrorResponse":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]},"AuthRequest":{"type":"object","properties":{"address":{"type":"string","pattern":"^0x[a-fA-F0-9]{40}$","description":"Ethereum wallet address"}},"required":["address"]},"AuthSuccessResponse":{"type":"object","properties":{"user":{"type":"object","properties":{"id":{"type":"string","description":"User ID"},"address":{"type":"string","description":"Ethereum address"}},"required":["id","address"]},"token":{"type":"string","description":"JWT authentication token"}},"required":["user","token"]},"AuthVerify":{"type":"object","properties":{"address":{"type":"string","pattern":"^0x[a-fA-F0-9]{40}$","description":"Ethereum wallet address"},"signature":{"type":"string","description":"Signature of the authentication message"}},"required":["address","signature"]},"TokenValidationResponse":{"type":"object","properties":{"valid":{"type":"boolean","description":"Whether the token is valid"},"user":{"type":"object","properties":{"id":{"type":"string"},"address":{"type":"string"}},"required":["id","address"]},"error":{"type":"string","description":"Error message if validation failed"}},"required":["valid"]},"TokenValidation":{"type":"object","properties":{"address":{"type":"string","pattern":"^0x[a-fA-F0-9]{40}$","description":"Ethereum wallet address"},"token":{"type":"string","description":"Authentication token"}},"required":["address","token"]},"AdminCheckResponse":{"type":"object","properties":{"isAdmin":{"type":"boolean","description":"Whether the current user is an admin"}},"required":["isAdmin"]},"ThemeModifyResponse":{"type":"object","properties":{"themes":{"type":"array","items":{"type":"string"},"description":"Array of 3 generated token-only CSS theme variants"}},"required":["themes"]},"ThemeErrorResponse":{"type":"object","properties":{"error":{"type":"string","description":"Error message"},"message":{"type":"string","description":"Additional error details"},"retryAfter":{"type":"number","description":"Seconds until retry is allowed"}}},"VerifyTxSuccess":{"type":"object","properties":{"success":{"type":"boolean","description":"Verification successful"},"message":{"type":"string","description":"Success message"},"amount":{"type":"string","description":"Amount paid in graduation fee"},"brokerCreationData":{"type":"object","properties":{"brokerId":{"type":"string","description":"Created broker ID"},"transactionHashes":{"type":"object","additionalProperties":{"type":"string"},"description":"Transaction hashes from broker creation"}},"required":["brokerId"]}},"required":["success","message","brokerCreationData"]},"GraduationErrorResponse":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}},"required":["success"]},"GraduationRefundResponse":{"type":"object","properties":{"success":{"type":"boolean","description":"Refund successful"},"message":{"type":"string","description":"Result message"},"refundTxHash":{"type":"string","description":"On-chain refund transaction hash"},"amount":{"type":"string","description":"Refunded amount in USDC"}},"required":["success","message"]},"GraduationRefund":{"type":"object","properties":{"txHash":{"type":"string","minLength":10,"maxLength":100,"description":"x402 settlement transaction hash (from the PAYMENT-RESPONSE header of POST /api/graduation/graduate)"},"chain":{"type":"string","minLength":1,"maxLength":50,"description":"Blockchain chain name of the settlement (e.g. base, base-sepolia)"}},"required":["txHash","chain"]},"GraduationStatus":{"type":"object","properties":{"success":{"type":"boolean"},"currentBrokerId":{"type":"string","description":"Current broker ID"},"approved":{"type":"boolean","description":"Whether graduation is approved"}},"required":["success","currentBrokerId","approved"]},"RebindPermissionlessVaultResponse":{"type":"object","properties":{"success":{"type":"boolean","description":"Rebind successful"},"message":{"type":"string","description":"Success message"},"brokerId":{"type":"string","description":"Broker ID rebound to the permissionless vault"},"txHash":{"type":"string","description":"Permissionless vault transaction hash"}},"required":["success","message","brokerId"]},"DexFees":{"type":"object","properties":{"success":{"type":"boolean"},"makerFee":{"type":"number","description":"Maker fee in basis points"},"takerFee":{"type":"number","description":"Taker fee in basis points"},"rwaMakerFee":{"type":"number","description":"RWA maker fee in basis points"},"rwaTakerFee":{"type":"number","description":"RWA taker fee in basis points"}},"required":["success","makerFee","takerFee","rwaMakerFee","rwaTakerFee"]},"BrokerTier":{"type":"object","properties":{"tier":{"type":"string","description":"Broker tier level"},"stakingVolume":{"type":"string","description":"Staking volume"},"tradingVolume":{"type":"string","description":"Trading volume"},"makerFeeRate":{"type":"string","description":"Maker fee rate in decimal"},"takerFeeRate":{"type":"string","description":"Taker fee rate in decimal"},"rwaMakerFeeRate":{"type":"string","description":"RWA maker fee rate in decimal"},"rwaTakerFeeRate":{"type":"string","description":"RWA taker fee rate in decimal"},"logDate":{"type":"string","description":"Log date"}},"required":["tier","stakingVolume","tradingVolume","makerFeeRate","takerFeeRate","rwaMakerFeeRate","rwaTakerFeeRate","logDate"]},"FinalizeAdminWalletResponse":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string","description":"Success message"},"isGraduated":{"type":"boolean"}},"required":["success","message","isGraduated"]},"GraduationStatusExtended":{"type":"object","properties":{"success":{"type":"boolean"},"isGraduated":{"type":"boolean","description":"Whether DEX has completed graduation"},"brokerId":{"type":"string","description":"Current broker ID"},"isMultisig":{"type":"boolean","description":"Whether using multisig admin"},"multisigAddress":{"type":"string","nullable":true,"description":"Multisig address if applicable"},"multisigChainId":{"type":"number","nullable":true,"description":"Multisig chain ID"}},"required":["success","isGraduated","brokerId","isMultisig","multisigAddress","multisigChainId"]},"FeeOptions":{"type":"object","properties":{"usdc":{"type":"object","properties":{"amount":{"type":"number","minimum":0,"exclusiveMinimum":true,"description":"Token amount required"},"currency":{"type":"string"},"stable":{"type":"boolean"}},"required":["amount","currency","stable"]},"order":{"type":"object","nullable":true,"properties":{"amount":{"type":"number","minimum":0,"exclusiveMinimum":true,"description":"Token amount required"},"currency":{"type":"string"},"stable":{"type":"boolean"},"currentPrice":{"type":"number","minimum":0,"exclusiveMinimum":true,"description":"Current ORDER token price in USD"},"quote":{"type":"string","minLength":1,"maxLength":4096},"quoteExpiresAt":{"type":"string","format":"date-time"}},"required":["amount","currency","stable","currentPrice","quote","quoteExpiresAt"]},"usdt":{"type":"object","properties":{"amount":{"type":"number","minimum":0,"exclusiveMinimum":true,"description":"Token amount required"},"currency":{"type":"string"},"stable":{"type":"boolean"}},"required":["amount","currency","stable"]},"receiverAddress":{"type":"string","pattern":"^0x[a-fA-F0-9]{40}$","description":"Address to send graduation payment"},"payerAddress":{"type":"string","pattern":"^0x[a-fA-F0-9]{40}$","description":"Authenticated wallet address that must send the graduation payment"}},"required":["usdc","order","usdt","receiverAddress","payerAddress"]},"LeaderboardResponse":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"isAnonymous":{"type":"boolean","description":"Whether DEX identity is masked"},"id":{"type":"string","description":"DEX ID"},"brokerId":{"type":"string","description":"Broker ID"},"brokerName":{"type":"string","description":"DEX display name"},"primaryLogo":{"type":"string","nullable":true,"description":"Primary logo URL"},"dexUrl":{"type":"string","nullable":true,"description":"DEX website URL"},"totalVolume":{"type":"number","description":"Total trading volume"},"totalPnl":{"type":"number","description":"Total profit/loss"},"totalBrokerFee":{"type":"number","description":"Sum of daily revenue history total_revenue for the period"},"totalFee":{"type":"number","description":"Total fees"},"lastUpdated":{"type":"string","format":"date-time","description":"Last statistics update"},"description":{"type":"string","nullable":true,"description":"DEX description"},"banner":{"type":"string","nullable":true,"description":"Banner image URL"},"logo":{"type":"string","nullable":true,"description":"Logo image URL"},"tokenAddress":{"type":"string","nullable":true,"description":"Token contract address"},"tokenChain":{"type":"string","nullable":true,"description":"Token blockchain network"},"tokenSymbol":{"type":"string","description":"Token symbol"},"tokenName":{"type":"string","description":"Token name"},"tokenPrice":{"type":"number","description":"Token price in USD"},"tokenMarketCap":{"type":"number","description":"Token market cap"},"tokenImageUrl":{"type":"string","description":"Token image URL"},"telegramLink":{"type":"string","nullable":true,"description":"Telegram group link"},"discordLink":{"type":"string","nullable":true,"description":"Discord invite link"},"xLink":{"type":"string","nullable":true,"description":"X (Twitter) profile link"},"websiteUrl":{"type":"string","nullable":true,"description":"Official website URL"}},"required":["isAnonymous","totalVolume","totalPnl","totalBrokerFee","totalFee","lastUpdated"]}},"meta":{"type":"object","properties":{"sortBy":{"type":"string","description":"Current sort field"},"period":{"type":"string","description":"Current time period"},"limit":{"type":"integer","description":"Results per page"},"offset":{"type":"integer","description":"Current offset"},"total":{"type":"integer","description":"Total number of DEXes"}},"required":["sortBy","period","limit","offset","total"]}},"required":["data","meta"]},"LeaderboardErrorResponse":{"type":"object","properties":{"error":{"type":"string","description":"Error message"}},"required":["error"]},"BrokerStatsResponse":{"type":"object","properties":{"data":{"type":"object","properties":{"dex":{"type":"object","properties":{"isAnonymous":{"type":"boolean","description":"Whether DEX identity is masked"},"id":{"type":"string","description":"DEX ID"},"brokerId":{"type":"string","description":"Broker ID"},"brokerName":{"type":"string","description":"DEX name"},"primaryLogo":{"type":"string","nullable":true,"description":"Primary logo URL"},"dexUrl":{"type":"string","nullable":true,"description":"DEX website URL"},"description":{"type":"string","nullable":true,"description":"DEX description"},"banner":{"type":"string","nullable":true,"description":"Banner image URL"},"logo":{"type":"string","nullable":true,"description":"Logo image URL"},"tokenAddress":{"type":"string","nullable":true,"description":"Token contract address"},"tokenChain":{"type":"string","nullable":true,"description":"Token blockchain network"},"tokenSymbol":{"type":"string","description":"Token symbol"},"tokenName":{"type":"string","description":"Token name"},"tokenPrice":{"type":"number","description":"Token price in USD"},"tokenMarketCap":{"type":"number","description":"Token market cap"},"tokenImageUrl":{"type":"string","description":"Token image URL"},"telegramLink":{"type":"string","nullable":true,"description":"Telegram group link"},"discordLink":{"type":"string","nullable":true,"description":"Discord invite link"},"xLink":{"type":"string","nullable":true,"description":"X (Twitter) profile link"},"websiteUrl":{"type":"string","nullable":true,"description":"Official website URL"}},"required":["isAnonymous"]},"aggregated":{"type":"object","properties":{"brokerId":{"type":"string","description":"Broker ID"},"brokerName":{"type":"string","description":"DEX name"},"totalVolume":{"type":"number","description":"Total trading volume"},"totalPnl":{"type":"number","description":"Total profit/loss"},"totalBrokerFee":{"type":"number","description":"Sum of daily revenue history total_revenue for the period"},"totalFee":{"type":"number","description":"Total fees"},"lastUpdated":{"type":"string","format":"date-time","description":"Last statistics update"},"tokenAddress":{"type":"string","description":"Token contract address"},"tokenChain":{"type":"string","description":"Token blockchain network"},"tokenSymbol":{"type":"string","description":"Token symbol"},"tokenName":{"type":"string","description":"Token name"},"tokenPrice":{"type":"number","description":"Token price in USD"},"tokenMarketCap":{"type":"number","description":"Token market cap"},"tokenImageUrl":{"type":"string","description":"Token image URL"}},"required":["totalVolume","totalPnl","totalBrokerFee","totalFee","lastUpdated"]},"daily":{"type":"array","items":{"type":"object","properties":{"brokerId":{"type":"string","description":"Broker ID"},"brokerName":{"type":"string","description":"DEX name"},"date":{"type":"string","description":"Revenue date in UTC"},"perp_volume":{"type":"number","description":"Perpetual trading volume"},"perp_taker_volume":{"type":"number","description":"Taker volume"},"perp_maker_volume":{"type":"number","description":"Maker volume"},"realized_pnl":{"type":"number","description":"Realized profit/loss"},"broker_fee":{"type":"number","description":"Daily revenue history total_revenue"},"total_fee":{"type":"number","description":"Total fees"}},"required":["date","perp_volume","perp_taker_volume","perp_maker_volume","realized_pnl","broker_fee","total_fee"]}}},"required":["dex","aggregated","daily"]}},"required":["data"]},"DexStats":{"type":"object","properties":{"total":{"type":"object","properties":{"allTime":{"type":"integer","description":"Total DEXes created all time"},"new":{"type":"integer","description":"New DEXes created in the period"}},"required":["allTime","new"]},"graduated":{"type":"object","properties":{"allTime":{"type":"integer","description":"Total graduated DEXes all time"},"new":{"type":"integer","description":"New graduated DEXes in the period"}},"required":["allTime","new"]},"demo":{"type":"object","properties":{"allTime":{"type":"integer","description":"Total demo DEXes all time"},"new":{"type":"integer","description":"New demo DEXes in the period"}},"required":["allTime","new"]},"period":{"type":"string","description":"Time period for these statistics"}},"required":["total","graduated","demo","period"]},"StatsErrorResponse":{"type":"object","properties":{"error":{"type":"string","description":"Error message"}},"required":["error"]},"SwapFeeConfig":{"type":"object","additionalProperties":{"type":"object","properties":{"fee_rate":{"type":"number","description":"Swap fee rate in basis points"}},"required":["fee_rate"]}},"BoostedDistributorSuccess":{"type":"object","properties":{"ok":{"type":"boolean"}},"required":["ok"]},"BoostedDistributorError":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]},"BoostedDistributorApplication":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"email":{"type":"string","maxLength":255,"format":"email"},"telegram":{"type":"string","pattern":"^@?[a-zA-Z0-9_]{4,32}$"},"source":{"type":"string","maxLength":80,"pattern":"^[a-zA-Z0-9_-]+$","default":"bd_funnel_v1"},"submitted_at":{"type":"string","format":"date-time"},"reason":{"type":"string","minLength":1,"maxLength":3000},"location":{"type":"string","enum":["North America","Latin America","Europe","UK","Middle East & North Africa","Sub-Saharan Africa","South Asia (India / Pakistan / Bangladesh)","Southeast Asia","East Asia (China / Korea / Japan)","Oceania","Other"]},"channels":{"type":"array","items":{"type":"string","enum":["x","telegram","youtube","discord","tiktok","newsletter","podcast","irl"]},"minItems":1,"maxItems":8},"links":{"type":"string","minLength":0,"maxLength":3000,"default":""},"idempotencyKey":{"type":"string","format":"uuid"},"turnstileToken":{"type":"string","minLength":1,"maxLength":4096}},"required":["name","email","telegram","reason","location","channels","idempotencyKey"]}},"parameters":{},"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"JWT token obtained from /api/auth/verify"}}},"paths":{"/api/dex":{"get":{"tags":["DEX"],"summary":"Get current user's DEX","description":"Retrieve the DEX information for the currently authenticated user","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"DEX information retrieved successfully","content":{"application/json":{"schema":{"anyOf":[{"allOf":[{"$ref":"#/components/schemas/DexNotFoundResponse"},{"type":"object","properties":{"exists":{"type":"boolean"},"rateLimit":{"type":"object","properties":{"isRateLimited":{"type":"boolean","description":"Whether the user is currently rate limited"},"remainingCooldownSeconds":{"type":"integer","description":"Remaining cooldown time in seconds"},"cooldownMinutes":{"type":"integer","description":"Cooldown period in minutes"}},"required":["isRateLimited","remainingCooldownSeconds","cooldownMinutes"]}},"required":["rateLimit"]}]},{"allOf":[{"$ref":"#/components/schemas/DexResponse"},{"type":"object","properties":{"rateLimit":{"type":"object","properties":{"isRateLimited":{"type":"boolean","description":"Whether the user is currently rate limited"},"remainingCooldownSeconds":{"type":"integer","description":"Remaining cooldown time in seconds"},"cooldownMinutes":{"type":"integer","description":"Cooldown period in minutes"}},"required":["isRateLimited","remainingCooldownSeconds","cooldownMinutes"]}},"required":["rateLimit"]}]}],"description":"DEX information or not found response"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message"}},"required":["error"],"description":"Error response"}}}}}},"post":{"tags":["DEX"],"summary":"Create a new DEX","description":"Create a new DEX for the authenticated user with the provided configuration","security":[{"bearerAuth":[]}],"requestBody":{"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"brokerName":{"type":"string","minLength":3,"maxLength":30,"pattern":"^[a-zA-Z0-9 .\\-_]*$"},"chainIds":{"anyOf":[{"type":"array","items":{"type":"integer","minimum":0,"exclusiveMinimum":true}},{"type":"string"}]},"defaultChain":{"anyOf":[{"type":"integer","minimum":0,"exclusiveMinimum":true},{"type":"string"}]},"themeCSS":{"type":"string","nullable":true},"themeConfig":{"anyOf":[{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"displayName":{"type":"string","minLength":1,"maxLength":50},"mode":{"type":"string","enum":["dark","light"]},"cssVars":{"type":"object","additionalProperties":{"type":"string"}},"tradingViewColorConfig":{"anyOf":[{"type":"object","properties":{"chartBG":{"type":"string","pattern":"^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i"},"upColor":{"type":"string","pattern":"^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i"},"downColor":{"type":"string","pattern":"^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i"},"pnlUpColor":{"type":"string","pattern":"^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i"},"pnlDownColor":{"type":"string","pattern":"^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i"},"pnlZeroColor":{"type":"string","pattern":"^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i"},"textColor":{"type":"string","pattern":"^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i"},"qtyTextColor":{"type":"string","pattern":"^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i"},"volumeUpColor":{"type":"string","pattern":"^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i"},"volumeDownColor":{"type":"string","pattern":"^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i"},"closeIconColor":{"type":"string"}},"additionalProperties":false},{"type":"object","properties":{"chartBG":{"type":"string","minLength":1},"upColor":{"type":"string","minLength":1},"downColor":{"type":"string","minLength":1},"pnlUpColor":{"type":"string","minLength":1},"pnlDownColor":{"type":"string","minLength":1},"pnlZeroColor":{"type":"string","minLength":1},"textColor":{"type":"string","minLength":1},"qtyTextColor":{"type":"string","minLength":1},"volumeUpColor":{"type":"string","minLength":1},"volumeDownColor":{"type":"string","minLength":1},"closeIconColor":{"type":"string","minLength":1}},"additionalProperties":false}]},"isDefault":{"type":"boolean"}},"required":["id","displayName","mode"],"additionalProperties":false},"minItems":1,"maxItems":10},{"type":"string"}]},"primaryLogo":{"type":"string","format":"binary"},"secondaryLogo":{"type":"string","format":"binary"},"favicon":{"type":"string","format":"binary"},"pnlPosters":{"type":"array","items":{"type":"string","format":"binary"}},"telegramLink":{"anyOf":[{"type":"string","format":"uri"},{"type":"string","enum":[""]},{"nullable":true}]},"discordLink":{"anyOf":[{"type":"string","format":"uri"},{"type":"string","enum":[""]},{"nullable":true}]},"xLink":{"anyOf":[{"type":"string","format":"uri"},{"type":"string","enum":[""]},{"nullable":true}]},"walletConnectProjectId":{"type":"string","nullable":true},"privyAppId":{"type":"string","nullable":true},"privyTermsOfUse":{"type":"string","nullable":true},"privyLoginMethods":{"type":"string","nullable":true},"enabledMenus":{"type":"string","nullable":true},"customMenus":{"type":"string","nullable":true},"enableAbstractWallet":{"anyOf":[{"type":"boolean"},{"type":"string"}]},"disableMainnet":{"anyOf":[{"type":"boolean"},{"type":"string"}]},"disableTestnet":{"anyOf":[{"type":"boolean"},{"type":"string"}]},"disableEvmWallets":{"anyOf":[{"type":"boolean"},{"type":"string"}]},"disableSolanaWallets":{"anyOf":[{"type":"boolean"},{"type":"string"}]},"enableServiceDisclaimerDialog":{"anyOf":[{"type":"boolean"},{"type":"string"}]},"enableCampaigns":{"anyOf":[{"type":"boolean"},{"type":"string"}]},"tradingViewColorConfig":{"type":"string","nullable":true},"availableLanguages":{"anyOf":[{"type":"array","items":{"type":"string","enum":["en","ar","fa","he","zh","ja","es","ko","vi","de","fr","ru","id","tr","it","pt","uk","pl","nl","tc"]}},{"type":"string","maxLength":512}]},"swapFeeBps":{"anyOf":[{"type":"integer","minimum":0,"maximum":100},{"type":"string"},{"nullable":true}]},"seoSiteName":{"type":"string","nullable":true,"maxLength":100},"seoSiteDescription":{"type":"string","nullable":true,"maxLength":300},"seoSiteLanguage":{"anyOf":[{"type":"string","pattern":"^[a-z]{2}(-[A-Z]{2})?$"},{"type":"string","enum":[""]},{"nullable":true}]},"seoSiteLocale":{"anyOf":[{"type":"string","pattern":"^[a-z]{2}_[A-Z]{2}$"},{"type":"string","enum":[""]},{"nullable":true}]},"seoTwitterHandle":{"anyOf":[{"type":"string","pattern":"^@[a-zA-Z0-9_]+$"},{"type":"string","enum":[""]},{"nullable":true}]},"seoThemeColor":{"anyOf":[{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},{"type":"string","enum":[""]},{"nullable":true}]},"seoKeywords":{"type":"string","nullable":true,"maxLength":500},"analyticsConfig":{"anyOf":[{"type":"object","properties":{"version":{"type":"number","enum":[1]},"provider":{"type":"string","enum":["ga4"]},"measurementId":{"type":"string","pattern":"^G-[A-Z0-9]{4,20}$"}},"required":["version","provider","measurementId"],"additionalProperties":false},{"type":"object","properties":{"version":{"type":"number","enum":[1]},"provider":{"type":"string","enum":["firebase"]},"apiKey":{"type":"string","maxLength":128,"pattern":"^AIza[0-9A-Za-z_-]{20,}$"},"projectId":{"type":"string","pattern":"^[a-z][a-z0-9-]{4,28}[a-z0-9]$"},"appId":{"type":"string","pattern":"^1:\\d{6,20}:web:[0-9a-fA-F]{6,64}$"},"measurementId":{"type":"string","pattern":"^G-[A-Z0-9]{4,20}$"}},"required":["version","provider","apiKey","projectId","appId","measurementId"],"additionalProperties":false},{"type":"object","properties":{"version":{"type":"number","enum":[1]},"provider":{"type":"string","enum":["plausible"]}},"required":["version","provider"],"additionalProperties":false},{"type":"string"},{"nullable":true}]},"symbolList":{"type":"string","nullable":true},"restrictedRegions":{"type":"string","nullable":true,"maxLength":2000},"whitelistedIps":{"type":"string","nullable":true,"maxLength":2000},"integrationType":{"anyOf":[{"type":"string","enum":["low_code","custom"]},{"type":"string"}]}},"required":["brokerName"],"additionalProperties":{"anyOf":[{"type":"string","format":"binary"},{"type":"string"}]}}}}},"responses":{"201":{"description":"DEX created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DexResponse"}}}},"400":{"description":"Invalid DEX configuration","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message"}},"required":["error"],"description":"Error response"}}}},"404":{"description":"User not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message"}},"required":["error"],"description":"Error response"}}}},"409":{"description":"User already has a DEX","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictError"}}}},"413":{"description":"Request body exceeds the 2 MiB limit","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message"}},"required":["error"],"description":"Error response"}}}},"429":{"description":"Rate limited - too many requests","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message"}},"required":["error"],"description":"Error response"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message"}},"required":["error"],"description":"Error response"}}}}}}},"/api/dex/rate-limit-status":{"get":{"tags":["DEX"],"summary":"Get rate limit status","description":"Check the current rate limiting status for DEX operations","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Rate limit status retrieved successfully","content":{"application/json":{"schema":{"type":"object","properties":{"isRateLimited":{"type":"boolean","description":"Whether the user is currently rate limited"},"remainingCooldownSeconds":{"type":"integer","description":"Remaining cooldown time in seconds"},"cooldownMinutes":{"type":"integer","description":"Cooldown period in minutes"},"message":{"type":"string","description":"Status message"}},"required":["isRateLimited","remainingCooldownSeconds","cooldownMinutes","message"],"description":"Rate limiting status"}}}}}}},"/api/dex/networks":{"get":{"tags":["DEX"],"summary":"Get available networks","description":"Retrieve a list of available blockchain networks for token selection","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Networks retrieved successfully","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"Network ID"},"name":{"type":"string","description":"Network name"}},"required":["id","name"]}}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message"}},"required":["error"],"description":"Error response"}}}}}}},"/api/dex/broker-name":{"put":{"tags":["DEX"],"summary":"Update the current user's builder name","description":"Update only the brokerName field for the authenticated user's DEX","security":[{"bearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BrokerNameUpdate"}}}},"responses":{"200":{"description":"Builder name updated successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BrokerNameUpdateSuccess"}}}},"404":{"description":"DEX not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFoundError"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message"}},"required":["error"],"description":"Error response"}}}}}}},"/api/dex/{id}":{"get":{"tags":["DEX"],"summary":"Get DEX by ID","description":"Retrieve a specific DEX by its ID","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"DEX ID","example":"cm3abc123def456"},"required":true,"description":"DEX ID","name":"id","in":"path"}],"responses":{"200":{"description":"DEX retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DexResponse"}}}},"403":{"description":"Unauthorized to access this DEX","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedError"}}}},"404":{"description":"DEX not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFoundError"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message"}},"required":["error"],"description":"Error response"}}}}}},"put":{"tags":["DEX"],"summary":"Update a DEX","description":"Update an existing DEX's configuration","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"DEX ID","example":"cm3abc123def456"},"required":true,"description":"DEX ID","name":"id","in":"path"}],"requestBody":{"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"brokerName":{"type":"string","nullable":true,"minLength":3,"maxLength":30,"pattern":"^[a-zA-Z0-9 .\\-_]*$"},"chainIds":{"anyOf":[{"type":"array","items":{"type":"integer","minimum":0,"exclusiveMinimum":true}},{"type":"string"}]},"defaultChain":{"anyOf":[{"type":"integer","minimum":0,"exclusiveMinimum":true},{"type":"string"}]},"themeCSS":{"type":"string","nullable":true},"themeConfig":{"anyOf":[{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"displayName":{"type":"string","minLength":1,"maxLength":50},"mode":{"type":"string","enum":["dark","light"]},"cssVars":{"type":"object","additionalProperties":{"type":"string"}},"tradingViewColorConfig":{"anyOf":[{"type":"object","properties":{"chartBG":{"type":"string","pattern":"^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i"},"upColor":{"type":"string","pattern":"^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i"},"downColor":{"type":"string","pattern":"^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i"},"pnlUpColor":{"type":"string","pattern":"^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i"},"pnlDownColor":{"type":"string","pattern":"^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i"},"pnlZeroColor":{"type":"string","pattern":"^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i"},"textColor":{"type":"string","pattern":"^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i"},"qtyTextColor":{"type":"string","pattern":"^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i"},"volumeUpColor":{"type":"string","pattern":"^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i"},"volumeDownColor":{"type":"string","pattern":"^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i"},"closeIconColor":{"type":"string"}},"additionalProperties":false},{"type":"object","properties":{"chartBG":{"type":"string","minLength":1},"upColor":{"type":"string","minLength":1},"downColor":{"type":"string","minLength":1},"pnlUpColor":{"type":"string","minLength":1},"pnlDownColor":{"type":"string","minLength":1},"pnlZeroColor":{"type":"string","minLength":1},"textColor":{"type":"string","minLength":1},"qtyTextColor":{"type":"string","minLength":1},"volumeUpColor":{"type":"string","minLength":1},"volumeDownColor":{"type":"string","minLength":1},"closeIconColor":{"type":"string","minLength":1}},"additionalProperties":false}]},"isDefault":{"type":"boolean"}},"required":["id","displayName","mode"],"additionalProperties":false},"minItems":1,"maxItems":10},{"type":"string"}]},"primaryLogo":{"type":"string","format":"binary"},"secondaryLogo":{"type":"string","format":"binary"},"favicon":{"type":"string","format":"binary"},"pnlPosters":{"type":"array","items":{"type":"string","format":"binary"}},"telegramLink":{"anyOf":[{"type":"string","format":"uri"},{"type":"string","enum":[""]},{"nullable":true}]},"discordLink":{"anyOf":[{"type":"string","format":"uri"},{"type":"string","enum":[""]},{"nullable":true}]},"xLink":{"anyOf":[{"type":"string","format":"uri"},{"type":"string","enum":[""]},{"nullable":true}]},"walletConnectProjectId":{"type":"string","nullable":true},"privyAppId":{"type":"string","nullable":true},"privyTermsOfUse":{"type":"string","nullable":true},"privyLoginMethods":{"type":"string","nullable":true},"enabledMenus":{"type":"string","nullable":true},"customMenus":{"type":"string","nullable":true},"enableAbstractWallet":{"anyOf":[{"type":"boolean"},{"type":"string"}]},"disableMainnet":{"anyOf":[{"type":"boolean"},{"type":"string"}]},"disableTestnet":{"anyOf":[{"type":"boolean"},{"type":"string"}]},"disableEvmWallets":{"anyOf":[{"type":"boolean"},{"type":"string"}]},"disableSolanaWallets":{"anyOf":[{"type":"boolean"},{"type":"string"}]},"enableServiceDisclaimerDialog":{"anyOf":[{"type":"boolean"},{"type":"string"}]},"enableCampaigns":{"anyOf":[{"type":"boolean"},{"type":"string"}]},"tradingViewColorConfig":{"type":"string","nullable":true},"availableLanguages":{"anyOf":[{"type":"array","items":{"type":"string","enum":["en","ar","fa","he","zh","ja","es","ko","vi","de","fr","ru","id","tr","it","pt","uk","pl","nl","tc"]}},{"type":"string","maxLength":512}]},"swapFeeBps":{"anyOf":[{"type":"integer","minimum":0,"maximum":100},{"type":"string"},{"nullable":true}]},"seoSiteName":{"type":"string","nullable":true,"maxLength":100},"seoSiteDescription":{"type":"string","nullable":true,"maxLength":300},"seoSiteLanguage":{"anyOf":[{"type":"string","pattern":"^[a-z]{2}(-[A-Z]{2})?$"},{"type":"string","enum":[""]},{"nullable":true}]},"seoSiteLocale":{"anyOf":[{"type":"string","pattern":"^[a-z]{2}_[A-Z]{2}$"},{"type":"string","enum":[""]},{"nullable":true}]},"seoTwitterHandle":{"anyOf":[{"type":"string","pattern":"^@[a-zA-Z0-9_]+$"},{"type":"string","enum":[""]},{"nullable":true}]},"seoThemeColor":{"anyOf":[{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},{"type":"string","enum":[""]},{"nullable":true}]},"seoKeywords":{"type":"string","nullable":true,"maxLength":500},"analyticsConfig":{"anyOf":[{"type":"object","properties":{"version":{"type":"number","enum":[1]},"provider":{"type":"string","enum":["ga4"]},"measurementId":{"type":"string","pattern":"^G-[A-Z0-9]{4,20}$"}},"required":["version","provider","measurementId"],"additionalProperties":false},{"type":"object","properties":{"version":{"type":"number","enum":[1]},"provider":{"type":"string","enum":["firebase"]},"apiKey":{"type":"string","maxLength":128,"pattern":"^AIza[0-9A-Za-z_-]{20,}$"},"projectId":{"type":"string","pattern":"^[a-z][a-z0-9-]{4,28}[a-z0-9]$"},"appId":{"type":"string","pattern":"^1:\\d{6,20}:web:[0-9a-fA-F]{6,64}$"},"measurementId":{"type":"string","pattern":"^G-[A-Z0-9]{4,20}$"}},"required":["version","provider","apiKey","projectId","appId","measurementId"],"additionalProperties":false},{"type":"object","properties":{"version":{"type":"number","enum":[1]},"provider":{"type":"string","enum":["plausible"]}},"required":["version","provider"],"additionalProperties":false},{"type":"string"},{"nullable":true}]},"symbolList":{"type":"string","nullable":true},"restrictedRegions":{"type":"string","nullable":true,"maxLength":2000},"whitelistedIps":{"type":"string","nullable":true,"maxLength":2000},"integrationType":{"anyOf":[{"type":"string","enum":["low_code","custom"]},{"type":"string"}]}},"additionalProperties":{"anyOf":[{"type":"string","format":"binary"},{"type":"string"}]}}}}},"responses":{"200":{"description":"DEX updated successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DexResponse"}}}},"400":{"description":"Invalid request - invalid TradingView color configuration","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message"}},"required":["error"],"description":"Error response"}}}},"403":{"description":"User is not authorized to update this DEX","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedError"}}}},"404":{"description":"DEX not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFoundError"}}}},"413":{"description":"Request body exceeds the 2 MiB limit","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message"}},"required":["error"],"description":"Error response"}}}},"429":{"description":"Rate limited - too many requests","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message"}},"required":["error"],"description":"Error response"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message"}},"required":["error"],"description":"Error response"}}}}}},"delete":{"tags":["DEX"],"summary":"Delete a DEX","description":"Delete a DEX and its associated resources","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"DEX ID","example":"cm3abc123def456"},"required":true,"description":"DEX ID","name":"id","in":"path"}],"responses":{"200":{"description":"DEX deleted successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeleteSuccess"}}}},"403":{"description":"User is not authorized to delete this DEX","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedError"}}}},"404":{"description":"DEX not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFoundError"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message"}},"required":["error"],"description":"Error response"}}}}}}},"/api/dex/social-card":{"put":{"tags":["DEX"],"summary":"Update social card information","description":"Update the social media and branding information for the user's DEX","security":[{"bearerAuth":[]}],"requestBody":{"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"brokerName":{"type":"string","minLength":3,"maxLength":30,"pattern":"^[a-zA-Z0-9 .\\-_]*$"},"description":{"type":"string","nullable":true,"maxLength":150},"banner":{"anyOf":[{"type":"string","format":"binary"},{"type":"string","enum":[""]}]},"logo":{"anyOf":[{"type":"string","format":"binary"},{"type":"string","enum":[""]}]},"tokenAddress":{"type":"string","nullable":true,"maxLength":100},"tokenChain":{"type":"string","nullable":true,"maxLength":50},"telegramLink":{"type":"string","nullable":true,"maxLength":50},"discordLink":{"type":"string","nullable":true,"maxLength":50},"xLink":{"type":"string","nullable":true,"maxLength":50},"websiteUrl":{"type":"string","nullable":true,"maxLength":50,"format":"uri"}}}}}},"responses":{"200":{"description":"Social card updated successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SocialCardUpdate"}}}},"400":{"description":"Invalid request - invalid token chain or token not found","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","description":"Response message"}},"required":["message"],"description":"Message response"}}}},"403":{"description":"User is not authorized to update this DEX","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedError"}}}},"404":{"description":"DEX not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFoundError"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","description":"Response message"}},"required":["message"],"description":"Message response"}}}}}}},"/api/dex/{id}/workflow-status":{"get":{"tags":["DEX"],"summary":"Get workflow status","description":"Get the status of GitHub Actions workflows for a DEX's repository","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"DEX ID","example":"cm3abc123def456"},"required":true,"description":"DEX ID","name":"id","in":"path"},{"schema":{"type":"string","description":"Workflow name","example":"deploy.yml"},"required":false,"description":"Workflow name","name":"workflow","in":"query"}],"responses":{"200":{"description":"Workflow status retrieved successfully","content":{"application/json":{"schema":{"type":"object","properties":{"totalCount":{"type":"integer","description":"Total workflow runs"},"workflowRuns":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"status":{"type":"string"},"conclusion":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"htmlUrl":{"type":"string"}},"required":["id","name","status","conclusion","createdAt","updatedAt","htmlUrl"]}}},"required":["totalCount","workflowRuns"]}}}},"400":{"description":"Invalid request - DEX does not have a repository","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","description":"Response message"}},"required":["message"],"description":"Message response"}}}},"403":{"description":"Unauthorized to access this DEX","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedError"}}}},"404":{"description":"DEX not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFoundError"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message"}},"required":["error"],"description":"Error response"}}}}}}},"/api/dex/{id}/workflow-runs/{runId}":{"get":{"tags":["DEX"],"summary":"Get workflow run details","description":"Get detailed information about a specific workflow run","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"DEX ID","example":"abc123def456"},"required":true,"description":"DEX ID","name":"id","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Workflow run ID","example":"123456789"},"required":true,"description":"Workflow run ID","name":"runId","in":"path"}],"responses":{"200":{"description":"Workflow run details retrieved successfully","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"status":{"type":"string"},"conclusion":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"htmlUrl":{"type":"string"},"jobs":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"status":{"type":"string"},"conclusion":{"type":"string","nullable":true},"startedAt":{"type":"string","nullable":true},"completedAt":{"type":"string","nullable":true},"steps":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"status":{"type":"string"},"conclusion":{"type":"string","nullable":true},"number":{"type":"integer"}},"required":["name","status","conclusion","number"]}}},"required":["id","name","status","conclusion","startedAt","completedAt","steps"]}}},"required":["id","name","status","conclusion","createdAt","updatedAt","htmlUrl","jobs"]}}}},"400":{"description":"Invalid run ID or DEX does not have a repository","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","description":"Response message"}},"required":["message"],"description":"Message response"}}}},"403":{"description":"Unauthorized to access this DEX","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedError"}}}},"404":{"description":"DEX not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFoundError"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message"}},"required":["error"],"description":"Error response"}}}}}}},"/api/dex/{id}/upgrade-status":{"get":{"tags":["DEX"],"summary":"Get upgrade status","description":"Check if template updates are available for the DEX","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"DEX ID","example":"cm3abc123def456"},"required":true,"description":"DEX ID","name":"id","in":"path"}],"responses":{"200":{"description":"Upgrade status retrieved successfully","content":{"application/json":{"schema":{"type":"object","properties":{"hasUpdates":{"type":"boolean","description":"Whether template updates are available"},"behindBy":{"type":"integer","description":"Number of commits behind"},"templateCommitSha":{"type":"string"},"userCommitSha":{"type":"string"},"commits":{"type":"array","items":{"type":"object","properties":{"sha":{"type":"string"},"message":{"type":"string"},"author":{"type":"string"},"date":{"type":"string"}},"required":["sha","message","author","date"]}}},"required":["hasUpdates","behindBy","templateCommitSha","userCommitSha"]}}}},"400":{"description":"Invalid request - DEX does not have a repository","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","description":"Response message"}},"required":["message"],"description":"Message response"}}}},"403":{"description":"Unauthorized to access this DEX","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedError"}}}},"404":{"description":"DEX not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFoundError"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message"}},"required":["error"],"description":"Error response"}}}}}}},"/api/dex/{id}/upgrade":{"post":{"tags":["DEX"],"summary":"Upgrade DEX","description":"Trigger a redeployment of the DEX to apply template updates","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"DEX ID","example":"cm3abc123def456"},"required":true,"description":"DEX ID","name":"id","in":"path"}],"responses":{"200":{"description":"DEX upgrade triggered successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpgradeSuccess"}}}},"400":{"description":"Invalid request - DEX does not have a repository","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","description":"Response message"}},"required":["message"],"description":"Message response"}}}},"403":{"description":"Unauthorized to access this DEX","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedError"}}}},"404":{"description":"DEX not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFoundError"}}}},"429":{"description":"Rate limited - too many requests","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message"}},"required":["error"],"description":"Error response"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message"}},"required":["error"],"description":"Error response"}}}}}}},"/api/dex/{id}/custom-domain":{"post":{"tags":["DEX"],"summary":"Set custom domain","description":"Set a custom domain for the DEX","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"DEX ID","example":"cm3abc123def456"},"required":true,"description":"DEX ID","name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"domain":{"type":"string","minLength":1,"maxLength":253,"description":"Custom domain to set for the DEX"}},"required":["domain"]}}}},"responses":{"200":{"description":"Custom domain set successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomDomainSuccess"}}}},"400":{"description":"Invalid domain format","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","description":"Response message"}},"required":["message"],"description":"Message response"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message"}},"required":["error"],"description":"Error response"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message"}},"required":["error"],"description":"Error response"}}}}}},"delete":{"tags":["DEX"],"summary":"Remove custom domain","description":"Remove the custom domain from a DEX","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"DEX ID","example":"cm3abc123def456"},"required":true,"description":"DEX ID","name":"id","in":"path"}],"responses":{"200":{"description":"Custom domain removed successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomDomainSuccess"}}}},"400":{"description":"DEX does not have a custom domain configured","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","description":"Response message"}},"required":["message"],"description":"Message response"}}}},"403":{"description":"User is not authorized to modify this DEX","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedError"}}}},"404":{"description":"DEX not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFoundError"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message"}},"required":["error"],"description":"Error response"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message"}},"required":["error"],"description":"Error response"}}}}}}},"/api/dex/{id}/swap-fee":{"put":{"tags":["DEX"],"summary":"Update swap fee","description":"Update the swap fee for a DEX. Accepts JSON body for programmatic/SDK usage.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"DEX ID","example":"cm3abc123def456"},"required":true,"description":"DEX ID","name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"swapFeeBps":{"type":"integer","nullable":true,"minimum":0,"maximum":100,"description":"Swap fee in basis points (0-100). Set to null to remove."}},"required":["swapFeeBps"]}}}},"responses":{"200":{"description":"Swap fee updated successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SwapFeeSuccess"}}}},"400":{"description":"Invalid request body","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message"}},"required":["error"],"description":"Error response"}}}},"403":{"description":"Unauthorized to update this DEX","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedError"}}}},"404":{"description":"DEX not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFoundError"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message"}},"required":["error"],"description":"Error response"}}}}}}},"/api/dex/{id}/frontend":{"post":{"tags":["DEX"],"summary":"Create DEX frontend","description":"Create a frontend for a DEX by forking the template repository and pushing configuration. Auto-switches integration type to low_code.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"DEX ID","example":"cm3abc123def456"},"required":true,"description":"DEX ID","name":"id","in":"path"}],"requestBody":{"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"brokerName":{"type":"string","nullable":true,"minLength":3,"maxLength":30,"pattern":"^[a-zA-Z0-9 .\\-_]*$"},"chainIds":{"anyOf":[{"type":"array","items":{"type":"integer","minimum":0,"exclusiveMinimum":true}},{"type":"string"}]},"defaultChain":{"anyOf":[{"type":"integer","minimum":0,"exclusiveMinimum":true},{"type":"string"}]},"themeCSS":{"type":"string","nullable":true},"themeConfig":{"anyOf":[{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"displayName":{"type":"string","minLength":1,"maxLength":50},"mode":{"type":"string","enum":["dark","light"]},"cssVars":{"type":"object","additionalProperties":{"type":"string"}},"tradingViewColorConfig":{"anyOf":[{"type":"object","properties":{"chartBG":{"type":"string","pattern":"^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i"},"upColor":{"type":"string","pattern":"^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i"},"downColor":{"type":"string","pattern":"^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i"},"pnlUpColor":{"type":"string","pattern":"^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i"},"pnlDownColor":{"type":"string","pattern":"^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i"},"pnlZeroColor":{"type":"string","pattern":"^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i"},"textColor":{"type":"string","pattern":"^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i"},"qtyTextColor":{"type":"string","pattern":"^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i"},"volumeUpColor":{"type":"string","pattern":"^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i"},"volumeDownColor":{"type":"string","pattern":"^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i"},"closeIconColor":{"type":"string"}},"additionalProperties":false},{"type":"object","properties":{"chartBG":{"type":"string","minLength":1},"upColor":{"type":"string","minLength":1},"downColor":{"type":"string","minLength":1},"pnlUpColor":{"type":"string","minLength":1},"pnlDownColor":{"type":"string","minLength":1},"pnlZeroColor":{"type":"string","minLength":1},"textColor":{"type":"string","minLength":1},"qtyTextColor":{"type":"string","minLength":1},"volumeUpColor":{"type":"string","minLength":1},"volumeDownColor":{"type":"string","minLength":1},"closeIconColor":{"type":"string","minLength":1}},"additionalProperties":false}]},"isDefault":{"type":"boolean"}},"required":["id","displayName","mode"],"additionalProperties":false},"minItems":1,"maxItems":10},{"type":"string"}]},"primaryLogo":{"type":"string","format":"binary"},"secondaryLogo":{"type":"string","format":"binary"},"favicon":{"type":"string","format":"binary"},"pnlPosters":{"type":"array","items":{"type":"string","format":"binary"}},"telegramLink":{"anyOf":[{"type":"string","format":"uri"},{"type":"string","enum":[""]},{"nullable":true}]},"discordLink":{"anyOf":[{"type":"string","format":"uri"},{"type":"string","enum":[""]},{"nullable":true}]},"xLink":{"anyOf":[{"type":"string","format":"uri"},{"type":"string","enum":[""]},{"nullable":true}]},"walletConnectProjectId":{"type":"string","nullable":true},"privyAppId":{"type":"string","nullable":true},"privyTermsOfUse":{"type":"string","nullable":true},"privyLoginMethods":{"type":"string","nullable":true},"enabledMenus":{"type":"string","nullable":true},"customMenus":{"type":"string","nullable":true},"enableAbstractWallet":{"anyOf":[{"type":"boolean"},{"type":"string"}]},"disableMainnet":{"anyOf":[{"type":"boolean"},{"type":"string"}]},"disableTestnet":{"anyOf":[{"type":"boolean"},{"type":"string"}]},"disableEvmWallets":{"anyOf":[{"type":"boolean"},{"type":"string"}]},"disableSolanaWallets":{"anyOf":[{"type":"boolean"},{"type":"string"}]},"enableServiceDisclaimerDialog":{"anyOf":[{"type":"boolean"},{"type":"string"}]},"enableCampaigns":{"anyOf":[{"type":"boolean"},{"type":"string"}]},"tradingViewColorConfig":{"type":"string","nullable":true},"availableLanguages":{"anyOf":[{"type":"array","items":{"type":"string","enum":["en","ar","fa","he","zh","ja","es","ko","vi","de","fr","ru","id","tr","it","pt","uk","pl","nl","tc"]}},{"type":"string","maxLength":512}]},"swapFeeBps":{"anyOf":[{"type":"integer","minimum":0,"maximum":100},{"type":"string"},{"nullable":true}]},"seoSiteName":{"type":"string","nullable":true,"maxLength":100},"seoSiteDescription":{"type":"string","nullable":true,"maxLength":300},"seoSiteLanguage":{"anyOf":[{"type":"string","pattern":"^[a-z]{2}(-[A-Z]{2})?$"},{"type":"string","enum":[""]},{"nullable":true}]},"seoSiteLocale":{"anyOf":[{"type":"string","pattern":"^[a-z]{2}_[A-Z]{2}$"},{"type":"string","enum":[""]},{"nullable":true}]},"seoTwitterHandle":{"anyOf":[{"type":"string","pattern":"^@[a-zA-Z0-9_]+$"},{"type":"string","enum":[""]},{"nullable":true}]},"seoThemeColor":{"anyOf":[{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},{"type":"string","enum":[""]},{"nullable":true}]},"seoKeywords":{"type":"string","nullable":true,"maxLength":500},"analyticsConfig":{"anyOf":[{"type":"object","properties":{"version":{"type":"number","enum":[1]},"provider":{"type":"string","enum":["ga4"]},"measurementId":{"type":"string","pattern":"^G-[A-Z0-9]{4,20}$"}},"required":["version","provider","measurementId"],"additionalProperties":false},{"type":"object","properties":{"version":{"type":"number","enum":[1]},"provider":{"type":"string","enum":["firebase"]},"apiKey":{"type":"string","maxLength":128,"pattern":"^AIza[0-9A-Za-z_-]{20,}$"},"projectId":{"type":"string","pattern":"^[a-z][a-z0-9-]{4,28}[a-z0-9]$"},"appId":{"type":"string","pattern":"^1:\\d{6,20}:web:[0-9a-fA-F]{6,64}$"},"measurementId":{"type":"string","pattern":"^G-[A-Z0-9]{4,20}$"}},"required":["version","provider","apiKey","projectId","appId","measurementId"],"additionalProperties":false},{"type":"object","properties":{"version":{"type":"number","enum":[1]},"provider":{"type":"string","enum":["plausible"]}},"required":["version","provider"],"additionalProperties":false},{"type":"string"},{"nullable":true}]},"symbolList":{"type":"string","nullable":true},"restrictedRegions":{"type":"string","nullable":true,"maxLength":2000},"whitelistedIps":{"type":"string","nullable":true,"maxLength":2000},"integrationType":{"anyOf":[{"type":"string","enum":["low_code","custom"]},{"type":"string"}]}},"additionalProperties":{"anyOf":[{"type":"string","format":"binary"},{"type":"string"}]}}}}},"responses":{"200":{"description":"Frontend created successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"Whether the operation was successful"},"data":{"type":"object","properties":{"id":{"type":"string","description":"DEX ID"},"brokerId":{"type":"string","description":"Broker ID"},"brokerName":{"type":"string","description":"Display name for the DEX"},"repoUrl":{"type":"string","nullable":true,"description":"GitHub repository URL"},"customDomain":{"type":"string","nullable":true,"description":"Custom domain for the DEX"},"customDomainOverride":{"type":"string","nullable":true,"description":"Custom domain override URL"},"chainIds":{"type":"array","items":{"type":"number"},"description":"Supported chain IDs"},"defaultChain":{"type":"number","nullable":true,"description":"Default chain ID"},"themeCSS":{"type":"string","nullable":true,"description":"Canonical :root CSS containing supported Orderly theme tokens"},"themeConfig":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"displayName":{"type":"string","minLength":1,"maxLength":50},"mode":{"type":"string","enum":["dark","light"]},"cssVars":{"type":"object","additionalProperties":{"type":"string"}},"tradingViewColorConfig":{"anyOf":[{"type":"object","properties":{"chartBG":{"type":"string","pattern":"^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i"},"upColor":{"type":"string","pattern":"^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i"},"downColor":{"type":"string","pattern":"^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i"},"pnlUpColor":{"type":"string","pattern":"^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i"},"pnlDownColor":{"type":"string","pattern":"^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i"},"pnlZeroColor":{"type":"string","pattern":"^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i"},"textColor":{"type":"string","pattern":"^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i"},"qtyTextColor":{"type":"string","pattern":"^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i"},"volumeUpColor":{"type":"string","pattern":"^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i"},"volumeDownColor":{"type":"string","pattern":"^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i"},"closeIconColor":{"type":"string"}},"additionalProperties":false},{"type":"object","properties":{"chartBG":{"type":"string","minLength":1},"upColor":{"type":"string","minLength":1},"downColor":{"type":"string","minLength":1},"pnlUpColor":{"type":"string","minLength":1},"pnlDownColor":{"type":"string","minLength":1},"pnlZeroColor":{"type":"string","minLength":1},"textColor":{"type":"string","minLength":1},"qtyTextColor":{"type":"string","minLength":1},"volumeUpColor":{"type":"string","minLength":1},"volumeDownColor":{"type":"string","minLength":1},"closeIconColor":{"type":"string","minLength":1}},"additionalProperties":false}]},"isDefault":{"type":"boolean"}},"required":["id","displayName","mode"],"additionalProperties":false},"minItems":1,"maxItems":10,"description":"SDK ThemeConfig array; legacy rows are represented as one default theme"},"telegramLink":{"type":"string","nullable":true,"description":"Telegram link"},"discordLink":{"type":"string","nullable":true,"description":"Discord link"},"xLink":{"type":"string","nullable":true,"description":"X (Twitter) link"},"walletConnectProjectId":{"type":"string","nullable":true,"description":"WalletConnect project ID"},"privyAppId":{"type":"string","nullable":true,"description":"Privy app ID"},"enabledMenus":{"type":"string","nullable":true,"description":"Enabled menu items"},"customMenus":{"type":"string","nullable":true,"description":"Custom menu configuration"},"enableAbstractWallet":{"type":"boolean","nullable":true,"description":"Whether Abstract wallet is enabled"},"disableMainnet":{"type":"boolean","nullable":true,"description":"Whether mainnet is disabled"},"disableTestnet":{"type":"boolean","nullable":true,"description":"Whether testnet is disabled"},"disableEvmWallets":{"type":"boolean","nullable":true,"description":"Whether EVM wallets are disabled"},"disableSolanaWallets":{"type":"boolean","nullable":true,"description":"Whether Solana wallets are disabled"},"enableServiceDisclaimerDialog":{"type":"boolean","nullable":true,"description":"Whether service disclaimer dialog is enabled"},"enableCampaigns":{"type":"boolean","nullable":true,"description":"Whether campaigns are enabled"},"tradingViewColorConfig":{"type":"string","nullable":true,"description":"TradingView color configuration JSON"},"availableLanguages":{"type":"array","items":{"type":"string"},"description":"Available language codes"},"seoSiteName":{"type":"string","nullable":true,"description":"SEO site name"},"seoSiteDescription":{"type":"string","nullable":true,"description":"SEO site description"},"seoSiteLanguage":{"type":"string","nullable":true,"description":"SEO site language"},"seoSiteLocale":{"type":"string","nullable":true,"description":"SEO site locale"},"seoTwitterHandle":{"type":"string","nullable":true,"description":"SEO Twitter handle"},"seoThemeColor":{"type":"string","nullable":true,"description":"SEO theme color"},"seoKeywords":{"type":"string","nullable":true,"description":"SEO keywords"},"analyticsConfig":{"oneOf":[{"type":"object","properties":{"version":{"type":"number","enum":[1]},"provider":{"type":"string","enum":["ga4"]},"measurementId":{"type":"string","pattern":"^G-[A-Z0-9]{4,20}$"}},"required":["version","provider","measurementId"],"additionalProperties":false},{"type":"object","properties":{"version":{"type":"number","enum":[1]},"provider":{"type":"string","enum":["firebase"]},"apiKey":{"type":"string","maxLength":128,"pattern":"^AIza[0-9A-Za-z_-]{20,}$"},"projectId":{"type":"string","pattern":"^[a-z][a-z0-9-]{4,28}[a-z0-9]$"},"appId":{"type":"string","pattern":"^1:\\d{6,20}:web:[0-9a-fA-F]{6,64}$"},"measurementId":{"type":"string","pattern":"^G-[A-Z0-9]{4,20}$"}},"required":["version","provider","apiKey","projectId","appId","measurementId"],"additionalProperties":false},{"type":"object","properties":{"version":{"type":"number","enum":[1]},"provider":{"type":"string","enum":["plausible"]}},"required":["version","provider"],"additionalProperties":false},{"nullable":true}],"description":"Validated fixed-provider analytics configuration"},"swapFeeBps":{"type":"number","nullable":true,"description":"Swap fee in basis points"},"symbolList":{"type":"string","nullable":true,"description":"Symbol list"},"restrictedRegions":{"type":"string","nullable":true,"description":"Restricted regions"},"whitelistedIps":{"type":"string","nullable":true,"description":"Whitelisted IPs"},"description":{"type":"string","nullable":true,"description":"DEX description"},"banner":{"type":"string","nullable":true,"description":"Banner image URL"},"logo":{"type":"string","nullable":true,"description":"Logo image URL"},"tokenAddress":{"type":"string","nullable":true,"description":"Token address"},"tokenChain":{"type":"string","nullable":true,"description":"Token chain"},"websiteUrl":{"type":"string","nullable":true,"description":"Website URL"},"isGraduated":{"type":"boolean","description":"Whether the DEX has graduated"},"graduationTxHash":{"type":"string","nullable":true,"description":"Graduation transaction hash"},"multisigChainId":{"type":"number","nullable":true,"description":"Multisig chain ID"},"showOnBoard":{"type":"boolean","description":"Whether to expose DEX identity on the public leaderboard"},"createdAt":{"type":"string","format":"date-time","description":"Creation timestamp"},"updatedAt":{"type":"string","format":"date-time","description":"Last update timestamp"}},"required":["id","brokerId","brokerName","repoUrl","customDomain","customDomainOverride","chainIds","defaultChain","themeCSS","themeConfig","telegramLink","discordLink","xLink","walletConnectProjectId","privyAppId","enabledMenus","customMenus","enableAbstractWallet","disableMainnet","disableTestnet","disableEvmWallets","disableSolanaWallets","enableServiceDisclaimerDialog","enableCampaigns","tradingViewColorConfig","availableLanguages","seoSiteName","seoSiteDescription","seoSiteLanguage","seoSiteLocale","seoTwitterHandle","seoThemeColor","seoKeywords","analyticsConfig","swapFeeBps","symbolList","restrictedRegions","whitelistedIps","description","banner","logo","tokenAddress","tokenChain","websiteUrl","isGraduated","graduationTxHash","multisigChainId","showOnBoard","createdAt","updatedAt"],"description":"DEX object"},"error":{"type":"object","properties":{"error":{"type":"string","description":"Error message"}},"required":["error"],"description":"Error response"}},"required":["success"],"description":"Frontend creation response"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message"}},"required":["error"],"description":"Error response"}}}},"403":{"description":"User is not authorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedError"}}}},"404":{"description":"DEX not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFoundError"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message"}},"required":["error"],"description":"Error response"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message"}},"required":["error"],"description":"Error response"}}}}}},"delete":{"tags":["DEX"],"summary":"Delete DEX frontend","description":"Delete the frontend for a DEX, removing the GitHub repository. Auto-switches integration type to custom.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"DEX ID","example":"cm3abc123def456"},"required":true,"description":"DEX ID","name":"id","in":"path"}],"responses":{"200":{"description":"Frontend deleted successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"Whether the operation was successful"},"data":{"type":"object","properties":{"id":{"type":"string","description":"DEX ID"},"brokerId":{"type":"string","description":"Broker ID"},"brokerName":{"type":"string","description":"Display name for the DEX"},"repoUrl":{"type":"string","nullable":true,"description":"GitHub repository URL"},"customDomain":{"type":"string","nullable":true,"description":"Custom domain for the DEX"},"customDomainOverride":{"type":"string","nullable":true,"description":"Custom domain override URL"},"chainIds":{"type":"array","items":{"type":"number"},"description":"Supported chain IDs"},"defaultChain":{"type":"number","nullable":true,"description":"Default chain ID"},"themeCSS":{"type":"string","nullable":true,"description":"Canonical :root CSS containing supported Orderly theme tokens"},"themeConfig":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"displayName":{"type":"string","minLength":1,"maxLength":50},"mode":{"type":"string","enum":["dark","light"]},"cssVars":{"type":"object","additionalProperties":{"type":"string"}},"tradingViewColorConfig":{"anyOf":[{"type":"object","properties":{"chartBG":{"type":"string","pattern":"^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i"},"upColor":{"type":"string","pattern":"^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i"},"downColor":{"type":"string","pattern":"^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i"},"pnlUpColor":{"type":"string","pattern":"^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i"},"pnlDownColor":{"type":"string","pattern":"^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i"},"pnlZeroColor":{"type":"string","pattern":"^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i"},"textColor":{"type":"string","pattern":"^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i"},"qtyTextColor":{"type":"string","pattern":"^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i"},"volumeUpColor":{"type":"string","pattern":"^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i"},"volumeDownColor":{"type":"string","pattern":"^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i"},"closeIconColor":{"type":"string"}},"additionalProperties":false},{"type":"object","properties":{"chartBG":{"type":"string","minLength":1},"upColor":{"type":"string","minLength":1},"downColor":{"type":"string","minLength":1},"pnlUpColor":{"type":"string","minLength":1},"pnlDownColor":{"type":"string","minLength":1},"pnlZeroColor":{"type":"string","minLength":1},"textColor":{"type":"string","minLength":1},"qtyTextColor":{"type":"string","minLength":1},"volumeUpColor":{"type":"string","minLength":1},"volumeDownColor":{"type":"string","minLength":1},"closeIconColor":{"type":"string","minLength":1}},"additionalProperties":false}]},"isDefault":{"type":"boolean"}},"required":["id","displayName","mode"],"additionalProperties":false},"minItems":1,"maxItems":10,"description":"SDK ThemeConfig array; legacy rows are represented as one default theme"},"telegramLink":{"type":"string","nullable":true,"description":"Telegram link"},"discordLink":{"type":"string","nullable":true,"description":"Discord link"},"xLink":{"type":"string","nullable":true,"description":"X (Twitter) link"},"walletConnectProjectId":{"type":"string","nullable":true,"description":"WalletConnect project ID"},"privyAppId":{"type":"string","nullable":true,"description":"Privy app ID"},"enabledMenus":{"type":"string","nullable":true,"description":"Enabled menu items"},"customMenus":{"type":"string","nullable":true,"description":"Custom menu configuration"},"enableAbstractWallet":{"type":"boolean","nullable":true,"description":"Whether Abstract wallet is enabled"},"disableMainnet":{"type":"boolean","nullable":true,"description":"Whether mainnet is disabled"},"disableTestnet":{"type":"boolean","nullable":true,"description":"Whether testnet is disabled"},"disableEvmWallets":{"type":"boolean","nullable":true,"description":"Whether EVM wallets are disabled"},"disableSolanaWallets":{"type":"boolean","nullable":true,"description":"Whether Solana wallets are disabled"},"enableServiceDisclaimerDialog":{"type":"boolean","nullable":true,"description":"Whether service disclaimer dialog is enabled"},"enableCampaigns":{"type":"boolean","nullable":true,"description":"Whether campaigns are enabled"},"tradingViewColorConfig":{"type":"string","nullable":true,"description":"TradingView color configuration JSON"},"availableLanguages":{"type":"array","items":{"type":"string"},"description":"Available language codes"},"seoSiteName":{"type":"string","nullable":true,"description":"SEO site name"},"seoSiteDescription":{"type":"string","nullable":true,"description":"SEO site description"},"seoSiteLanguage":{"type":"string","nullable":true,"description":"SEO site language"},"seoSiteLocale":{"type":"string","nullable":true,"description":"SEO site locale"},"seoTwitterHandle":{"type":"string","nullable":true,"description":"SEO Twitter handle"},"seoThemeColor":{"type":"string","nullable":true,"description":"SEO theme color"},"seoKeywords":{"type":"string","nullable":true,"description":"SEO keywords"},"analyticsConfig":{"oneOf":[{"type":"object","properties":{"version":{"type":"number","enum":[1]},"provider":{"type":"string","enum":["ga4"]},"measurementId":{"type":"string","pattern":"^G-[A-Z0-9]{4,20}$"}},"required":["version","provider","measurementId"],"additionalProperties":false},{"type":"object","properties":{"version":{"type":"number","enum":[1]},"provider":{"type":"string","enum":["firebase"]},"apiKey":{"type":"string","maxLength":128,"pattern":"^AIza[0-9A-Za-z_-]{20,}$"},"projectId":{"type":"string","pattern":"^[a-z][a-z0-9-]{4,28}[a-z0-9]$"},"appId":{"type":"string","pattern":"^1:\\d{6,20}:web:[0-9a-fA-F]{6,64}$"},"measurementId":{"type":"string","pattern":"^G-[A-Z0-9]{4,20}$"}},"required":["version","provider","apiKey","projectId","appId","measurementId"],"additionalProperties":false},{"type":"object","properties":{"version":{"type":"number","enum":[1]},"provider":{"type":"string","enum":["plausible"]}},"required":["version","provider"],"additionalProperties":false},{"nullable":true}],"description":"Validated fixed-provider analytics configuration"},"swapFeeBps":{"type":"number","nullable":true,"description":"Swap fee in basis points"},"symbolList":{"type":"string","nullable":true,"description":"Symbol list"},"restrictedRegions":{"type":"string","nullable":true,"description":"Restricted regions"},"whitelistedIps":{"type":"string","nullable":true,"description":"Whitelisted IPs"},"description":{"type":"string","nullable":true,"description":"DEX description"},"banner":{"type":"string","nullable":true,"description":"Banner image URL"},"logo":{"type":"string","nullable":true,"description":"Logo image URL"},"tokenAddress":{"type":"string","nullable":true,"description":"Token address"},"tokenChain":{"type":"string","nullable":true,"description":"Token chain"},"websiteUrl":{"type":"string","nullable":true,"description":"Website URL"},"isGraduated":{"type":"boolean","description":"Whether the DEX has graduated"},"graduationTxHash":{"type":"string","nullable":true,"description":"Graduation transaction hash"},"multisigChainId":{"type":"number","nullable":true,"description":"Multisig chain ID"},"showOnBoard":{"type":"boolean","description":"Whether to expose DEX identity on the public leaderboard"},"createdAt":{"type":"string","format":"date-time","description":"Creation timestamp"},"updatedAt":{"type":"string","format":"date-time","description":"Last update timestamp"}},"required":["id","brokerId","brokerName","repoUrl","customDomain","customDomainOverride","chainIds","defaultChain","themeCSS","themeConfig","telegramLink","discordLink","xLink","walletConnectProjectId","privyAppId","enabledMenus","customMenus","enableAbstractWallet","disableMainnet","disableTestnet","disableEvmWallets","disableSolanaWallets","enableServiceDisclaimerDialog","enableCampaigns","tradingViewColorConfig","availableLanguages","seoSiteName","seoSiteDescription","seoSiteLanguage","seoSiteLocale","seoTwitterHandle","seoThemeColor","seoKeywords","analyticsConfig","swapFeeBps","symbolList","restrictedRegions","whitelistedIps","description","banner","logo","tokenAddress","tokenChain","websiteUrl","isGraduated","graduationTxHash","multisigChainId","showOnBoard","createdAt","updatedAt"],"description":"DEX object"},"error":{"type":"object","properties":{"error":{"type":"string","description":"Error message"}},"required":["error"],"description":"Error response"}},"required":["success"],"description":"Frontend deletion response"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message"}},"required":["error"],"description":"Error response"}}}},"403":{"description":"User is not authorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedError"}}}},"404":{"description":"DEX not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFoundError"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message"}},"required":["error"],"description":"Error response"}}}}}}},"/api/auth/nonce":{"post":{"tags":["Authentication"],"summary":"Generate authentication nonce","description":"Generate a nonce that the user must sign to authenticate","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuthRequest"}}}},"responses":{"200":{"description":"Nonce generated successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NonceResponse"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuthErrorResponse"}}}}}}},"/api/auth/verify":{"post":{"tags":["Authentication"],"summary":"Verify signature and authenticate","description":"Verify the signed message and return an authentication token","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuthVerify"}}}},"responses":{"200":{"description":"Authentication successful","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuthSuccessResponse"}}}},"401":{"description":"Invalid signature","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuthErrorResponse"}}}},"404":{"description":"User not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuthErrorResponse"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuthErrorResponse"}}}}}}},"/api/auth/validate":{"post":{"tags":["Authentication"],"summary":"Validate authentication token","description":"Validate if an authentication token is still valid","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenValidation"}}}},"responses":{"200":{"description":"Token is valid","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenValidationResponse"}}}},"401":{"description":"Token invalid or expired","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenValidationResponse"}}}},"404":{"description":"User not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenValidationResponse"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenValidationResponse"}}}}}}},"/api/admin/check":{"get":{"tags":["Admin"],"summary":"Check admin status","description":"Check if the current user is an admin","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Admin status retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminCheckResponse"}}}}}}},"/api/theme/modify":{"post":{"tags":["Theme"],"summary":"Modify theme tokens","description":"Generate three token-only theme variants","security":[{"bearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"prompt":{"type":"string","minLength":3,"maxLength":100,"description":"Description of the desired theme modifications"},"currentTheme":{"type":"string","description":"Current canonical Orderly theme token CSS"},"currentMode":{"type":"string","enum":["dark","light"],"description":"Current theme color scheme"}},"required":["prompt"]}}}},"responses":{"200":{"description":"Theme modified successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ThemeModifyResponse"}}}},"413":{"description":"Theme request body is too large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ThemeErrorResponse"}}}},"429":{"description":"Theme generation rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ThemeErrorResponse"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ThemeErrorResponse"}}}}}}},"/api/graduation/verify-tx":{"post":{"tags":["Graduation"],"summary":"Verify graduation transaction","description":"Verify a graduation payment transaction and create the broker ID. Two ways to pay:\n\n1. **x402 (agent-friendly)** — call `POST /api/graduation/graduate` first, optionally with `brokerId` + fee query parameters and a Bearer token for **single-fetch auto-finalization** (the broker is registered automatically once the payment settles, no separate call needed). Otherwise, once the payment settles (200), read the settlement transaction hash from the `PAYMENT-RESPONSE` response header and pass it here as `txHash` together with the chain you paid on (`\"base-sepolia\" | \"arbitrum-sepolia\" | \"sepolia\"`) and `paymentType: \"usdc\"`. The paying wallet must belong to the Bearer-authenticated account.\n\n2. **Manual transfer** — send an ERC-20 transfer of USDC/ORDER/USDT to the receiver address from `GET /fee-options` on any accepted chain and pass its `txHash` here.\n\nIn both cases the broker ID is created by this call, but graduation is not finished: register your admin wallet via `POST /api/graduation/finalize-admin-wallet` (see its description for the registration recipe) and confirm with `GET /api/graduation/graduation-status` (`isGraduated: true`).\n\nIf verification permanently fails after an x402 payment, the fee can be reclaimed via `POST /api/graduation/refund`.","security":[{"bearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"txHash":{"type":"string","minLength":10,"maxLength":100,"description":"Transaction hash to verify"},"chain":{"type":"string","minLength":1,"maxLength":50,"description":"Blockchain chain name"},"brokerId":{"type":"string","minLength":5,"maxLength":15,"pattern":"^[a-z0-9_-]+$","description":"Desired broker ID"},"makerFee":{"type":"number","minimum":-0.5,"maximum":15,"description":"Maker fee in basis points (-0.5 to 15), in 0.1 bps increments. Negative values indicate rebates."},"takerFee":{"type":"number","minimum":1,"maximum":15,"description":"Taker fee in basis points (1-15), in 0.1 bps increments"},"rwaMakerFee":{"type":"number","minimum":-0.5,"maximum":15,"description":"RWA maker fee in basis points (-0.5 to 15), in 0.1 bps increments. Negative values indicate rebates."},"rwaTakerFee":{"type":"number","minimum":1,"maximum":15,"description":"RWA taker fee in basis points (1-15), in 0.1 bps increments"},"paymentType":{"type":"string","enum":["usdc","order","usdt"],"default":"order","description":"Payment token type"},"paymentQuote":{"type":"string","maxLength":4096,"description":"Server-signed quote required for ORDER payments"}},"required":["txHash","chain","brokerId","makerFee","takerFee","rwaMakerFee","rwaTakerFee"]}}}},"responses":{"200":{"description":"Transaction verified and broker created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerifyTxSuccess"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GraduationErrorResponse"}}}},"404":{"description":"User not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GraduationErrorResponse"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GraduationErrorResponse"}}}}}}},"/api/graduation/refund":{"post":{"tags":["Graduation"],"summary":"Refund an unused x402 graduation payment","description":"Refunds a settled x402 graduation payment that was not consumed by graduation. Use when POST /api/graduation/graduate returned 200 (payment settled) but POST /api/graduation/verify-tx failed or was never completed. The authenticated user must be the EIP-3009 payer of the settlement. Once refunded, the settlement transaction can no longer be used for graduation.","security":[{"bearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GraduationRefund"}}}},"responses":{"200":{"description":"Refund transaction submitted on-chain","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GraduationRefundResponse"}}}},"400":{"description":"Invalid request, non-x402 transaction, or already used/refunded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GraduationErrorResponse"}}}},"404":{"description":"User not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GraduationErrorResponse"}}}},"429":{"description":"Too many refund attempts — retry after the cooldown","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GraduationErrorResponse"}}}},"500":{"description":"Server error (refund transaction failed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GraduationErrorResponse"}}}}}}},"/api/graduation/status":{"get":{"tags":["Graduation"],"summary":"Get graduation status","description":"Get the current graduation status for the user's DEX","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Graduation status retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GraduationStatus"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GraduationErrorResponse"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GraduationErrorResponse"}}}}}}},"/api/graduation/rebind-permissionless-vault":{"post":{"tags":["Graduation"],"summary":"Rebind broker ID to permissionless vault","description":"Retry adding the current user's broker ID to the permissionless vault allowlist","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Permissionless vault allowlist updated successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RebindPermissionlessVaultResponse"}}}},"400":{"description":"Invalid request or rebind failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GraduationErrorResponse"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GraduationErrorResponse"}}}}}}},"/api/graduation/fees":{"get":{"tags":["Graduation"],"summary":"Get DEX fees","description":"Get the trading fees for the user's DEX","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"DEX fees retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DexFees"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GraduationErrorResponse"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GraduationErrorResponse"}}}}}}},"/api/graduation/tier":{"get":{"tags":["Graduation"],"summary":"Get broker tier","description":"Get the broker tier information for the user's DEX","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Broker tier retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BrokerTier"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","description":"Response message"}},"required":["message"],"description":"Message response"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","description":"Response message"}},"required":["message"],"description":"Message response"}}}}}}},"/api/graduation/finalize-admin-wallet":{"post":{"tags":["Graduation"],"summary":"Finalize admin wallet setup","description":"Finalize the admin wallet setup and mark DEX as graduated. This is the last step of graduation: it binds the admin wallet's Orderly account to the broker (on-chain FeeManager `setBrokerAccountId` + broker API `updateAdminAccount`) and sets `isGraduated: true`.\n\n**Prerequisite — register your wallet as an Orderly account first** (an EIP-712-signed registration against the Orderly API at `http://orderly-gateway-rest`):\n\n1. `GET http://orderly-gateway-rest/v1/registration_nonce?address={yourAddress}` → `data.registration_nonce`\n2. Sign EIP-712 typed data with your wallet:\n   - domain: `{ name: \"Orderly\", version: \"1\", chainId: <your EVM chainId, e.g. 421614>, verifyingContract: \"0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC\" }`\n   - types: `Registration: [ { name: \"brokerId\", type: \"string\" }, { name: \"chainId\", type: \"uint256\" }, { name: \"timestamp\", type: \"uint64\" }, { name: \"registrationNonce\", type: \"uint256\" } ]`\n   - message: `{ brokerId, chainId, timestamp: <current time in ms>, registrationNonce: <nonce from step 1> }`\n3. `POST http://orderly-gateway-rest/v1/register_account` with JSON body `{ message, signature, userAddress }` → `data.account_id` (keep the same brokerId and address you graduated with)\n\nThen call this endpoint with an **empty JSON body** (`{}`) — the EOA path binds the Bearer-authenticated user's own wallet as the admin. The multisig/delegate fields are for browser users with an Orderly delegate contract; agents should omit both.\n\nCall `GET /api/graduation/graduation-status` afterwards to confirm `isGraduated: true`.","security":[{"bearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"multisigAddress":{"type":"string","pattern":"^0x[a-fA-F0-9]{40}$","description":"Multisig/delegate wallet address to bind as admin"},"multisigChainId":{"type":"integer","minimum":0,"exclusiveMinimum":true,"description":"Chain ID for the multisig/delegate contract"}}}}}},"responses":{"200":{"description":"Admin wallet setup completed successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FinalizeAdminWalletResponse"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GraduationErrorResponse"}}}},"403":{"description":"Forbidden - caller is not the authorized signer for the admin wallet","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GraduationErrorResponse"}}}},"404":{"description":"User not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GraduationErrorResponse"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GraduationErrorResponse"}}}}}}},"/api/graduation/graduation-status":{"get":{"tags":["Graduation"],"summary":"Get detailed graduation status","description":"Get detailed graduation status including multisig information. Poll this endpoint after paying the fee: `isGraduated` becomes `true` only after the admin wallet has been registered and bound via `POST /api/graduation/finalize-admin-wallet` — a broker ID alone (`brokerId != \"demo\"`) is not yet a finished graduation.","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Graduation status retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GraduationStatusExtended"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GraduationErrorResponse"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GraduationErrorResponse"}}}}}}},"/api/graduation/fee-options":{"get":{"tags":["Graduation"],"summary":"Get graduation fee options","description":"Get the available fee options for graduation (USDC, ORDER, or USDT), the receiver address for manual transfers, and the authenticated payer address required for graduation payment. Agents that prefer not to build transactions manually can instead pay the USDC fee via the x402 HTTP-native payment protocol — see `POST /api/graduation/graduate` (payment requirements are returned in its 402 response)","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Fee options retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FeeOptions"}}}},"400":{"description":"DEX is not eligible for graduation payment","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GraduationErrorResponse"}}}},"404":{"description":"Authenticated user not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GraduationErrorResponse"}}}},"500":{"description":"Graduation payment configuration unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GraduationErrorResponse"}}}}}}},"/api/leaderboard":{"get":{"tags":["Leaderboard"],"summary":"Get leaderboard","description":"Get a paginated list of graduated DEXes sorted by trading metrics","parameters":[{"schema":{"type":"string","enum":["volume","pnl","fee"],"default":"volume","description":"Sort field for leaderboard","example":"volume"},"required":false,"description":"Sort field for leaderboard","name":"sort","in":"query"},{"schema":{"type":"string","enum":["today","daily","weekly","30d","90d"],"default":"weekly","description":"Time period for statistics","example":"weekly"},"required":false,"description":"Time period for statistics","name":"period","in":"query"},{"schema":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":50,"default":20,"description":"Number of results to return","example":20},"required":false,"description":"Number of results to return","name":"limit","in":"query"},{"schema":{"type":"integer","nullable":true,"minimum":0,"default":0,"description":"Number of results to skip","example":0},"required":false,"description":"Number of results to skip","name":"offset","in":"query"}],"responses":{"200":{"description":"Leaderboard retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeaderboardResponse"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeaderboardErrorResponse"}}}}}}},"/api/leaderboard/broker/{brokerId}":{"get":{"tags":["Leaderboard"],"summary":"Get broker stats","description":"Get detailed statistics for a specific broker/DEX","parameters":[{"schema":{"type":"string","minLength":1,"description":"Broker ID","example":"demo_dex"},"required":true,"description":"Broker ID","name":"brokerId","in":"path"},{"schema":{"type":"string","enum":["today","daily","weekly","30d","90d"],"default":"weekly","description":"Time period for statistics","example":"weekly"},"required":false,"description":"Time period for statistics","name":"period","in":"query"}],"responses":{"200":{"description":"Broker stats retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BrokerStatsResponse"}}}},"404":{"description":"Broker not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeaderboardErrorResponse"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeaderboardErrorResponse"}}}}}}},"/api/stats":{"get":{"tags":["Stats"],"summary":"Get DEX statistics","description":"Get aggregate statistics about DEX creation and graduation over a specified time period","parameters":[{"schema":{"type":"string","enum":["today","daily","weekly","30d","90d"],"default":"30d","description":"Time period for statistics","example":"30d"},"required":false,"description":"Time period for statistics","name":"period","in":"query"}],"responses":{"200":{"description":"Statistics retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DexStats"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatsErrorResponse"}}}}}}},"/api/stats/swap-fee-config":{"get":{"tags":["Stats"],"summary":"Get swap fee configurations","description":"Get the swap fee configuration for all graduated DEXes (cached for 5 minutes)","responses":{"200":{"description":"Swap fee configurations retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SwapFeeConfig"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatsErrorResponse"}}}}}}},"/api/bd-application":{"post":{"tags":["Boosted Distributor"],"summary":"Create a Boosted Distributor application","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BoostedDistributorApplication"}}}},"responses":{"200":{"description":"Application saved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BoostedDistributorSuccess"}}}},"400":{"description":"Invalid verification challenge","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BoostedDistributorError"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BoostedDistributorError"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BoostedDistributorError"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BoostedDistributorError"}}}}}}},"/api/graduation/graduate":{"post":{"tags":["Graduation"],"summary":"Pay graduation fee via x402 (agent-friendly)","description":"Pay the graduation fee using the x402 native HTTP payment protocol — designed for AI agents. No Bearer token, account, or manual transaction submission required for this step.\n\nFlow: send a POST. If payment is required, the server responds 402 with a `payment-required` response header (base64-encoded JSON) containing one payment option per accepted network: base-sepolia (chainId 84532), arbitrum-sepolia (chainId 421614), sepolia (chainId 11155111). Each option is an EIP-3009 (ERC-3009) USDC `transferWithAuthorization`. Pick any network whose USDC your wallet holds; an x402-aware client (e.g. `@x402/fetch`) signs the EIP-712 authorization and retries the request with a `payment-signature` header. On success the server settles the on-chain transfer and responds 200.\n\n**Single-fetch auto-finalization (recommended for agents):** include the `brokerId` and fee **query parameters** plus your `Authorization: Bearer` header on the same POST. The server validates them before charging (invalid parameters return 400 and the payment is canceled, nothing is paid), and once the payment settles it registers the broker automatically — no second call needed. Poll `GET /api/graduation/status` afterwards to confirm.\n\n**Two-step fallback:** omit the query parameters; after a 200, read the settlement transaction hash from the `PAYMENT-RESPONSE` response header (base64 JSON, field `.transaction`), then call `POST /api/graduation/verify-tx` with `{ txHash, chain: \"base-sepolia\" | \"arbitrum-sepolia\" | \"sepolia\", paymentType: \"usdc\", brokerId, makerFee, takerFee, rwaMakerFee, rwaTakerFee }` — using the chain you paid on.\n\nIf verification fails or graduation is not completed, the payment can be reclaimed via `POST /api/graduation/refund` (Bearer auth, same wallet as the payer) with the settlement transaction hash — the fee is returned on-chain.\n\n**After the payment** (either flow), one step remains to finish graduation: register your paying wallet as the broker's admin account — `POST /api/graduation/finalize-admin-wallet` documents the exact Orderly registration recipe. Poll `GET /api/graduation/graduation-status` until `isGraduated: true`.\n\n**Important:** without query parameters this endpoint requires no Bearer auth — the payment itself is the authentication. For auto-finalization the Bearer token is required, and the EIP-3009 payer wallet must be the same wallet that owns the Bearer-authenticated account.","security":[{},{"bearerAuth":[]}],"parameters":[{"name":"brokerId","in":"query","required":false,"description":"Desired broker ID. Supply together with all fee parameters and a Bearer token to auto-finalize graduation in this single request.","schema":{"type":"string","minLength":5,"maxLength":15,"pattern":"^[a-z0-9_-]+$"}},{"name":"makerFee","in":"query","required":false,"description":"Maker fee in bps (-0.5 to 15, 0.1 increments). Auto-finalization only.","schema":{"type":"number"}},{"name":"takerFee","in":"query","required":false,"description":"Taker fee in bps (1 to 15, 0.1 increments). Auto-finalization only.","schema":{"type":"number"}},{"name":"rwaMakerFee","in":"query","required":false,"description":"RWA maker fee in bps (-0.5 to 15, 0.1 increments). Auto-finalization only.","schema":{"type":"number"}},{"name":"rwaTakerFee","in":"query","required":false,"description":"RWA taker fee in bps (1 to 15, 0.1 increments). Auto-finalization only.","schema":{"type":"number"}}],"responses":{"200":{"description":"Payment received and settled on-chain. The settlement transaction hash is in the `PAYMENT-RESPONSE` response header.","headers":{"PAYMENT-RESPONSE":{"description":"Base64-encoded JSON settlement result containing the on-chain transaction hash.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"message":{"type":"string"}}}}}},"400":{"description":"Invalid auto-finalization parameters (bad brokerId/fees, missing Bearer token, payer mismatch, no DEX, already graduated, broker ID taken). The payment is canceled — nothing is charged.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"message":{"type":"string"}}}}}},"401":{"description":"Auto-finalization query parameters supplied without a valid Bearer token. The payment is canceled.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"message":{"type":"string"}}}}}},"402":{"description":"Payment Required. Payment requirements are in the `payment-required` response header (base64-encoded JSON). Retry the request with a `payment-signature` header containing the signed EIP-3009 authorization.","headers":{"payment-required":{"description":"Base64-encoded JSON PaymentRequired payload (`accepts[].amount` in atomic USDC units, `payTo`, `asset`, `network`).","schema":{"type":"string"}}}}}}}}}