> ## 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 order history v2

> Handles `GET /v1/traders/{trader_pubkey}/orders_v2` via `get.v1.traders.by_trader_pubkey.orders_v2`.



## OpenAPI

````yaml /openapi/phoenix-public-api.json get /v1/traders/{trader_pubkey}/orders_v2
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/traders/{trader_pubkey}/orders_v2:
    get:
      tags:
        - Trader
      summary: Get order history v2
      description: >-
        Handles `GET /v1/traders/{trader_pubkey}/orders_v2` via
        `get.v1.traders.by_trader_pubkey.orders_v2`.
      operationId: get.v1.traders.by_trader_pubkey.orders_v2
      parameters:
        - name: market_symbol
          in: query
          description: Optional market symbol filter
          required: false
          schema:
            type: string
        - name: limit
          in: query
          description: Number of items to return (max 1000)
          required: true
          schema:
            type: integer
            format: int64
        - name: cursor
          in: query
          description: >-
            Optional base64-encoded cursor for pagination. Returns items older
            than (exclusive of) this cursor.
          required: false
          schema:
            type: string
        - name: trader_pubkey
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaginatedResponse_Vec_OrderHistoryV2Item'
      security:
        - PhoenixBearerAuth: []
components:
  schemas:
    PaginatedResponse_Vec_OrderHistoryV2Item:
      type: object
      description: >-
        Generic paginated response wrapper with bidirectional cursor support.


        The cursor system supports both forward (newer) and backward (older)

        pagination:

        - `prev_cursor`: Use this cursor to poll for new items (items newer than
        the
          current result set)
        - `next_cursor`: Use this cursor to load more items (items older than
        the
          current result set)

        The direction is embedded in the cursor itself, so clients just need to
        pass

        the appropriate cursor to the `cursor` parameter.
      required:
        - data
        - hasMore
      properties:
        data:
          type: array
          items:
            type: object
            description: >-
              Order history V2 item showing intended order (from packet), actual
              placed

              order (from event), and current state (from orders table)
            required:
              - userId
              - traderId
              - traderPdaIndex
              - traderSubaccountIndex
              - slot
              - slotIndex
              - instructionIndex
              - eventIndex
              - marketSymbol
              - instructionType
              - orderType
              - createdAt
              - price
              - intended
              - isReduceOnly
              - isStopLoss
              - isStopLossDirection
              - isConditionalOrder
              - status
            properties:
              createdAt:
                type: string
                format: date-time
              currentOrderState:
                oneOf:
                  - type: 'null'
                  - $ref: '#/components/schemas/CurrentOrderState'
              eventIndex:
                type: integer
                format: int32
              fillBeforePlacement:
                oneOf:
                  - type: 'null'
                  - $ref: '#/components/schemas/AggregatedTrades'
              instructionIndex:
                type: integer
                format: int32
              instructionType:
                type: string
              intended:
                $ref: '#/components/schemas/IntendedOrder'
              isConditionalOrder:
                type: boolean
              isReduceOnly:
                type: boolean
              isStopLoss:
                type: boolean
              isStopLossDirection:
                type: boolean
              marketSymbol:
                type: string
              orderType:
                type: string
              placedOrder:
                oneOf:
                  - type: 'null'
                  - $ref: '#/components/schemas/PlacedOrder'
              price:
                type: string
              slot:
                type: integer
                format: int64
              slotIndex:
                type: integer
                format: int32
              status:
                type: string
              traderId:
                type: integer
                format: int64
              traderPdaIndex:
                type: integer
                format: int32
              traderSubaccountIndex:
                type: integer
                format: int32
              userId:
                type: integer
                format: int64
        hasMore:
          type: boolean
          description: Whether there are more results available after this page
        nextCursor:
          type:
            - string
            - 'null'
          description: >-
            Opaque cursor for fetching the next page of older results.

            Pass this value as the `cursor` parameter in the next request to
            load

            more.
        prevCursor:
          type:
            - string
            - 'null'
          description: >-
            Opaque cursor for fetching newer items (for polling).

            Pass this value as the `cursor` parameter to get items newer than
            the

            first item in data.
    CurrentOrderState:
      type: object
      description: Current order state from orders table
      required:
        - orderSequenceNumber
        - side
        - price
        - baseQty
        - remainingBaseQty
        - filledBaseQty
        - releasedBaseQty
        - orderStatus
      properties:
        baseQty:
          type: string
        cancelledAt:
          type:
            - string
            - 'null'
          format: date-time
        filledBaseQty:
          type: string
        lastFillAt:
          type:
            - string
            - 'null'
          format: date-time
        orderSequenceNumber:
          type: integer
          format: int64
        orderStatus:
          type: string
          description: '"active", "filled", "cancelled"'
        placedAt:
          type:
            - string
            - 'null'
          format: date-time
        price:
          type: string
        releasedBaseQty:
          type: string
          description: base_qty - remaining_base_qty
        remainingBaseQty:
          type: string
        side:
          type: string
    AggregatedTrades:
      type: object
      description: Aggregated trades summary for an instruction
      required:
        - totalBaseQtyFilled
        - totalQuoteQtyFilled
        - totalTakerFee
        - totalNumFills
        - numTrades
      properties:
        numTrades:
          type: integer
          format: int32
        totalBaseQtyFilled:
          type: string
        totalNumFills:
          type: integer
          format: int32
        totalQuoteQtyFilled:
          type: string
        totalTakerFee:
          type: string
    IntendedOrder:
      type: object
      description: Intended order details from order_packets
      required:
        - orderKind
        - side
        - hasPriceLimit
        - baseLots
        - baseQty
        - orderFlags
        - isReduceOnly
        - isStopLoss
        - isPostOnly
        - isTakeOnly
        - cancelExisting
      properties:
        baseLots:
          type: integer
          format: int64
        baseQty:
          type: string
        cancelExisting:
          type: boolean
        clientOrderId:
          type:
            - string
            - 'null'
        hasPriceLimit:
          type: boolean
        isConditionalOrder:
          type: boolean
        isPostOnly:
          type: boolean
        isReduceOnly:
          type: boolean
        isStopLoss:
          type: boolean
        isStopLossDirection:
          type: boolean
        isTakeOnly:
          type: boolean
        lastValidSlot:
          type:
            - integer
            - 'null'
          format: int64
        matchLimit:
          type:
            - integer
            - 'null'
          format: int64
        orderFlags:
          type: integer
          format: int32
        orderKind:
          type: string
        priceInTicks:
          type:
            - integer
            - 'null'
          format: int64
        priceUsd:
          type:
            - string
            - 'null'
        quoteLotBudget:
          type:
            - integer
            - 'null'
          format: int64
        side:
          type: string
    PlacedOrder:
      type: object
      description: Actual placed order details from order_events
      required:
        - orderSequenceNumber
        - eventIndex
        - side
        - price
        - baseQty
        - transactionTimestamp
      properties:
        baseQty:
          type: string
        eventIndex:
          type: integer
          format: int32
        initialSlot:
          type:
            - integer
            - 'null'
          format: int64
        lastValidSlot:
          type:
            - integer
            - 'null'
          format: int64
        orderFlags:
          type:
            - integer
            - 'null'
          format: int32
        orderSequenceNumber:
          type: integer
          format: int64
        price:
          type: string
        side:
          type: string
        transactionTimestamp:
          type: string
          format: date-time
          description: Formatted datetime string (ISO 8601).
  securitySchemes:
    PhoenixBearerAuth:
      type: http
      scheme: bearer
      description: Bearer access token issued by `/v1/auth/*` login endpoints.

````