Get multiple swap quotes based on desired receive amount
Retrieves multiple swap quotes from available market makers based on the amount of destination tokens you want to receive. This endpoint queries active market maker orders and calculates how much of the source token you need to send to receive the specified amount of destination tokens. Returns an array of quotes, each containing the required source amount (amountFrom) and optionally the market maker public key. This is useful when you know exactly how much you want to receive and need to compare different market maker rates. The quotes are typically sorted by the best rate (lowest amountFrom for the same amountTo).
Query Parameters
The source token contract address. This is the L2 contract address (C1 contract) for the token you want to send in the swap.
The destination token contract address. This is the L2 contract address (C2 contract) for the token you want to receive in the swap.
The amount of destination tokens you want to receive. This is specified in the smallest unit of the destination token (e.g., satoshis for BTC, wei for ETH). The endpoint will calculate how much of the source token you need to send to receive this amount.
Backend URL. Default is https://api-cloud.coinweb.io/wallet. This URL is used to query available market maker orders and calculate swap quotes.
uriOptional filter to get quotes only from a specific market maker. If provided, only quotes from this market maker will be returned. The market maker is identified by their public key (hex string without 0x prefix).
The type of the source token blockchain. Used to determine the blockchain type for the source token (e.g., "btc", "eth", "usdc"). If not provided, the system may attempt to infer it from the contract address.
"eth" | "btc" | "ltc" | "doge" | "bnb" | "pol" | "trx" | "usdt_trx" | "usdt_bnb" | "usdc_bnb" | "usd1_bnb" | "wbtc_bnb" | "usdt_eth" | "wbtc_eth" | "usdc_eth" | "usd1_eth" | "usdt_pol"The type of the destination token blockchain. Used to determine the blockchain type for the destination token (e.g., "btc", "eth", "usdc"). If not provided, the system may attempt to infer it from the contract address.
"eth" | "btc" | "ltc" | "doge" | "bnb" | "pol" | "trx" | "usdt_trx" | "usdt_bnb" | "usdc_bnb" | "usd1_bnb" | "wbtc_bnb" | "usdt_eth" | "wbtc_eth" | "usdc_eth" | "usd1_eth" | "usdt_pol"Response Body
curl -X GET "https://cwap-api.coinhq.store/pactswap_cm/getSwapQuotesByAmountTo?from=0x6f20d1802288c90d2a044d3f7afae73fda261b27d85c0e01fdaaf3199b2c0e85&to=0x6f20d1802288c90d2a044d3f7afae73fda261b27d85c0e01fdaaf3199b2c0e85&amountTo=0&backendUrl=https%3A%2F%2Fapi-cloud.coinweb.io%2Fwallet&marketMaker=020a89e0698443aaf4ecd613317d2fdf90ef73b99244182fc7bb3c6b85f375b876&fromType=eth&toType=eth"[
{
"amountFrom": 1000000000000000000,
"marketMaker": "020a89e0698443aaf4ecd613317d2fdf90ef73b99244182fc7bb3c6b85f375b876"
}
]Was this documentation helpful? Any suggestions?