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

# Order Book

> Returns the full order book for a token, including all bid and ask price levels, market properties, and PolyNode metadata enrichment.

The response format is compatible with Polymarket's CLOB API. Data is served from PolyNode's live orderbook engine, which maintains real-time state via WebSocket deltas from Polymarket.

Returns the full order book for a Polymarket token or market.

## Identifier types

The `{token_id}` parameter accepts three identifier types. The response format depends on which type you use:

| Identifier       | Format                | Returns                                             |
| ---------------- | --------------------- | --------------------------------------------------- |
| **Token ID**     | All digits, 70+ chars | Single book for one outcome (Polymarket-compatible) |
| **Condition ID** | Starts with `0x`      | Both outcomes for one market (Yes + No)             |
| **Slug**         | Human-readable string | All outcomes across all markets in the event        |

### By token ID (single outcome)

Best when you already have a specific token ID and want the exact Polymarket-compatible format.

```bash theme={null}
curl "https://api.polynode.dev/v1/orderbook/114694726451307654528948558967898493662917070661203465131156925998487819889437" \
  -H "x-api-key: YOUR_KEY"
```

Response matches Polymarket's CLOB `/book` format exactly, plus a `metadata` field:

```json theme={null}
{
  "market": "0xd1796c09d0d6f876f8580086ae9808ec991784e3a74b25a1830a25de71a78c96",
  "asset_id": "114694726451307654528948558967898493662917070661203465131156925998487819889437",
  "timestamp": "1773901991806",
  "hash": "b811dc1233a0f250a60018bc94f377955c9a513e",
  "bids": [
    {"price": "0.01", "size": "1130220"},
    {"price": "0.02", "size": "76910"},
    {"price": "0.46", "size": "18"}
  ],
  "asks": [
    {"price": "0.99", "size": "24292"},
    {"price": "0.98", "size": "2048"},
    {"price": "0.47", "size": "687"}
  ],
  "min_order_size": "5",
  "tick_size": "0.01",
  "neg_risk": false,
  "last_trade_price": "0.540",
  "metadata": {
    "question": "Netanyahu out by end of 2026?",
    "slug": "netanyahu-out-before-2027-684-719-226",
    "outcomes": ["Yes", "No"],
    "condition_id": "0xd1796c09d0d6f876f8580086ae9808ec991784e3a74b25a1830a25de71a78c96",
    "image": "https://polymarket-upload.s3.us-east-2.amazonaws.com/netanyahu-out-in-2025-Vc7bE4GtiJzM.jpg"
  }
}
```

### By condition ID (both outcomes)

Best when you want both sides of a market at once. Condition IDs start with `0x`.

```bash theme={null}
curl "https://api.polynode.dev/v1/orderbook/0xd1796c09d0d6f876f8580086ae9808ec991784e3a74b25a1830a25de71a78c96" \
  -H "x-api-key: YOUR_KEY"
```

Response wraps both outcomes:

```json theme={null}
{
  "condition_id": "0xd1796c09d0d6f876f8580086ae9808ec991784e3a74b25a1830a25de71a78c96",
  "question": "Netanyahu out by end of 2026?",
  "event_title": "Netanyahu out by...?",
  "outcomes": [
    {
      "outcome": "Yes",
      "token_id": "114694726451307654528948558967898493662917070661203465131156925998487819889437",
      "market": "0xd1796c09d0d6f876f8580086ae9808ec991784e3a74b25a1830a25de71a78c96",
      "bids": [{"price": "0.01", "size": "1130220"}, "..."],
      "asks": [{"price": "0.99", "size": "24292"}, "..."],
      "min_order_size": "5",
      "tick_size": "0.01",
      "neg_risk": false,
      "last_trade_price": "0.540"
    },
    {
      "outcome": "No",
      "token_id": "66255671088804707681511323064315150986307471908131081808279119719218775249892",
      "market": "0xd1796c09d0d6f876f8580086ae9808ec991784e3a74b25a1830a25de71a78c96",
      "bids": [{"price": "0.01", "size": "821530"}, "..."],
      "asks": [{"price": "0.99", "size": "13720.65"}, "..."],
      "min_order_size": "5",
      "tick_size": "0.01",
      "neg_risk": false,
      "last_trade_price": "0.540"
    }
  ]
}
```

### By slug (all outcomes across markets)

Best for getting a complete view of an event. Slugs are the human-readable event identifiers from Polymarket (e.g. `netanyahu-out-before-2027`). An event may have multiple markets, each with their own outcomes.

```bash theme={null}
curl "https://api.polynode.dev/v1/orderbook/netanyahu-out-before-2027" \
  -H "x-api-key: YOUR_KEY"
```

Response includes all outcomes across all markets in the event. Same format as the condition ID response, but with `slug` instead of `condition_id` at the top level.

## Fields (single-token response)

| Field              | Type    | Description                                                         |
| ------------------ | ------- | ------------------------------------------------------------------- |
| `market`           | string  | Market condition ID (hex)                                           |
| `asset_id`         | string  | Token ID                                                            |
| `timestamp`        | string  | Unix timestamp in milliseconds                                      |
| `hash`             | string  | 40-character hex hash of the book state                             |
| `bids`             | array   | Bid price levels, sorted ascending by price                         |
| `asks`             | array   | Ask price levels, sorted descending by price                        |
| `min_order_size`   | string  | Minimum order size for this market                                  |
| `tick_size`        | string  | Minimum price increment (e.g. `"0.01"` or `"0.001"`)                |
| `neg_risk`         | boolean | Whether this is a neg-risk market                                   |
| `last_trade_price` | string  | Last traded price                                                   |
| `metadata`         | object  | PolyNode enrichment: question, slug, outcomes, condition\_id, image |

## Notes

* `tick_size` and `min_order_size` vary per market. They are sourced from the Gamma API, not hardcoded.
* Bids are sorted ascending by price (best bid is the last element). Asks are sorted descending (best ask is the last element). This matches Polymarket's sort order.
* If no book exists for the requested identifier, returns a 404 with `{"error": "No orderbook exists for the requested token id"}`.


## OpenAPI

````yaml GET /v1/orderbook/{token_id}
openapi: 3.1.0
info:
  title: PolyNode API
  description: >-
    Real-time Polymarket data API with decoded mempool settlements, OHLCV
    candles, and full Polygon JSON-RPC proxy.
  contact:
    name: PolyNode
    url: https://polynode.dev
  license:
    name: ''
  version: 2.0.0
servers:
  - url: https://api.polynode.dev
    description: Production
security:
  - api_key: []
paths:
  /v1/orderbook/{token_id}:
    get:
      tags:
        - Orderbook
      summary: Order book
      description: >-
        Returns the full order book for a token, including all bid and ask price
        levels, market properties, and PolyNode metadata enrichment.


        The response format is compatible with Polymarket's CLOB API. Data is
        served from PolyNode's live orderbook engine, which maintains real-time
        state via WebSocket deltas from Polymarket.
      operationId: get_orderbook
      parameters:
        - name: token_id
          in: path
          description: >-
            Token ID (all digits), condition ID (starts with 0x), or event slug.
            Token ID returns a single book; condition ID and slug return all
            outcomes.
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Order book snapshot
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrderBookResponse'
              example:
                market: >-
                  0xd1796c09d0d6f876f8580086ae9808ec991784e3a74b25a1830a25de71a78c96
                asset_id: >-
                  114694726451307654528948558967898493662917070661203465131156925998487819889437
                timestamp: '1773901991806'
                hash: b811dc1233a0f250a60018bc94f377955c9a513e
                bids:
                  - price: '0.01'
                    size: '1130220'
                  - price: '0.02'
                    size: '76910'
                  - price: '0.03'
                    size: '94333.34'
                  - price: '0.04'
                    size: '119706'
                  - price: '0.05'
                    size: '16328'
                  - price: '0.46'
                    size: '18'
                asks:
                  - price: '0.99'
                    size: '24292'
                  - price: '0.98'
                    size: '2048'
                  - price: '0.97'
                    size: '13333.33'
                  - price: '0.96'
                    size: '1024'
                  - price: '0.95'
                    size: '14100'
                  - price: '0.47'
                    size: '687'
                min_order_size: '5'
                tick_size: '0.01'
                neg_risk: false
                last_trade_price: '0.540'
                metadata:
                  question: Netanyahu out by end of 2026?
                  slug: netanyahu-out-before-2027-684-719-226
                  outcomes:
                    - 'Yes'
                    - 'No'
                  condition_id: >-
                    0xd1796c09d0d6f876f8580086ae9808ec991784e3a74b25a1830a25de71a78c96
                  image: >-
                    https://polymarket-upload.s3.us-east-2.amazonaws.com/netanyahu-out-in-2025-Vc7bE4GtiJzM.jpg
        '401':
          description: Missing or invalid API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Token not found in orderbook
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error: No orderbook exists for the requested token id
        '429':
          description: Rate limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - api_key: []
components:
  schemas:
    OrderBookResponse:
      type: object
      description: >-
        Full order book snapshot. Base fields match Polymarket's CLOB `/book`
        response exactly. The `metadata` field is a PolyNode addition.
      required:
        - market
        - asset_id
        - timestamp
        - hash
        - bids
        - asks
        - min_order_size
        - tick_size
        - neg_risk
        - last_trade_price
      properties:
        market:
          type: string
          description: Market condition ID (hex)
        asset_id:
          type: string
          description: Token ID
        timestamp:
          type: string
          description: Unix timestamp in milliseconds (as string)
        hash:
          type: string
          description: 40-character hex hash of the book state
        bids:
          type: array
          items:
            $ref: '#/components/schemas/PriceLevel'
          description: Bid price levels, sorted ascending by price
        asks:
          type: array
          items:
            $ref: '#/components/schemas/PriceLevel'
          description: Ask price levels, sorted descending by price
        min_order_size:
          type: string
          description: Minimum order size for this market (e.g. "5")
        tick_size:
          type: string
          description: Minimum price increment for this market (e.g. "0.01" or "0.001")
        neg_risk:
          type: boolean
          description: Whether this is a neg-risk market
        last_trade_price:
          type: string
          description: Last trade price (e.g. "0.540")
        metadata:
          $ref: '#/components/schemas/OrderBookMetadata'
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: string
    PriceLevel:
      type: object
      description: A single price level in the order book.
      required:
        - price
        - size
      properties:
        price:
          type: string
          description: Price as a decimal string (e.g. "0.55")
        size:
          type: string
          description: Total size available at this price level (e.g. "1500.25")
    OrderBookMetadata:
      type: object
      description: >-
        PolyNode market metadata enrichment (not present in Polymarket's CLOB
        API).
      properties:
        question:
          type: string
          description: Market question text
        slug:
          type: string
          description: Event slug for URL construction
        outcomes:
          type: array
          items:
            type: string
          description: Outcome labels (e.g. ["Yes", "No"])
        condition_id:
          type: string
          description: Market condition ID (hex)
        image:
          type: string
          description: Market image URL
  securitySchemes:
    api_key:
      type: apiKey
      in: header
      name: x-api-key

````