latestOpenAPI 3.0.02026-08-15161451.7 KB

6ffb6a8fd74a

Swaps

Get swap rates

Get informative swap rates from all available swappers. This does not create a transaction.

get/v1/swap/rates

Query parameters

sellAssetIdstring required
Example:eip155:1/slip44:60
buyAssetIdstring required
Example:eip155:1/erc20:0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48
sellAmountCryptoBaseUnitstring

Exact amount of the sell asset to send, in base units. Required unless buyAmountCryptoBaseUnit is given.

Example:1000000000000000000
buyAmountCryptoBaseUnitstring

Exact amount of the buy asset to receive, in base units. Each rate returns the sell amount needed to get it. Mutually exclusive with sellAmountCryptoBaseUnit; swappers that cannot quote an exact output come back with an ExactOutputNotSupported error.

Example:100000
slippageTolerancePercentageDecimalstring
Example:0.01

Headers

X-Partner-Codestring

Partner code for affiliate fee attribution. The API resolves the code to the registered affiliate address and BPS. Register a code at the affiliate dashboard.

Response

Swap rates

timestampnumber required
expiresAtnumber required

Example response

{
  "rates": [
    {
      "allowanceContract": "0xdef1c0ded9bec7f1a1670819833240f027b25eff",
      "affiliateBps": "60",
      "partnerBps": "50",
      "shapeshiftBps": "10"
    }
  ]
}