Collects accumulated trading fees from a Uniswap V3 or V4 position. V2 positions do not support fee claiming — V2 fees are embedded in LP token value and are realized when liquidity is removed. The server derives the uncollected fee amounts from the Data API (which computes them on-chain) and generates the collect transaction. The fee amounts are included in the response so the caller knows what they will receive.Documentation Index
Fetch the complete documentation index at: https://api-docs.uniswap.org/llms.txt
Use this file to discover all available pages before exploring further.
Key Parameters
protocol—V3orV4. SendingV2returns a validation error explaining that V2 fees are accumulated through LP tokens.chain_id— The blockchain networktoken_id— The NFT token ID identifying the V3 or V4 positioncollect_as_weth— For V3 positions involving native ETH: iffalse, unwraps WETH to native ETH in the claim. Not applicable to V4.simulate_transaction— If true, includes gas fee estimates in the response
How It Works
- V3: Generates a
collectcall via the NonfungiblePositionManager. For positions involving native ETH (whencollect_as_wethis false), generates a multicall withcollect,unwrapWETH9, andsweepToken. The uncollected fee amounts from the Data API are used as minimum amounts for sandwich protection. - V4: Generates a zero-liquidity decrease via the V4 PositionManager followed by
TAKE_PAIRto sweep all collected fees.
Response
Returns the fee amounts (token_0, token_1) and a fully-formed claim transaction to sign. If simulate_transaction is true, also includes gas fee estimates.