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

> Best bid and ask with the quantity resting at each, mid and last trade for up to 25 markets in one call, across venues and per venue. Ids that match no market are returned in `not_found`.



## OpenAPI

````yaml api-reference/openapi.json GET /prices
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:
  /prices:
    get:
      tags:
        - Markets
      summary: Get prices
      description: >-
        Best bid and ask with the quantity resting at each, mid and last trade
        for up to 25 markets in one call, across venues and per venue. Ids that
        match no market are returned in `not_found`.
      operationId: getPrices
      parameters:
        - schema:
            type: string
            description: >-
              Markets separated by commas, at most 25: market ids from GET
              /markets or venue symbols that each name one market, such as
              Polymarket token ids or Hyperliquid book coins. A venue symbol is
              priced on the one listing it names, as an order naming it would
              trade, under its market id with that listing in `venues`. A market
              id is priced across every listing. Ids naming the same listings
              are priced once.
          required: true
          description: >-
            Markets separated by commas, at most 25: market ids from GET
            /markets or venue symbols that each name one market, such as
            Polymarket token ids or Hyperliquid book coins. A venue symbol is
            priced on the one listing it names, as an order naming it would
            trade, under its market id with that listing in `venues`. A market
            id is priced across every listing. Ids naming the same listings are
            priced once.
          name: market_ids
          in: query
      responses:
        '200':
          description: Top of book per market, best across venues and per venue
          content:
            application/json:
              schema:
                oneOf:
                  - type: object
                    properties:
                      success:
                        type: boolean
                        enum:
                          - true
                      data:
                        type: object
                        properties:
                          prices:
                            type: array
                            items:
                              type: object
                              properties:
                                market_id:
                                  type: string
                                  minLength: 1
                                  description: >-
                                    The market id from GET /markets, however the
                                    request named the market.
                                best_bid:
                                  type: string
                                  nullable: true
                                best_bid_quantity:
                                  type: string
                                  nullable: true
                                  pattern: ^\d+(?:\.\d+)?$
                                  description: >-
                                    Shares resting at `best_bid`, summed over
                                    every venue at that price; null when
                                    `best_bid` is null.
                                best_ask:
                                  type: string
                                  nullable: true
                                best_ask_quantity:
                                  type: string
                                  nullable: true
                                  pattern: ^\d+(?:\.\d+)?$
                                  description: >-
                                    Shares resting at `best_ask`, summed over
                                    every venue at that price; null when
                                    `best_ask` is null.
                                mid:
                                  type: string
                                  nullable: true
                                spread:
                                  type: string
                                  nullable: true
                                  pattern: ^-?\d+(?:\.\d+)?$
                                last_trade_price:
                                  type: string
                                  nullable: true
                                last_trade_at:
                                  type: string
                                  nullable: true
                                  format: date-time
                                venues:
                                  type: array
                                  items:
                                    type: object
                                    properties:
                                      venue:
                                        type: string
                                        enum:
                                          - kalshi
                                          - polymarket
                                          - polymarket_us
                                          - hyperliquid
                                      ticker:
                                        type: string
                                        minLength: 1
                                      best_bid:
                                        type: string
                                        nullable: true
                                      best_bid_quantity:
                                        type: string
                                        nullable: true
                                        pattern: ^\d+(?:\.\d+)?$
                                        description: >-
                                          Shares resting at `best_bid`, summed
                                          over every venue at that price; null
                                          when `best_bid` is null.
                                      best_ask:
                                        type: string
                                        nullable: true
                                      best_ask_quantity:
                                        type: string
                                        nullable: true
                                        pattern: ^\d+(?:\.\d+)?$
                                        description: >-
                                          Shares resting at `best_ask`, summed
                                          over every venue at that price; null
                                          when `best_ask` is null.
                                    required:
                                      - venue
                                      - ticker
                                      - best_bid
                                      - best_bid_quantity
                                      - best_ask
                                      - best_ask_quantity
                                unavailable:
                                  type: array
                                  items:
                                    type: string
                                    enum:
                                      - kalshi
                                      - polymarket
                                      - polymarket_us
                                      - hyperliquid
                              required:
                                - market_id
                                - best_bid
                                - best_bid_quantity
                                - best_ask
                                - best_ask_quantity
                                - mid
                                - spread
                                - last_trade_price
                                - last_trade_at
                                - venues
                                - unavailable
                          not_found:
                            type: array
                            items:
                              type: string
                              minLength: 1
                          as_of:
                            type: string
                            format: date-time
                          livemode:
                            type: boolean
                        required:
                          - prices
                          - not_found
                          - as_of
                          - 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:
                  prices:
                    - market_id: >-
                        mkt_bmZsOjIwMjYtMTAtMTE6REVOLUxBQwpzcHJlYWQ6Z2FtZTpERU46LTMuNQpERU4
                      best_bid: '0.54'
                      best_bid_quantity: '150'
                      best_ask: '0.55'
                      best_ask_quantity: '120'
                      mid: '0.545'
                      spread: '0.01'
                      last_trade_price: '0.55'
                      last_trade_at: '2026-10-29T17:59:12.000Z'
                      venues:
                        - venue: hyperliquid
                          ticker: hl:9999
                          best_bid: '0.54'
                          best_bid_quantity: '100'
                          best_ask: '0.56'
                          best_ask_quantity: '80'
                        - venue: polymarket
                          ticker: >-
                            pm:0x2222222222222222222222222222222222222222222222222222222222222222
                          best_bid: '0.54'
                          best_bid_quantity: '50'
                          best_ask: '0.55'
                          best_ask_quantity: '120'
                      unavailable: []
                  not_found: []
                  as_of: '2026-10-29T18:00:00.000Z'
                  livemode: true
                meta:
                  timestampMs: 1792771200000
                  requestId: 7d2c9f4e-1b3a-4e8d-9c6f-2a5b8e0d4f17
        '400':
          description: API error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              example:
                success: false
                error:
                  code: VALIDATION_ERROR
                  message: Invalid request
                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
        '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.