# Collect fees from liquidity URL: /docs/api-reference/liquidity-pools/CollectFeesController_handle_v1 Collects the fees received by the liquidity NFT. This will both create a user operation to be executed and will show how much will be collected, so you can choose if you really want to collect it or not. Always collects the full amount. ## POST /api/v1/liquidity/collect Request: `POST https://api.notus.team/api/v1/liquidity/collect` Authentication: send your project's API key in the `x-api-key` header. ```json { "description": "Collects the fees received by the liquidity NFT. This will both create a user operation to be executed and will show how much will be collected, so you can choose if you really want to collect it or not. Always collects the full amount.", "operationId": "CollectFeesController_handle_v1", "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CollectFeesDTO" } } } }, "responses": { "200": { "description": "The amounts of tokens needed to provide liquidity.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/LiquidityOperationResponseDTO" } } } }, "400": { "description": "BAD_REQUEST", "content": { "application/json": { "schema": { "oneOf": [ { "type": "object", "description": "NOT_AUTHORIZED_TOKENS", "required": [ "statusCode", "id", "message" ], "properties": { "statusCode": { "type": "number", "description": "HTTP status code", "examples": [ 400 ] }, "id": { "type": "string", "description": "Our ID of the problem", "examples": [ "NOT_AUTHORIZED_TOKENS" ] }, "message": { "type": "string", "description": "A human readable message that explains the problem", "examples": [ "" ] } } }, { "type": "object", "description": "NOT_SUPPORTED_CHAIN", "required": [ "statusCode", "id", "message" ], "properties": { "statusCode": { "type": "number", "description": "HTTP status code", "examples": [ 400 ] }, "id": { "type": "string", "description": "Our ID of the problem", "examples": [ "NOT_SUPPORTED_CHAIN" ] }, "message": { "type": "string", "description": "A human readable message that explains the problem", "examples": [ "UNISWAP_V3 does not support this chain ([object Object])." ] } } }, { "type": "object", "description": "LIQUIDITY_PROVIDER_MISMATCH", "required": [ "statusCode", "id", "message" ], "properties": { "statusCode": { "type": "number", "description": "HTTP status code", "examples": [ 400 ] }, "id": { "type": "string", "description": "Our ID of the problem", "examples": [ "LIQUIDITY_PROVIDER_MISMATCH" ] }, "message": { "type": "string", "description": "A human readable message that explains the problem", "examples": [ "The liquidityProvider does not match the provider of the position manager given in nftAddress" ] } } }, { "type": "object", "description": "UNKNOWN_POSITION_MANAGER", "required": [ "statusCode", "id", "message" ], "properties": { "statusCode": { "type": "number", "description": "HTTP status code", "examples": [ 400 ] }, "id": { "type": "string", "description": "Our ID of the problem", "examples": [ "UNKNOWN_POSITION_MANAGER" ] }, "message": { "type": "string", "description": "A human readable message that explains the problem", "examples": [ "The nftAddress is not a supported liquidity position manager on this chain" ] } } } ] } } } }, "403": { "description": "FORBIDDEN", "content": { "application/json": { "schema": { "oneOf": [ { "type": "object", "description": "UNAVAILABLE_COMPUTE_UNITS", "required": [ "statusCode", "id", "message" ], "properties": { "statusCode": { "type": "number", "description": "HTTP status code", "examples": [ 403 ] }, "id": { "type": "string", "description": "Our ID of the problem", "examples": [ "UNAVAILABLE_COMPUTE_UNITS" ] }, "message": { "type": "string", "description": "A human readable message that explains the problem", "examples": [ "The project doesn't have enough compute units to perform this action. Please upgrade your plan." ] } } }, { "type": "object", "description": "POSITION_NOT_OWNED_BY_WALLET", "required": [ "statusCode", "id", "message" ], "properties": { "statusCode": { "type": "number", "description": "HTTP status code", "examples": [ 403 ] }, "id": { "type": "string", "description": "Our ID of the problem", "examples": [ "POSITION_NOT_OWNED_BY_WALLET" ] }, "message": { "type": "string", "description": "A human readable message that explains the problem", "examples": [ "The liquidity position NFT does not belong to the provided wallet address" ] } } } ] } } } }, "500": { "description": "INTERNAL_SERVER_ERROR", "content": { "application/json": { "schema": { "type": "object", "description": "BLOCKCHAIN_ERROR", "required": [ "statusCode", "id", "message" ], "properties": { "statusCode": { "type": "number", "description": "HTTP status code", "examples": [ 500 ] }, "id": { "type": "string", "description": "Our ID of the problem", "examples": [ "BLOCKCHAIN_ERROR" ] }, "message": { "type": "string", "description": "A human readable message that explains the problem", "examples": [ "We had a problem fetching the data from the blockchain. If the problem persists, contact our support." ] } } } } } } }, "summary": "Collect fees from liquidity", "tags": [ "Liquidity Pools" ] } ``` ### Schema CollectFeesDTO ```json { "type": "object", "properties": { "liquidityProvider": { "description": "Optional provider for entering a liquidity pool. If not provided, Uniswap v3 will be used.", "type": "string", "enum": [ "UNISWAP_V3", "PANCAKESWAP_V3", "UNISWAP_V4" ], "examples": [ "UNISWAP_V3" ] }, "nftAddress": { "description": "Optional position manager (NFT contract) of the position: the `nftAddress` returned when the position was created. It selects the liquidity provider; if `liquidityProvider` is also sent, both must name the same provider. Without either, Uniswap V3 is used.", "type": [ "string", "null" ], "examples": [ "0xC36442b4a4522E871399CD717aBDD847Ab11FE88" ] }, "chainId": { "description": "The blockchain network where the liquidity will be provided. \n Supported EVM chains:\n- Arbitrum One: 42161\n- Avalanche: 43114\n- Base: 8453\n- BNB Smart Chain: 56\n- Ethereum: 1\n- Gnosis: 100\n- OP Mainnet: 10\n- Polygon: 137\n- X Layer Mainnet: 196\n- Robinhood Chain: 4663", "type": "number", "examples": [ 42161 ] }, "nftId": { "type": "string", "description": "ID of the NFT that represents the liquidity", "examples": [ "2375619234" ] }, "walletAddress": { "description": "The wallet address (in hexadecimal format) who owns the liquidity.", "type": "string", "examples": [ "0x6e397ddf51d9f15dbe0414538e7529f51f2e5464" ] }, "payGasFeeToken": { "description": "The token address (in hexadecimal format) used to pay the transaction fee.", "type": "string", "examples": [ "0x82af49447d8a07e3bd95bd0d56f35241523fbab1" ] }, "unwrapNativeToken": { "description": "Receive the native token (POL, ETH...) instead of the wrapped one (WPOL, WETH...) for that leg of the position. The wrapped token never reaches the wallet, so pay the gas fee with the native token or another token the wallet holds. Ignored when the position has no wrapped native token.", "type": [ "boolean", "null" ], "examples": [ false ] }, "metadata": { "type": "object", "additionalProperties": { "type": "string" }, "description": "Custom metadata. Key-value pairs with string values. Max 1KB size.", "examples": [ { "key": "value" } ] } }, "required": [ "chainId", "nftId", "walletAddress", "payGasFeeToken" ] } ``` ### Schema LiquidityOperationResponseDTO ```json { "type": "object", "properties": { "operation": { "$ref": "#/components/schemas/CreateLiquidityDTO" } }, "required": [ "operation" ] } ``` ### Schema CreateLiquidityDTO ```json { "type": "object", "properties": { "liquidityProvider": { "description": "Optional provider for entering a liquidity pool. If not provided, Uniswap v3 will be used.", "type": "string", "enum": [ "UNISWAP_V3", "PANCAKESWAP_V3", "UNISWAP_V4" ], "examples": [ "UNISWAP_V3" ] }, "walletAddress": { "description": "The wallet address (in hexadecimal format) that will provide the liquidity.", "type": "string", "examples": [ "0x6e397ddf51d9f15dbe0414538e7529f51f2e5464" ] }, "toAddress": { "description": "The address (in hexadecimal format) receiving the token that represents the provided liquidity.", "type": "string", "examples": [ "0x1337133713371337133713371337133713371337" ] }, "chainId": { "description": "The blockchain network where the liquidity will be provided. \n Supported EVM chains:\n- Arbitrum One: 42161\n- Avalanche: 43114\n- Base: 8453\n- BNB Smart Chain: 56\n- Ethereum: 1\n- Gnosis: 100\n- OP Mainnet: 10\n- Polygon: 137\n- X Layer Mainnet: 196\n- Robinhood Chain: 4663", "type": "number", "examples": [ 42161 ] }, "transactionFeePercent": { "default": 0, "description": "Percentage fee applied to the transaction (e.g., 5 for 5%).", "type": "number", "minimum": 0, "maximum": 99.99, "examples": [ 2.5 ] }, "payGasFeeToken": { "description": "The token address (in hexadecimal format) used to pay the transaction fee.", "type": "string", "examples": [ "0x82af49447d8a07e3bd95bd0d56f35241523fbab1" ] }, "gasFeePaymentMethod": { "type": "string", "enum": [ "ADD_TO_AMOUNT", "DEDUCT_FROM_AMOUNT" ], "description": "Defines how the fee will be paid: \"ADD_TO_AMOUNT\" adds it to the input amount, while \"DEDUCT_FROM_AMOUNT\" subtracts it from the input amount.", "examples": [ "ADD_TO_AMOUNT" ] }, "tokenIn": { "description": "The address (in hexadecimal format) of the token being swapped from.", "type": "string", "examples": [ "0x2791bca1f2de4661ed88a30c99a7a9449aa84174" ] }, "amountIn": { "type": "string", "description": "The amount of token being swapped from, expressed as a decimal string.", "examples": [ "1.2" ] }, "token0": { "description": "The address (in hexadecimal format) of one of the tokens of the pool.", "type": "string", "examples": [ "0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f" ] }, "token1": { "description": "The address (in hexadecimal format) of the other token of the pool.", "type": "string", "examples": [ "0xaf88d065e77c8cc2239327c5edb3a432268e5831" ] }, "poolFeePercent": { "type": "number", "exclusiveMinimum": 0, "maximum": 100, "description": "Defines the fee earned by providing liquidity. Lower values are recommended for more stable tokens, while higher values are better suited for volatile assets. The values allowed depend on the provider, so check the provider docs too to know which fee tiers are allowed.", "examples": [ 1 ] }, "tickSpacing": { "type": [ "integer", "null" ], "exclusiveMinimum": 0, "maximum": 9007199254740991, "description": "Tick spacing of the pool (`tickSpacing` from the pool list). Part of the pool's identity where the fee alone does not fix it: required for UNISWAP_V4, ignored by the providers that read it from the pool.", "examples": [ 60 ] }, "poolId": { "type": [ "string", "null" ], "pattern": "^[0-9]+-0x([0-9a-fA-F]{40}|[0-9a-fA-F]{64})$", "description": "Optional `id` of the pool from the pool list. When sent, the request fails with POOL_ID_MISMATCH unless the pool it resolves to is this one.", "examples": [ "137-0x5b5bf85e5dc1e76ff90025ac5d8e8595fb575443" ] }, "stake": { "description": "PANCAKESWAP_V3 only: also stake the new position in the pool's MasterChefV3 farm, in the same operation, so it earns CAKE from the start. The wallet approves the staker contract on the position manager once: on the pool's network that approval is part of this operation; coming from another network it is a second, sponsored operation returned as `stakeApprovalUserOperation`. Ignored when the pool has no live farm or `toAddress` is not `walletAddress`. The response's `staked` tells whether the position will be staked.", "type": [ "boolean", "null" ], "examples": [ false ] }, "minPrice": { "type": "number", "minimum": 0, "description": "Minimum price the liquidity will be active. If the price goes below this, the liquidity won't be active and will generate no revenues. This will allow to concentrate the liquidity to a price range, thus enhancing the gains. Price is always `p = token1 / token0`", "examples": [ 83475.12 ] }, "maxPrice": { "type": "number", "minimum": 0, "description": "Maximum price the liquidity will be active. If the price goes above this, the liquidity won't be active and will generate no revenues. This will allow to concentrate the liquidity to a price range, thus enhancing the gains. Price is always `p = token1 / token0`", "examples": [ 102300.5 ] }, "slippage": { "default": 0.5, "description": "Optional parameter controlling the maximum deviation allowed of the expected price of a trade and the actual price at which the trade is executed, with a minimum value of 0.5 and a maximum value of 99, default is 0.5, where 1 unit equals 1%.", "type": "number", "minimum": 0, "maximum": 99, "examples": [ 1.2 ] }, "extraFee": { "description": "Optional extra fee that can be charged in addition to the transaction fee (configured in the dashboard or via `transactionFeePercent`). This extra fee is deducted from the input token and sent to the specified `toAddress`, allowing you to define a custom recipient for this additional charge.", "type": "object", "properties": { "percentage": { "type": "number", "minimum": 0, "maximum": 99.99, "description": "The percentage of the extra fee to be charged", "examples": [ 1.5 ] }, "toAddress": { "description": "The address (in hexadecimal format) receiving the extra fee.", "type": "string", "examples": [ "0x6e397ddf51d9f15dbe0414538e7529f51f2e5464" ] } }, "required": [ "percentage", "toAddress" ] }, "metadata": { "type": "object", "additionalProperties": { "type": "string" }, "description": "Custom metadata. Key-value pairs with string values. Max 1KB size.", "examples": [ { "key": "value" } ] } }, "required": [ "walletAddress", "toAddress", "chainId", "payGasFeeToken", "gasFeePaymentMethod", "tokenIn", "amountIn", "token0", "token1", "poolFeePercent", "minPrice", "maxPrice" ] } ```