Create Swap
This endpoint provides a real-time quote for a token swap, detailing the estimated destination token amount, fees, and other relevant parameters.
Authorization
x-api-key
<token>In: header
Request Body
application/json
RequiredamountIn
RequiredstringThe amount to be swapped, expressed as a decimal string. Example: "1.2".
chainIdIn
RequirednumberThe blockchain network where the swap originates. Supported chains:
- Arbitrum One: 42161
- Avalanche: 43114
- Base: 8453
- BNB Smart Chain: 56
- Ethereum: 1
- OP Mainnet: 10
- Polygon: 137
- Gnosis: 100
chainIdOut
RequirednumberThe blockchain network where the swapped asset will be sent to. Supported chains:
- Arbitrum One: 42161
- Avalanche: 43114
- Base: 8453
- BNB Smart Chain: 56
- Ethereum: 1
- OP Mainnet: 10
- Polygon: 137
- Gnosis: 100
swapProviders
array<string>Optional array of providers for the quote process. - Scenario 1: If not provided and the swap is within the same chain, the default provider will be "PARASWAP". - Scenario 2: If not provided and the swap is cross-chain, the default provider will be "XY". - Scenario 3: If an array is provided (e.g., ["XY", "LIFI", "PARASWAP"]), a quote will be performed for each specified provider.
gasFeePaymentMethod
RequiredstringDefines how the fee will be paid: "ADD_TO_AMOUNT" adds it to the input amount, while "DEDUCT_FROM_AMOUNT" subtracts it from the input amount.
"ADD_TO_AMOUNT" | "DEDUCT_FROM_AMOUNT"
payGasFeeToken
RequiredstringThe token address (in hexadecimal format) used to pay the transaction fee.
"^0x[a-fA-F0-9]{40}$"
tokenIn
RequiredstringThe address (in hexadecimal format) of the token being swapped from.
"^0x[a-fA-F0-9]{40}$"
tokenOut
RequiredstringThe address (in hexadecimal format) of the token being swapped to.
"^0x[a-fA-F0-9]{40}$"
walletAddress
RequiredstringThe wallet address (in hexadecimal format) initiating the swap.
"^0x[a-fA-F0-9]{40}$"
toAddress
RequiredstringThe address (in hexadecimal format) receiving the swap.
"^0x[a-fA-F0-9]{40}$"
transactionFeePercent
numberPercentage fee to be charged (0 to 99%). The fee is deducted from the input token and sent to the treasuryAddress if configured.
0
Maximum: 99.99
slippage
numberOptional parameter controlling the maximum deviation allowed of the expected price of a trade and the actual price at which the trade is executed, with a minimum value of 0.5 and a maximum value of 99, default is 0.5, where 1 unit equals 1%.
0.5
Minimum: 0.5
Maximum: 99
metadata
objectCustom metadata for the transaction. Key-value pairs with string values. Max 1KB size.