Execute Swap
Execute a token swap transaction using a quote obtained from the quote endpoint.
Endpoint
POST
/swapExecute swap transactionRequest Body
json
{
"publicKey": "0xe0918C56A2C7a216644B6d890c80d164417A70E3",
"quote": {
"tokenA": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
"tokenB": "0x59ef6f3943bbdfe2fb19565037ac85071223e94c",
"amountIn": "1000000000000000000",
"amountOut": "2429260061494",
"tokenPrice": "2436.737744408513",
"routePlan": [
{
"tokenA": "0x1cd0690ff9a693f5ef2dd976660a8dafc81a109c",
"tokenB": "0x59ef6f3943bbdfe2fb19565037ac85071223e94c",
"dexId": "ZERO_G",
"poolAddress": "0x224D0891D63Ca83e6DD98B4653C27034503a5E76",
"aToB": true,
"fee": 3000
}
],
"dexId": "ALL",
"dexFactory": "0x9bdcA5798E52e592A08e3b34d3F18EeF76Af7ef4",
"isNativeIn": true,
"isNativeOut": false
},
"slippage": 1
"partnerFees": {
"fee": 50,
"recipient": "0x1234567890123456789012345678901234567890"
}
}Parameters
| Field | Type | Required | Description |
|---|---|---|---|
| publicKey | string | User's wallet address | |
| quote | object | Quote object from /quote endpoint | |
| slippage | number | Slippage tolerance percentage (e.g., 1 = 1%) | |
| partnerFees | object (optional) | Partner fee details |
Response
json
{
"transactions": [
{
"from": "0xe0918C56A2C7a216644B6d890c80d164417A70E3",
"to": "0x228864aeAAE12Ee8000D9543d9cCfB538F46Da3b",
"data": "0x5a18dddd00000000000000000000000000000000...",
"value": "1000000000000000000"
}
]
}Response Fields
transactions:Array of transaction objects ready to be signed and sent to the blockchain.
from:Your wallet address (matches the publicKey from request).
to:The smart contract address that will execute the swap.
data:Encoded function call data containing swap parameters and routing information.
value:Amount of native token to send with the transaction (in wei). Only present when swapping native token.
⚠️ Important
You must sign and broadcast this transaction using your wallet. The transaction will fail if the price moves beyond your slippage tolerance before it's mined.
Need help? Contact support or visit our developer community.