getQuote (Permit2)
getQuote (Permit2)
getQuote (Permit2)
The amount of sellToken in sellToken base units to sell
The exact amount of buyToken in buyToken base units to buy
The address which holds the sellToken balance and has the allowance set for the swap
The address of the external account that started the transaction. This is only needed if taker is a smart contract.
The address to receive the buyToken. If not provided, defaults to the taker address. Not supported for wrap/unwrap operations.
The wallet address to receive the specified trading fees (supports single or multiple comma-separated values). You must also specify the swapFeeBps in the request to use this feature. When multiple values are provided, must match length of swapFeeBps.
The maximum trade surplus (positive slippage) that can be collected in Bps of the buy amount. If not provided, defaults to 10000 (100%). Must be used together with tradeSurplusRecipient.
The target gas price (in wei) for the swap transaction. If not provided, the default value is based on the 0x gas price oracle
The maximum acceptable slippage of the buyToken in Bps. If this parameter is set to 0, no slippage will be tolerated. If not provided, the default slippage tolerance is 100Bps
The maximum acceptable slippage of the buyToken in parts-per-million (PPM). Mutually exclusive with slippageBps. e.g. 3000 PPM = 30 BPS = 0.30%.
Liquidity sources e.g. Uniswap_V3, SushiSwap, 0x_RFQ to exclude from the provided quote. See https://api.0x.org/sources?chainId=<chain_id> with the desired chain’s ID for a full list of sources. Separate multiple sources with a comma
Controls how native wrap/unwrap trades are executed. direct calls the wrapped-native token contract directly. settler routes wrap/unwrap through Settler or Allowance Holder for compatibility. Ignored for non-wrap/unwrap swaps. If omitted, direct mode is used.
Chain ID. See here for the list of supported chains
The amount in Bps of the swapFeeToken to charge and deliver to the swapFeeRecipient (supports single or multiple comma-separated values). You must also specify the swapFeeRecipient in the request to use this feature. For security, this field has a default limit of 1000 Bps. If your application requires a higher value, please reach out to us.
The contract address of the token to receive trading fees in (supports single or multiple comma-separated values). Each token must be set to the value of either the buyToken or the sellToken. If omitted, the fee token will be determined by 0x with preference to stablecoins and highly liquid assets. You must also specify the swapFeeRecipient and swapFeeBps to charge integrator fees. When multiple values are provided, must match length of swapFeeBps.
If set to true, the taker’s entire sellToken balance will be sold during trade execution. The sellAmount should be the maximum estimated value, as close as possible to the actual taker’s balance to ensure the best routing. Selling more than the sellAmount may cause the trade to revert. This feature is designed for cases where the precise sell amount is determined during execution. Learn more here.