{"openapi":"3.1.0","info":{"title":"MehrSwap Aggregated Crypto Swap API","version":"1.0.0","description":"High-performance, multi-provider cryptocurrency swap aggregation engine on Cloudflare Workers. Features automatic best-rate routing, instant free API keys for developers, custom partner margins, and zero-custody swaps.","contact":{"name":"Mehrnet Support","url":"https://swap.mehrnet.com"},"license":{"name":"MIT","url":"https://opensource.org/licenses/MIT"}},"servers":[{"url":"https://swap-api.mehrnet.com","description":"Production Edge Network"}],"tags":[{"name":"Swaps","description":"Currency listings, real-time rate quotes, and order lifecycle management"},{"name":"Developer & Affiliate","description":"Free developer keys, custom partner margins, balance tracking, and profit withdrawals"},{"name":"Admin","description":"Platform analytics, provider breakdown, and account maintenance"}],"paths":{"/api/v1/coins":{"get":{"tags":["Swaps"],"summary":"List supported swap currencies and networks","description":"Returns aggregated list of supported cryptocurrencies and token networks from top global liquidity providers.","responses":{"200":{"description":"Supported coin list"}}}},"/api/v1/quote":{"get":{"tags":["Swaps"],"summary":"Get best aggregated exchange quote","description":"Compares liquidity providers in real-time, guarantees the cheapest swap rate, and applies optional partner margins.","parameters":[{"name":"from","in":"query","required":true,"schema":{"type":"string","example":"BTC"}},{"name":"fromNetwork","in":"query","required":false,"schema":{"type":"string","example":"bitcoin"}},{"name":"to","in":"query","required":true,"schema":{"type":"string","example":"ETH"}},{"name":"toNetwork","in":"query","required":false,"schema":{"type":"string","example":"ethereum"}},{"name":"amount","in":"query","required":true,"schema":{"type":"number","example":0.1}}],"responses":{"200":{"description":"Best quote details"}}}},"/api/v1/orders":{"post":{"tags":["Swaps"],"summary":"Create a cryptocurrency swap order","description":"Initiates a swap with the best liquidity route, generating a one-time deposit wallet address.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["fromCoin","toCoin","amount","settleAddress"],"properties":{"fromCoin":{"type":"string","example":"BTC"},"fromNetwork":{"type":"string","example":"bitcoin"},"toCoin":{"type":"string","example":"ETH"},"toNetwork":{"type":"string","example":"ethereum"},"amount":{"type":"number","example":0.1},"settleAddress":{"type":"string","example":"0x71C...b88"},"settleMemo":{"type":"string","nullable":true},"refundAddress":{"type":"string","nullable":true},"refundMemo":{"type":"string","nullable":true},"quoteId":{"type":"string","nullable":true}}}}}},"responses":{"200":{"description":"Order created successfully"}}}},"/api/v1/orders/{id}":{"get":{"tags":["Swaps"],"summary":"Check swap order status","description":"Provides real-time updates on deposit detection, network confirmations, exchange progress, and settle payout hashes.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","example":"ms_7b89f2a1"}}],"responses":{"200":{"description":"Order status information"}}}},"/api/v1/auth/register":{"post":{"tags":["Developer & Affiliate"],"summary":"Get instant free API key","description":"Generate a developer account starting in `discover` status. Valid for 24h, automatically becomes permanent `active` upon first swap.","requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"label":{"type":"string","example":"My Crypto Bot"},"email":{"type":"string","example":"dev@example.com"}}}}}},"responses":{"200":{"description":"Account and API key details"}}}},"/api/v1/account":{"get":{"tags":["Developer & Affiliate"],"summary":"Retrieve account details and affiliate profits","security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Account metrics and unpaid profit balance"}}}},"/api/v1/account/margin":{"post":{"tags":["Developer & Affiliate"],"summary":"Configure custom profit margin (0.0% to 5.0%)","security":[{"ApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["marginPercent"],"properties":{"marginPercent":{"type":"number","example":1}}}}}},"responses":{"200":{"description":"Margin successfully updated"}}}},"/api/v1/account/withdraw":{"post":{"tags":["Developer & Affiliate"],"summary":"Withdraw accrued affiliate profit","security":[{"ApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["amountUsd","payoutAddress","payoutCoin"],"properties":{"amountUsd":{"type":"number","example":50},"payoutAddress":{"type":"string","example":"0x71C...b88"},"payoutCoin":{"type":"string","example":"USDT"}}}}}},"responses":{"200":{"description":"Withdrawal submitted"}}}}}}