---
agentTools:
  projectIndex: https://ociswap.readme.io/llms.txt
---

# Preview for removing liquidity from a pool. Only one of the three optional parameters (input_amount, x_output_amount, y_output_amount) should be specified, and the rest will be calculated and returned based on this value.

Preview for removing liquidity from a pool

# OpenAPI definition

```json
{
  "openapi": "3.0.0",
  "info": {
    "version": "0.6.1",
    "title": "Ociswap API",
    "description": "Ociswap API",
    "license": {
      "name": "MIT License",
      "url": "https://api.ociswap.com/license"
    }
  },
  "servers": [
    {
      "url": "https://api.ociswap.com"
    }
  ],
  "security": [],
  "paths": {
    "/preview/remove-liquidity": {
      "get": {
        "operationId": "remove_liquidity_preview",
        "description": "Preview for removing liquidity from a pool",
        "summary": "Preview for removing liquidity from a pool. Only one of the three optional parameters (input_amount, x_output_amount, y_output_amount) should be specified, and the rest will be calculated and returned based on this value.",
        "parameters": [
          {
            "name": "pool_address",
            "in": "query",
            "description": "The pool address fo the pool to remove liquidity from.",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/ComponentAddress"
            }
          },
          {
            "name": "liquidity_amount",
            "in": "query",
            "description": "The amount of input LP tokens. If left empty, this will be the calculated value.",
            "schema": {
              "$ref": "#/components/schemas/Decimal"
            }
          },
          {
            "name": "x_amount",
            "in": "query",
            "description": "The amount of desired x token. If left empty, this will be the calculated value.",
            "schema": {
              "$ref": "#/components/schemas/Decimal"
            }
          },
          {
            "name": "y_amount",
            "in": "query",
            "description": "The amount of desired y token. If left empty, this will be the calculated value.",
            "schema": {
              "$ref": "#/components/schemas/Decimal"
            }
          },
          {
            "name": "left_bound",
            "in": "query",
            "description": "The left bound of the liquidity range",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "right_bound",
            "in": "query",
            "description": "The right bound of the liquidity range",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PreviewRemoveLiquidity"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "description": "Not found",
            "$ref": "#/components/responses/Error"
          },
          "500": {
            "description": "An unexpected error occured",
            "$ref": "#/components/responses/Error"
          }
        }
      }
    }
  },
  "components": {
    "responses": {
      "Error": {
        "description": "Error response",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "required": [
                "error"
              ],
              "properties": {
                "error": {
                  "type": "string",
                  "description": "Error message"
                }
              }
            }
          }
        }
      }
    },
    "schemas": {
      "ComponentAddress": {
        "description": "Bech32m-encoded human readable version of the component (normal, account, system) global address or hex-encoded id.",
        "type": "string"
      },
      "Decimal": {
        "description": "String-encoded decimal representing the amount of a related fungible resource.",
        "type": "string",
        "format": "decimal"
      },
      "Amounts": {
        "type": "object",
        "properties": {
          "token": {
            "$ref": "#/components/schemas/Decimal"
          },
          "xrd": {
            "$ref": "#/components/schemas/Decimal"
          },
          "usd": {
            "$ref": "#/components/schemas/Decimal"
          }
        }
      },
      "PreviewRemoveLiquidity": {
        "type": "object",
        "properties": {
          "pool_address": {
            "type": "string"
          },
          "liquidity_amount": {
            "$ref": "#/components/schemas/Decimal"
          },
          "x_amount": {
            "$ref": "#/components/schemas/Amounts"
          },
          "y_amount": {
            "$ref": "#/components/schemas/Amounts"
          },
          "left_bound": {
            "type": "integer"
          },
          "right_bound": {
            "type": "integer"
          }
        }
      }
    }
  },
  "x-readme": {
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "_id": {
    "buffer": {
      "0": 101,
      "1": 18,
      "2": 175,
      "3": 145,
      "4": 46,
      "5": 146,
      "6": 246,
      "7": 0,
      "8": 30,
      "9": 1,
      "10": 34,
      "11": 138
    }
  }
}
```