Skip to main content

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.

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.

Key Parameters

  • protocolV3 or V4. Sending V2 returns a validation error explaining that V2 fees are accumulated through LP tokens.
  • chain_id — The blockchain network
  • token_id — The NFT token ID identifying the V3 or V4 position
  • collect_as_weth — For V3 positions involving native ETH: if false, 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 collect call via the NonfungiblePositionManager. For positions involving native ETH (when collect_as_weth is false), generates a multicall with collect, unwrapWETH9, and sweepToken. 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_PAIR to 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.

Example Request

curl --location 'https://api.uniswap.org/lp/claim' \
--header 'Content-Type: application/json' \
--header 'x-api-key: XXXXX' \
--data '{
    "protocol": "V4",
    "walletAddress": "XXXX",
    "chainId": 130,
    "tokenId": "1833079",
    "simulateTransaction": false
}'