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

# Get a market

> One market by its id, with each venue leg and how that venue resolves it. A market id keeps resolving after its fixture leaves the default list window. A venue symbol that names one market, such as a Polymarket token id or a Hyperliquid book coin, returns that market under its market id.



## OpenAPI

````yaml api-reference/openapi.json GET /markets/{id}
openapi: 3.0.0
info:
  title: Lean API
  version: 0.1.0
  description: >-
    Programmatic access to Lean: canonical sports markets, quotes, orders,
    positions and balances.
servers:
  - url: '{baseUrl}/v1'
    description: Lean API
    variables:
      baseUrl:
        default: https://api.lean.xyz
        description: >-
          The Lean API base URL, without /v1. Same value as LEAN_API_URL in the
          guides.
security:
  - apiKey: []
paths:
  /markets/{id}:
    get:
      tags:
        - Markets
      summary: Get a market
      description: >-
        One market by its id, with each venue leg and how that venue resolves
        it. A market id keeps resolving after its fixture leaves the default
        list window. A venue symbol that names one market, such as a Polymarket
        token id or a Hyperliquid book coin, returns that market under its
        market id.
      operationId: getMarket
      parameters:
        - schema:
            type: string
            minLength: 1
            maxLength: 512
            description: >-
              A market id from GET /markets, or a venue symbol that names one
              market: a Polymarket token id, a Hyperliquid book coin (`#…`,
              written `%23…` in a path), or a leg `ticker` (`pm:…`, `hl:…`,
              `pmus:…` or a Kalshi market ticker) that lists only this outcome.
              A symbol that names more than one market, such as a Polymarket
              condition id, is refused with 400; use the token id or the market
              id instead.
            example: >-
              mkt_bmZsOjIwMjYtMTAtMTE6REVOLUxBQwpzcHJlYWQ6Z2FtZTpERU46LTMuNQpERU4
          required: true
          description: >-
            A market id from GET /markets, or a venue symbol that names one
            market: a Polymarket token id, a Hyperliquid book coin (`#…`,
            written `%23…` in a path), or a leg `ticker` (`pm:…`, `hl:…`,
            `pmus:…` or a Kalshi market ticker) that lists only this outcome. A
            symbol that names more than one market, such as a Polymarket
            condition id, is refused with 400; use the token id or the market id
            instead.
          name: id
          in: path
      responses:
        '200':
          description: One canonical market with its venue legs
          content:
            application/json:
              schema:
                oneOf:
                  - type: object
                    properties:
                      success:
                        type: boolean
                        enum:
                          - true
                      data:
                        type: object
                        properties:
                          id:
                            type: string
                            minLength: 1
                          title:
                            type: string
                            minLength: 1
                          outcome:
                            type: string
                            minLength: 1
                          line:
                            type: string
                            nullable: true
                            pattern: ^-?\d+(?:\.\d+)?$
                          fixture:
                            type: object
                            properties:
                              key:
                                type: string
                                minLength: 1
                              sport:
                                type: string
                                minLength: 1
                              league:
                                type: string
                                minLength: 1
                              title:
                                type: string
                                minLength: 1
                              starts_at:
                                type: string
                                format: date-time
                              scheduled_date:
                                type: string
                                nullable: true
                                pattern: ^\d{4}-\d{2}-\d{2}$
                              participants:
                                type: array
                                items:
                                  type: string
                                  minLength: 1
                              teams:
                                type: array
                                items:
                                  type: object
                                  properties:
                                    key:
                                      type: string
                                      minLength: 1
                                    name:
                                      type: string
                                      minLength: 1
                                    role:
                                      type: string
                                      enum:
                                        - home
                                        - away
                                        - competitor
                                  required:
                                    - key
                                    - name
                                    - role
                            required:
                              - key
                              - sport
                              - league
                              - title
                              - starts_at
                              - scheduled_date
                              - participants
                              - teams
                          group:
                            type: object
                            properties:
                              key:
                                type: string
                                minLength: 1
                              kind:
                                type: string
                                enum:
                                  - moneyline
                                  - spread
                                  - total
                                  - team_total
                                  - prop
                              label:
                                type: string
                                minLength: 1
                              period:
                                type: string
                                minLength: 1
                              subject:
                                type: string
                                nullable: true
                              stat:
                                type: string
                                nullable: true
                              line:
                                type: string
                                nullable: true
                                pattern: ^-?\d+(?:\.\d+)?$
                            required:
                              - key
                              - kind
                              - label
                              - period
                              - subject
                              - stat
                              - line
                          legs:
                            type: array
                            items:
                              type: object
                              properties:
                                venue:
                                  type: string
                                  enum:
                                    - kalshi
                                    - polymarket
                                    - polymarket_us
                                    - hyperliquid
                                ticker:
                                  type: string
                                  minLength: 1
                                side:
                                  type: string
                                  enum:
                                    - 'yes'
                                    - 'no'
                                status:
                                  type: string
                                  nullable: true
                                  enum:
                                    - unopened
                                    - open
                                    - closed
                                    - resolving
                                    - resolved
                                  description: >-
                                    The venue market status: `unopened`, `open`,
                                    `closed`, `resolving` or `resolved`; null
                                    until Lean has recorded the venue market.
                                    The platform shows a live book for every
                                    status but `closed` and `resolved`.
                                tradable:
                                  type: boolean
                                  description: >-
                                    Whether the venue takes orders on this leg
                                    now: `status` is `open`, the venue has not
                                    marked the market untradable, and the API
                                    trades on its venue. An `unopened` or
                                    `resolving` leg is live but not tradable.
                                resolution:
                                  type: object
                                  properties:
                                    source:
                                      type: string
                                      nullable: true
                                      description: >-
                                        How the venue's resolution was recorded,
                                        such as the oracle event; null until it
                                        resolves.
                                    rules:
                                      type: string
                                      nullable: true
                                      description: >-
                                        The venue's resolution rules verbatim,
                                        secondary rules after a blank line.
                                    end_date:
                                      type: string
                                      nullable: true
                                      format: date-time
                                      description: >-
                                        When the venue market is scheduled to
                                        close, if the venue gives one.
                                    url:
                                      type: string
                                      nullable: true
                                      format: uri
                                      description: >-
                                        The venue's public page for this market,
                                        when it can be built from stored data.
                                  required:
                                    - source
                                    - rules
                                    - end_date
                                    - url
                                  description: How this venue resolves its market.
                                fees:
                                  type: object
                                  nullable: true
                                  properties:
                                    formula:
                                      type: string
                                      enum:
                                        - price_curve
                                        - notional_on_exit
                                      description: >-
                                        `price_curve`: every fill, buy or sell,
                                        pays quantity × rate × (price × (1 −
                                        price))^exponent. `notional_on_exit`: a
                                        buy pays nothing; a sell pays quantity ×
                                        price × rate, and each winning share
                                        pays rate × $1 at settlement.
                                    taker_rate:
                                      type: string
                                      pattern: ^\d+(?:\.\d+)?$
                                      description: >-
                                        The rate, as a fraction of 1, a fill
                                        that takes liquidity pays.
                                    maker_rate:
                                      type: string
                                      pattern: ^\d+(?:\.\d+)?$
                                      description: >-
                                        The rate, as a fraction of 1, a resting
                                        order pays when it fills.
                                    exponent:
                                      type: integer
                                      nullable: true
                                      description: >-
                                        The exponent of `price_curve`; null for
                                        `notional_on_exit`.
                                  required:
                                    - formula
                                    - taker_rate
                                    - maker_rate
                                    - exponent
                                  description: >-
                                    What this venue charges a fill, as `POST
                                    /v1/orders/preview` prices it; null on
                                    Kalshi and Polymarket US, and when the
                                    venue's fee terms for the market are not
                                    recorded.
                              required:
                                - venue
                                - ticker
                                - side
                                - status
                                - tradable
                                - resolution
                                - fees
                          equivalence:
                            type: string
                            enum:
                              - single_venue
                              - verified
                              - unreviewed
                            description: >-
                              `single_venue`: one leg. `verified`: a reviewer
                              confirmed each venue market is the same
                              proposition; rules text can still differ, so read
                              each leg `resolution.rules`. `unreviewed`: at
                              least one leg is not reviewed yet.
                          livemode:
                            type: boolean
                        required:
                          - id
                          - title
                          - outcome
                          - line
                          - fixture
                          - group
                          - legs
                          - equivalence
                          - livemode
                      meta:
                        type: object
                        properties:
                          timestampMs:
                            type: integer
                            minimum: 0
                          requestId:
                            type: string
                            minLength: 1
                          traceId:
                            type: string
                            minLength: 1
                          cachedAtMs:
                            type: integer
                            minimum: 0
                          source:
                            type: string
                            enum:
                              - cache
                              - database
                              - clickhouse
                              - upstream
                              - fallback
                              - internal
                        required:
                          - timestampMs
                          - requestId
                    required:
                      - success
                      - data
                      - meta
                  - $ref: '#/components/schemas/ApiError'
              example:
                success: true
                data:
                  id: >-
                    mkt_bmZsOjIwMjYtMTAtMTE6REVOLUxBQwpzcHJlYWQ6Z2FtZTpERU46LTMuNQpERU4
                  title: >-
                    Denver Broncos at Los Angeles Chargers: DEN -3.5, Denver
                    Broncos -3.5
                  outcome: DEN
                  line: '-3.5'
                  fixture:
                    key: nfl:2026-10-11:DEN-LAC
                    sport: football
                    league: nfl
                    title: Denver Broncos at Los Angeles Chargers
                    starts_at: '2026-10-11T20:25:00.000Z'
                    scheduled_date: '2026-10-11'
                    participants:
                      - Denver Broncos
                      - Los Angeles Chargers
                    teams:
                      - key: DEN
                        name: Denver Broncos
                        role: away
                      - key: LAC
                        name: Los Angeles Chargers
                        role: home
                  group:
                    key: spread:game:DEN:-3.5
                    kind: spread
                    label: DEN -3.5
                    period: game
                    subject: DEN
                    stat: null
                    line: '-3.5'
                  legs:
                    - venue: hyperliquid
                      ticker: hl:9999
                      side: 'yes'
                      status: open
                      tradable: true
                      resolution:
                        source: null
                        rules: >-
                          Resolves YES if the Denver Broncos win by more than
                          3.5 points, overtime included.
                        end_date: '2026-10-12T04:00:00.000Z'
                        url: null
                      fees:
                        formula: notional_on_exit
                        taker_rate: '0.0007'
                        maker_rate: '0.0004'
                        exponent: null
                    - venue: polymarket
                      ticker: >-
                        pm:0x2222222222222222222222222222222222222222222222222222222222222222
                      side: 'yes'
                      status: open
                      tradable: true
                      resolution:
                        source: null
                        rules: >-
                          Resolves to Denver Broncos if they win by more than
                          3.5 points, overtime included.
                        end_date: '2026-10-12T04:00:00.000Z'
                        url: null
                      fees:
                        formula: price_curve
                        taker_rate: '0.03'
                        maker_rate: '0'
                        exponent: 1
                  equivalence: verified
                  livemode: true
                meta:
                  timestampMs: 1792771200000
                  requestId: 7d2c9f4e-1b3a-4e8d-9c6f-2a5b8e0d4f17
        '400':
          description: Not a market id, or a venue symbol that names more than one market
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              example:
                success: false
                error:
                  code: VALIDATION_ERROR
                  message: >-
                    Not a market id, or a venue symbol that names more than one
                    market
                meta:
                  timestampMs: 1792771200000
                  requestId: 7d2c9f4e-1b3a-4e8d-9c6f-2a5b8e0d4f17
        '401':
          description: Missing, invalid, expired or revoked API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              example:
                success: false
                error:
                  code: UNAUTHORIZED
                  message: Invalid, expired or revoked API key
                meta:
                  timestampMs: 1792771200000
                  requestId: 7d2c9f4e-1b3a-4e8d-9c6f-2a5b8e0d4f17
        '403':
          description: The key lacks the scope this route needs
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              example:
                success: false
                error:
                  code: FORBIDDEN
                  message: This API key lacks the scope this route needs
                meta:
                  timestampMs: 1792771200000
                  requestId: 7d2c9f4e-1b3a-4e8d-9c6f-2a5b8e0d4f17
        '404':
          description: No market with this id
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              example:
                success: false
                error:
                  code: NOT_FOUND
                  message: No market with this id
                meta:
                  timestampMs: 1792771200000
                  requestId: 7d2c9f4e-1b3a-4e8d-9c6f-2a5b8e0d4f17
        '429':
          description: API error
          headers:
            Retry-After:
              description: Seconds remaining in the upstream read cooldown, when available
              schema:
                type: integer
                minimum: 0
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              example:
                success: false
                error:
                  code: RATE_LIMITED
                  message: Too many requests for this API key
                meta:
                  timestampMs: 1792771200000
                  requestId: 7d2c9f4e-1b3a-4e8d-9c6f-2a5b8e0d4f17
        '500':
          description: API error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              example:
                success: false
                error:
                  code: INTERNAL_ERROR
                  message: An internal error occurred.
                meta:
                  timestampMs: 1792771200000
                  requestId: 7d2c9f4e-1b3a-4e8d-9c6f-2a5b8e0d4f17
components:
  schemas:
    ApiError:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - false
        error:
          type: object
          properties:
            code:
              type: string
              enum:
                - VALIDATION_ERROR
                - NOT_FOUND
                - UNAUTHORIZED
                - FORBIDDEN
                - CONFLICT
                - UPSTREAM_ERROR
                - RATE_LIMITED
                - INTERNAL_ERROR
                - FEATURE_DISABLED
                - CONDITIONAL_SELL_REJECTED
                - CONDITIONAL_SELL_ACTIVE
            message:
              type: string
              minLength: 1
            details:
              nullable: true
          required:
            - code
            - message
        meta:
          type: object
          properties:
            timestampMs:
              type: integer
              minimum: 0
            requestId:
              type: string
              minLength: 1
            traceId:
              type: string
              minLength: 1
            cachedAtMs:
              type: integer
              minimum: 0
            source:
              type: string
              enum:
                - cache
                - database
                - clickhouse
                - upstream
                - fallback
                - internal
          required:
            - timestampMs
            - requestId
      required:
        - success
        - error
        - meta
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      description: >-
        A Lean API key, sent as `Authorization: Bearer <key>`. A test key
        (`lean_sk_test_...`) simulates orders and fills with no money; a live
        key (`lean_sk_live_...`) trades for real within the key's limits. Every
        successful response says which mode answered in `data.livemode`.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.