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

# GetOrders

> Returns the latest stored state of each order associated with `address`,
 optionally filtered to one market. Results include position-opening and
 reduce-only orders across active and terminal statuses. This endpoint
 does not return order lifecycle events or individual fills.



## OpenAPI

````yaml /developers/api-reference/openapi.yaml post /order_service.v1.OrderService/GetOrders
openapi: 3.1.0
info:
  title: Fairground.Fi API
  description: |
    API for the Fairground Perpetuals trading platform.

    This API uses ConnectRPC which accepts JSON over HTTP POST requests.
    All service endpoints follow the pattern: `/package.ServiceName/MethodName`
  version: 1.0.0
  contact:
    name: Forte Service Company
    url: https://github.com/Forte-Service-Company-Ltd/perpetuals-api-server
  license:
    name: Proprietary
    identifier: UNLICENSED
servers:
  - url: https://api.fairground.fi
    description: Production API server
security:
  - bearerAuth: []
tags:
  - name: Trades
    description: Wallet trade/fill history
  - name: Markets
    description: Market configuration and summary endpoints
  - name: Orderbook
    description: Orderbook data retrieval
  - name: Orders
    description: Order management operations
  - name: Portfolio
    description: Aggregated per-wallet portfolio data
  - name: Positions
    description: Position management operations
  - name: Prices
    description: Oracle price and historical price data
paths:
  /order_service.v1.OrderService/GetOrders:
    post:
      tags:
        - Orders
      summary: GetOrders
      description: |-
        Returns the latest stored state of each order associated with `address`,
         optionally filtered to one market. Results include position-opening and
         reduce-only orders across active and terminal statuses. This endpoint
         does not return order lifecycle events or individual fills.
      operationId: order_service.v1.OrderService.GetOrders
      parameters:
        - name: Connect-Protocol-Version
          in: header
          required: true
          schema:
            $ref: '#/components/schemas/connect-protocol-version'
        - name: Connect-Timeout-Ms
          in: header
          schema:
            $ref: '#/components/schemas/connect-timeout-header'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/order_service.v1.GetOrdersRequest'
        required: true
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/order_service.v1.GetOrdersResponse'
components:
  schemas:
    connect-protocol-version:
      type: number
      title: Connect-Protocol-Version
      enum:
        - 1
      description: Define the version of the Connect protocol. If omitted, use 1.
      const: 1
      default: 1
    connect-timeout-header:
      type: number
      title: Connect-Timeout-Ms
      description: Define the timeout, in ms
    order_service.v1.GetOrdersRequest:
      type: object
      properties:
        address:
          type: string
          title: address
          description: |-
            Wallet address used to filter orders.
             The server trims surrounding whitespace and matches addresses
             case-insensitively.
        market:
          description: |-
            Optional market filter.
             Omit this field to query all markets. Set either a nonzero `market_id` or
             a `market_symbol`. An empty selector, a zero market ID, or an empty asset
             or quote symbol returns `INVALID_ARGUMENT`.
          oneOf:
            - type: 'null'
            - type: object
              title: market_id
              properties:
                marketId:
                  type: string
                  format: int64
                  title: market_id
              required:
                - marketId
              additionalProperties: false
            - type: object
              title: market_symbol
              properties:
                marketSymbol:
                  $ref: '#/components/schemas/base_objects.v1.MarketSymbol'
                  title: market_symbol
              required:
                - marketSymbol
              additionalProperties: false
      title: GetOrdersRequest
      additionalProperties: false
      description: Request for listing order records owned by a wallet.
    order_service.v1.GetOrdersResponse:
      type: object
      properties:
        orders:
          type: array
          items:
            $ref: '#/components/schemas/base_objects.v1.Order'
          title: orders
          description: |-
            Orders matching the wallet and optional market filter.
             Includes active and terminal order statuses and is ordered by `timestamp`
             descending, newest first. No pagination or result limit is applied. The
             result is empty when no orders match.
      title: GetOrdersResponse
      additionalProperties: false
      description: Response containing the matching order records.
    base_objects.v1.MarketSymbol:
      type: object
      properties:
        assetSymbol:
          type: string
          title: asset_symbol
          description: |-
            Underlying asset symbol, e.g. `"BTC"`. Matched case-insensitively
            and trimmed.
        quoteSymbol:
          type: string
          title: quote_symbol
          description: |-
            Quote symbol, e.g. `"PERP"`. Technically optional, but omitting
            it looks up a market named exactly by `assetSymbol` alone (e.g.
            `"BTC"`) rather than `"BTC-PERP"`, which will not resolve to any
            real market. In practice, always set this.
      title: MarketSymbol
      additionalProperties: false
    base_objects.v1.Order:
      type: object
      properties:
        owner:
          type: string
          title: owner
          description: Lowercase EVM wallet address that owns the order.
        orderId:
          type: string
          title: order_id
          format: int64
          description: >-
            On-chain order identifier.

            Unique together with `marketId` and `reduceOnly`. Connect/JSON
            encodes

            this uint64 as a decimal string.
        timestamp:
          $ref: '#/components/schemas/google.protobuf.Timestamp'
          title: timestamp
          description: >-
            Order-creation timestamp from the submission event, in RFC 3339
            format.
        marketId:
          type: string
          title: market_id
          format: int64
          description: |-
            On-chain market identifier.
            Connect/JSON encodes this uint64 as a decimal string.
        market:
          type: string
          title: market
          description: >-
            Human-readable market name, such as `BTC-PERP`.

            Falls back to `MARKET-{marketId}` when market metadata is
            unavailable.
        type:
          $ref: '#/components/schemas/base_objects.v1.OrderType'
          title: type
          description: Order-type classification. Currently always `ORDER_TYPE_MARKET`.
        side:
          $ref: '#/components/schemas/base_objects.v1.Side'
          title: side
          description: >-
            Position direction.

            For reduce-only orders, inherited from the associated
            position-opening

            order.
        thresholdPrice:
          type: number
          title: threshold_price
          format: float
          description: >-
            Execution price threshold in quote asset terms per underlying asset.

            Converted using the market's tick precision. This is not necessarily
            the

            fill price.
        size:
          type: number
          title: size
          format: float
          description: Amount exposed for the order.
        leverage:
          type: number
          title: leverage
          format: float
          description: >-
            Leverage multiplier.

            For reduce-only orders, inherited from the associated
            position-opening

            order when available.
        status:
          $ref: '#/components/schemas/base_objects.v1.OrderStatus'
          title: status
          description: Current order lifecycle state.
        filledSize:
          type: number
          title: filled_size
          format: float
          description: Order Amount that has been filled
        unfilledSize:
          type: number
          title: unfilled_size
          format: float
          description: Order amount remaining to be filled
        reduceOnly:
          type: boolean
          title: reduce_only
          description: >-
            Whether the order is reducing an existing position.

            False for orders that open or increase exposure; true for orders
            that

            reduce exposure.
        canceled:
          type: boolean
          title: canceled
          description: |-
            Legacy field that the server does not populate.
            Use `status` to determine whether an order was cancelled.
        initialMargin:
          type: number
          title: initial_margin
          format: float
          description: >-
            Initial collateral or threshold-price notional, denominated in quote
            asset units.

            For position-opening orders, this is the initial collateral.
        tickDecimals:
          type: integer
          title: tick_decimals
          description: Market price precision used to convert raw on-chain price values.
        fees:
          type: number
          title: fees
          format: float
          description: Fees recorded for the order, denominated in quote asset units.
        rebates:
          type: number
          title: rebates
          format: float
          description: >-
            Direct order-side rebates recorded for reduce fills, denominated in
            quote asset units.
        reduceOrderType:
          type: string
          title: reduce_order_type
          description: >-
            Reduce-order classification.

            Values are `MANUAL`, `STOP_LOSS`, `TAKE_PROFIT`, `LIQUIDATION`, or
            `ADL`.

            Empty for position-opening orders.
        initialNotional:
          type: number
          title: initial_notional
          format: float
          description: >-
            Initial notional amount for a position-opening order.

            Calculated as `initialMargin * leverage`. Zero for reduce-only
            orders.
        stopLossPrice:
          type: number
          title: stop_loss_price
          format: float
          description: >-
            Stop-loss trigger price attached to a position-opening order, in
            quote asset units.

            Zero when no stop-loss is configured.
        takeProfitPrice:
          type: number
          title: take_profit_price
          format: float
          description: >-
            Take-profit trigger price attached to a position-opening order, in
            quote asset units.

            Zero when no take-profit is configured.
      title: Order
      additionalProperties: false
      description: |-
        Current stored state of a position-opening or reduce-only order.
        Because both order kinds share this message, some numeric fields have
        different meanings and units. Use `reduceOnly` when interpreting them.
    google.protobuf.Timestamp:
      type: string
      examples:
        - '2023-01-15T01:30:15.01Z'
        - '2024-12-25T12:00:00Z'
      format: date-time
    base_objects.v1.OrderType:
      type: string
      title: OrderType
      enum:
        - ORDER_TYPE_MARKET
      description: >-
        Order-type classification used by the API. Currently only market orders
        are returned.
    base_objects.v1.Side:
      type: string
      title: Side
      enum:
        - SIDE_LONG
        - SIDE_SHORT
      description: Direction of the position represented by an order.
    base_objects.v1.OrderStatus:
      type: string
      title: OrderStatus
      enum:
        - ORDER_STATUS_PENDING
        - ORDER_STATUS_PARTIALLY_FILLED
        - ORDER_STATUS_FULLY_FILLED
        - ORDER_STATUS_CLOSED
        - ORDER_STATUS_CANCELLED
        - ORDER_STATUS_MERGED
        - ORDER_STATUS_PARTIALLY_MERGED
        - ORDER_STATUS_PARTIALLY_CANCELLED
      description: Current lifecycle state of an order.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````