Create DEX Swap Transaction

Enables users to perform token swaps on a DEX by supplying source tokens, desired output tokens, and other trade parameters. This endpoint calculates the optimal path (or uses a given path) across liquidity pools, then returns key details such as the route taken, final amounts, and any additional transaction data needed to finalize the swap on-chain. It is particularly useful for DeFi integrations that require seamless conversions between multiple ERC20 tokens within a single request.

Compute Unit Value: 55 (Fixed)

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…
Body Params

The request body for a /defi/v1/dex/swap

string
enum

The unique ID to specify the decentralized exchange (DEX) within a particular blockchain. Find more here.

path
array of strings
required

Array of token addresses to swap, in order of the swap.

path*
string
required

Amount of token to be swapped.

string

Minimum amount accepted as the result of the swap.

string
required

Address of the recipient of the token.

string
required

Deadline for the transaction to be executed (UNIX Timestamp).

string
required

Address of the sender of the token.

string

Maximum gas to be approved for the transaction.

string

Specifies the priority level for gas fees (e.g., 'low', 'medium', or 'high'), which influences the transaction speed and cost.

string

Percentage of total swap value allowed for slippage. Default is 1 (0 <= slippage <= 100).

boolean

Flag to include a basis points fee transaction alongside the main transaction when set to true.

string
enum

The batch option to be used for the transaction.

Allowed:
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.

string

Different pool based on the fees. By default, it will take the pool with maximum amountOut.

Response

Language
Credentials
Header
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json