v1

latestOpenAPI 3.0.02026-07-142115792.8 KB
Swap

Create swap calldata

Create the calldata for a swap transaction (including wrap/unwrap) against the Uniswap Protocols. If the quote parameter includes the fee parameters, then the calldata will include the fee disbursement. The gas estimates will be more precise when the the response calldata would be valid if submitted on-chain.

post/swap

Headers

x-universal-router-version'1.2' | '2.0'

The version of the Universal Router to use for the swap journey. MUST be consistent throughout the API calls.

Request body

signaturestring

The signed permit.

includeGasInfoboolean

Use refreshGasPrice instead.

refreshGasPriceboolean

If true, the gas price will be re-fetched from the network.

simulateTransactionboolean

If true, the transaction will be simulated. If the simulation results on an onchain error, endpoint will return an error.

safetyMode'SAFE'

Swap safety mode will automatically sweep the transaction for the native token and return it to the sender wallet address. This is to prevent accidental loss of funds in the event that the token amount is set in the transaction value instead of as part of the calldata.

deadlinenumber

The unix timestamp at which the order will be reverted if not filled.

urgency'normal' | 'fast' | 'urgent'

The urgency impacts the estimated gas price of the transaction. The higher the urgency, the higher the gas price, and the faster the transaction is likely to be selected from the mempool. The default value is urgent.

Example request

{
  "quote": {
    "route": [
      [
        {
          "tokenIn": {
            "symbol": "ETH"
          },
          "tokenOut": {
            "symbol": "ETH"
          }
        }
      ]
    ]
  }
}

Response

Create swap successful.

requestIdstring required

A unique ID for the request.

gasFeestring

The total estimated gas cost of this transaction (eg. gasLimit multiplied by maxFeePerGas) in the base unit of the chain.