v1
latestOpenAPI 3.1.02026-07-24223580832.9 KBdex
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)
post/defi/v1/dex/swap
Request body
Example request
{
"dexId": "1000",
"path": [
"0x514910771AF9Ca656af840dff83E8264EcF986CA",
"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
],
"amountIn": "10000",
"amountOutMin": "0",
"to": "0xdAe2F6EdDdA6fb4fb60cc02633DE27e2b431B402",
"deadline": "1707313948",
"from": "0xdAe2F6EdDdA6fb4fb60cc02633DE27e2b431B402",
"gas": "100000",
"gasPriority": "low",
"slippage": "10",
"enableFee": false,
"batchOption": "EIP-5792",
"batcherContract": "0x9c933f9d2efd76ce25b0d3dde84d3f94e78a50ca",
"poolFees": "3000"
}Response
Successful response
Example response
{
"status": 200,
"msg": "success",
"data": {
"chainId": "56",
"from": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
"to": "0x10ED43C718714eb63d5aA57B78B54704E256024E",
"value": "0",
"gas": "29880",
"data": "0x38ed17390000000000000000000000000000000000000000000000000000000007270e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000063056e00436da25bcf48a40dfbbdcc7089351006000000000000000000000000000000000000000000000000000000006336b3860000000000000000000000000000000000000000000000000000000000000002000000000000000000000000bb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c000000000000000000000000cc42724c6683b7e57334c4e856f4c9965ed682bd",
"estimationCheck": true,
"referenceId": "48d6003c0aad431aa571e798bfe102ba"
}
}