---
title: "Aggregate DEX Swap"
method: POST
path: "/defi/v1/dex/swaps"
tags: ["dex"]
---

# Aggregate DEX Swap

`POST /defi/v1/dex/swaps`

Aggregates swap quotes from all DEXs supporting a specified token pair. It allows users to customize their query to prioritize either the best output or the lowest gas costs. The response provides detailed transaction data including DEX identifiers, output amounts, swap routing parameters (such as call data), gas estimates, and a reference, enabling traders to compare and select the most efficient swap route for their needs.

> 💡 
**Compute Unit Value:** `115` (Fixed)

## Request body

- DexSwapaggregatorRequest — The request body for a /defi/v1/dex/swaps
  - `chainId` '1' | '43114' | '56' | '137' | '42161' | '10' | '8453' | '324' | '5000' | '900' | '1400' | '1200' | '101' | '1700' | '1500' | '1100' | '1600' | '8217' — The unique ID to direct queries or transactions to the correct blockchain. Find more [here](https://docs.blockdaemon.com/docs/defi-api-supported-protocols#supported-chains).
  - `path` string[], required — Comma-separated values of token pair.
  - `amountIn` string, required — Amount of token.
  - `chainSymbol` string — The abbreviated chain name for queries or transactions.
  - `from` string, required — Address of the sender of the token.
  - `gas` string — Maximum gas to be approved for the transaction.
  - `to` string, required — Address of the recipient of the token.
  - `poolFees` string — Different pool based on the fees. By default, it will take the pool with maximum amountOut.
  - `excludedDexes` string — Comma-separated values of dexes to exclude.
  - `bestNetPrice` boolean — If true, sorts prepared transactions by net value (amountsOut minus gas) in descending order. If multiple sort parameters are true, bestNetPrice takes precedence.
  - `bestQuote` boolean — If true, sorts prepared transactions by amountsOut in descending order. If multiple sort parameters are true, bestNetPrice takes precedence.
  - `lowestGas` boolean — If true, sorts prepared transactions by gas cost in ascending order. If multiple sort parameters are true, bestNetPrice takes precedence.
  - `gasPriority` string — Specifies the priority level for gas fees (e.g., 'low', 'medium', or 'high'), which influences the transaction speed and cost.
  - `amountOutMin` string — Minimum amount to be received.
  - `slippage` string — Percentage of total swap value allowed for slippage. Default is 1 (0 <= slippage <= 100).
  - `enableFee` boolean — Flag to include a basis points fee transaction alongside the main transaction when set to true.
  - `batchOption` 'EIP-5792' | 'EIP-7702' — The batch option to be used for the transaction.
  - `batcherContract` string — The EOA address of the batcher that will be used to execute the transaction when using EIP-7702 batching. If not provided, the default batcher contract for the chain will be used.

## Response `200`

Successful response

- object
  - `status` number — Numeric status code indicating success or failure of the API call
  - `msg` string — Human-readable message describing the API result or error
  - `data` union
    - object[]
      - `dexName` string — Name of the decentralized exchange
      - `amountsOut` string, required — Expected output amounts from swaps or conversions
      - `chainId` string, required — Blockchain network identifier (EVM chain ID, Solana chain name, etc.)
      - `from` string — Sender's wallet address
      - `to` string — Recipient's wallet address
      - `value` string — Amount being transferred or involved in a transaction
      - `gas` string — Gas limit for the transaction
      - `data` union — Main payload object or array returned by the API
        - string
        - string[]
      - `gasPrice` string — Price per gas unit for the transaction
      - `estimationCheck` union — Flag or value indicating transaction fee/estimate status
        - string
        - boolean
      - `referenceId` string, required — Unique ID for tracking a specific transaction or operation
      - `bridgeName` string — Human-readable bridge service name
      - `message` string — Message string related to an operation
    - object
      - `createFeeTxn` object, required
        - `chainId` string, required — Blockchain network identifier (EVM chain ID, Solana chain name, etc.)
        - `from` string, required — Sender's wallet address
        - `to` string, required — Recipient's wallet address
        - `value` string, required — Amount being transferred or involved in a transaction
        - `gasPrice` string — Price per gas unit for the transaction
        - `gas` string, required — Gas limit for the transaction
      - `swapaggregatorTxn` object[], required
        - `dexName` string — Name of the decentralized exchange
        - `amountsOut` string, required — Expected output amounts from swaps or conversions
        - `chainId` string, required — Blockchain network identifier (EVM chain ID, Solana chain name, etc.)
        - `from` string — Sender's wallet address
        - `to` string — Recipient's wallet address
        - `value` string — Amount being transferred or involved in a transaction
        - `gas` string — Gas limit for the transaction
        - `data` union — Main payload object or array returned by the API
          - string
          - string[]
        - `gasPrice` string — Price per gas unit for the transaction
        - `estimationCheck` union — Flag or value indicating transaction fee/estimate status
          - string
          - boolean
        - `referenceId` string, required — Unique ID for tracking a specific transaction or operation
        - `bridgeName` string — Human-readable bridge service name
        - `message` string — Message string related to an operation
    - object[]
      - `from` string, required
      - `dexName` string
      - `chainId` string, required
      - `amountsOut` string, required
      - `referenceId` string, required
      - `methodUsed` 'EIP-5792' | 'EIP-7702', required
      - `calls` object[], required
        - `to` string, required
        - `value` string, required
        - `data` string, required
      - `bridgeName` string

---

[API](https://skmtc.dev/blockdaemon/apis/staking-api.md) · [All operations](https://skmtc.dev/blockdaemon/apis/staking-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/blockdaemon/staking-api/revisions/f94e296a08a3/schema)
