Skip to main content
POST
/
sdk
/
{environmentId}
/
swap
/
quote
Generate a swap quote
curl --request POST \
  --url https://app.dynamicauth.com/api/v0/sdk/{environmentId}/swap/quote \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "from": {
    "address": "0xbF394748301603f18d953C90F0b087CBEC0E1834",
    "chainId": "An example name",
    "chainName": "ETH",
    "tokenAddress": "An example name",
    "amount": "<string>"
  },
  "to": {
    "address": "0xbF394748301603f18d953C90F0b087CBEC0E1834",
    "chainId": "An example name",
    "chainName": "ETH",
    "tokenAddress": "An example name",
    "amount": "<string>"
  },
  "maxPriceImpact": 0.5,
  "order": "CHEAPEST",
  "slippage": 0.5
}
'
{
  "from": {
    "address": "<string>",
    "amount": "<string>",
    "token": {
      "address": "<string>",
      "chainId": "<string>",
      "decimals": 123,
      "name": "<string>",
      "symbol": "<string>",
      "coinKey": "<string>",
      "logoURI": "<string>",
      "priceUSD": "<string>"
    },
    "amountMin": "<string>",
    "amountUSD": "<string>"
  },
  "id": "<string>",
  "steps": [
    {
      "from": {
        "amount": "<string>",
        "token": {
          "address": "<string>",
          "chainId": "<string>",
          "decimals": 123,
          "name": "<string>",
          "symbol": "<string>",
          "coinKey": "<string>",
          "logoURI": "<string>",
          "priceUSD": "<string>"
        },
        "amountMin": "<string>",
        "amountUSD": "<string>"
      },
      "id": "<string>",
      "to": {
        "amount": "<string>",
        "token": {
          "address": "<string>",
          "chainId": "<string>",
          "decimals": 123,
          "name": "<string>",
          "symbol": "<string>",
          "coinKey": "<string>",
          "logoURI": "<string>",
          "priceUSD": "<string>"
        },
        "amountMin": "<string>",
        "amountUSD": "<string>"
      },
      "tool": "<string>",
      "type": "<string>",
      "feeCosts": [
        {
          "amount": "<string>",
          "included": true,
          "name": "<string>",
          "token": {
            "address": "<string>",
            "chainId": "<string>",
            "decimals": 123,
            "name": "<string>",
            "symbol": "<string>",
            "coinKey": "<string>",
            "logoURI": "<string>",
            "priceUSD": "<string>"
          },
          "amountUSD": "<string>"
        }
      ],
      "gasCosts": [
        {
          "amount": "<string>",
          "token": {
            "address": "<string>",
            "chainId": "<string>",
            "decimals": 123,
            "name": "<string>",
            "symbol": "<string>",
            "coinKey": "<string>",
            "logoURI": "<string>",
            "priceUSD": "<string>"
          },
          "amountUSD": "<string>"
        }
      ]
    }
  ],
  "to": {
    "address": "<string>",
    "amount": "<string>",
    "token": {
      "address": "<string>",
      "chainId": "<string>",
      "decimals": 123,
      "name": "<string>",
      "symbol": "<string>",
      "coinKey": "<string>",
      "logoURI": "<string>",
      "priceUSD": "<string>"
    },
    "amountMin": "<string>",
    "amountUSD": "<string>"
  },
  "approvalAddress": "<string>",
  "feeCosts": [
    {
      "amount": "<string>",
      "included": true,
      "name": "<string>",
      "token": {
        "address": "<string>",
        "chainId": "<string>",
        "decimals": 123,
        "name": "<string>",
        "symbol": "<string>",
        "coinKey": "<string>",
        "logoURI": "<string>",
        "priceUSD": "<string>"
      },
      "amountUSD": "<string>"
    }
  ],
  "gasCostUSD": "<string>",
  "signingPayload": {
    "chainName": "ETH",
    "chainId": "<string>",
    "evmTransaction": {
      "to": "<string>",
      "data": "<string>",
      "value": "<string>",
      "gasLimit": "<string>",
      "gasPrice": "<string>",
      "maxFeePerGas": "<string>",
      "maxPriorityFeePerGas": "<string>",
      "nonce": 123
    },
    "evmApproval": {
      "tokenAddress": "<string>",
      "spenderAddress": "<string>",
      "amount": "<string>"
    },
    "serializedTransaction": {
      "serializedTransaction": "<string>"
    },
    "psbtTransaction": {
      "psbt": "<string>"
    }
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

environmentId
string
required

ID of the environment

Required string length: 36
Pattern: ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$
Example:

"95b11417-f18f-457f-8804-68e361f9164f"

Body

application/json
from
object
required
to
object
required
maxPriceImpact
number

The price impact threshold above which routes are hidden. As an example, one should specify 0.15 (15%) to hide routes with more than 15% price impact. The default is 10%.

Required range: 0 <= x <= 1
order
enum<string>

Route optimization preference.

Available options:
CHEAPEST,
FASTEST
slippage
number

Slippage tolerance (e.g. 0.005 for 0.5%)

Required range: 0 <= x <= 1

Response

Swap quote

from
object
required
id
string
required
steps
object[]
required
to
object
required
approvalAddress
string

Address that needs token approval (spender), if applicable

feeCosts
object[]
gasCostUSD
string
signingPayload
object

Chain-aware signing payload. Which fields are populated depends on chainName: EVM uses evmTransaction + optional evmApproval. SOL and SUI use serializedTransaction. BTC uses psbtTransaction.