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

# Get position by ID

> Handles `GET /v1/positions/{position_id}` via `get.v1.positions.by_position_id`.



## OpenAPI

````yaml /openapi/phoenix-public-api.json get /v1/positions/{position_id}
openapi: 3.1.0
info:
  title: Phoenix Eternal API
  description: >-
    RESTful API for accessing Phoenix Eternal perpetual trading data. Provides
    real-time orderbook levels, asset information, and market metadata.
  termsOfService: https://www.phoenix.trade/terms-of-service
  contact:
    name: Phoenix Development Team
    url: https://github.com/Ellipsis-Labs/phoenix
  license:
    name: Proprietary
  version: 1.0.0
servers:
  - url: https://perp-api.phoenix.trade
    description: Phoenix Eternal Perp API
security: []
tags:
  - name: Auth
    description: Wallet and session authentication.
  - name: Exchange
    description: Exchange, market, candle, and no-referral register-instruction workflows.
  - name: Invite
    description: Invite validation, referral activation, and wallet allowlist checks.
  - name: Notifications
    description: Trader notification reads and acknowledgement helpers.
  - name: Trader
    description: Trader state, account history, and transaction builders.
externalDocs:
  url: https://docs.phoenix.trade
  description: Phoenix developer documentation
paths:
  /v1/positions/{position_id}:
    get:
      tags:
        - Trader
      summary: Get position by ID
      description: >-
        Handles `GET /v1/positions/{position_id}` via
        `get.v1.positions.by_position_id`.
      operationId: get.v1.positions.by_position_id
      parameters:
        - name: position_id
          in: path
          description: Position id
          required: true
          schema:
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PositionSummary'
          description: Successful response
components:
  schemas:
    PositionSummary:
      type: object
      description: >-
        One position of one subaccount: from the trade that left the market flat

        (or reversed the previous position) to the trade that next made it flat
        or

        reversed it.


        Size amounts are in base units and money amounts in USD, as decimal

        strings. PnL terms are signed; `fees` is what the trader paid, negative

        for net rebates; `netPnl = realizedPnl + fundingPayment - fees`. For an

        open position every amount covers the trades so far and excludes

        unrealized PnL.
      required:
        - positionId
        - userPubkey
        - traderPdaIndex
        - subaccountIndex
        - marketSymbol
        - side
        - status
        - openedAt
        - openKey
        - entrySize
        - avgEntryPrice
        - exitSize
        - peakSize
        - realizedPnl
        - fundingPayment
        - fees
        - netPnl
        - complete
      properties:
        avgEntryPrice:
          type: string
        avgExitPrice:
          type:
            - string
            - 'null'
          description: '`None` until the position is reduced.'
        closeKey:
          oneOf:
            - $ref: '#/components/schemas/TradeKey'
              description: >-
                The trade that closed the position; the position's trades are
                those

                from `openKey` through `closeKey` in its subaccount and market.
            - type: 'null'
        closeReason:
          oneOf:
            - $ref: '#/components/schemas/PositionCloseReason'
            - type: 'null'
        closedAt:
          type:
            - string
            - 'null'
          format: date-time
        complete:
          type: boolean
          description: |-
            `false` when the recorded history does not account for the whole
            position; amounts then cover only the recorded part.
        entrySize:
          type: string
          description: Total size bought (long) or sold (short) into the position.
        exitSize:
          type: string
          description: Total size traded out of the position.
        fees:
          type: string
        fundingPayment:
          type: string
        marketSymbol:
          type: string
        netPnl:
          type: string
        openKey:
          $ref: '#/components/schemas/TradeKey'
          description: The trade that opened the position.
        openedAt:
          type: string
          format: date-time
        peakSize:
          type: string
          description: Largest size held at any point.
        positionId:
          type: string
          description: Stable identifier of the position.
        realizedPnl:
          type: string
        reversedFrom:
          type:
            - string
            - 'null'
          description: The position this one reversed out of.
        reversedInto:
          type:
            - string
            - 'null'
          description: The position this one reversed into.
        side:
          $ref: '#/components/schemas/PositionSide'
        status:
          $ref: '#/components/schemas/PositionStatus'
        subaccountIndex:
          type: integer
          format: int32
          description: Subaccount holding the position; 0 is the cross account.
        traderPdaIndex:
          type: integer
          format: int32
        tradesCursor:
          type:
            - string
            - 'null'
          description: >-
            `cursor` for `trades_v2` whose first page starts at `closeKey` and
            goes

            back in time; `None` while the position is open.
        userPubkey:
          type: string
          description: Wallet of the user whose trader holds the position (base58 encoded).
    TradeKey:
      type: object
      description: |-
        Coordinates of one of a trader's trades, shared with the `slot`,
        `slotIndex` and `eventIndex` of `trades_v2`.
      required:
        - slot
        - slotIndex
        - eventIndex
      properties:
        eventIndex:
          type: integer
          format: int32
        slot:
          type: integer
          format: int64
        slotIndex:
          type: integer
          format: int32
    PositionCloseReason:
      type: string
      description: How a closed position ended.
      enum:
        - closed
        - reversed
        - liquidated
        - adl
        - marketSettled
        - takeProfit
        - stopLoss
    PositionSide:
      type: string
      enum:
        - long
        - short
    PositionStatus:
      type: string
      enum:
        - open
        - closed

````

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