Get a quote
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-erc20eth-enabledbooleandefault:falseEnable native ETH input support for UniswapX via ERC20-ETH (EIP-7914). When set to true and tokenIn is the native currency address (e.g. 0x0000000000000000000000000000000000000000), the API may return UniswapX routes that spend native ETH for supported wallets.
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/jsontypeenumrequireddefault:EXACT_INPUTThe 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.
amountstringrequiredThe 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.
tokenInChainIdenumrequireddefault:1The unique ID of the blockchain. For a list of supported chains see the FAQ.
tokenOutChainIdenumrequireddefault:1The unique ID of the blockchain. For a list of supported chains see the FAQ.
tokenInstringrequiredThe token which will be sent, specified by its token address. For a list of supported tokens, see the FAQ.
tokenOutstringrequiredThe token which will be received, specified by its token address. For a list of supported tokens, see the FAQ.
generatePermitAsTransactionbooleandefault:falseIndicates whether you want to receive a permit2 transaction to sign and submit onchain, or a permit message to sign. When set to true, the quote response returns the Permit2 as a calldata which the user signs and broadcasts. When set to false (the default), the quote response returns the Permit2 as a message which the user signs but does not need to broadcast. When using a 7702-delegated wallet, set this field to true. Except for this scenario, it is recommended that this field is set to false. Note that a Permit2 calldata (e.g. true), will provide indefinite permission for Permit2 to spend a token, in contrast to a Permit2 message (e.g. false) which is only valid for 30 days. Further, a Permit2 calldata (e.g. true) requires the user to pay gas to submit the transaction, whereas the Permit2 message (e.g. false ) does not require the user to submit a transaction and requires no gas.
swapperstringrequiredThe wallet address which will be used to send the token.
slippageTolerancenumberThe slippage tolerance 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 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.
Must be between 0 and 100. A value outside that range, including a negative one, is rejected with a 400.
autoSlippageenumThe auto slippage strategy to employ. For Uniswap Protocols (v2, v3, v4) the auto slippage will be automatically calculated when this field is set to DEFAULT. Auto slippage cannot be calculated for UniswapX swaps.
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, autoSlippage may not be set when slippageTolerance is defined. One of slippageTolerance or autoSlippage must be defined.
routingPreferenceenumdefault:BEST_PRICEThe routingPreference specifies the preferred strategy to determine the quote. If the routingPreference is BEST_PRICE, then the quote will propose a route through the specified whitelisted protocols (or all, if none are specified) that provides the best price. When the routingPreference is FASTEST, the quote will propose the first route which is found to complete the swap.
protocolsenum[]The protocols to use for the swap/order. If the protocols field is defined, then you can only set the routingPreference to BEST_PRICE. Note that the value UNISWAPX is deprecated and will be removed in a future release.
hooksOptionsenumThe hook options to use for V4 pool quotes. V4_HOOKS_INCLUSIVE will get quotes for V4 pools with or without hooks. V4_HOOKS_ONLY will only get quotes for V4 pools with hooks. V4_NO_HOOKS will only get quotes for V4 pools without hooks. Defaults to V4_HOOKS_INCLUSIVE if V4 is included in protocols and hookOptions is not set. This field is ignored if V4 is not passed in protocols.
spreadOptimizationenumdefault:EXECUTIONFor UniswapX swaps, when set to EXECUTION, quotes optimize for looser spreads at higher fill rates. When set to PRICE, quotes optimize for tighter spreads at lower fill rates. This field is not applicable to Uniswap Protocols (v2, v3, v4), bridging, or wrapping/unwrapping and will be ignored if set.
permitAmountenumdefault:FULLFor Uniswap Protocols (v2, v3, v4) swaps, specify the input token spend allowance (e.g. quantity) to be set in the permit. FULL can be used to specify an unlimited token quantity, and may prevent the wallet from needing to sign another permit for the same token in the future. EXACT can be used to specify the exact input token quantity for this request. Defaults to FULL.
recipientstring(optional) The wallet address which will receive the output of the swap. If not provided, the output is returned to the swapper.
integratorFeesobject[]swapSourceenumdefault: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
Quote request successful.
requestIdstringrequiredA unique ID for the request.
quoteDutchQuote | ClassicQuote | WrapUnwrapQuote | DutchQuoteV2 | DutchQuoteV3 | BridgeQuote | PriorityQuote | ChainedQuoterequiredroutingenumrequiredThe routing for the proposed transaction.
isTokenApprovalApplicablebooleanWhether an ERC-20 token approval is applicable to this swap's input. true when the routing pulls the input token via an allowance, so an approval may be required — verify (or orchestrate) it via /check_approval. false when no approval is ever needed for this route (e.g. native-currency input, wrap/unwrap, or a native-gas-token input paid as native value). Reflects the routing mechanism, not the swapper's current on-chain allowance. If absent, assume an approval is applicable.
permitTransactionobjectpermitDataobjectrequiredthe permit2 message object for the customer to sign to permit spending by the permit2 contract.
permitGasFeestringThe total estimated gas cost of this transaction (eg. gasLimit multiplied by maxFeePerGas) in the base unit of the chain.
swapTransactionobjectReady-to-send swap transaction, returned for CLASSIC quotes when no permit signature needs to be embedded in the calldata. That's the case when the request used x-permit2-disabled: true, the swapper already holds a valid permit (permitData is null), or the permit was requested as a transaction (generatePermitAsTransaction: true). The returned calldata is built with default settings (safetyMode: SAFE, deadline 30 minutes ahead); use /swap to customize them. Not returned when txFailureReasons is populated; call /swap to build the calldata anyway. With swapSource: "UNIVERSAL_ROUTER" a failed simulation returns a 422 instead of a quote without calldata, except for TRANSFER_FROM_FAILED and SLIPPAGE_TOO_LOW, which still return calldata. /swap is unchanged for these quotes.
swapGasFeestringThe estimated gas fee for swapTransaction, equal to the gasFee that /swap would return without gas refresh. Only present when swapTransaction is present.
/quotecurl --request POST \
--url 'https://trade-api.gateway.uniswap.org/v1/quote' \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--header 'x-universal-router-version: 2.1.2' \
--header 'x-erc20eth-enabled: false' \
--header 'x-permit2-disabled: false' \
--data '{
"type": "EXACT_INPUT",
"amount": "1000000000",
"tokenInChainId": 1,
"tokenOutChainId": 1,
"tokenIn": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"tokenOut": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
"swapper": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
"slippageTolerance": 0.5
}'{ "requestId": "<string>", "quote": { "encodedOrder": "<string>", "orderId": "<string>", "orderInfo": { "chainId": "<number>", "nonce": "<string>", "reactor": "<string>", "swapper": "<string>", "deadline": "<number>", "additionalValidationContract": "<string>", "additionalValidationData": "<string>", "decayStartTime": "<number>", "decayEndTime": "<number>", "exclusiveFiller": "<string>", "exclusivityOverrideBps": "<string>", "input": { "startAmount": "<string>", "endAmount": "<string>", "token": "<string>" }, "outputs": [ { "startAmount": "<string>", "endAmount": "<string>", "token": "<string>", "recipient": "<string>" } ] }, "input": { "amount": "<string>", "token": "<string>", "maximumAmount": "<string>" }, "output": { "amount": "<string>", "token": "<string>", "recipient": "<string>", "minimumAmount": "<string>" }, "portionBips": "<number>", "portionAmount": "<string>", "portionRecipient": "<string>", "quoteId": "<string>", "slippageTolerance": "<number>", "classicGasUseEstimateUSD": "<string>", "aggregatedOutputs": [ { "token": "<string>", "amount": "<string>", "recipient": "<string>", "bps": "<number>", "minAmount": "<string>", "fee": "<string>" } ] }, "routing": "<string>", "isTokenApprovalApplicable": "<boolean>", "permitTransaction": { "to": "<string>", "from": "<string>", "data": "<string>", "value": "<string>", "gasLimit": "<string>", "chainId": "<number>", "maxFeePerGas": "<string>", "maxPriorityFeePerGas": "<string>", "gasPrice": "<string>" }, "permitData": { "domain": {}, "values": {}, "types": {} }, "permitGasFee": "<string>", "swapTransaction": { "to": "<string>", "from": "<string>", "data": "<string>", "value": "<string>", "gasLimit": "<string>", "chainId": "<number>", "maxFeePerGas": "<string>", "maxPriorityFeePerGas": "<string>", "gasPrice": "<string>" }, "swapGasFee": {}}