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

# Get order books

> Batch order books. The response array is parallel to the request
body — same length, same order. Unknown token ids return an
empty book shape rather than 404 (batch endpoints don't
per-element error).




## OpenAPI

````yaml /api-reference/openapi.yaml post /books
openapi: 3.0.3
info:
  title: XO Orderbook API
  description: |
    Public REST surface of the XO CLOB API.

    XO mainnet chain id is `3223`. The EIP-712 order domain is
    `XO Market CLOB` with `verifyingContract` set to the
    [CTF Exchange](/) address. See
    [Smart accounts](../guides/smart-accounts) for the smart-account
    identity model and ERC-1271 order signing.

    Wire conventions:
      * Prices are trimmed decimal strings (e.g. `"0.5"`, `"0.555"`).
      * Sizes are decimal-string integers in human shares.
      * Timestamps in trade and book responses are stringified Unix
        seconds / milliseconds (the SDK uses `TimestampSeconds<String>`
        / `TimestampMilliSeconds<String>`).
      * Token IDs are decimal U256 strings; condition IDs are
        `0x`-prefixed 32-byte hex.
  version: 1.0.0
  contact:
    name: XO Market
    url: https://beta.xo.market
servers:
  - url: https://orderbooks.xo.market
    description: Mainnet (XO chain id 3223)
security: []
tags:
  - name: Authentication
    description: >-
      Create and manage API keys. The L1 ClobAuth EIP-712 flow mints HMAC
      credentials that authenticate every other private request.
  - name: Market Data
    description: >-
      Public reads for books, prices, midpoints, spreads, last trades, and price
      history. Also includes server time and per-token configuration.
  - name: Markets
    description: >-
      Discovery for tradable markets, including pagination and SDK-compatible
      simplified shapes.
  - name: Trade
    description: Place, cancel, and inspect orders and trades for the authenticated maker.
  - name: Account
    description: Maker balance, allowance, positions, and claimable settled positions.
paths:
  /books:
    post:
      tags:
        - Market Data
      summary: Get order books
      description: |
        Batch order books. The response array is parallel to the request
        body — same length, same order. Unknown token ids return an
        empty book shape rather than 404 (batch endpoints don't
        per-element error).
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: array
              items:
                type: object
                required:
                  - token_id
                properties:
                  token_id:
                    type: string
            examples:
              two_sided_market:
                summary: both sides of a binary market
                value:
                  - token_id: >-
                      26516164265702901957933644848127860370782874751279270726689263951695181556943
                  - token_id: >-
                      13730057904096984444199595880113152612639388204530324084054099203558669491245
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/BookResponse'
              examples:
                populated:
                  summary: both sides populated (illustrative)
                  value:
                    - market: >-
                        0x39a12d52b63969654926e095ddd96f5c459112714da03edca769aa58173c78fb
                      asset_id: >-
                        26516164265702901957933644848127860370782874751279270726689263951695181556943
                      timestamp: '1779355812367'
                      hash: >-
                        86abb2eec0fed47888ef100977aa363345a032f35a53976d88e951c28bb57ab9
                      bids:
                        - price: '0.547'
                          size: '120'
                      asks:
                        - price: '0.553'
                          size: '95'
                      min_order_size: '5'
                      tick_size: '0.001'
                      neg_risk: false
                      last_trade_price: '0.550'
                    - market: >-
                        0x39a12d52b63969654926e095ddd96f5c459112714da03edca769aa58173c78fb
                      asset_id: >-
                        13730057904096984444199595880113152612639388204530324084054099203558669491245
                      timestamp: '1779355812367'
                      hash: >-
                        1a2b3c4d5e6f0011223344556677889900aabbccddeeff00112233445566778899
                      bids:
                        - price: '0.447'
                          size: '95'
                      asks:
                        - price: '0.453'
                          size: '120'
                      min_order_size: '5'
                      tick_size: '0.001'
                      neg_risk: false
                      last_trade_price: '0.450'
      x-codeSamples:
        - lang: Rust
          label: xo-orderbook-client-rs
          source: >
            use xo_orderbook_client::orderbook::{Client, Config};

            use
            xo_orderbook_client::orderbook::types::request::OrderBookSummaryRequest;

            use xo_orderbook_client::types::U256;


            let client = Client::new("https://orderbooks.xo.market",
            Config::default())?;

            let yes =
            U256::from_str_radix("26516164265702901957933644848127860370782874751279270726689263951695181556943",
            10)?;

            let no  =
            U256::from_str_radix("13730057904096984444199595880113152612639388204530324084054099203558669491245",
            10)?;

            let reqs = [
                OrderBookSummaryRequest { token_id: yes },
                OrderBookSummaryRequest { token_id: no },
            ];

            let books = client.order_books(&reqs).await?;

            // Response array is parallel to the request (same length, same
            order).
components:
  schemas:
    BookResponse:
      type: object
      required:
        - market
        - asset_id
        - asks
        - bids
        - hash
        - timestamp
        - tick_size
        - min_order_size
        - neg_risk
        - last_trade_price
      properties:
        market:
          type: string
          description: conditionId
        asset_id:
          type: string
          description: Decimal U256 token id
        asks:
          type: array
          description: Sorted ascending by price (best ask first).
          items:
            $ref: '#/components/schemas/PriceLevel'
        bids:
          type: array
          description: Sorted descending by price (best bid first).
          items:
            $ref: '#/components/schemas/PriceLevel'
        hash:
          type: string
          description: >-
            keccak256 of `{bids ++ asks ++ timestamp}`; bumps on every book
            change.
        timestamp:
          type: string
          description: Unix milliseconds, stringified (TimestampMilliSeconds<String>)
        tick_size:
          type: string
          example: '0.001'
        min_order_size:
          type: string
          description: |
            Minimum order size in human shares (decimal-string integer).
            Returns `"0"` when the gateway has no MarketInfo for the
            token yet (e.g. very fresh markets) — populated once
            engine MarketInfo arrives.
        neg_risk:
          type: boolean
          description: Always `false` on XO.
        last_trade_price:
          type: string
          description: >-
            Trimmed decimal; `"0.000"` if no trades have ever printed on this
            token.
    PriceLevel:
      type: object
      required:
        - price
        - size
      properties:
        price:
          type: string
          description: Trimmed decimal
        size:
          type: string
          description: Decimal-string integer (human shares)

````