# Change Liquidity URL: /docs/api-reference/liquidity-pools/ChangeLiquidityController_handle_v1 Change the amount of liquidity provided in a liquidity pool ## POST /api/v1/liquidity/change Request: `POST https://api.notus.team/api/v1/liquidity/change` Authentication: send your project's API key in the `x-api-key` header. ```json { "description": "Change the amount of liquidity provided in a liquidity pool", "operationId": "ChangeLiquidityController_handle_v1", "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ChangeLiquidityDTO" } } } }, "responses": { "200": { "description": "Data about the change of 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": "BAD_DEDUCT_FEE_TOKEN", "required": [ "statusCode", "id", "message" ], "properties": { "statusCode": { "type": "number", "description": "HTTP status code", "examples": [ 400 ] }, "id": { "type": "string", "description": "Our ID of the problem", "examples": [ "BAD_DEDUCT_FEE_TOKEN" ] }, "message": { "type": "string", "description": "A human readable message that explains the problem", "examples": [ "You requested to deduct the gas fee from the amounts, but the token given \"0x82af49447d8a07e3bd95bd0d56f35241523fbab1\" is not one of tokens of the pool 0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f,0xaf88d065e77c8cc2239327c5edb3a432268e5831." ] } } }, { "type": "object", "description": "BAD_AMOUNTS", "required": [ "statusCode", "id", "message" ], "properties": { "statusCode": { "type": "number", "description": "HTTP status code", "examples": [ 400 ] }, "id": { "type": "string", "description": "Our ID of the problem", "examples": [ "BAD_AMOUNTS" ] }, "message": { "type": "string", "description": "A human readable message that explains the problem", "examples": [ "The amounts given to change the liquidity can't have one positive and another negative, nor can they be zero." ] } } }, { "type": "object", "description": "LIQUIDITY_AMOUNT_TOO_SMALL_FOR_FEES", "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_AMOUNT_TOO_SMALL_FOR_FEES" ] }, "message": { "type": "string", "description": "A human readable message that explains the problem", "examples": [ "The amount does not cover the fees and the network gas. Increase the amount and try again." ] } } }, { "type": "object", "description": "NOT_SUPPORTED_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_SUPPORTED_TOKENS" ] }, "message": { "type": "string", "description": "A human readable message that explains the problem", "examples": [ "Uniswap V3 does not support these tokens (0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee)." ] } } }, { "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" ] } } } ] } } } }, "404": { "description": "NOT_FOUND", "content": { "application/json": { "schema": { "type": "object", "description": "ACCOUNT_ABSTRACTION_ADDRESS_NOT_REGISTERED_WITH_PROJECT", "required": [ "statusCode", "id", "message" ], "properties": { "statusCode": { "type": "number", "description": "HTTP status code", "examples": [ 404 ] }, "id": { "type": "string", "description": "Our ID of the problem", "examples": [ "ACCOUNT_ABSTRACTION_ADDRESS_NOT_REGISTERED_WITH_PROJECT" ] }, "message": { "type": "string", "description": "A human readable message that explains the problem", "examples": [ "The requested wallet \"0x6e397ddf51d9f15dbe0414538e7529f51f2e5464\" is not registered with the project" ] } } } } } }, "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": "Change Liquidity", "tags": [ "Liquidity Pools" ] } ``` ### Schema ChangeLiquidityDTO ```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" ] }, "walletAddress": { "description": "The wallet address (in hexadecimal format) who owns the liquidity.", "type": "string", "examples": [ "0x6e397ddf51d9f15dbe0414538e7529f51f2e5464" ] }, "chainId": { "description": "The blockchain network where the current liquidity will be modified. \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 ] }, "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" ] }, "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 ] }, "tokenId": { "type": "string", "description": "ID of the NFT that represents the liquidity", "examples": [ "2375619234" ] }, "change": { "anyOf": [ { "type": "object", "properties": { "token0": { "description": "The address (in hexadecimal format) of one of the tokens of the pool. Use `0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee` to pay with the native token (POL, ETH...): the position holds the wrapped token (WPOL, WETH...) and the wrapping is done for you.", "type": "string", "examples": [ "0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f" ] }, "token1": { "description": "The address (in hexadecimal format) of the other token of the pool. Use `0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee` to pay with the native token (POL, ETH...).", "type": "string", "examples": [ "0xaf88d065e77c8cc2239327c5edb3a432268e5831" ] }, "token0Amount": { "type": "string", "description": "The amount of token0 to add to or remove from the liquidity pool, expressed as a decimal string. Negative values are allowed.", "examples": [ "26.2345" ] }, "token1Amount": { "type": "string", "description": "The amount of token1 to add to or remove from the liquidity pool, expressed as a decimal string. Negative values are allowed.", "examples": [ "1823.2" ] } }, "required": [ "token0", "token1", "token0Amount", "token1Amount" ] }, { "type": "object", "properties": { "percentage": { "type": "number", "minimum": 0.01, "maximum": 100, "description": "Reduce the liquidity by a percentage, so if you want to reduce the liquidity by 20% send 20 here. Can't be used to increase liquidity.", "examples": [ 15.5 ] } }, "required": [ "percentage" ] } ] }, "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 ] }, "unwrapNativeToken": { "description": "When removing liquidity, 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 or when adding liquidity.", "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": [ "walletAddress", "chainId", "payGasFeeToken", "gasFeePaymentMethod", "tokenId", "change" ] } ``` ### 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" ] } ```