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

> Returns the latest CLOB orderbook snapshot for a position, including derived metrics (best bid/ask, mid price, spread, liquidity depth). Data is sourced from the real-time Polymarket WebSocket feed. `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
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:
    get:
      tags:
        - Order Book
      summary: Get order book
      description: >-
        Returns the latest CLOB orderbook snapshot for a position, including
        derived metrics (best bid/ask, mid price, spread, liquidity depth). Data
        is sourced from the real-time Polymarket WebSocket feed. `bids` and
        `asks` are arrays of `{"p": price, "s": size}` objects, sorted
        best-first.
      operationId: get_order_book
      parameters:
        - name: position_id
          in: query
          description: Token ID (position ID) to query
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Latest orderbook snapshot. ts is Unix milliseconds.
          content:
            application/json:
              schema:
                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

````