---
title: "Create swap calldata"
method: POST
path: "/swap"
tags: ["Swap"]
---

# Create swap calldata

`POST /swap`

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.

## Headers

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

## Request body

- CreateSwapRequest — The parameters **signature** and **permitData** should only be included if *permitData* was returned from **/quote**.
  - `quote` union, required
    - ClassicQuote
      - `input` ClassicInput
        - `token` string — The token which will be sent, specified by its token address. For a list of supported tokens, see the [FAQ](https://uniswap-docs.readme.io/reference/faqs).
        - `amount` string — The quantity of tokens denominated in the token's base units. (For example, for an ERC20 token one token is 1x10^18 base units. For one USDC token one token is 1x10^6 base units.) This value must be greater than 0.
      - `output` ClassicOutput
        - `token` string — The token which will be received, specified by its token address. For a list of supported tokens, see the [FAQ](https://uniswap-docs.readme.io/reference/faqs).
        - `amount` string — The quantity of tokens denominated in the token's base units. (For example, for an ERC20 token one token is 1x10^18 base units. For one USDC token one token is 1x10^6 base units.) This value must be greater than 0.
        - `recipient` string — The wallet address which will receive the token.
      - `swapper` string — The wallet address which will be used to send the token.
      - `chainId` 1 | 10 | 56 | 130 | 137 | 324 | 480 | 1868 | 8453 | 10143 | 42161 | 42220 | 43114 | 81457 | 7777777 | 1301 | 84532 | 11155111 | 143 | 196 — The unique ID of the blockchain. For a list of supported chains see the [FAQ](https://uniswap-docs.readme.io/reference/faqs).
      - `slippage` number — The slippage tollerace as a percentage up to a maximum of two decimal places. For Uniswap Protocols (v2, v3, v4), the slippage tolerance is the maximum amount the price can change between the time the transaction is submitted and the time it is executed. The slippage tolerance is a percentage of the total value of the swap. When submitting a quote, note that slippage tolerance works differently in UniswapX swaps where it does not set a limit on the Spread in an order. See [here](https://uniswap-docs.readme.io/reference/faqs#why-do-the-uniswapx-quotes-have-more-slippage-than-the-tolerance-i-set) for more information. Note that if the trade type is `EXACT_INPUT`, then the slippage is in terms of the output token. If the trade type is `EXACT_OUTPUT`, then the slippage is in terms of the input token. When submitting a request, `slippageTolerance` may not be set when `autoSlippage` is defined. One of `slippageTolerance` or `autoSlippage` must be defined.
      - `tradeType` 'EXACT_INPUT' | 'EXACT_OUTPUT' — The handling of the `amount` field. `EXACT_INPUT` means the requester will send the specified `amount` of input tokens and get a quote with a variable quantity of output tokens. `EXACT_OUTPUT` means the requester will receive the specified `amount` of output tokens and get a quote with a variable quantity of input tokens.
      - `gasFee` string — The total estimated gas cost of this transaction (eg. `gasLimit` multiplied by `maxFeePerGas`) in the base unit of the chain.
      - `gasFeeUSD` string — The total estimated gas cost of this transaction (eg. `gasLimit` multiplied by `maxFeePerGas`) denominated in USDC.
      - `gasFeeQuote` string — The total estimated gas cost of this transaction (eg. gasLimit multiplied by maxFeePerGas) in the quoted currency (e.g. output token) in the base units of the quoted currency.
      - `route` array[]
        - union[]
          - union
            - V3PoolInRoute
              - …
            - V2PoolInRoute
              - …
            - V4PoolInRoute
              - …
      - `portionBips` number — The portion of the swap that will be taken as a fee stated in basis points. The fee will be taken from the output token.
      - `portionAmount` string — The portion of the swap that will be taken as a fee in the base units of the token. The fee will be taken from the output token.
      - `portionRecipient` string — The wallet address which will receive the fee.
      - `routeString` string — The route in string format.
      - `quoteId` string — A unique ID for the quote.
      - `gasUseEstimate` string — The estimated gas use. It does NOT include the additional gas for token approvals.
      - `blockNumber` string — The current block number.
      - `gasPrice` string — The cost per unit of gas.
      - `maxFeePerGas` string — The sum of the base fee and priority fee. Subtracting `maxPriorityFeePerGas` from this value will yield the base fee to be paid for this transaction.
      - `maxPriorityFeePerGas` string — The maximum tip to the block builder. Adjusted based upon the urgency specified in the request.
      - `txFailureReasons` TransactionFailureReason[] — The reason(s) why the transaction failed during simulation.
      - `priceImpact` number — The impact the trade has on the market price of the pool, between 0-100 percent
      - `aggregatedOutputs` AggregatedOutput[]
        - `token` string — The token which will be received, specified by its token address. For a list of supported tokens, see the [FAQ](https://uniswap-docs.readme.io/reference/faqs).
        - `amount` string — The quantity of tokens denominated in the token's base units. (For example, for an ERC20 token one token is 1x10^18 base units. For one USDC token one token is 1x10^6 base units.) This value must be greater than 0.
        - `recipient` string — The wallet address which will receive the token.
        - `bps` number — The portion of the swap stated in basis points.
        - `minAmount` string — The minimum portion of the swap, stated in the base unit of the token, which will be output to the recipient.
    - WrapUnwrapQuote
      - `swapper` string — The wallet address which will receive the token.
      - `input` ClassicInput
        - `token` string — The token which will be sent, specified by its token address. For a list of supported tokens, see the [FAQ](https://uniswap-docs.readme.io/reference/faqs).
        - `amount` string — The quantity of tokens denominated in the token's base units. (For example, for an ERC20 token one token is 1x10^18 base units. For one USDC token one token is 1x10^6 base units.) This value must be greater than 0.
      - `output` ClassicOutput
        - `token` string — The token which will be received, specified by its token address. For a list of supported tokens, see the [FAQ](https://uniswap-docs.readme.io/reference/faqs).
        - `amount` string — The quantity of tokens denominated in the token's base units. (For example, for an ERC20 token one token is 1x10^18 base units. For one USDC token one token is 1x10^6 base units.) This value must be greater than 0.
        - `recipient` string — The wallet address which will receive the token.
      - `chainId` 1 | 10 | 56 | 130 | 137 | 324 | 480 | 1868 | 8453 | 10143 | 42161 | 42220 | 43114 | 81457 | 7777777 | 1301 | 84532 | 11155111 | 143 | 196 — The unique ID of the blockchain. For a list of supported chains see the [FAQ](https://uniswap-docs.readme.io/reference/faqs).
      - `tradeType` 'EXACT_INPUT' | 'EXACT_OUTPUT' — The handling of the `amount` field. `EXACT_INPUT` means the requester will send the specified `amount` of input tokens and get a quote with a variable quantity of output tokens. `EXACT_OUTPUT` means the requester will receive the specified `amount` of output tokens and get a quote with a variable quantity of input tokens.
      - `gasFee` string — The total estimated gas cost of this transaction (eg. `gasLimit` multiplied by `maxFeePerGas`) in the base unit of the chain.
      - `gasFeeUSD` string — The total estimated gas cost of this transaction (eg. `gasLimit` multiplied by `maxFeePerGas`) denominated in USDC.
      - `gasFeeQuote` string — The total estimated gas cost of this transaction (eg. gasLimit multiplied by maxFeePerGas) in the quoted currency (e.g. output token) in the base units of the quoted currency.
      - `gasUseEstimate` string — The maximum units of gas that will be consumed by this transaction.
      - `gasPrice` string — The cost per unit of gas.
      - `maxFeePerGas` string — The sum of the base fee and priority fee. Subtracting `maxPriorityFeePerGas` from this value will yield the base fee to be paid for this transaction.
      - `maxPriorityFeePerGas` string — The maximum tip to the block builder. Adjusted based upon the urgency specified in the request.
    - BridgeQuote
      - `quoteId` string — A unique ID for the quote.
      - `chainId` 1 | 10 | 56 | 130 | 137 | 324 | 480 | 1868 | 8453 | 10143 | 42161 | 42220 | 43114 | 81457 | 7777777 | 1301 | 84532 | 11155111 | 143 | 196 — The unique ID of the blockchain. For a list of supported chains see the [FAQ](https://uniswap-docs.readme.io/reference/faqs).
      - `destinationChainId` 1 | 10 | 56 | 130 | 137 | 324 | 480 | 1868 | 8453 | 10143 | 42161 | 42220 | 43114 | 81457 | 7777777 | 1301 | 84532 | 11155111 | 143 | 196 — The unique ID of the blockchain. For a list of supported chains see the [FAQ](https://uniswap-docs.readme.io/reference/faqs).
      - `swapper` string — The wallet address which will receive the token.
      - `input` ClassicInput
        - `token` string — The token which will be sent, specified by its token address. For a list of supported tokens, see the [FAQ](https://uniswap-docs.readme.io/reference/faqs).
        - `amount` string — The quantity of tokens denominated in the token's base units. (For example, for an ERC20 token one token is 1x10^18 base units. For one USDC token one token is 1x10^6 base units.) This value must be greater than 0.
      - `output` ClassicOutput
        - `token` string — The token which will be received, specified by its token address. For a list of supported tokens, see the [FAQ](https://uniswap-docs.readme.io/reference/faqs).
        - `amount` string — The quantity of tokens denominated in the token's base units. (For example, for an ERC20 token one token is 1x10^18 base units. For one USDC token one token is 1x10^6 base units.) This value must be greater than 0.
        - `recipient` string — The wallet address which will receive the token.
      - `tradeType` 'EXACT_INPUT' | 'EXACT_OUTPUT' — The handling of the `amount` field. `EXACT_INPUT` means the requester will send the specified `amount` of input tokens and get a quote with a variable quantity of output tokens. `EXACT_OUTPUT` means the requester will receive the specified `amount` of output tokens and get a quote with a variable quantity of input tokens.
      - `quoteTimestamp` number
      - `gasPrice` string — The cost per unit of gas.
      - `maxFeePerGas` string — The sum of the base fee and priority fee. Subtracting `maxPriorityFeePerGas` from this value will yield the base fee to be paid for this transaction.
      - `maxPriorityFeePerGas` string — The maximum tip to the block builder. Adjusted based upon the urgency specified in the request.
      - `gasFee` string — The total estimated gas cost of this transaction (eg. `gasLimit` multiplied by `maxFeePerGas`) in the base unit of the chain.
      - `gasUseEstimate` string — The maximum units of gas that will be consumed by this transaction.
      - `gasFeeUSD` string — The total estimated gas cost of this transaction (eg. `gasLimit` multiplied by `maxFeePerGas`) denominated in USDC.
      - `portionBips` number — The portion of the swap that will be taken as a fee stated in basis points. The fee will be taken from the output token.
      - `portionAmount` string — The portion of the swap that will be taken as a fee in the base units of the token. The fee will be taken from the output token.
      - `portionRecipient` string — The wallet address which will receive the fee.
      - `estimatedFillTimeMs` number — The estimated time it will take to fill the order in milliseconds.
      - `exclusiveRelayer` string — The address of the exclusive filler (the relayer).
      - `exclusivityDeadline` number — The deadline (unix timestamp) by which the exclusive relayer must fill the order before other relayers can fill it.
      - `fillDeadline` number — The deadline by which, if the order is not filled, the order will be reverted.
  - `signature` string — The signed permit.
  - `includeGasInfo` boolean — Use `refreshGasPrice` instead.
  - `refreshGasPrice` boolean — If true, the gas price will be re-fetched from the network.
  - `simulateTransaction` boolean — If true, the transaction will be simulated. If the simulation results on an onchain error, endpoint will return an error.
  - `permitData` Permit — the permit2 message object for the customer to sign to permit spending by the permit2 contract.
    - `domain` object
    - `values` object
    - `types` object
  - `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.
  - `deadline` number — 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`.

## Response `200`

Create swap successful.

- CreateSwapResponse
  - `requestId` string, required — A unique ID for the request.
  - `swap` TransactionRequest, required
    - `to` string, required — The wallet address which will receive the token.
    - `from` string, required — The wallet address which will be used to send the token.
    - `data` string, required — The calldata for the transaction.
    - `value` string, required — The quantity of ETH tokens approved for spending by the transaction, denominated in wei. Note that by default Uniswap Labs sets this to the maximum approvable spend.
    - `gasLimit` string — The maximum units of gas that will be consumed by this transaction.
    - `chainId` 1 | 10 | 56 | 130 | 137 | 324 | 480 | 1868 | 8453 | 10143 | 42161 | 42220 | 43114 | 81457 | 7777777 | 1301 | 84532 | 11155111 | 143 | 196, required — The unique ID of the blockchain. For a list of supported chains see the [FAQ](https://uniswap-docs.readme.io/reference/faqs).
    - `maxFeePerGas` string — The sum of the base fee and priority fee. Subtracting `maxPriorityFeePerGas` from this value will yield the base fee to be paid for this transaction.
    - `maxPriorityFeePerGas` string — The maximum tip to the block builder. Adjusted based upon the urgency specified in the request.
    - `gasPrice` string — The cost per unit of gas.
  - `gasFee` string — The total estimated gas cost of this transaction (eg. `gasLimit` multiplied by `maxFeePerGas`) in the base unit of the chain.

## Other responses

- `400` — RequestValidationError, Bad Input
- `401` — UnauthorizedError eg. Account is blocked or Fee is not enabled.
- `404` — ResourceNotFound eg. No quotes available or Gas fee/price not available
- `419` — Ratelimited
- `500` — Unexpected error
- `504` — Request duration limit reached.

---

[API](https://skmtc.net/uniswap/apis/token-trading.md) · [All operations](https://skmtc.net/uniswap/apis/token-trading/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/uniswap/token-trading/revisions/55533f9bd1ab/schema)
