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

# Fetch markets

> Returns a paginated list of markets based on the provided filter and ordering criteria. This can get specific known markets (by market ID), or markets based on other criteria such as event ID(s) and/or market type and status etc.



## OpenAPI

````yaml https://docs.api.monacoprotocol.xyz/api/v1/exchange-openapi-general.json get /markets
openapi: 3.1.0
info:
  title: BetDEX General Integration API
  description: >-
    A RESTful API that allows you to interact with the BetDEX Exchange. Provides
    endpoints for managing Events, Markets, Sessions, Wallets and Orders. To
    interact with the API, a client must have an App Id and an API Key to
    authenticate and create a session.
  version: '0.1'
servers:
  - url: https://sandbox.api.btdx.io/
    description: Sandbox API Server
  - url: https://prod.api.btdx.io/
    description: Production API Server
security: []
tags:
  - name: API Key Management
  - name: App Management
  - name: Currencies
  - name: Event Categories
  - name: Event Groups
  - name: Event Subcategories
  - name: Events
  - name: External Reference Sources
  - name: Heartbeat Management
  - name: Market Prices
  - name: Market Types
  - name: Markets
  - name: Orders
  - name: Participants
  - name: Session Management
  - name: Status
  - name: Trades
  - name: Wallet API Key Management
  - name: Wallets
paths:
  /markets:
    get:
      tags:
        - Markets
      summary: Fetch markets
      description: >-
        Returns a paginated list of markets based on the provided filter and
        ordering criteria. This can get specific known markets (by market ID),
        or markets based on other criteria such as event ID(s) and/or market
        type and status etc.
      operationId: getMarkets
      parameters:
        - name: authorization
          in: header
          description: Header with the accessToken for the current session
          required: true
          schema:
            type: string
          example: Bearer eyJ0eXAiOiJ...bjV7AtDgA
        - name: ids
          in: query
          description: Optional list of specific IDs to fetch
          required: false
          schema:
            type: array
            items:
              type: string
            uniqueItems: true
        - name: ownerAppIds
          in: query
          description: Optional list of app IDs to filter results by
          required: false
          schema:
            type: array
            items:
              type: string
            uniqueItems: true
        - name: eventIds
          in: query
          description: Optional list of event IDs to filter results by
          required: false
          schema:
            type: array
            items:
              type: string
            uniqueItems: true
        - name: marketTypeIds
          in: query
          description: Optional list of market type IDs to filter results by
          required: false
          schema:
            type: array
            items:
              type: string
            uniqueItems: true
        - name: currencyIds
          in: query
          description: Optional list of currency IDs to filter results by
          required: false
          schema:
            type: array
            items:
              type: string
            uniqueItems: true
        - name: statuses
          in: query
          description: Optional list of market statuses to filter results by
          required: false
          schema:
            type: array
            items:
              type: string
              enum:
                - Initializing
                - Open
                - Locking
                - Locked
                - Settling
                - Settled
                - Voiding
                - Voided
                - Closed
            uniqueItems: true
        - name: inPlayStatuses
          in: query
          description: >-
            Whether the markets are currently in-play or not. Returns all if not
            set
          required: false
          schema:
            type: array
            items:
              type: string
              enum:
                - NotApplicable
                - PrePlay
                - InPlay
            uniqueItems: true
        - name: fromDateTime
          in: query
          description: >-
            The inclusive beginning of a date-time range filter. If not
            provided, no restriction will be applied to the beginning of the
            range
          required: false
          schema:
            type: string
            format: date-time
        - name: toDateTime
          in: query
          description: >-
            The exclusive end of a date-time range filter. If not provided, no
            restriction will be applied to the end of the range
          required: false
          schema:
            type: string
            format: date-time
        - name: published
          in: query
          description: Optional filter as to whether the market is published or not
          required: false
          schema:
            type: boolean
        - name: page
          in: query
          description: Zero-based page index (0..N)
          schema:
            type: integer
            default: 0
        - name: size
          in: query
          description: The size of the page to be returned
          schema:
            type: integer
            default: 20
        - name: sort
          in: query
          description: >-
            Sorting criteria in the format: property,(asc|desc). Default sort
            order is ascending. Multiple sort criteria are supported.
          schema:
            type: array
            items:
              type: string
      responses:
        '200':
          description: OK
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/PagedMarketResponse'
        '401':
          description: Session invalid
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/PagedMarketResponse'
components:
  schemas:
    PagedMarketResponse:
      type: object
      properties:
        _meta:
          $ref: '#/components/schemas/Meta'
        markets:
          type: array
          items:
            $ref: '#/components/schemas/Market'
        marketTypes:
          type: array
          items:
            $ref: '#/components/schemas/MarketTypeSummary'
        marketOutcomes:
          type: array
          items:
            $ref: '#/components/schemas/MarketOutcomeSummary'
        events:
          type: array
          items:
            $ref: '#/components/schemas/EventSummary'
        eventGroups:
          type: array
          items:
            $ref: '#/components/schemas/EventGroupSummary'
        subcategories:
          type: array
          items:
            $ref: '#/components/schemas/SubcategorySummary'
        categories:
          type: array
          items:
            $ref: '#/components/schemas/CategorySummary'
        externalReferences:
          type: array
          items:
            $ref: '#/components/schemas/ExternalReference'
        participants:
          type: array
          items:
            $ref: '#/components/schemas/ParticipantSummary'
    Meta:
      type: object
      properties:
        _primary_document:
          type: string
          enum:
            - apiKeys
            - apps
            - categories
            - commissionRates
            - currencies
            - depositAddresses
            - depositRequests
            - events
            - eventGroups
            - externalReferences
            - externalReferenceSources
            - heartbeats
            - ids
            - markets
            - marketOutcomes
            - marketPositions
            - marketTypes
            - orders
            - participants
            - prices
            - priceLadders
            - sessions
            - statuses
            - subcategories
            - trades
            - transactions
            - wallets
            - walletMetrics
            - withdrawalRequests
        _count:
          type: integer
          format: int32
        _page:
          $ref: '#/components/schemas/PageMeta'
    Market:
      type: object
      properties:
        id:
          type: string
        ownerAppId:
          type: string
        event:
          $ref: '#/components/schemas/DocumentReference'
        name:
          type: string
        marketType:
          $ref: '#/components/schemas/DocumentReference'
        marketValue:
          type: string
        marketDiscriminator:
          type: string
        currencyId:
          type: string
        inPlayStatus:
          type: string
          enum:
            - NotApplicable
            - PrePlay
            - InPlay
        inPlayDelay:
          type: integer
          format: int32
        crossMatchingEnabled:
          type: boolean
        published:
          type: boolean
        suspended:
          type: boolean
        lockAt:
          type: string
          format: date-time
        settledAt:
          type: string
          format: date-time
        marketLockAction:
          type: string
          description: >-
            Action to take when market locks - default is to cancel unmatched
            liquidity
          enum:
            - None
            - CancelUnmatchedLiquidity
        eventStartAction:
          type: string
          description: >-
            Action to take when market's event start time passes, i.e.,
            transitioning a market from PrePlay to InPlay - default is to cancel
            unmatched liquidity (can be managed per order)
          enum:
            - None
            - CancelUnmatchedLiquidity
        status:
          type: string
          enum:
            - Initializing
            - Open
            - Locking
            - Locked
            - Settling
            - Settled
            - Voiding
            - Voided
            - Closed
        marketOutcomes:
          $ref: '#/components/schemas/DocumentReference'
        externalReferences:
          $ref: '#/components/schemas/DocumentReference'
        createdAt:
          type: string
          format: date-time
        modifiedAt:
          type: string
          format: date-time
    MarketTypeSummary:
      type: object
      properties:
        id:
          type: string
        outcomesRange:
          $ref: '#/components/schemas/Range'
        winnersRange:
          $ref: '#/components/schemas/Range'
    MarketOutcomeSummary:
      type: object
      properties:
        id:
          type: string
        title:
          type: string
        ordering:
          type: integer
          format: int32
        winner:
          type: boolean
        participant:
          $ref: '#/components/schemas/DocumentReference'
    EventSummary:
      type: object
      properties:
        id:
          type: string
        eventGroup:
          $ref: '#/components/schemas/DocumentReference'
        name:
          type: string
        code:
          type: string
        expectedStartTime:
          type: string
          format: date-time
        active:
          type: boolean
    EventGroupSummary:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        subcategory:
          $ref: '#/components/schemas/DocumentReference'
    SubcategorySummary:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        category:
          $ref: '#/components/schemas/DocumentReference'
    CategorySummary:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
    ExternalReference:
      type: object
      properties:
        id:
          type: integer
          format: int64
        source:
          type: string
        externalReference:
          type: string
    ParticipantSummary:
      type: object
      properties:
        id:
          type: string
          description: Globally unique ID for this participant across all subcategories
        code:
          type: string
          description: >-
            Unique code for this participant across all events in a given
            subcategory
        name:
          type: string
        type:
          type: string
          enum:
            - Individual
            - Team
        active:
          type: boolean
    PageMeta:
      type: object
      properties:
        _pageNumber:
          type: integer
          format: int32
        _pageSize:
          type: integer
          format: int32
        _totalElements:
          type: integer
          format: int64
        _totalPages:
          type: integer
          format: int32
    DocumentReference:
      type: object
      properties:
        _ref:
          type: string
        _ids:
          type: array
          items:
            type: string
    Range:
      type: object
      properties:
        min:
          type: integer
          format: int32
        max:
          type: integer
          format: int32

````