Swaps

Get executable quote

Changed on

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

post/v1/swap/quote

Request

  • Base URL
    https://api.shapeshift.com
  • URL
    https://api.shapeshift.com/v1/swap/quote
  • Auth
    none declared

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

The user's address on the sell chain: the swap is funded from it, and refunds return to it. When the quote carries a depositAddress nothing is sent from it - the deposit can arrive from any wallet - so it only receives refunds, and must still be an address the user controls. For UTXO chains, use the account's first receive address (m/84'/0'/0'/0/0).

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
depositAddressstring

Present when this quote can be paid by a plain transfer from any wallet: send exactly sellAmountCryptoBaseUnit here before expiresAt, then poll /v1/swap/status with quoteId alone. A deposit sent after expiresAt may be refunded to sendAddress, or lost. Absent means the swap must be signed by the wallet at sendAddress.

expiresAtnumber required

Epoch ms after which the quote must not be executed - the swapper's own deadline. Broadcasting after it risks a failed swap, or lost funds on an externally paid quote. 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"
      }
    }
  ],
  "depositAddress": "bc1qar0srrr7xfkvy5l643lydnw9re59gtzzwf5mdq",
  "expiresAt": 1754265600000
}

Changes

    • breaking

      added subschema #7 to the // response property oneOf list for the response status

    • info

      added the optional property to the response with the status