latestOpenAPI 3.0.02026-08-15161451.7 KB

6ffb6a8fd74a

Swaps

Get executable quote

Get an executable quote for a swap, including transaction data. Requires a specific swapper name.

post/v1/swap/quote

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.

Request body

sellAssetIdstring required
buyAssetIdstring required
sellAmountCryptoBaseUnitstring

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

buyAmountCryptoBaseUnitstring

Exact amount of the buy asset to receive, in base units. The sell amount you must send is derived from it and returned on the quote. Mutually exclusive with sellAmountCryptoBaseUnit, and rejected for swappers that cannot quote an exact output.

receiveAddressstring required
sendAddressstring required
swapperNamestring required
slippageTolerancePercentageDecimalstring
accountNumbernumber nullable
xpubstring

Example request

{
  "sellAssetId": "eip155:1/slip44:60",
  "buyAssetId": "bip122:000000000019d6689c085ae165831e93/slip44:0",
  "sellAmountCryptoBaseUnit": "1000000000000000000",
  "buyAmountCryptoBaseUnit": "100000",
  "receiveAddress": "bc1qar0srrr7xfkvy5l643lydnw9re59gtzzwf5mdq",
  "sendAddress": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
  "swapperName": "Relay",
  "slippageTolerancePercentageDecimal": "0.01",
  "xpub": "zpub6rFR7y4Q2AijBEqTUquhVz398htDFrtymD9xYYfG1m4wAcvPhXNfE3EfH1r1ADqtfSdVCToUG868RvUUkgDKf31mGDtKsAYz2oz2AGutZYs"
}

Response

Swap quote

quoteIdstring uuid required
swapperNamestring required
ratestring required
sellAmountCryptoBaseUnitstring required
buyAmountBeforeFeesCryptoBaseUnitstring required
buyAmountAfterFeesCryptoBaseUnitstring required
affiliateBpsstring required

Total on-chain fee in bps.

partnerBpsstring

Partner share in bps.

shapeshiftBpsstring required

ShapeShift platform fee in bps.

slippageTolerancePercentageDecimalstring
networkFeeCryptoBaseUnitstring
expiresAtnumber required

Epoch ms after which the quote must not be executed - the swapper's own deadline (inbound address rotation, deposit channel expiry, order validity). Broadcasting after it risks failed swaps or, for deposit-style swappers, lost funds. Request a fresh quote instead.

Example response

{
  "swapperName": "0x",
  "rate": "0.995",
  "sellAsset": {
    "assetId": "eip155:1/slip44:60",
    "chainId": "eip155:1",
    "name": "Ethereum",
    "symbol": "ETH",
    "precision": 18,
    "color": "#5C6BC0",
    "icon": "https://assets.coincap.io/assets/icons/eth@2x.png",
    "networkName": "Ethereum",
    "networkColor": "#5C6BC0",
    "networkIcon": "https://assets.coincap.io/assets/icons/eth@2x.png",
    "explorer": "https://etherscan.io",
    "explorerAddressLink": "https://etherscan.io/address/",
    "explorerTxLink": "https://etherscan.io/tx/"
  },
  "buyAsset": {
    "assetId": "eip155:1/slip44:60",
    "chainId": "eip155:1",
    "name": "Ethereum",
    "symbol": "ETH",
    "precision": 18,
    "color": "#5C6BC0",
    "icon": "https://assets.coincap.io/assets/icons/eth@2x.png",
    "networkName": "Ethereum",
    "networkColor": "#5C6BC0",
    "networkIcon": "https://assets.coincap.io/assets/icons/eth@2x.png",
    "explorer": "https://etherscan.io",
    "explorerAddressLink": "https://etherscan.io/address/",
    "explorerTxLink": "https://etherscan.io/tx/"
  },
  "affiliateBps": "60",
  "partnerBps": "50",
  "shapeshiftBps": "10",
  "slippageTolerancePercentageDecimal": "0.01",
  "networkFeeCryptoBaseUnit": "23000",
  "approval": {
    "isRequired": true,
    "spender": "0xdef1c0ded9bec7f1a1670819833240f027b25eff",
    "approvalTxs": [
      {
        "to": "0xdac17f958d2ee523a2206206994597c13d831ec7",
        "data": "0x095ea7b3...",
        "value": "0"
      }
    ]
  },
  "steps": [
    {
      "sellAsset": {
        "assetId": "eip155:1/slip44:60",
        "chainId": "eip155:1",
        "name": "Ethereum",
        "symbol": "ETH",
        "precision": 18,
        "color": "#5C6BC0",
        "icon": "https://assets.coincap.io/assets/icons/eth@2x.png",
        "networkName": "Ethereum",
        "networkColor": "#5C6BC0",
        "networkIcon": "https://assets.coincap.io/assets/icons/eth@2x.png",
        "explorer": "https://etherscan.io",
        "explorerAddressLink": "https://etherscan.io/address/",
        "explorerTxLink": "https://etherscan.io/tx/"
      },
      "buyAsset": {
        "assetId": "eip155:1/slip44:60",
        "chainId": "eip155:1",
        "name": "Ethereum",
        "symbol": "ETH",
        "precision": 18,
        "color": "#5C6BC0",
        "icon": "https://assets.coincap.io/assets/icons/eth@2x.png",
        "networkName": "Ethereum",
        "networkColor": "#5C6BC0",
        "networkIcon": "https://assets.coincap.io/assets/icons/eth@2x.png",
        "explorer": "https://etherscan.io",
        "explorerAddressLink": "https://etherscan.io/address/",
        "explorerTxLink": "https://etherscan.io/tx/"
      },
      "sellAmountCryptoBaseUnit": "1000000000000000000",
      "buyAmountAfterFeesCryptoBaseUnit": "995000000",
      "allowanceContract": "0xdef1c0ded9bec7f1a1670819833240f027b25eff",
      "estimatedExecutionTimeMs": 60000,
      "source": "0x",
      "transactionData": {
        "type": "evm",
        "chainId": 1,
        "to": "0xdef1c0ded9bec7f1a1670819833240f027b25eff",
        "data": "0x...",
        "value": "1000000000000000000",
        "gasLimit": "300000"
      }
    }
  ],
  "expiresAt": 1754265600000
}