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

# Active orders

> Query active orders on the SX Bet orderbook. Filter by market hash, maker address, or token.

<Note>**Rate limit:** All `GET /orders/*` endpoints share a combined limit of 5,500 requests/min. See [Rate Limits](/developers/rate-limits).</Note>

<Info>One of `marketHashes` or `maker` is required.</Info>

<Info>Only one of `marketHashes` and `sportXeventId` can be present.</Info>

<Note>
  Note that `totalBetSize`, `fillAmount`, and `pendingFillAmount` are from *the
  perspective of the market maker*. `totalBetSize` can be thought of as the
  maximum amount of tokens the maker will be putting into the pot if the order
  was fully filled. `fillAmount` can be thought of as how many tokens the maker
  has already put into the pot. `pendingFillAmount` can be thought of as how
  many tokens the maker has pending in accepted fills that are not yet included
  in `fillAmount`. To compute how much space there is left from the taker's
  perspective while accounting for pending fills, you can use the formula
  `remainingTakerSpace = (totalBetSize - fillAmount - pendingFillAmount) * 10^20
      / percentageOdds - (totalBetSize - fillAmount - pendingFillAmount)`
</Note>


## OpenAPI

````yaml GET /orders
openapi: 3.0.1
info:
  title: SX Bet API
  version: 1.0.0
  description: >-
    REST API for the SX Bet decentralized sports betting exchange. Retrieve
    sports data, markets, and orderbook information. Post, cancel, and fill
    orders with signed payloads.


    Base URLs:

    - **Mainnet**: `https://api.sx.bet`

    - **Testnet**: `https://api.toronto.sx.bet`
servers:
  - url: https://api.sx.bet
    description: Mainnet (SX Network, chainId 4162)
  - url: https://api.toronto.sx.bet
    description: Testnet (Toronto, chainId 79479957)
security: []
tags:
  - name: Connection
    description: Server metadata and heartbeat management
  - name: Sports Data
    description: Sports, leagues, teams, fixtures, and live scores
  - name: Markets
    description: Active, specific, and popular betting markets
  - name: Trades
    description: Matched trades and portfolio history
  - name: Orders
    description: Orderbook queries, posting, cancelling, and filling orders
paths:
  /orders:
    get:
      tags:
        - Orders
      summary: Get orders
      description: >-
        This endpoint returns active orders on the exchange based on a few
        parameters
      operationId: getOrders
      parameters:
        - name: marketHashes
          in: query
          required: false
          schema:
            type: array
            items:
              type: string
          description: Only get orders for these market hashes. Comma separated.
        - name: baseToken
          in: query
          required: false
          schema:
            type: string
          description: Only get orders denominated in this base token
        - name: maker
          in: query
          required: false
          schema:
            type: string
          description: Only get orders for this market maker
        - name: sportXeventId
          in: query
          required: false
          schema:
            type: string
          description: Only get orders for this event ID
        - name: orderHashes
          in: query
          required: false
          schema:
            type: array
            items:
              type: string
          description: Only get orders for these order hashes. Comma separated.
        - name: page
          in: query
          required: false
          schema:
            type: integer
          description: Which page to query for paginated queries, min 0
        - name: perPage
          in: query
          required: false
          schema:
            type: integer
          description: How many per page for paginated queries, max 1000
        - name: sortBy
          in: query
          required: false
          schema:
            type: string
            enum:
              - fill_amount
              - total_bet_size
              - percentage_odds
              - api_expiry
              - created_at
              - updated_at
            default: created_at
          description: Which field to sort by
        - name: sortAsc
          in: query
          required: false
          schema:
            type: boolean
          description: 'Sort direction, default: true'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    description: '`success` or `failure` if the request succeeded or not'
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/Order'
                  page:
                    type: integer
                    description: The current page number
                  perPage:
                    type: integer
                    description: The number of records per page
              example:
                status: success
                data:
                  - marketHash: >-
                      0x09a68f49e98028f58b3620e8e57f203c0f314278f8e1fa3935d7e139cfbaef7a
                    fillAmount: '0'
                    pendingFillAmount: '0'
                    orderHash: >-
                      0x55eb16b32b5999e7bb67f995d5168b2569bbf6eeb7049a28687b41ea900d6529
                    maker: '0x740d5718a79A8559fEeE8B00922F8Cd773A81D84'
                    totalBetSize: '542187500'
                    percentageOdds: '86750000000000000000'
                    baseToken: '0x6629Ce1Cf35Cc1329ebB4F63202F3f197b3F050B'
                    executor: '0x52adf738AAD93c31f798a30b2C74D658e1E9a562'
                    salt: >-
                      0x5762782b288e9be9899c7664e9695247d180828783c8254bb53f56cb765eb2b3
                    isMakerBettingOutcomeOne: false
                    signature: >-
                      0xd0de402bddd95bb2dba21ef721143461dab5fa26461aa3cf6d31335cd7848af153c2fa604bfeab796e4859f4678919d2c76c53eed49bfbc5c337fd6982aaa78c1b
                    expiry: 2209006800
                    apiExpiry: 1773511660
                    sportXeventId: L18272453
                    orderStatus: ACTIVE
        '400':
          description: >-
            Error Codes:


            `RATE_LIMIT_ORDER_REQUEST_MARKET_COUNT` — More than 1000
            `marketHashes` queried


            `BOTH_SPORTXEVENTID_MARKETHASHES_PRESENT` — Can only send one of
            `marketHashes` or `sportXeventId`


            `BASE_TOKEN_MISMATCH` — The provided `baseToken` does not match the
            orders


            `RATE_LIMIT_ORDER_REQUEST_ORDER_COUNT` — Too many `orderHashes`
            queried
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                  errorCode:
                    type: string
components:
  schemas:
    Order:
      type: object
      properties:
        marketHash:
          type: string
          description: The market corresponding to this order
        fillAmount:
          type: string
          description: >-
            How much this order has been filled in Ethereum units up to a max of
            `totalBetSize`. See the token section of how to convert this into
            nominal amounts
        pendingFillAmount:
          type: string
          description: >-
            The pending fill amount of this order in Ethereum units. See the
            token section for how to convert this into nominal amounts.
        orderHash:
          type: string
          description: A unique identifier for this order
        maker:
          type: string
          description: The market maker for this order
        totalBetSize:
          type: string
          description: >-
            The total size of this order in Ethereum units. See the the token
            section section for how to convert this into nominal amounts.
        percentageOdds:
          type: string
          description: >-
            The odds that the `maker` receives in the sx.bet protocol format. To
            convert to an implied odds divide by 10^20. To convert to the odds
            that the taker would receive if this order would be filled in
            implied format, use the formula `takerOdds=1-percentageOdds/10^20`.
            See the unit conversion section for more details.
        baseToken:
          type: string
          description: The base token this order is denominated in
        executor:
          type: string
          description: >-
            The address permitted to execute on this order. This is set to the
            sx.bet exchange
        salt:
          type: string
          description: A random number to differentiate identical orders
        isMakerBettingOutcomeOne:
          type: boolean
          description: >-
            `true` if the maker is betting outcome one (and hence taker is
            betting outcome two if filled)
        signature:
          type: string
          description: Signature of the maker on this order
        expiry:
          type: number
          description: >-
            Deprecated: the time in unix seconds after which this order is no
            longer valid. After deprecation, this field is always 2209006800
            (2040)
        apiExpiry:
          type: number
          description: The time in unix seconds after which this order is no longer valid.
        sportXeventId:
          type: string
          description: The event related to this order
        orderStatus:
          type: string
          description: >-
            The current status of the order. Possible values: `ACTIVE`,
            `INACTIVE`

````