> ## 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 markets

> Retrieve all active betting markets on the SX Bet exchange, with filters for sport, league, and event.

<Note>To retrieve odds for a particular market, you must query the [orders endpoint](/api-reference/get-orders) separately.</Note>

<Info>Only one of `type` and `betGroup` can be present. Not both.</Info>


## OpenAPI

````yaml GET /markets/active
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:
  /markets/active:
    get:
      tags:
        - Markets
      summary: Get active markets
      description: >-
        This endpoint retrieves active markets on the exchange. It does not
        return markets that have been settled or reported.
      operationId: getActiveMarkets
      parameters:
        - name: onlyMainLine
          in: query
          required: false
          schema:
            type: boolean
          description: >-
            If set to true, the result will only include main lines on spread
            and over under markets
        - name: eventId
          in: query
          required: false
          schema:
            type: string
          description: If set, it will only include markets for a particular sportXeventId
        - name: leagueId
          in: query
          required: false
          schema:
            type: integer
          description: If set, it will only include markets for a particular league ID
        - name: sportIds
          in: query
          required: false
          schema:
            type: array
            items:
              type: integer
          description: >-
            If set, it will only include markets for particular sport IDs (comma
            separated)
        - name: liveOnly
          in: query
          required: false
          schema:
            type: boolean
          description: >-
            If set, it will only include markets that are currently available
            for in-play betting
        - name: betGroup
          in: query
          required: false
          schema:
            type: string
          description: If set, it will only include markets for a particular bet group
        - name: type
          in: query
          required: false
          schema:
            type: array
            items:
              type: integer
          description: >-
            If set, it will only include markets for those particular market
            types. See below for the options
        - name: paginationKey
          in: query
          required: false
          schema:
            type: string
          description: >-
            Used for pagination. Pass the `nextKey` returned from the previous
            request to retrieve the next set of records.
        - name: pageSize
          in: query
          required: false
          schema:
            type: integer
          description: >-
            Used for pagination. Requested page size. Each call will only return
            up to this amount of records. Maximum of 100
        - name: gameTime
          in: query
          required: false
          schema:
            type: integer
          description: >-
            If set, only return markets for games starting at or after this UNIX
            timestamp
      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: object
                    properties:
                      markets:
                        type: array
                        items:
                          $ref: '#/components/schemas/Market'
                      nextKey:
                        type: string
                        description: >-
                          Use this key as the `paginationKey` to retrieve the
                          next set of records, if any
              example:
                status: success
                data:
                  markets:
                    - status: ACTIVE
                      marketHash: >-
                        0x8120ae9408cd7556246473be7ceada8cba47d42418cce31ffad0b67b196e3218
                      outcomeOneName: Golden State Warriors
                      outcomeTwoName: Minnesota Timberwolves
                      outcomeVoidName: NO_CONTEST
                      teamOneName: Golden State Warriors
                      teamTwoName: Minnesota Timberwolves
                      type: 226
                      gameTime: 1773453600
                      sportXeventId: L18272456
                      liveEnabled: true
                      sportLabel: Basketball
                      sportId: 1
                      leagueId: 1
                      leagueLabel: NBA
                      group1: NBA
                      chainVersion: SXR
                      participantOneId: 15002
                      participantTwoId: 14999
                      __type: Market
                    - status: ACTIVE
                      marketHash: >-
                        0x531e9e6d6469f6323d464340e91840b3666e4e43cf04b8c2a52c2ac0d67839fb
                      outcomeOneName: Golden State Warriors +6.5
                      outcomeTwoName: Minnesota Timberwolves -6.5
                      outcomeVoidName: NO_GAME_OR_EVEN
                      teamOneName: Golden State Warriors
                      teamTwoName: Minnesota Timberwolves
                      type: 342
                      gameTime: 1773453600
                      line: 6.5
                      sportXeventId: L18272456
                      liveEnabled: true
                      sportLabel: Basketball
                      sportId: 1
                      leagueId: 1
                      leagueLabel: NBA
                      group1: NBA
                      chainVersion: SXR
                      participantOneId: 15002
                      participantTwoId: 14999
                      mainLine: true
                      __type: Market
                  nextKey: 60c7b8f54da0ad001aa3261c
components:
  schemas:
    Market:
      type: object
      properties:
        status:
          type: string
          description: '`ACTIVE` or `INACTIVE`'
        marketHash:
          type: string
          description: The unique identifier for the market
        outcomeOneName:
          type: string
          description: Outcome one for this market
        outcomeTwoName:
          type: string
          description: Outcome two for this market
        outcomeVoidName:
          type: string
          description: Outcome void for this market
        teamOneName:
          type: string
          description: The name of the first team/player participating
        teamTwoName:
          type: string
          description: The name of the second team/player participating
        type:
          type: integer
          description: The type of the market
        gameTime:
          type: number
          description: The UNIX timestamp of the game
        line:
          type: number
          nullable: true
          description: The line of the market. Only applicable to markets with a line
        sportXeventId:
          type: string
          description: The unique event ID for this market
        liveEnabled:
          type: boolean
          description: Whether or not this match is available for live betting
        sportLabel:
          type: string
          description: The name of the sport for this market
        sportId:
          type: number
          description: The ID of the sport for this market
        leagueId:
          type: number
          description: The league ID for this market
        leagueLabel:
          type: string
          description: The name of the league for this market
        mainLine:
          type: boolean
          description: >-
            If this market is currently the main line or not. If the market is
            not a market with multiple lines, this field will not be present
        group1:
          type: string
          description: Indicator to the client of how to display this market
        chainVersion:
          type: string
          description: The chain version this market is deployed on
          example: SXR
        participantOneId:
          type: integer
          description: The team ID of participant one
        participantTwoId:
          type: integer
          description: The team ID of participant two
        __type:
          type: string
          description: The type of this object
          example: Market
        legs:
          type: array
          items:
            $ref: '#/components/schemas/Market'
          description: >-
            If this is a Parlay Market, this field will contain an array of the
            underlying Legs as a Market object
        group2:
          type: string
          description: Secondary display grouping indicator for the market
        teamOneMeta:
          type: object
          description: Extra metadata for team one
        teamTwoMeta:
          type: object
          description: Extra metadata for team two
        marketMeta:
          type: object
          description: Extra metadata for the market overall
        reportedDate:
          type: number
          description: UNIX timestamp of when the market was reported/settled
        outcome:
          type: integer
          description: The outcome of the market once settled
        teamOneScore:
          type: number
          description: Final score for team one
        teamTwoScore:
          type: number
          description: Final score for team two

````