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

# Get orderbook snapshot

> Aggregated orderbook snapshot. **L0 — public.**



## OpenAPI

````yaml /api-reference/openapi-clob-v1.yaml get /v1/markets/{condition_id}/book
openapi: 3.1.0
info:
  title: Foresight CLOB Trading API v1
  version: 1.0.0
  description: >
    Public-facing CLOB (central-limit order book) REST API for the Foresight

    prediction-market platform.


    This is a **different API from the legacy AMM Trade API** (`/trade/*`). The

    CLOB API trades signed limit/market orders against an order book instead of

    swapping against an automated market maker.


    ## Base URL


    ```

    https://api.foresight.now

    ```


    All routes below are prefixed with `/v1`.


    ## Auth tiers


    - **L0** — public, no credentials (all market-data routes).

    - **L1** — Privy JWT (`Authorization: Bearer <jwt>`); used for API-key
    management.

    - **L2** — Privy JWT **or** API-key headers (`fs-api-key` +
    `fs-api-secret`); used for trading and private reads.


    ## Market identity


    A market is identified by the pair **`condition_id`** (on-chain
    ConditionalTokens

    condition hash) + **`chain_id`** (blockchain network id). Internal database

    identifiers are never exposed.


    The CLOB currently runs on **BNB Smart Chain (BSC) mainnet — `chain_id:
    56`**.

    The collateral token on BSC has **18 decimals**. Always read the
    authoritative

    `decimals` from `GET /v1/markets/{condition_id}/tokens` rather than
    hard-coding

    it — amount math signed at the wrong scale is rejected at ingest.


    ## Async matching


    `POST /v1/orders` always returns `status: OPEN`. Matching runs in a
    background

    worker; matched / partial / failed transitions arrive on the private `user`

    WebSocket channel (`wss://api.foresight.now/v1/ws`).


    ## Error envelope


    Every non-2xx response is shaped as (all field names snake_case):


    ```json

    {
      "correlation_id": "abc-123",
      "code": "NOT_FOUND",
      "message": "Market not found",
      "status_code": 404,
      "timestamp": "2026-06-03T10:15:30.000Z",
      "path": "/v1/markets/0x.../book"
    }

    ```
servers:
  - url: https://api.foresight.now
    description: Production
  - url: http://localhost:3000
    description: Local development
security: []
tags:
  - name: Auth
    description: API-key lifecycle and WebSocket token issuance.
  - name: Market Data
    description: Public markets, orderbook, ticker, trades, tokens. L0 — no auth.
  - name: Orders
    description: Place, list, and cancel signed EIP-712 orders. L2.
  - name: Fills
    description: Authenticated wallet's fill history. L2.
  - name: Positions
    description: Authenticated wallet's CLOB positions. L2.
paths:
  /v1/markets/{condition_id}/book:
    get:
      tags:
        - Market Data
      summary: Get orderbook snapshot
      description: Aggregated orderbook snapshot. **L0 — public.**
      parameters:
        - $ref: '#/components/parameters/ConditionIdPath'
        - $ref: '#/components/parameters/ChainIdQuery'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrderBookResponse'
        default:
          $ref: '#/components/responses/ErrorResponse'
components:
  parameters:
    ConditionIdPath:
      in: path
      name: condition_id
      required: true
      schema:
        type: string
        example: '0x9cded060be358b76678e598084cf258c7257771e473dbb461cad23417302d606'
      description: On-chain ConditionalTokens condition hash.
    ChainIdQuery:
      in: query
      name: chain_id
      required: true
      schema:
        type: integer
        example: 56
      description: Blockchain network id. BSC mainnet is `56`.
  schemas:
    OrderBookResponse:
      type: object
      properties:
        condition_id:
          type: string
        chain_id:
          type: integer
          example: 56
        timestamp:
          type: string
          format: date-time
        bids:
          type: array
          description: Buy side, highest price first.
          items:
            $ref: '#/components/schemas/OrderBookLevel'
        asks:
          type: array
          description: Sell side, lowest price first.
          items:
            $ref: '#/components/schemas/OrderBookLevel'
    OrderBookLevel:
      type: object
      properties:
        price:
          type: string
          example: '0.54'
          description: Price level (decimal string, 2dp).
        remainingSize:
          type: string
          example: '123.45'
          description: Aggregate remaining size resting at this price (decimal string).
    Error:
      type: object
      required:
        - correlation_id
        - code
        - message
        - status_code
        - timestamp
        - path
      properties:
        correlation_id:
          type: string
          description: Request correlation id; falls back to `"unknown"` when none is set.
        code:
          type: string
          example: NOT_FOUND
        message:
          type: string
        status_code:
          type: integer
          example: 404
        timestamp:
          type: string
          format: date-time
        path:
          type: string
          example: /v1/markets/0x.../book
  responses:
    ErrorResponse:
      description: Error envelope.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'

````