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

# Get user portfolio with all pools containing closed positions

> Returns a paginated list of pools where the user has closed positions,
sorted by most recent activity (last_closed_at DESC). The response includes:
- Pool metadata (address, token symbols, icons, fees)
- Aggregated PnL data (deposits, withdrawals, fees, total PnL)
- Per-token breakdowns (X and Y)

For detailed position history within each pool, call the /positions/{pool_address}/pnl endpoint.



# Arguments

* `user` - The wallet address of the user
* `page` - Page number for pagination (default: 1)
* `page_size` - Number of pools per page (default: 120, max: 365)
* `days_back` - Only include pools with positions closed within this many days (default: 90)

# Returns

* `200` - The user's portfolio with pool metadata and aggregated PnL
* `400` - Invalid user address or query parameters



## OpenAPI

````yaml /developer-guides/dlmm/api-reference/openapi.json get /portfolio
openapi: 3.1.0
info:
  title: DLMM API
  description: >-
    Indexed DLMM data for pools, portfolios, positions, limit orders, wallets,
    and protocol stats.
  license:
    name: ''
  version: 0.1.0
servers:
  - url: https://dlmm.datapi.meteora.ag
    description: Production
  - url: https://dlmm.dev.metdev.io
    description: Development
security: []
paths:
  /portfolio:
    get:
      tags:
        - Portfolio
      summary: Get user portfolio with all pools containing closed positions
      description: >-
        Returns a paginated list of pools where the user has closed positions,

        sorted by most recent activity (last_closed_at DESC). The response
        includes:

        - Pool metadata (address, token symbols, icons, fees)

        - Aggregated PnL data (deposits, withdrawals, fees, total PnL)

        - Per-token breakdowns (X and Y)


        For detailed position history within each pool, call the
        /positions/{pool_address}/pnl endpoint.




        # Arguments


        * `user` - The wallet address of the user

        * `page` - Page number for pagination (default: 1)

        * `page_size` - Number of pools per page (default: 120, max: 365)

        * `days_back` - Only include pools with positions closed within this
        many days (default: 90)


        # Returns


        * `200` - The user's portfolio with pool metadata and aggregated PnL

        * `400` - Invalid user address or query parameters
      operationId: get_user_portfolio
      parameters:
        - name: user
          in: query
          description: User's wallet address
          required: true
          schema:
            type: string
        - name: page
          in: query
          description: 'Page number for pagination (minimum: 1, default: 1)'
          required: false
          schema:
            type: integer
            format: int32
            minimum: 0
        - name: page_size
          in: query
          description: 'Page size for pagination (default: 20, maximum: 50)'
          required: false
          schema:
            type: integer
            format: int32
            minimum: 0
        - name: days_back
          in: query
          description: |-
            Only include pools with positions closed within this many days
            Applied only for closed positions
            (minimum: 1, maximum: 365, default: 120)
          required: false
          schema:
            type: integer
            format: int32
            minimum: 0
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetPortfolioResponse'
components:
  schemas:
    GetPortfolioResponse:
      type: object
      description: User portfolio response with aggregated pool data
      required:
        - page
        - pageSize
        - hasNext
        - totalCount
        - totalPositions
        - pools
      properties:
        hasNext:
          type: boolean
        page:
          type: integer
          format: int32
          minimum: 0
        pageSize:
          type: integer
          format: int32
          minimum: 0
        pools:
          type: array
          items:
            $ref: '#/components/schemas/PoolPortfolioItem'
        totalCount:
          type: integer
          format: int64
          minimum: 0
        totalPositions:
          type: integer
          format: int64
          description: Total number of closed positions across all pools
          minimum: 0
    PoolPortfolioItem:
      type: object
      description: Aggregated portfolio data for a single pool
      required:
        - poolAddress
        - binStep
        - baseFee
        - collectFeeMode
        - tokenXMint
        - tokenYMint
        - tokenXIcon
        - tokenYIcon
        - tokenX
        - tokenY
        - totalDeposit
        - totalDepositSol
        - totalWithdrawal
        - totalWithdrawalSol
        - totalFee
        - totalFeeSol
        - pnlUsd
        - pnlSol
        - pnlPctChange
        - pnlSolPctChange
        - totalDepositTokenX
        - totalDepositTokenXUsd
        - totalDepositTokenXSol
        - totalWithdrawalTokenX
        - totalWithdrawalTokenXUsd
        - totalWithdrawalTokenXSol
        - totalFeeTokenX
        - totalFeeTokenXUsd
        - totalFeeTokenXSol
        - totalDepositTokenY
        - totalDepositTokenYUsd
        - totalDepositTokenYSol
        - totalWithdrawalTokenY
        - totalWithdrawalTokenYUsd
        - totalWithdrawalTokenYSol
        - totalFeeTokenY
        - totalFeeTokenYUsd
        - totalFeeTokenYSol
      properties:
        baseFee:
          type: string
        binStep:
          type: string
        collectFeeMode:
          type: integer
          format: int32
          minimum: 0
        lastClosedAt:
          type:
            - integer
            - 'null'
          format: int64
        pnlPctChange:
          type: string
          description: PnL percent change (USD)
        pnlSol:
          type: string
          description: Total PnL in SOL (historical per-event SOL price)
        pnlSolPctChange:
          type: string
          description: PnL percent change (SOL)
        pnlUsd:
          type: string
          description: Total PnL in USD, including realized and unrealized
        poolAddress:
          type: string
        tokenX:
          type: string
        tokenXIcon:
          type: string
        tokenXMint:
          type: string
        tokenY:
          type: string
        tokenYIcon:
          type: string
        tokenYMint:
          type: string
        totalDeposit:
          type: string
          description: Total deposit in USD
        totalDepositSol:
          type: string
          description: Total deposit in SOL (historical per-event SOL price)
        totalDepositTokenX:
          type: string
        totalDepositTokenXSol:
          type: string
        totalDepositTokenXUsd:
          type: string
        totalDepositTokenY:
          type: string
        totalDepositTokenYSol:
          type: string
        totalDepositTokenYUsd:
          type: string
        totalFee:
          type: string
          description: Total claim fee in USD
        totalFeeSol:
          type: string
          description: Total claim fee in SOL (historical per-event SOL price)
        totalFeeTokenX:
          type: string
        totalFeeTokenXSol:
          type: string
        totalFeeTokenXUsd:
          type: string
        totalFeeTokenY:
          type: string
        totalFeeTokenYSol:
          type: string
        totalFeeTokenYUsd:
          type: string
        totalWithdrawal:
          type: string
          description: Total withdrawal in USD
        totalWithdrawalSol:
          type: string
          description: Total withdrawal in SOL (historical per-event SOL price)
        totalWithdrawalTokenX:
          type: string
        totalWithdrawalTokenXSol:
          type: string
        totalWithdrawalTokenXUsd:
          type: string
        totalWithdrawalTokenY:
          type: string
        totalWithdrawalTokenYSol:
          type: string
        totalWithdrawalTokenYUsd:
          type: string

````