Create swap calldata
npx skills add uniswap/uniswap-ai --skill swap-integrationFull swap flow integration for apps. Works with Claude Code, Cursor, and other AI coding tools.
npx skills add uniswap/uniswap-ai --skill swap-plannerAuthorization
x-api-keystringrequiredheaderHeaders
x-universal-router-versionenumdefault:2.1.2The 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.
x-agent-infostringOptional attribution hint for AI-agent traffic; send it if an AI agent built or operates your integration. The value is a JSON object with up to three fields: decision_origin (required, exactly autonomous or human_mediated, case-sensitive), integration_name (optional string naming your integration, e.g. my-trading-bot), and version (optional string identifying your integration's version). Any other key is dropped, never rejected. The raw value must be at most 1024 bytes of printable US-ASCII (0x20-0x7E), so send non-ASCII text as JSON \u escapes; integration_name and version are each limited to 256 UTF-16 code units and may not contain control characters, U+2028, U+2029, or U+FFFD. Send the header once: repeated header lines are joined with , and the joined string is what gets parsed, so two complete objects fail as invalid JSON while a single object split across two lines still parses. The header is analytics-only and never affects the request: omitting it, sending it, or sending a value that fails these rules never changes the response status, body, or swap behavior. A value that fails to parse is dropped and reported by the x-agent-info-status response header. Never put a user ID, wallet address, email, session token, or API key in these fields.
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.
permitDataobjectsafetyModeenumSwap 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.
urgencyenum | UrgencyWithOverridesswapSourceenumdefault:WALLETWhere the input tokens come from. Leave unset (or send "WALLET") to pull them from the swapper's wallet as usual. Send "UNIVERSAL_ROUTER" to get calldata that swaps whatever balance of the input token the Universal Router holds when it runs, for bridge-and-swap flows where a bridge deposits into the router and executes the swap in the same transaction. In this mode, quote on the destination chain, use amount as your estimate of what will arrive, and put the end user in swapper. Exact-input, single-chain swaps only; the returned transaction has no from and a value of "0". Works on both /quote and /swap. Read the guide before using it: /docs/trading/swapping-api/start-building/integration-guide#swapping-funds-already-in-the-universal-router
enforceExactInbooleandefault:falseOnly with swapSource "UNIVERSAL_ROUTER". Set it to true when your bridge guarantees how much will arrive; the calldata then checks the router's balance and reverts if it holds less than amount. Leave it off if amount is just an estimate, or a good fill can revert over a small shortfall. Details: /docs/trading/swapping-api/start-building/integration-guide#swapping-funds-already-in-the-universal-router
Response
Create swap successful.
requestIdstringrequiredA unique ID for the request.
swapobjectrequiredgasFeestringThe total estimated gas cost of this transaction (eg. gasLimit multiplied by maxFeePerGas) in the base unit of the chain.
/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.1.2' \
--header 'x-permit2-disabled: false'{ "requestId": "<string>", "swap": { "to": "<string>", "from": "<string>", "data": "<string>", "value": "<string>", "gasLimit": "<string>", "chainId": "<number>", "maxFeePerGas": "<string>", "maxPriorityFeePerGas": "<string>", "gasPrice": "<string>" }, "gasFee": "<string>"}