Create swap calldata
npx skills add uniswap/uniswap-trading --skill swap-integrationFull swap flow integration for apps. Works with Claude Code, Cursor, and other AI coding tools.
npx skills add uniswap/uniswap-driver --skill swap-plannerAuthorization
x-api-keystringrequiredheaderHeaders
x-universal-router-versionenumdefault:2.0The version of the Universal Router to use for the swap journey. *MUST* be consistent throughout the API calls.
x-permit2-disabledbooleandefault:falseDisables 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
application/jsonsignaturestringThe signed permit.
includeGasInfobooleandefault:falseUse refreshGasPrice instead.
refreshGasPricebooleandefault:falseIf true, the gas price will be re-fetched from the network.
simulateTransactionbooleandefault:falseIf true, the transaction will be simulated. If the simulation results on an onchain error, endpoint will return an error.
permitDataunknownsafetyModeenumSwap 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.
deadlinenumberThe unix timestamp at which the order will be reverted if not filled.
urgencyenumdefault:urgentThe 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.
/swapcurl --request POST \
--url 'https://trade-api.gateway.uniswap.org/v1/swap' \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--header 'x-universal-router-version: 2.0' \
--header 'x-permit2-disabled: false'