> ## Documentation Index
> Fetch the complete documentation index at: https://docs.struct.to/llms.txt
> Use this file to discover all available pages before exploring further.

# Quote a liquidity action

> Returns the position preview, token amounts, and approval requirements for adding, removing, collecting, or burning liquidity.

```bash theme={null}
curl -X POST "https://staging-api.struct.to/v1/trading/liquidity/quote?fields=short" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"chain_id":8453,"wallet_address":"0x12a371444CCeBb6B64Cc35EBbC70d1d998433d51","protocol":"uniswap_v4","operation":"mint_position","pool_id":"0x1111111111111111111111111111111111111111111111111111111111111111","tick_lower":-180,"tick_upper":60,"amount0_max_raw":"1500000000000000000","amount1_max_raw":"3700000000","slippage_bps":50}'
```

```json Response (Long) theme={null}
{
  "protocol": "uniswap_v4",
  "operation": "mint_position",
  "warnings": [
    "Execute Permit2 approvals before supplying liquidity."
  ],
  "position": {
    "protocol": "uniswap_v4",
    "pool_id": "0x1111111111111111111111111111111111111111111111111111111111111111",
    "currency0": "0x0000000000000000000000000000000000000000",
    "currency1": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
    "fee": 3000,
    "tick_spacing": 60,
    "hooks": "0x0000000000000000000000000000000000000000",
    "tick_lower": -180,
    "tick_upper": 60,
    "liquidity_raw": "250000000",
    "amount0_max_raw": "1500000000000000000",
    "amount1_max_raw": "3700000000",
    "current_tick": -120,
    "sqrt_price_x96": "12345678901234567890",
    "active_liquidity_raw": "1000000000"
  },
  "permit2_approvals": [
    {
      "token": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
      "permit2": "0x000000000022D473030F116dDEE9F6B43aC78BA3",
      "spender": "0x1f7d7550B1b028f7571E69A784071F0205FD2EfA",
      "amount": "3700000000",
      "expiration_unix_seconds": 1784265827
    }
  ],
  "expires_at": "2026-09-21T13:10:00Z"
}
```

```jsonc Response (Short) theme={null}
{
  "pr": "uniswap_v4",
  "op": "mint_position",
  "w": [
    "Execute Permit2 approvals before supplying liquidity."
  ],
  "pos": {
    "pr": "uniswap_v4",
    "p": "0x1111111111111111111111111111111111111111111111111111111111111111",
    "c0": "0x0000000000000000000000000000000000000000",
    "c1": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
    "f": 3000,
    "ts": 60,
    "h": "0x0000000000000000000000000000000000000000",
    "tl": -180,
    "tu": 60,
    "lq": "250000000",
    "a0x": "1500000000000000000",
    "a1x": "3700000000",
    "ctk": -120,
    "sp": "12345678901234567890",
    "al": "1000000000"
  },
  "p2": [
    {
      "tk": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
      "p2": "0x000000000022D473030F116dDEE9F6B43aC78BA3",
      "sp": "0x1f7d7550B1b028f7571E69A784071F0205FD2EfA",
      "a": "3700000000",
      "ex": 1784265827
    }
  ],
  "ea": "2026-09-21T13:10:00Z"
}
```


## OpenAPI

````yaml onchain-openapi.json POST /trading/liquidity/quote
openapi: 3.1.0
info:
  title: Struct On-chain API
  description: >-
    RESTful API for token market data, discovery, holders, audits, and trader
    analytics across supported chains. Pass `fields=short` or header
    `x-field-names: short` for abbreviated keys. HTTP defaults to `long`. Token
    candlesticks, token trades and wallet batch trades also support
    `fields=array` for typed positional rows.
  version: 1.0.0
servers:
  - url: https://staging-api.struct.to/v1
    description: Staging
security:
  - ApiKey: []
paths:
  /trading/liquidity/quote:
    post:
      tags:
        - DEX Trading
      summary: Quote a liquidity action
      description: >-
        Returns the position preview, token amounts, and approval requirements
        for adding, removing, collecting, or burning liquidity.
      operationId: post_dex_trading_liquidity_quote
      parameters:
        - name: x-field-names
          in: header
          required: false
          description: >-
            Select long (full) or short (abbreviated) field names. HTTP defaults
            to `long`. Takes precedence over `fields`. See [Response
            Format](/api-reference/response-format#long-and-short-field-names).
          schema:
            type: string
            enum:
              - long
              - short
            default: long
          example: short
        - name: fields
          in: query
          required: false
          description: >-
            Same as `x-field-names`. Use `long` or `short`. HTTP defaults to
            `long`. Ignored when the header is set. `field_names` is accepted as
            an alias.
          schema:
            type: string
            enum:
              - long
              - short
            default: long
          example: short
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LiquidityTransactionBuildRequest'
            example:
              chain_id: 8453
              wallet_address: '0x12a371444CCeBb6B64Cc35EBbC70d1d998433d51'
              protocol: uniswap_v4
              operation: mint_position
              pool_id: >-
                0x1111111111111111111111111111111111111111111111111111111111111111
              tick_lower: -180
              tick_upper: 60
              amount0_max_raw: '1500000000000000000'
              amount1_max_raw: '3700000000'
              slippage_bps: 50
        required: true
      responses:
        '200':
          description: Liquidity action preview
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LiquidityQuoteResponse'
              examples:
                long:
                  summary: Response (Long)
                  value:
                    protocol: uniswap_v4
                    operation: mint_position
                    warnings:
                      - Execute Permit2 approvals before supplying liquidity.
                    position:
                      protocol: uniswap_v4
                      pool_id: >-
                        0x1111111111111111111111111111111111111111111111111111111111111111
                      currency0: '0x0000000000000000000000000000000000000000'
                      currency1: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913'
                      fee: 3000
                      tick_spacing: 60
                      hooks: '0x0000000000000000000000000000000000000000'
                      tick_lower: -180
                      tick_upper: 60
                      liquidity_raw: '250000000'
                      amount0_max_raw: '1500000000000000000'
                      amount1_max_raw: '3700000000'
                      current_tick: -120
                      sqrt_price_x96: '12345678901234567890'
                      active_liquidity_raw: '1000000000'
                    permit2_approvals:
                      - token: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913'
                        permit2: '0x000000000022D473030F116dDEE9F6B43aC78BA3'
                        spender: '0x1f7d7550B1b028f7571E69A784071F0205FD2EfA'
                        amount: '3700000000'
                        expiration_unix_seconds: 1784265827
                    expires_at: '2026-09-21T13:10:00Z'
                short:
                  summary: Response (Short)
                  value:
                    pr: uniswap_v4
                    op: mint_position
                    w:
                      - Execute Permit2 approvals before supplying liquidity.
                    pos:
                      pr: uniswap_v4
                      p: >-
                        0x1111111111111111111111111111111111111111111111111111111111111111
                      c0: '0x0000000000000000000000000000000000000000'
                      c1: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913'
                      f: 3000
                      ts: 60
                      h: '0x0000000000000000000000000000000000000000'
                      tl: -180
                      tu: 60
                      lq: '250000000'
                      a0x: '1500000000000000000'
                      a1x: '3700000000'
                      ctk: -120
                      sp: '12345678901234567890'
                      al: '1000000000'
                    p2:
                      - tk: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913'
                        p2: '0x000000000022D473030F116dDEE9F6B43aC78BA3'
                        sp: '0x1f7d7550B1b028f7571E69A784071F0205FD2EfA'
                        a: '3700000000'
                        ex: 1784265827
                    ea: '2026-09-21T13:10:00Z'
        '400':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DexTradingErrorEnvelope'
        '501':
          description: No liquidity route available for the requested operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DexTradingErrorEnvelope'
components:
  schemas:
    LiquidityTransactionBuildRequest:
      type: object
      required:
        - chain_id
        - wallet_address
        - protocol
        - operation
        - pool_id
      properties:
        chain_id:
          $ref: '#/components/schemas/TradingChainId'
          description: Chain id. Use `-1` for Solana or an EVM chain id such as `4663`.
        wallet_address:
          type: string
          description: >-
            Wallet that owns the position or supplies tokens and signs the
            returned transaction.
        recipient_address:
          type:
            - string
            - 'null'
          description: >-
            Wallet that receives position NFTs or collected tokens. Defaults to
            `wallet_address`.
        protocol:
          $ref: '#/components/schemas/LiquidityProtocol'
          description: Liquidity protocol to build for.
        operation:
          $ref: '#/components/schemas/LiquidityOperation'
          description: Liquidity action to build.
        pool_id:
          type: string
          description: Uniswap V4 pool id as a 32-byte hex string.
        tick_lower:
          type:
            - integer
            - 'null'
          format: int32
          description: Lower tick for minting or increasing a position.
        tick_upper:
          type:
            - integer
            - 'null'
          format: int32
          description: Upper tick for minting or increasing a position.
        token_id:
          type:
            - string
            - 'null'
          description: >-
            Position NFT token id for increasing, decreasing, collecting, or
            burning.
        liquidity_raw:
          type:
            - string
            - 'null'
          description: >-
            Position liquidity amount. Required for direct increase/decrease
            unless amount caps are supplied for add operations.
        amount0_max_raw:
          type:
            - string
            - 'null'
          description: Maximum token0 amount the transaction may spend.
        amount1_max_raw:
          type:
            - string
            - 'null'
          description: Maximum token1 amount the transaction may spend.
        amount0_min_raw:
          type:
            - string
            - 'null'
          description: Minimum token0 amount to receive when decreasing or burning.
        amount1_min_raw:
          type:
            - string
            - 'null'
          description: Minimum token1 amount to receive when decreasing or burning.
        liquidity_percentage_bps:
          type:
            - integer
            - 'null'
          format: int32
          description: >-
            Percentage of current position liquidity to remove, in basis points.
            `10000` means 100%.
          minimum: 0
        slippage_bps:
          type:
            - integer
            - 'null'
          format: int32
          description: >-
            Slippage tolerance in basis points, included in previews and
            guardrails.
          minimum: 0
        hook_data:
          type:
            - string
            - 'null'
          description: Optional data passed to pool hooks.
        deadline_unix_seconds:
          type:
            - integer
            - 'null'
          format: int64
          description: Optional execution deadline in Unix seconds.
          minimum: 0
        idempotency_key:
          type:
            - string
            - 'null'
          description: Caller-supplied key used to make repeated requests safe.
        metadata:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/TradeRequestMetadata'
              description: Caller metadata echoed in tracking records.
    LiquidityQuoteResponse:
      type: object
      required:
        - protocol
        - operation
        - position
        - permit2_approvals
        - expires_at
        - warnings
      properties:
        protocol:
          $ref: '#/components/schemas/LiquidityProtocol'
        operation:
          $ref: '#/components/schemas/LiquidityOperation'
        position:
          $ref: '#/components/schemas/LiquidityPositionPreview'
        permit2_approvals:
          type: array
          items:
            $ref: '#/components/schemas/EvmPermit2AllowanceRequirement'
        expires_at:
          type: string
          format: date-time
        warnings:
          type: array
          items:
            type: string
    DexTradingErrorEnvelope:
      type: object
      required:
        - success
        - message
        - error_code
        - category
        - retryable
        - data
        - info
      properties:
        success:
          type: boolean
        message:
          type: string
        error_code:
          type: string
        category:
          type: string
        retryable:
          type: boolean
        data:
          type: 'null'
          description: Errors have no response data; this field is always null.
        info:
          $ref: '#/components/schemas/DexTradingErrorInfo'
    TradingChainId:
      type: integer
      format: int64
      example: 4663
    LiquidityProtocol:
      type: string
      enum:
        - uniswap_v4
    LiquidityOperation:
      type: string
      enum:
        - mint_position
        - increase_liquidity
        - decrease_liquidity
        - collect_fees
        - burn_position
    TradeRequestMetadata:
      type: object
      properties:
        reference_id:
          type:
            - string
            - 'null'
          description: Caller-side order, quote, or request identifier.
        source:
          type:
            - string
            - 'null'
          description: Client application or integration label.
        user_id:
          type:
            - string
            - 'null'
          description: Caller-side user identifier.
        account_id:
          type:
            - string
            - 'null'
          description: Caller-side wallet or account grouping identifier.
        attributes:
          type:
            - object
            - 'null'
          description: Additional caller-defined string attributes.
          additionalProperties:
            type: string
          propertyNames:
            type: string
    LiquidityPositionPreview:
      type: object
      required:
        - protocol
        - pool_id
        - currency0
        - currency1
        - fee
        - tick_spacing
        - hooks
      properties:
        protocol:
          $ref: '#/components/schemas/LiquidityProtocol'
        pool_id:
          type: string
        currency0:
          type: string
        currency1:
          type: string
        fee:
          type: integer
          format: int32
          minimum: 0
        tick_spacing:
          type: integer
          format: int32
        hooks:
          type: string
        tick_lower:
          type:
            - integer
            - 'null'
          format: int32
        tick_upper:
          type:
            - integer
            - 'null'
          format: int32
        token_id:
          type:
            - string
            - 'null'
        liquidity_raw:
          type:
            - string
            - 'null'
        amount0_max_raw:
          type:
            - string
            - 'null'
        amount1_max_raw:
          type:
            - string
            - 'null'
        amount0_min_raw:
          type:
            - string
            - 'null'
        amount1_min_raw:
          type:
            - string
            - 'null'
        current_tick:
          type:
            - integer
            - 'null'
          format: int32
        sqrt_price_x96:
          type:
            - string
            - 'null'
        active_liquidity_raw:
          type:
            - string
            - 'null'
    EvmPermit2AllowanceRequirement:
      type: object
      required:
        - token
        - permit2
        - spender
        - amount
      properties:
        token:
          type: string
        permit2:
          type: string
        spender:
          type: string
        amount:
          type: string
        expiration_unix_seconds:
          type:
            - integer
            - 'null'
          format: int64
          minimum: 0
    DexTradingErrorInfo:
      type: object
      required:
        - version
        - credits_consumed
        - compute_time_ms
      properties:
        version:
          type: string
        credits_consumed:
          type: integer
          format: int32
          minimum: 0
        compute_time_ms:
          type: number
          format: float
  securitySchemes:
    ApiKey:
      type: apiKey
      in: header
      name: X-API-Key
      description: Secret API key (`sk_*`) or JWT public key (`pk_jwt_*`).

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.