{"openapi":"3.1.0","info":{"title":"Market Mayhem API","version":"1","description":"Launch and trade tokens on BNB Chain. Free and non-custodial: every build is simulated and returned unsigned for your wallet to sign. Read /settings first."},"servers":[{"url":"https://marketmayhem.co/api/v1"}],"components":{"securitySchemes":{"apiKey":{"type":"apiKey","in":"header","name":"x-api-key","description":"Optional. Makes your wallet the default referrer on trades your key builds."}}},"security":[{},{"apiKey":[]}],"paths":{"/settings":{"get":{"summary":"The live network, contracts, fees, pair currencies and limits. Read this first.","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"apiVersion":{"type":"number","const":1,"description":"The API version; /v1 is frozen"},"chainId":{"type":"integer","description":"56 BSC mainnet, 97 BSC testnet"},"network":{"type":"string","description":"The network's name"},"contracts":{"type":"object","properties":{"factory":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"A 0x address"},"router":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"A 0x address"},"permit2":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"A 0x address"},"quoter":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"A 0x address"},"wbnb":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"A 0x address"},"siteFeeRecipient":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"A 0x address"},"referrals":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"A 0x address"},{"type":"null"}],"description":"A 0x address"}},"required":["factory","router","permit2","quoter","wbnb","siteFeeRecipient"],"additionalProperties":true,"description":"Every contract the API builds for"},"fees":{"type":"object","properties":{"siteFeeBps":{"type":"integer","description":"The site fee on every trade, in basis points (100 = 1%)"},"referrerBps":{"type":"integer","description":"The referrer's part of it, in basis points of the trade (20 = 0.2%)"},"lifetimeReferralBps":{"type":"integer","description":"A referrer's lifetime share of our income from wallets bound to them (1500 = 15%)"}},"required":["siteFeeBps","referrerBps","lifetimeReferralBps"]},"launch":{"type":"object","properties":{"paused":{"type":"boolean","description":"True while launches are paused"},"launchFeeWei":{"type":"string","pattern":"^\\d+$","description":"The launch fee in wei (0: launching is free)"},"feeTiers":{"type":"array","items":{"type":"object","properties":{"bps":{"type":"integer"},"label":{"type":"string"},"default":{"type":"boolean"}},"required":["bps","label"]}},"defaultFeeTier":{"type":"integer","description":"The pool fee tier used when none is sent"},"defaultSupply":{"type":"string","description":"The supply used when none is sent, in whole tokens"}},"required":["paused","launchFeeWei","feeTiers","defaultFeeTier","defaultSupply"]},"pairs":{"type":"array","items":{"type":"object","properties":{"address":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"The pair currency's contract (WBNB for BNB)"},"decimals":{"type":"integer","description":"Its decimals"},"symbol":{"type":"string","description":"Its symbol, e.g. BNB"},"native":{"type":"boolean","description":"True for BNB, paid natively"}},"required":["address","decimals","symbol"]},"description":"The listed pair currencies. Any BEP20 can also be a pair."},"limits":{"type":"object","properties":{"tradeDeadlineSeconds":{"type":"integer","description":"How long a built trade stays valid"},"permitDays":{"type":"integer","description":"How long the Permit2 approval to our router lasts"},"maxSlippageBps":{"type":"integer","description":"The largest slippage a build accepts"},"defaultSlippageBps":{"type":"integer","description":"The slippage used when none is sent"}},"required":["tradeDeadlineSeconds","permitDays","maxSlippageBps","defaultSlippageBps"]}},"required":["apiVersion","chainId","network","contracts","fees","launch","pairs","limits"]}}}},"default":{"description":"An error. Codes this endpoint can return: see /errors.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable: act on this"},"message":{"type":"string"},"fix":{"type":"string"},"field":{"type":"string"},"detail":{}},"required":["code","message"]}},"required":["error"]}}}}},"x-error-codes":[]}},"/errors":{"get":{"summary":"Every error code: what it means, the fix, and whether retrying can succeed.","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"errors":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"status":{"type":"integer"},"meaning":{"type":"string"},"cause":{"type":"string"},"fix":{"type":"string"},"retry":{"type":"boolean"}},"required":["code","status","meaning","fix","retry"]}}},"required":["errors"]}}}},"default":{"description":"An error. Codes this endpoint can return: see /errors.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable: act on this"},"message":{"type":"string"},"fix":{"type":"string"},"field":{"type":"string"},"detail":{}},"required":["code","message"]}},"required":["error"]}}}}},"x-error-codes":[]}},"/launches":{"get":{"summary":"Launches: newest first, or with `after`, everything since that block, oldest first (for polling).","parameters":[{"name":"after","in":"query","required":false,"description":"The `next` from the previous answer","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Default 50","schema":{"type":"integer","minimum":1,"maximum":200}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"launches":{"type":"array","items":{"type":"object","properties":{"token":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"The token"},"symbol":{"type":"string"},"name":{"type":"string"},"creator":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"The wallet that launched it"},"pool":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"Its PancakeSwap V3 pool"},"pair":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"The pair currency"},"feeTier":{"type":"integer","description":"The pool fee tier (10000 = 1%)"},"image":{"type":["string","null"],"description":"Its logo, or null"},"launchedAt":{"type":"string","description":"When, ISO 8601"},"tx":{"type":"string","pattern":"^0x[0-9a-fA-F]{64}$","description":"The launch transaction"},"block":{"type":"integer","description":"The block it launched in"}},"required":["token","symbol","name","creator","pool","pair","feeTier","image","launchedAt","tx","block"]}},"next":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Send as `after` next time to get only newer launches"}},"required":["launches","next"]}}}},"default":{"description":"An error. Codes this endpoint can return: INVALID_CURSOR.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable: act on this"},"message":{"type":"string"},"fix":{"type":"string"},"field":{"type":"string"},"detail":{}},"required":["code","message"]}},"required":["error"]}}}}},"x-error-codes":["INVALID_CURSOR"]}},"/tokens/{address}":{"get":{"summary":"One token launched on Market Mayhem.","parameters":[{"name":"address","in":"path","required":true,"description":"The token","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"address":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"The token"},"symbol":{"type":"string"},"name":{"type":"string"},"pool":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"Its PancakeSwap V3 pool"},"fee":{"type":"integer","description":"The pool fee tier (10000 = 1%)"},"creator":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"The wallet that launched it"},"decimals":{"type":"integer"},"quote":{"type":"object","properties":{"address":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"The pair currency's contract (WBNB for BNB)"},"decimals":{"type":"integer","description":"Its decimals"},"symbol":{"type":"string","description":"Its symbol, e.g. BNB"}},"required":["address","decimals","symbol"],"description":"The pair currency"},"quoteIsBnb":{"type":"boolean","description":"True when it trades against BNB"}},"required":["address","symbol","name","pool","fee","creator","decimals","quote","quoteIsBnb"]}}}},"default":{"description":"An error. Codes this endpoint can return: UNKNOWN_TOKEN, INVALID_ADDRESS.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable: act on this"},"message":{"type":"string"},"fix":{"type":"string"},"field":{"type":"string"},"detail":{}},"required":["code","message"]}},"required":["error"]}}}}},"x-error-codes":["UNKNOWN_TOKEN","INVALID_ADDRESS"]}},"/quote":{"get":{"summary":"What a buy or sale gets right now. Sends nothing.","parameters":[{"name":"token","in":"query","required":true,"description":"The token","schema":{"type":"string"}},{"name":"side","in":"query","required":true,"description":"","schema":{"type":"string","enum":["buy","sell"]}},{"name":"amount","in":"query","required":true,"description":"Whole units of the exact side","schema":{"type":"string"}},{"name":"exact","in":"query","required":false,"description":"Default in","schema":{"type":"string","enum":["in","out"]}},{"name":"slippageBps","in":"query","required":false,"description":"Default 50","schema":{"type":"integer"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"object","properties":{"address":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"A 0x address"},"symbol":{"type":"string"},"pool":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"A 0x address"},"feeTier":{"type":"integer"},"pair":{"type":"object","properties":{"address":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"The pair currency's contract (WBNB for BNB)"},"decimals":{"type":"integer","description":"Its decimals"},"symbol":{"type":"string","description":"Its symbol, e.g. BNB"}},"required":["address","decimals","symbol"]}},"required":["address","symbol","pool","feeTier","pair"],"description":"The token traded"},"side":{"type":"string","enum":["buy","sell"],"description":"buy: pay the pair currency, get the token; sell: the reverse"},"exact":{"type":"string","enum":["in","out"],"description":"in: `pay` is fixed; out: `receive` is fixed"},"slippageBps":{"type":"integer","description":"The tolerance the limit is set from"},"pay":{"type":"object","properties":{"amount":{"type":"string","pattern":"^\\d+(\\.\\d+)?$","description":"A decimal amount in whole units, as a string: \"0.05\""},"wei":{"type":"string","pattern":"^\\d+$","description":"The same amount in the smallest unit, an integer as a string"},"symbol":{"type":"string","description":"The currency, e.g. BNB or the token's ticker"}},"required":["amount","wei","symbol"],"description":"What is spent"},"receive":{"type":"object","properties":{"amount":{"type":"string","pattern":"^\\d+(\\.\\d+)?$","description":"A decimal amount in whole units, as a string: \"0.05\""},"wei":{"type":"string","pattern":"^\\d+$","description":"The same amount in the smallest unit, an integer as a string"},"symbol":{"type":"string","description":"The currency, e.g. BNB or the token's ticker"}},"required":["amount","wei","symbol"],"description":"What comes back, at the price now"},"limit":{"type":"object","properties":{"amount":{"type":"string","pattern":"^\\d+(\\.\\d+)?$","description":"A decimal amount in whole units, as a string: \"0.05\""},"wei":{"type":"string","pattern":"^\\d+$","description":"The same amount in the smallest unit, an integer as a string"},"kind":{"type":"string","enum":["minReceive","maxPay"]}},"required":["amount","wei","kind"],"description":"The floor (or ceiling) written into the trade: it reverts rather than fill worse"},"siteFee":{"type":"object","properties":{"amount":{"type":"string","pattern":"^\\d+(\\.\\d+)?$","description":"A decimal amount in whole units, as a string: \"0.05\""},"wei":{"type":"string","pattern":"^\\d+$","description":"The same amount in the smallest unit, an integer as a string"},"symbol":{"type":"string","description":"The currency, e.g. BNB or the token's ticker"},"bps":{"type":"integer","description":"Its rate, in basis points"}},"required":["amount","wei","symbol","bps"],"description":"The site fee this trade pays"},"priceImpactPct":{"type":"number","description":"How far this trade moves the price, in per cent"}},"required":["token","side","exact","slippageBps","pay","receive","limit","siteFee","priceImpactPct"]}}}},"default":{"description":"An error. Codes this endpoint can return: UNKNOWN_TOKEN, INVALID_SIDE, INVALID_EXACT, INVALID_AMOUNT, AMOUNT_TOO_SMALL, TOO_MANY_DECIMALS, INVALID_SLIPPAGE, POOL_TOO_THIN, RATE_LIMITED.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable: act on this"},"message":{"type":"string"},"fix":{"type":"string"},"field":{"type":"string"},"detail":{}},"required":["code","message"]}},"required":["error"]}}}}},"x-error-codes":["UNKNOWN_TOKEN","INVALID_SIDE","INVALID_EXACT","INVALID_AMOUNT","AMOUNT_TOO_SMALL","TOO_MANY_DECIMALS","INVALID_SLIPPAGE","POOL_TOO_THIN","RATE_LIMITED"]}},"/build/buy":{"post":{"summary":"An unsigned, simulated buy.","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"object","properties":{"address":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"A 0x address"},"symbol":{"type":"string"},"pool":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"A 0x address"},"feeTier":{"type":"integer"},"pair":{"type":"object","properties":{"address":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"The pair currency's contract (WBNB for BNB)"},"decimals":{"type":"integer","description":"Its decimals"},"symbol":{"type":"string","description":"Its symbol, e.g. BNB"}},"required":["address","decimals","symbol"]}},"required":["address","symbol","pool","feeTier","pair"],"description":"The token traded"},"side":{"type":"string","enum":["buy","sell"],"description":"buy: pay the pair currency, get the token; sell: the reverse"},"exact":{"type":"string","enum":["in","out"],"description":"in: `pay` is fixed; out: `receive` is fixed"},"slippageBps":{"type":"integer","description":"The tolerance the limit is set from"},"pay":{"type":"object","properties":{"amount":{"type":"string","pattern":"^\\d+(\\.\\d+)?$","description":"A decimal amount in whole units, as a string: \"0.05\""},"wei":{"type":"string","pattern":"^\\d+$","description":"The same amount in the smallest unit, an integer as a string"},"symbol":{"type":"string","description":"The currency, e.g. BNB or the token's ticker"}},"required":["amount","wei","symbol"],"description":"What is spent"},"receive":{"type":"object","properties":{"amount":{"type":"string","pattern":"^\\d+(\\.\\d+)?$","description":"A decimal amount in whole units, as a string: \"0.05\""},"wei":{"type":"string","pattern":"^\\d+$","description":"The same amount in the smallest unit, an integer as a string"},"symbol":{"type":"string","description":"The currency, e.g. BNB or the token's ticker"}},"required":["amount","wei","symbol"],"description":"What comes back, at the price now"},"limit":{"type":"object","properties":{"amount":{"type":"string","pattern":"^\\d+(\\.\\d+)?$","description":"A decimal amount in whole units, as a string: \"0.05\""},"wei":{"type":"string","pattern":"^\\d+$","description":"The same amount in the smallest unit, an integer as a string"},"kind":{"type":"string","enum":["minReceive","maxPay"]}},"required":["amount","wei","kind"],"description":"The floor (or ceiling) written into the trade: it reverts rather than fill worse"},"siteFee":{"type":"object","properties":{"amount":{"type":"string","pattern":"^\\d+(\\.\\d+)?$","description":"A decimal amount in whole units, as a string: \"0.05\""},"wei":{"type":"string","pattern":"^\\d+$","description":"The same amount in the smallest unit, an integer as a string"},"symbol":{"type":"string","description":"The currency, e.g. BNB or the token's ticker"},"bps":{"type":"integer","description":"Its rate, in basis points"}},"required":["amount","wei","symbol","bps"],"description":"The site fee this trade pays"},"priceImpactPct":{"type":"number","description":"How far this trade moves the price, in per cent"},"wallet":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"The wallet it was built for"},"referrer":{"anyOf":[{"type":"object","properties":{"address":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"A 0x address"},"bps":{"type":"integer","description":"Its cut, in basis points of the trade"}},"required":["address","bps"]},{"type":"null"}],"description":"Who is paid the referral cut, and how much, or null"},"referrerNote":{"type":"string","description":"Why your key's wallet was not used as referrer, when it was not"},"requires":{"type":"array","items":{"type":"object","properties":{"step":{"type":"string","description":"e.g. \"approve-permit2\", \"approve-router\", \"approve-factory\""},"explain":{"type":"string"},"tx":{"type":"object","properties":{"chainId":{"type":"integer","description":"56 BSC mainnet, 97 BSC testnet"},"to":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"A 0x address"},"data":{"type":"string","pattern":"^0x[0-9a-fA-F]*$","description":"The call data: send it exactly as it is"},"value":{"type":"string","pattern":"^\\d+$","description":"BNB to send with it, in wei"},"gas":{"type":"string","pattern":"^\\d+$","description":"The simulated gas plus a margin. Absent while a step in `requires` is still needed."}},"required":["chainId","to","data","value"],"description":"An unsigned transaction: sign it with the wallet and send it."}},"required":["step","explain","tx"]},"description":"One-time steps to send and wait for first, in order. Empty when the wallet is ready."},"tx":{"type":"object","properties":{"chainId":{"type":"integer","description":"56 BSC mainnet, 97 BSC testnet"},"to":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"A 0x address"},"data":{"type":"string","pattern":"^0x[0-9a-fA-F]*$","description":"The call data: send it exactly as it is"},"value":{"type":"string","pattern":"^\\d+$","description":"BNB to send with it, in wei"},"gas":{"type":"string","pattern":"^\\d+$","description":"The simulated gas plus a margin. Absent while a step in `requires` is still needed."}},"required":["chainId","to","data","value"],"description":"An unsigned transaction: sign it with the wallet and send it."},"simulation":{"type":"object","properties":{"ran":{"type":"boolean","description":"Whether it was simulated: not while a step in `requires` is still needed"},"ok":{"type":"boolean","description":"It would succeed if sent now"}},"required":["ran","ok"],"additionalProperties":true,"description":"The simulation against the chain, from the wallet"},"cost":{"type":"object","properties":{"gasPriceWei":{"type":"string","pattern":"^\\d+$","description":"The same amount in the smallest unit, an integer as a string"},"maxWei":{"type":"string","pattern":"^\\d+$","description":"The same amount in the smallest unit, an integer as a string"},"max":{"type":"string","pattern":"^\\d+(\\.\\d+)?$","description":"A decimal amount in whole units, as a string: \"0.05\""}},"required":["gasPriceWei","maxWei","max"],"description":"The most the transaction can cost in gas, in BNB."},"expiresAt":{"type":"string","description":"The on-chain deadline"},"explain":{"type":"string","description":"One sentence to show before signing"}},"required":["token","side","exact","slippageBps","pay","receive","limit","siteFee","priceImpactPct","wallet","referrer","requires","tx","simulation","cost","expiresAt","explain"]}}}},"default":{"description":"An error. Codes this endpoint can return: UNKNOWN_TOKEN, INVALID_AMOUNT, INSUFFICIENT_BALANCE, SIMULATION_FAILED, SELF_REFERRAL, REFERRER_NOT_REGISTERED, POOL_TOO_THIN, CHAIN_UNREACHABLE, RATE_LIMITED.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable: act on this"},"message":{"type":"string"},"fix":{"type":"string"},"field":{"type":"string"},"detail":{}},"required":["code","message"]}},"required":["error"]}}}}},"x-error-codes":["UNKNOWN_TOKEN","INVALID_AMOUNT","INSUFFICIENT_BALANCE","SIMULATION_FAILED","SELF_REFERRAL","REFERRER_NOT_REGISTERED","POOL_TOO_THIN","CHAIN_UNREACHABLE","RATE_LIMITED"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"wallet":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"The wallet that will sign and send"},"token":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"A 0x address"},"amount":{"type":"string","pattern":"^\\d+(\\.\\d+)?$","description":"exact \"in\": what is spent; exact \"out\": what is received"},"exact":{"type":"string","enum":["in","out"],"description":"in (default): `amount` is spent; out: `amount` is received"},"slippageBps":{"type":"integer","minimum":1,"maximum":5000,"description":"Basis points; default 50 (0.5%)"},"referrer":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"A 0x address"},{"type":"null"}],"description":"Paid the referral cut inside the trade. Omit: your API key's wallet; null: nobody."}},"required":["wallet","token","amount"]}}}}}},"/build/sell":{"post":{"summary":"An unsigned, simulated sale.","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"object","properties":{"address":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"A 0x address"},"symbol":{"type":"string"},"pool":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"A 0x address"},"feeTier":{"type":"integer"},"pair":{"type":"object","properties":{"address":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"The pair currency's contract (WBNB for BNB)"},"decimals":{"type":"integer","description":"Its decimals"},"symbol":{"type":"string","description":"Its symbol, e.g. BNB"}},"required":["address","decimals","symbol"]}},"required":["address","symbol","pool","feeTier","pair"],"description":"The token traded"},"side":{"type":"string","enum":["buy","sell"],"description":"buy: pay the pair currency, get the token; sell: the reverse"},"exact":{"type":"string","enum":["in","out"],"description":"in: `pay` is fixed; out: `receive` is fixed"},"slippageBps":{"type":"integer","description":"The tolerance the limit is set from"},"pay":{"type":"object","properties":{"amount":{"type":"string","pattern":"^\\d+(\\.\\d+)?$","description":"A decimal amount in whole units, as a string: \"0.05\""},"wei":{"type":"string","pattern":"^\\d+$","description":"The same amount in the smallest unit, an integer as a string"},"symbol":{"type":"string","description":"The currency, e.g. BNB or the token's ticker"}},"required":["amount","wei","symbol"],"description":"What is spent"},"receive":{"type":"object","properties":{"amount":{"type":"string","pattern":"^\\d+(\\.\\d+)?$","description":"A decimal amount in whole units, as a string: \"0.05\""},"wei":{"type":"string","pattern":"^\\d+$","description":"The same amount in the smallest unit, an integer as a string"},"symbol":{"type":"string","description":"The currency, e.g. BNB or the token's ticker"}},"required":["amount","wei","symbol"],"description":"What comes back, at the price now"},"limit":{"type":"object","properties":{"amount":{"type":"string","pattern":"^\\d+(\\.\\d+)?$","description":"A decimal amount in whole units, as a string: \"0.05\""},"wei":{"type":"string","pattern":"^\\d+$","description":"The same amount in the smallest unit, an integer as a string"},"kind":{"type":"string","enum":["minReceive","maxPay"]}},"required":["amount","wei","kind"],"description":"The floor (or ceiling) written into the trade: it reverts rather than fill worse"},"siteFee":{"type":"object","properties":{"amount":{"type":"string","pattern":"^\\d+(\\.\\d+)?$","description":"A decimal amount in whole units, as a string: \"0.05\""},"wei":{"type":"string","pattern":"^\\d+$","description":"The same amount in the smallest unit, an integer as a string"},"symbol":{"type":"string","description":"The currency, e.g. BNB or the token's ticker"},"bps":{"type":"integer","description":"Its rate, in basis points"}},"required":["amount","wei","symbol","bps"],"description":"The site fee this trade pays"},"priceImpactPct":{"type":"number","description":"How far this trade moves the price, in per cent"},"wallet":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"The wallet it was built for"},"referrer":{"anyOf":[{"type":"object","properties":{"address":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"A 0x address"},"bps":{"type":"integer","description":"Its cut, in basis points of the trade"}},"required":["address","bps"]},{"type":"null"}],"description":"Who is paid the referral cut, and how much, or null"},"referrerNote":{"type":"string","description":"Why your key's wallet was not used as referrer, when it was not"},"requires":{"type":"array","items":{"type":"object","properties":{"step":{"type":"string","description":"e.g. \"approve-permit2\", \"approve-router\", \"approve-factory\""},"explain":{"type":"string"},"tx":{"type":"object","properties":{"chainId":{"type":"integer","description":"56 BSC mainnet, 97 BSC testnet"},"to":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"A 0x address"},"data":{"type":"string","pattern":"^0x[0-9a-fA-F]*$","description":"The call data: send it exactly as it is"},"value":{"type":"string","pattern":"^\\d+$","description":"BNB to send with it, in wei"},"gas":{"type":"string","pattern":"^\\d+$","description":"The simulated gas plus a margin. Absent while a step in `requires` is still needed."}},"required":["chainId","to","data","value"],"description":"An unsigned transaction: sign it with the wallet and send it."}},"required":["step","explain","tx"]},"description":"One-time steps to send and wait for first, in order. Empty when the wallet is ready."},"tx":{"type":"object","properties":{"chainId":{"type":"integer","description":"56 BSC mainnet, 97 BSC testnet"},"to":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"A 0x address"},"data":{"type":"string","pattern":"^0x[0-9a-fA-F]*$","description":"The call data: send it exactly as it is"},"value":{"type":"string","pattern":"^\\d+$","description":"BNB to send with it, in wei"},"gas":{"type":"string","pattern":"^\\d+$","description":"The simulated gas plus a margin. Absent while a step in `requires` is still needed."}},"required":["chainId","to","data","value"],"description":"An unsigned transaction: sign it with the wallet and send it."},"simulation":{"type":"object","properties":{"ran":{"type":"boolean","description":"Whether it was simulated: not while a step in `requires` is still needed"},"ok":{"type":"boolean","description":"It would succeed if sent now"}},"required":["ran","ok"],"additionalProperties":true,"description":"The simulation against the chain, from the wallet"},"cost":{"type":"object","properties":{"gasPriceWei":{"type":"string","pattern":"^\\d+$","description":"The same amount in the smallest unit, an integer as a string"},"maxWei":{"type":"string","pattern":"^\\d+$","description":"The same amount in the smallest unit, an integer as a string"},"max":{"type":"string","pattern":"^\\d+(\\.\\d+)?$","description":"A decimal amount in whole units, as a string: \"0.05\""}},"required":["gasPriceWei","maxWei","max"],"description":"The most the transaction can cost in gas, in BNB."},"expiresAt":{"type":"string","description":"The on-chain deadline"},"explain":{"type":"string","description":"One sentence to show before signing"}},"required":["token","side","exact","slippageBps","pay","receive","limit","siteFee","priceImpactPct","wallet","referrer","requires","tx","simulation","cost","expiresAt","explain"]}}}},"default":{"description":"An error. Codes this endpoint can return: UNKNOWN_TOKEN, INVALID_AMOUNT, INSUFFICIENT_BALANCE, SIMULATION_FAILED, SELF_REFERRAL, REFERRER_NOT_REGISTERED, POOL_TOO_THIN, CHAIN_UNREACHABLE, RATE_LIMITED.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable: act on this"},"message":{"type":"string"},"fix":{"type":"string"},"field":{"type":"string"},"detail":{}},"required":["code","message"]}},"required":["error"]}}}}},"x-error-codes":["UNKNOWN_TOKEN","INVALID_AMOUNT","INSUFFICIENT_BALANCE","SIMULATION_FAILED","SELF_REFERRAL","REFERRER_NOT_REGISTERED","POOL_TOO_THIN","CHAIN_UNREACHABLE","RATE_LIMITED"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"wallet":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"The wallet that will sign and send"},"token":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"A 0x address"},"amount":{"type":"string","pattern":"^\\d+(\\.\\d+)?$","description":"exact \"in\": what is spent; exact \"out\": what is received"},"exact":{"type":"string","enum":["in","out"],"description":"in (default): `amount` is spent; out: `amount` is received"},"slippageBps":{"type":"integer","minimum":1,"maximum":5000,"description":"Basis points; default 50 (0.5%)"},"referrer":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"A 0x address"},{"type":"null"}],"description":"Paid the referral cut inside the trade. Omit: your API key's wallet; null: nobody."}},"required":["wallet","token","amount"]}}}}}},"/build/launch":{"post":{"summary":"An unsigned, simulated token launch.","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"wallet":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"A 0x address"},"token":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"The new token's address, known before sending"},"name":{"type":"string"},"symbol":{"type":"string"},"supply":{"type":"object","properties":{"amount":{"type":"string","pattern":"^\\d+(\\.\\d+)?$","description":"A decimal amount in whole units, as a string: \"0.05\""},"wei":{"type":"string","pattern":"^\\d+$","description":"The same amount in the smallest unit, an integer as a string"}},"required":["amount","wei"],"description":"The total supply"},"pair":{"type":"object","properties":{"address":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"The pair currency's contract (WBNB for BNB)"},"decimals":{"type":"integer","description":"Its decimals"},"symbol":{"type":"string","description":"Its symbol, e.g. BNB"},"priced":{"type":"boolean","description":"Whether it has a dollar price"},"note":{"type":"string"}},"required":["address","decimals","symbol","priced"],"description":"The pair currency"},"opening":{"type":"object","properties":{"marketCapPair":{"type":"number","description":"A number, not a string: the opening cap the chosen tick gives"},"marketCapUsd":{"type":["number","null"]},"driftFromAskedPct":{"type":"number","description":"Ticks are ~2% apart on the 1% tier, so the cap opens near, not at, what was asked"}},"required":["marketCapPair","marketCapUsd","driftFromAskedPct"]},"feeTier":{"type":"integer","description":"The pool fee tier (10000 = 1%)"},"firstBuy":{"anyOf":[{"type":"object","properties":{"spend":{"type":"object","properties":{"amount":{"type":"string","pattern":"^\\d+(\\.\\d+)?$","description":"A decimal amount in whole units, as a string: \"0.05\""},"wei":{"type":"string","pattern":"^\\d+$","description":"The same amount in the smallest unit, an integer as a string"}},"required":["amount","wei"]},"minTokens":{"type":"object","properties":{"amount":{"type":"string","pattern":"^\\d+(\\.\\d+)?$","description":"A decimal amount in whole units, as a string: \"0.05\""},"wei":{"type":"string","pattern":"^\\d+$","description":"The same amount in the smallest unit, an integer as a string"}},"required":["amount","wei"]}},"required":["spend","minTokens"]},{"type":"null"}],"description":"The first buy: what it spends and the fewest tokens it accepts; null without one"},"launchFee":{"type":"object","properties":{"amount":{"type":"string","pattern":"^\\d+(\\.\\d+)?$","description":"A decimal amount in whole units, as a string: \"0.05\""},"wei":{"type":"string","pattern":"^\\d+$","description":"The same amount in the smallest unit, an integer as a string"}},"required":["amount","wei"],"description":"The launch fee (0: free)"},"creatorFeeRecipient":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"Where the royalty is paid"},"royalty":{"type":"object","properties":{"kind":{"type":"string","enum":["keep","split","holders"]},"burnPct":{"type":"number"},"to":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"A 0x address"},"explain":{"type":"string"}},"required":["kind","burnPct","to","explain"],"description":"The royalty choice, and one sentence saying it"},"shape":{"type":"string","description":"The supply shape"},"firstBuyTo":{"anyOf":[{"type":"array","items":{"type":"object","properties":{"wallet":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"A 0x address"},"pct":{"type":"number"}},"required":["wallet","pct"]}},{"type":"null"}],"description":"How the first buy is split, or null"},"salt":{"type":"string","description":"The salt that fixes the token's address"},"metadata":{"anyOf":[{"type":"object","properties":{"uri":{"type":"string"}},"required":["uri"],"additionalProperties":true},{"type":"null"}],"description":"The stored logo and details, or null"},"requires":{"type":"array","items":{"type":"object","properties":{"step":{"type":"string","description":"e.g. \"approve-permit2\", \"approve-router\", \"approve-factory\""},"explain":{"type":"string"},"tx":{"type":"object","properties":{"chainId":{"type":"integer","description":"56 BSC mainnet, 97 BSC testnet"},"to":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"A 0x address"},"data":{"type":"string","pattern":"^0x[0-9a-fA-F]*$","description":"The call data: send it exactly as it is"},"value":{"type":"string","pattern":"^\\d+$","description":"BNB to send with it, in wei"},"gas":{"type":"string","pattern":"^\\d+$","description":"The simulated gas plus a margin. Absent while a step in `requires` is still needed."}},"required":["chainId","to","data","value"],"description":"An unsigned transaction: sign it with the wallet and send it."}},"required":["step","explain","tx"]},"description":"One-time steps to send and wait for first, in order. Empty when the wallet is ready."},"tx":{"type":"object","properties":{"chainId":{"type":"integer","description":"56 BSC mainnet, 97 BSC testnet"},"to":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"A 0x address"},"data":{"type":"string","pattern":"^0x[0-9a-fA-F]*$","description":"The call data: send it exactly as it is"},"value":{"type":"string","pattern":"^\\d+$","description":"BNB to send with it, in wei"},"gas":{"type":"string","pattern":"^\\d+$","description":"The simulated gas plus a margin. Absent while a step in `requires` is still needed."}},"required":["chainId","to","data","value"],"description":"An unsigned transaction: sign it with the wallet and send it."},"simulation":{"type":"object","properties":{"ran":{"type":"boolean","description":"Whether it was simulated: not while a step in `requires` is still needed"},"ok":{"type":"boolean","description":"It would succeed if sent now"}},"required":["ran","ok"],"additionalProperties":true,"description":"The simulation against the chain, from the wallet"},"cost":{"type":"object","properties":{"gasPriceWei":{"type":"string","pattern":"^\\d+$","description":"The same amount in the smallest unit, an integer as a string"},"maxWei":{"type":"string","pattern":"^\\d+$","description":"The same amount in the smallest unit, an integer as a string"},"max":{"type":"string","pattern":"^\\d+(\\.\\d+)?$","description":"A decimal amount in whole units, as a string: \"0.05\""}},"required":["gasPriceWei","maxWei","max"],"description":"The most the transaction can cost in gas, in BNB."},"explain":{"type":"string"}},"required":["wallet","token","name","symbol","supply","pair","opening","feeTier","firstBuy","launchFee","creatorFeeRecipient","royalty","shape","firstBuyTo","salt","metadata","requires","tx","simulation","cost","explain"]}}}},"default":{"description":"An error. Codes this endpoint can return: MISSING_MARKET_CAP, NO_PRICE, INVALID_SUPPLY, INVALID_LAUNCH, INVALID_SHAPE, SHAPE_BELOW_LADDER, INVALID_BURN, CONFLICTING_ROYALTY, CONFLICTING_METADATA, INVALID_METADATA_URI, INVALID_IMAGE, IMAGE_TOO_LARGE, UNSUPPORTED_IMAGE, UPLOADS_BUSY, STORAGE_UNAVAILABLE, UNSUPPORTED_PAIR, LAUNCHES_PAUSED, INSUFFICIENT_BALANCE, TOO_MUCH_GAS, SIMULATION_FAILED, RATE_LIMITED.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable: act on this"},"message":{"type":"string"},"fix":{"type":"string"},"field":{"type":"string"},"detail":{}},"required":["code","message"]}},"required":["error"]}}}}},"x-error-codes":["MISSING_MARKET_CAP","NO_PRICE","INVALID_SUPPLY","INVALID_LAUNCH","INVALID_SHAPE","SHAPE_BELOW_LADDER","INVALID_BURN","CONFLICTING_ROYALTY","CONFLICTING_METADATA","INVALID_METADATA_URI","INVALID_IMAGE","IMAGE_TOO_LARGE","UNSUPPORTED_IMAGE","UPLOADS_BUSY","STORAGE_UNAVAILABLE","UNSUPPORTED_PAIR","LAUNCHES_PAUSED","INSUFFICIENT_BALANCE","TOO_MUCH_GAS","SIMULATION_FAILED","RATE_LIMITED"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"wallet":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"A 0x address"},"name":{"type":"string","description":"Up to 64 bytes"},"symbol":{"type":"string","description":"Up to 32 bytes"},"marketCapUsd":{"type":"string","pattern":"^\\d+(\\.\\d+)?$","description":"A decimal amount in whole units, as a string: \"0.05\""},"marketCapPair":{"type":"string","pattern":"^\\d+(\\.\\d+)?$","description":"A decimal amount in whole units, as a string: \"0.05\""},"supply":{"type":"string","pattern":"^\\d+(\\.\\d+)?$","description":"Whole tokens, 1 to 1,000,000,000,000; default 1,000,000,000"},"pair":{"type":"string","description":"\"BNB\" (default), a listed symbol, or any BEP20 address"},"firstBuy":{"type":"string","pattern":"^\\d+(\\.\\d+)?$","description":"A buy in the pair currency, inside the launch transaction"},"firstBuyTo":{"type":"array","items":{"type":"object","properties":{"wallet":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"A 0x address"},"pct":{"type":"number","exclusiveMinimum":true,"minimum":0,"description":"Its share of the first buy, in percent"}},"required":["wallet","pct"]},"maxItems":8,"description":"Split the first buy; must add to 100. The dead address burns."},"slippagePct":{"type":"number","minimum":0.5,"maximum":50},"image":{"type":"string","format":"uri","description":"The logo: an https:// link to a PNG, JPG, GIF or WebP, up to 5 MB. Required unless metadataURI is sent (and its metadata must have an image)."},"description":{"type":"string"},"website":{"type":"string","format":"uri"},"x":{"type":"string","format":"uri"},"telegram":{"type":"string","format":"uri"},"metadataURI":{"type":"string"},"burnPct":{"type":"number","minimum":0,"maximum":100,"description":"Share of the creator royalty that buys back and burns, for ever"},"royaltyTo":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"A 0x address"},"shape":{"anyOf":[{"type":"string","enum":["flat","stepped","steep"]},{"type":"array","items":{"type":"object","properties":{"fromPct":{"type":"number","description":"Where the range starts, as a percent of 46,000 ticks (about 100x in price) above where the shape begins"},"toPct":{"type":"number","description":"Where it ends, on the same scale. The last range always runs to the top price, so no shape caps the price"},"bps":{"type":"integer","description":"Its share of the shaped supply; all ranges add to 10,000"}},"required":["fromPct","toPct","bps"]}}],"description":"How the supply is laid across prices: \"flat\" (default), \"stepped\", \"steep\", or 1 to 4 ranges"},"feeTier":{"type":"number","enum":[100,500,2500,10000]}},"required":["wallet","name","symbol"]}}}}}},"/tx/{hash}":{"get":{"summary":"Where a transaction is: wait for `indexed` before reading state it changed.","parameters":[{"name":"hash","in":"path","required":true,"description":"The transaction hash","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"hash":{"type":"string","pattern":"^0x[0-9a-fA-F]{64}$","description":"A transaction hash"},"status":{"type":"string","enum":["unknown","pending","failed","confirmed","indexed"],"description":"indexed: mined and in our reads; wait for it before reading state it changed"},"block":{"type":"integer","description":"The block it was mined in"},"gasUsed":{"type":"string","description":"Gas it used"},"note":{"type":"string"}},"required":["hash","status"],"additionalProperties":true}}}},"default":{"description":"An error. Codes this endpoint can return: INVALID_HASH.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable: act on this"},"message":{"type":"string"},"fix":{"type":"string"},"field":{"type":"string"},"detail":{}},"required":["code","message"]}},"required":["error"]}}}}},"x-error-codes":["INVALID_HASH"]}},"/media/image":{"post":{"summary":"Upload a logo: the raw image bytes as the body (image/png, jpeg, gif or webp, up to 5 MB).","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"type":{"type":"string"},"bytes":{"type":"integer"}},"required":["url","type","bytes"]}}}},"default":{"description":"An error. Codes this endpoint can return: UNSUPPORTED_IMAGE, IMAGE_TOO_LARGE, INVALID_IMAGE, UPLOADS_BUSY, STORAGE_UNAVAILABLE, RATE_LIMITED.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable: act on this"},"message":{"type":"string"},"fix":{"type":"string"},"field":{"type":"string"},"detail":{}},"required":["code","message"]}},"required":["error"]}}}}},"x-error-codes":["UNSUPPORTED_IMAGE","IMAGE_TOO_LARGE","INVALID_IMAGE","UPLOADS_BUSY","STORAGE_UNAVAILABLE","RATE_LIMITED"],"requestBody":{"required":true,"content":{"image/png":{"schema":{"type":"string","format":"binary"}},"image/jpeg":{"schema":{"type":"string","format":"binary"}},"image/gif":{"schema":{"type":"string","format":"binary"}},"image/webp":{"schema":{"type":"string","format":"binary"}}}}}},"/referrals/challenge":{"get":{"summary":"The message to sign to register as a referrer.","parameters":[{"name":"address","in":"query","required":true,"description":"The wallet","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"nonce":{"type":"string"},"expires":{"type":"integer","description":"Unix milliseconds; 5 minutes after it was issued"},"message":{"type":"string","description":"Sign this exact text with the wallet (personal_sign / EIP-191)"},"next":{"type":"string"}},"required":["nonce","expires","message","next"]}}}},"default":{"description":"An error. Codes this endpoint can return: INVALID_ADDRESS.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable: act on this"},"message":{"type":"string"},"fix":{"type":"string"},"field":{"type":"string"},"detail":{}},"required":["code","message"]}},"required":["error"]}}}}},"x-error-codes":["INVALID_ADDRESS"]}},"/referrals/register":{"post":{"summary":"Register as a referrer with the signed challenge.","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":true}}}},"default":{"description":"An error. Codes this endpoint can return: INVALID_SIGNATURE, RATE_LIMITED.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable: act on this"},"message":{"type":"string"},"fix":{"type":"string"},"field":{"type":"string"},"detail":{}},"required":["code","message"]}},"required":["error"]}}}}},"x-error-codes":["INVALID_SIGNATURE","RATE_LIMITED"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"nonce":{"type":"string"},"signature":{"type":"string"}},"required":["nonce","signature"]}}}}}},"/referrals/{address}":{"get":{"summary":"A referrer: eligibility, links, earnings, weeks to claim.","parameters":[{"name":"address","in":"path","required":true,"description":"The referrer","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"address":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"A 0x address"},"eligible":{"type":"boolean"},"registered":{"type":"boolean"},"active":{"type":"boolean"},"links":{"type":"object","properties":{"site":{"type":"string","format":"uri"},"token":{"type":"string"},"launch":{"type":"string","format":"uri"}},"required":["site","token","launch"]},"rates":{"type":"object","properties":{"instantBps":{"type":"integer"},"lifetimeShareBps":{"type":"integer"}},"required":["instantBps","lifetimeShareBps"]},"instant":{"type":"object","properties":{"earnings":{"type":"object","properties":{"h24":{"type":"object","properties":{"usd":{"type":"number"},"unpriced":{"type":"array","items":{}},"byCurrency":{"type":"array","items":{}}},"required":["usd","unpriced","byCurrency"]},"d7":{"type":"object","properties":{"usd":{"type":"number"},"unpriced":{"type":"array","items":{}},"byCurrency":{"type":"array","items":{}}},"required":["usd","unpriced","byCurrency"]},"d30":{"type":"object","properties":{"usd":{"type":"number"},"unpriced":{"type":"array","items":{}},"byCurrency":{"type":"array","items":{}}},"required":["usd","unpriced","byCurrency"]},"all":{"type":"object","properties":{"usd":{"type":"number"},"unpriced":{"type":"array","items":{}},"byCurrency":{"type":"array","items":{}}},"required":["usd","unpriced","byCurrency"]}},"required":["h24","d7","d30","all"]}},"required":["earnings"]},"lifetime":{"type":"object","properties":{"referred":{"type":"integer"},"weeklyCapWei":{"type":"string","pattern":"^\\d+$","description":"The same amount in the smallest unit, an integer as a string"},"allTimePaidWei":{"type":"string","pattern":"^\\d+$","description":"The same amount in the smallest unit, an integer as a string"},"todayEstimateWei":{"anyOf":[{"type":"string","pattern":"^\\d+$","description":"The same amount in the smallest unit, an integer as a string"},{"type":"null"}],"description":"The same amount in the smallest unit, an integer as a string"},"backlog":{"anyOf":[{"type":"object","properties":{"owedWei":{"type":"string","pattern":"^\\d+$","description":"The same amount in the smallest unit, an integer as a string"},"sinceWeek":{"type":"integer"},"lastAddedWeek":{"type":"integer"}},"required":["owedWei","sinceWeek","lastAddedWeek"]},{"type":"null"}]},"claimableWeeks":{"type":"array","items":{"type":"object","properties":{"week":{"type":"integer"},"amount":{"type":"string","pattern":"^\\d+$","description":"The same amount in the smallest unit, an integer as a string"},"paid":{"type":"boolean"},"claimable":{"type":"boolean"},"proof":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]}},"required":["week","amount","paid","claimable","proof"]}},"boundTo":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"A 0x address"},{"type":"null"}],"description":"A 0x address"}},"required":["referred","weeklyCapWei","allTimePaidWei","todayEstimateWei","backlog","claimableWeeks","boundTo"],"additionalProperties":true}},"required":["address","eligible","registered","active","links","rates","instant","lifetime"]}}}},"default":{"description":"An error. Codes this endpoint can return: INVALID_ADDRESS.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable: act on this"},"message":{"type":"string"},"fix":{"type":"string"},"field":{"type":"string"},"detail":{}},"required":["code","message"]}},"required":["error"]}}}}},"x-error-codes":["INVALID_ADDRESS"]}},"/referrals/{address}/link":{"get":{"summary":"One referral URL to any page of the site.","parameters":[{"name":"address","in":"path","required":true,"description":"The referrer","schema":{"type":"string"}},{"name":"path","in":"query","required":false,"description":"e.g. /t/0x…; default /","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"address":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"A 0x address"},"url":{"type":"string","format":"uri"}},"required":["address","url"]}}}},"default":{"description":"An error. Codes this endpoint can return: INVALID_PATH.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable: act on this"},"message":{"type":"string"},"fix":{"type":"string"},"field":{"type":"string"},"detail":{}},"required":["code","message"]}},"required":["error"]}}}}},"x-error-codes":["INVALID_PATH"]}},"/build/claim":{"post":{"summary":"A claim transaction for each unpaid week of lifetime referrals.","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":true}}}},"default":{"description":"An error. Codes this endpoint can return: NOT_DEPLOYED, CANNOT_BUILD.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable: act on this"},"message":{"type":"string"},"fix":{"type":"string"},"field":{"type":"string"},"detail":{}},"required":["code","message"]}},"required":["error"]}}}}},"x-error-codes":["NOT_DEPLOYED","CANNOT_BUILD"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"referrer":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"A 0x address"},"wallet":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"A 0x address"}},"required":["referrer"]}}}}}},"/build/bind":{"post":{"summary":"The one-time on-chain referral binding (optional: a first trade through a link also binds).","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":true}}}},"default":{"description":"An error. Codes this endpoint can return: ALREADY_BOUND, SELF_REFERRAL, REFERRER_NOT_REGISTERED, NOT_DEPLOYED.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable: act on this"},"message":{"type":"string"},"fix":{"type":"string"},"field":{"type":"string"},"detail":{}},"required":["code","message"]}},"required":["error"]}}}}},"x-error-codes":["ALREADY_BOUND","SELF_REFERRAL","REFERRER_NOT_REGISTERED","NOT_DEPLOYED"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"wallet":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"A 0x address"},"referrer":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"A 0x address"}},"required":["wallet","referrer"]}}}}}},"/keys/challenge":{"get":{"summary":"The message to sign to create an API key.","parameters":[{"name":"address","in":"query","required":true,"description":"The wallet","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"nonce":{"type":"string"},"expires":{"type":"integer","description":"Unix milliseconds; 5 minutes after it was issued"},"message":{"type":"string","description":"Sign this exact text with the wallet (personal_sign / EIP-191)"},"next":{"type":"string"}},"required":["nonce","expires","message","next"]}}}},"default":{"description":"An error. Codes this endpoint can return: INVALID_ADDRESS, KEYS_OFF.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable: act on this"},"message":{"type":"string"},"fix":{"type":"string"},"field":{"type":"string"},"detail":{}},"required":["code","message"]}},"required":["error"]}}}}},"x-error-codes":["INVALID_ADDRESS","KEYS_OFF"]}},"/keys":{"post":{"summary":"Create an API key with the signed challenge. The key is shown once.","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":true}}}},"default":{"description":"An error. Codes this endpoint can return: INVALID_SIGNATURE, KEY_LIMIT, KEYS_UNAVAILABLE.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable: act on this"},"message":{"type":"string"},"fix":{"type":"string"},"field":{"type":"string"},"detail":{}},"required":["code","message"]}},"required":["error"]}}}}},"x-error-codes":["INVALID_SIGNATURE","KEY_LIMIT","KEYS_UNAVAILABLE"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"nonce":{"type":"string"},"signature":{"type":"string"},"label":{"type":"string"}},"required":["nonce","signature"]}}}}},"get":{"summary":"Your keys (send the key as x-api-key).","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":true}}}},"default":{"description":"An error. Codes this endpoint can return: API_KEY_REQUIRED, INVALID_API_KEY, API_KEY_REVOKED.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable: act on this"},"message":{"type":"string"},"fix":{"type":"string"},"field":{"type":"string"},"detail":{}},"required":["code","message"]}},"required":["error"]}}}}},"x-error-codes":["API_KEY_REQUIRED","INVALID_API_KEY","API_KEY_REVOKED"]}},"/keys/{id}":{"delete":{"summary":"Revoke a key.","parameters":[{"name":"id","in":"path","required":true,"description":"The key id","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"revoked":{"type":"boolean"},"id":{"type":"string"}},"required":["revoked","id"]}}}},"default":{"description":"An error. Codes this endpoint can return: KEY_NOT_FOUND, API_KEY_REQUIRED, INVALID_ID.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable: act on this"},"message":{"type":"string"},"fix":{"type":"string"},"field":{"type":"string"},"detail":{}},"required":["code","message"]}},"required":["error"]}}}}},"x-error-codes":["KEY_NOT_FOUND","API_KEY_REQUIRED","INVALID_ID"]}}}}