# Create swap calldata (POST /swap)

Operation `create_swap_transaction` of the Uniswap API. Base URL: `https://trade-api.gateway.uniswap.org/v1`.

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.

Parameters: 3 header, 9 body · Request: `application/json` · Auth: apiKey · Responses: 200, 400, 401, 404, 429, 500, 504

## Headers

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `x-api-key` | string | yes | Your API key for authentication. |
| `x-universal-router-version` | enum | no | The version of the Universal Router to use for the swap journey. *MUST* be consistent throughout the API calls. |
| `x-permit2-disabled` | boolean | no | Disables the Permit2 approval flow. When set to `true`, `permitData` is returned as `null` and the header is forwarded to the routing layer for correct gas simulation against the Proxy Universal Router contract. When `false` or omitted, the standard Permit2 approval flow is used. This header is intended for integrators whose infrastructure uses a direct approval-then-swap pattern without Permit2. |

## Body

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `quote` | ClassicQuote | WrapUnwrapQuote | BridgeQuote | yes |  |
| `signature` | string | no | The signed permit. |
| `includeGasInfo` | boolean | no | Use `refreshGasPrice` instead. |
| `refreshGasPrice` | boolean | no | If true, the gas price will be re-fetched from the network. |
| `simulateTransaction` | boolean | no | If true, the transaction will be simulated. If the simulation results on an onchain error, endpoint will return an error. |
| `permitData` | object | no | the permit2 message object for the customer to sign to permit spending by the permit2 contract. |
| `safetyMode` | enum | no | 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 | no | The unix timestamp at which the order will be reverted if not filled. |
| `urgency` | enum | UrgencyWithOverrides | no | 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. Send the bare string form (e.g. `"normal"`) for the common case, or the object form `{ level, overrides }` to supply caller caps for `maxPriorityFeePerGas`, `maxFeePerGas`, and `gasLimit`. |

## Responses

- `200` — Create swap successful.
- `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
- `429` — Ratelimited
- `500` — Unexpected error
- `504` — Request duration limit reached.

Interactive playground: https://developers.uniswap.org/docs/api-reference/create_swap_transaction
All endpoints: https://developers.uniswap.org/docs/api-reference
