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

# Get order books for a market

> Returns the latest orderbook snapshot for every position (outcome) in a market. Accepts condition_id or market_slug. `bids` and `asks` are arrays of `{"p": price, "s": size}` objects, sorted best-first.



## OpenAPI

````yaml https://api.struct.to/openapi.json get /polymarket/order-book/market
openapi: 3.1.0
info:
  title: Polymarket API
  description: >-
    RESTful API for querying Polymarket prediction markets data including
    events, markets, traders, holders, and real-time metrics
  license:
    name: ''
  version: 1.0.0
servers:
  - url: https://api.struct.to/v1
security: []
paths:
  /polymarket/order-book/market:
    get:
      tags:
        - Order Book
      summary: Get order books for a market
      description: >-
        Returns the latest orderbook snapshot for every position (outcome) in a
        market. Accepts condition_id or market_slug. `bids` and `asks` are
        arrays of `{"p": price, "s": size}` objects, sorted best-first.
      operationId: get_market_order_book
      parameters:
        - name: condition_id
          in: query
          description: Condition ID of the market
          required: false
          schema:
            type: string
        - name: market_slug
          in: query
          description: Market slug (alternative to condition_id)
          required: false
          schema:
            type: string
      responses:
        '200':
          description: Latest orderbook snapshot per position. ts is Unix milliseconds.
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  required:
                    - ts
                    - position_id
                    - condition_id
                    - bids
                    - asks
                    - hash
                  properties:
                    ts:
                      type: integer
                      format: int64
                      description: Unix timestamp in seconds.
                    position_id:
                      type: string
                      description: Position ID.
                    condition_id:
                      type: string
                      description: Condition ID.
                    bids:
                      type: array
                      items:
                        $ref: '#/components/schemas/OrderbookLevel'
                      description: Bid levels for the order book.
                    asks:
                      type: array
                      items:
                        $ref: '#/components/schemas/OrderbookLevel'
                      description: Ask levels for the order book.
                    hash:
                      type: string
                      description: Order book snapshot hash.
                    best_bid:
                      type:
                        - number
                        - 'null'
                      format: double
                      description: Best bid.
                    best_ask:
                      type:
                        - number
                        - 'null'
                      format: double
                      description: Best ask.
                    mid_price:
                      type:
                        - number
                        - 'null'
                      format: double
                      description: Mid price.
                    spread:
                      type:
                        - number
                        - 'null'
                      format: double
                      description: Spread.
                    bid_liquidity_usd:
                      type:
                        - number
                        - 'null'
                      format: double
                      description: Bid liquidity in USD.
                    ask_liquidity_usd:
                      type:
                        - number
                        - 'null'
                      format: double
                      description: Ask liquidity in USD.
                    bid_levels:
                      type:
                        - integer
                        - 'null'
                      format: int32
                      description: Bid levels.
                    ask_levels:
                      type:
                        - integer
                        - 'null'
                      format: int32
                      description: Ask levels.
        '400':
          description: Missing or invalid parameters
components:
  schemas:
    OrderbookLevel:
      type: object
      description: A single price level in a bids/asks array.
      required:
        - p
        - s
      properties:
        p:
          type: string
          description: Price as a decimal string
        s:
          type: string
          description: Size as a decimal string

````