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

# Get positions

> Get a wallet's open perps positions for one or more providers.

This is a read that uses `POST` with a JSON body. Send `address` and at least one of `providerId` or `providerIds` (up to 10); when both are set, results include all listed providers. Each position carries `pendingActions`, pre-filled actions you can pass to [Execute an action](https://docs.yield.xyz/api-reference/perps-api/actions/execute-action.md). Field meanings are in [Position fields](https://docs.yield.xyz/api-reference/perps-api/objects.md#position-fields).


## OpenAPI

````yaml openapi-perps.json POST /v1/positions
openapi: 3.0.0
info:
  title: 'Yield API: Trade (Perps)'
  description: >-
    API Documentation. Errors follow a uniform envelope with `details.code` from
    the public catalog (https://docs.yield.xyz). ValidationPipe failures use
    `validation.message: string[]`.
  version: '1.0'
  contact: {}
servers:
  - url: https://perps.yield.xyz
    description: Production
security: []
tags:
  - name: Discovery
    description: Browse and discover perps markets, networks, and providers
  - name: Portfolio
    description: User-specific positions, orders, and balances
  - name: Actions
    description: Generate transactions to open, close, and manage positions
externalDocs:
  description: For more information
  url: https://docs.yield.xyz
paths:
  /v1/positions:
    post:
      tags:
        - Portfolio
        - Portfolio
      summary: Get positions
      description: >-
        Retrieve active positions for a wallet address. Pass providerId or
        providerIds (one or more providers).
      operationId: PortfolioController_getPositions_v1
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PortfolioRequestDto'
      responses:
        '200':
          description: User positions
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/PositionDto'
        '401':
          description: Invalid or missing API key
          content:
            application/json:
              schema:
                type: object
                properties:
                  statusCode:
                    type: number
                    example: 401
                  timestamp:
                    type: string
                    example: '2026-05-04T12:00:00.000Z'
                  path:
                    type: string
                    example: /v1/actions
                  message:
                    type: string
                    example: Invalid API key
                  details:
                    type: object
                    properties:
                      message:
                        type: string
                        example: Invalid API key
                      code:
                        type: string
                        example: AUTH_INVALID_API_KEY
        '429':
          description: Rate limit exceeded
          headers:
            x-ratelimit-limit:
              description: Request limit per window
              schema:
                type: string
            x-ratelimit-remaining:
              description: Remaining requests (will be 0)
              schema:
                type: string
            x-ratelimit-reset:
              description: Unix timestamp when window resets
              schema:
                type: string
            retry-after:
              description: Seconds to wait before retrying
              schema:
                type: string
          content:
            application/json:
              schema:
                type: object
                properties:
                  statusCode:
                    type: number
                    example: 429
                  timestamp:
                    type: string
                    example: '2026-05-04T12:00:00.000Z'
                  path:
                    type: string
                    example: /v1/actions
                  message:
                    type: string
                    example: Rate limit exceeded
                  details:
                    type: object
                    properties:
                      message:
                        type: string
                        example: Rate limit exceeded
                      code:
                        type: string
                        example: RATE_LIMIT_EXCEEDED
                      error:
                        type: string
                        example: Too Many Requests
                      retryAfter:
                        type: number
                        example: 30
      security:
        - ApiKey: []
components:
  schemas:
    PortfolioRequestDto:
      type: object
      properties:
        providerId:
          type: string
          description: >-
            Single provider identifier. At least one of providerId or
            providerIds must be provided.
          example: hyperliquid
          enum:
            - hyperliquid
            - hyperliquid-xyz
        providerIds:
          type: array
          description: >-
            Filter by multiple providers (CSV, repeated query params, or JSON
            array). At least one of providerId or providerIds must be provided.
            When both providerId and providerIds are set, results include all
            listed providers.
          example:
            - hyperliquid
            - hyperliquid-xyz
          items:
            type: string
            enum:
              - hyperliquid
              - hyperliquid-xyz
        address:
          type: string
          description: User wallet address
          example: 0x1234...
      required:
        - address
    PositionDto:
      type: object
      properties:
        marketId:
          type: string
          description: Market ID
          example: hyperliquid-eth-usdc
        side:
          description: Position side
          example: long
          allOf:
            - $ref: '#/components/schemas/PositionSide'
        size:
          type: string
          description: Position size in base asset
          example: '0.215'
        entryPrice:
          type: number
          description: Entry price
          example: 4000
        markPrice:
          type: number
          description: Current mark price
          example: 3975
        leverage:
          type: number
          description: Leverage multiplier
          example: 20
        marginMode:
          description: Margin mode
          example: isolated
          allOf:
            - $ref: '#/components/schemas/MarginMode'
        margin:
          type: number
          description: Margin amount
          example: 43
        unrealizedPnl:
          type: number
          description: Unrealized PnL from price movement
          example: 5.38
        funding:
          type: number
          description: >-
            Net cumulative funding received (positive) or paid (negative) since
            open
          example: -1.24
        liquidationPrice:
          type: number
          description: Liquidation price
          example: 4200
        pendingActions:
          description: Available actions for this position
          type: array
          items:
            $ref: '#/components/schemas/PendingActionDto'
      required:
        - marketId
        - side
        - size
        - entryPrice
        - markPrice
        - leverage
        - marginMode
        - margin
        - unrealizedPnl
        - funding
        - liquidationPrice
        - pendingActions
    PositionSide:
      type: string
      enum:
        - long
        - short
      description: Position side
    MarginMode:
      type: string
      enum:
        - cross
        - isolated
      description: Margin mode
    PendingActionDto:
      type: object
      properties:
        type:
          description: Action type
          example: close
          allOf:
            - $ref: '#/components/schemas/PerpActionTypes'
        label:
          type: string
          description: Action label
          example: Close Position
        args:
          description: Pre-filled arguments for the action
          example:
            marketId: hyperliquid-eth-usdc
          allOf:
            - $ref: '#/components/schemas/ArgumentsDto'
      required:
        - type
        - label
        - args
    PerpActionTypes:
      type: string
      enum:
        - open
        - close
        - updateLeverage
        - stopLoss
        - takeProfit
        - cancelOrder
        - editOrder
        - fund
        - withdraw
        - approveAgent
        - approveBuilderFee
        - updateMargin
        - setTpAndSl
        - setUnifiedAccount
      description: Supported action types
    ArgumentsDto:
      type: object
      properties:
        marketId:
          type: string
          description: Market identifier
          example: hyperliquid-eth-usdc
        side:
          description: Position side - long (buy) or short (sell)
          example: long
          allOf:
            - $ref: '#/components/schemas/PositionSide'
        amount:
          type: string
          description: 'Margin/collateral amount in USD (alternative to size). Min: $10'
          example: '100'
        size:
          type: string
          description: 'Position size in USD (alternative to amount). Min: $10'
          example: '1000'
        leverage:
          type: number
          description: Leverage multiplier
          example: 10
        marginMode:
          description: >-
            Margin mode - isolated (dedicated collateral) or cross (shared
            collateral)
          example: isolated
          allOf:
            - $ref: '#/components/schemas/MarginMode'
        limitPrice:
          type: number
          description: >-
            Limit price. If provided, order will be placed as a limit order at
            this price. If not provided, order executes immediately as a market
            order.
          example: 2000
        stopLossPrice:
          type: number
          description: Stop loss trigger price
          example: 1800
        takeProfitPrice:
          type: number
          description: Take profit trigger price
          example: 2200
        orderId:
          type: string
          description: >-
            Order ID (for cancelOrder, or for updating existing
            stopLoss/takeProfit)
          example: '12345'
        orderIds:
          description: Order IDs for batch cancelOrder
          example:
            - '12345'
            - '67890'
          type: array
          items:
            type: string
        assetIndex:
          type: number
          description: Asset index (internal)
          example: 0
        fromToken:
          description: >-
            Source token for cross-chain funding (bridge/swap from another
            chain)
          allOf:
            - $ref: '#/components/schemas/TokenIdentifierDto'
        agentAddress:
          type: string
          description: Agent wallet address to approve (for approveAgent action)
          example: '0x1234567890abcdef1234567890abcdef12345678'
        agentName:
          type: string
          description: >-
            Name for the agent wallet (for approveAgent action). If not
            provided, defaults to "key".
          example: My Trading Bot
        validUntil:
          type: number
          description: >-
            Unix timestamp (seconds) when agent approval expires. If not
            provided, never expires.
          example: 1735689600
        stopLossOrderId:
          type: string
          description: >-
            Existing stop loss order ID (for updating via SET_TP_AND_SL bundled
            action)
          example: '12345'
        takeProfitOrderId:
          type: string
          description: >-
            Existing take profit order ID (for updating via SET_TP_AND_SL
            bundled action)
          example: '12346'
        skipApproval:
          type: boolean
          description: Skip the ERC20 approval transaction.
          example: true
        fundingMethod:
          description: >-
            Funding method: "bridge2" for direct Hyperliquid Bridge2 (Arbitrum
            USDC only), "lifi" for LiFi bridging (any token/network). If not
            provided, defaults to bridge2 for Arbitrum USDC and lifi for others.
          example: bridge2
          allOf:
            - $ref: '#/components/schemas/FundingMethod'
        enabled:
          type: boolean
          description: >-
            Enable or disable Unified Account Mode (setUnifiedAccount action).
            When true, collateral is unified across Hyperliquid venues.
          example: true
    TokenIdentifierDto:
      type: object
      properties:
        network:
          description: The blockchain network where the token is located
          example: ethereum
          allOf:
            - $ref: '#/components/schemas/Networks'
        address:
          type: string
          description: Token contract address. Leave empty for native tokens like ETH.
          example: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48'
      required:
        - network
    FundingMethod:
      type: string
      enum:
        - bridge2
        - lifi
      description: >-
        Funding method: "bridge2" for direct Hyperliquid Bridge2 (Arbitrum USDC
        only), "lifi" for LiFi bridging (any token/network). If not provided,
        defaults to bridge2 for Arbitrum USDC and lifi for others.
    Networks:
      type: string
      enum:
        - ethereum
        - ethereum-goerli
        - ethereum-holesky
        - ethereum-sepolia
        - ethereum-hoodi
        - arbitrum
        - base
        - base-sepolia
        - gnosis
        - optimism
        - polygon
        - polygon-amoy
        - starknet
        - zksync
        - linea
        - unichain
        - plume
        - monad-testnet
        - monad
        - robinhood
        - robinhood-testnet
        - arc-testnet
        - arc
        - avalanche-c
        - avalanche-c-atomic
        - avalanche-p
        - binance
        - celo
        - fantom
        - harmony
        - moonriver
        - okc
        - viction
        - core
        - sonic
        - plasma
        - katana
        - hyperevm
        - tempo
        - pharos
        - agoric
        - akash
        - axelar
        - band-protocol
        - bitsong
        - canto
        - chihuahua
        - comdex
        - coreum
        - cosmos
        - crescent
        - cronos
        - cudos
        - desmos
        - dydx
        - evmos
        - fetch-ai
        - gravity-bridge
        - injective
        - irisnet
        - juno
        - kava
        - ki-network
        - mars-protocol
        - nym
        - okex-chain
        - onomy
        - osmosis
        - persistence
        - quicksilver
        - regen
        - secret
        - sentinel
        - sommelier
        - stafi
        - stargaze
        - stride
        - teritori
        - tgrade
        - umee
        - sei
        - mantra
        - celestia
        - saga
        - zetachain
        - dymension
        - humansai
        - neutron
        - polkadot
        - kusama
        - westend
        - bittensor
        - aptos
        - binancebeacon
        - cardano
        - near
        - solana
        - solana-devnet
        - stellar
        - stellar-testnet
        - sui
        - tezos
        - tron
        - ton
        - ton-testnet
        - hyperliquid
      description: Blockchain network
  securitySchemes:
    ApiKey:
      type: apiKey
      in: header
      name: x-api-key

````

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