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

# predictionOutcomeOrderBooks

> Returns live order books for a set of Polymarket and Kalshi prediction outcomes, fetched from the venue's CLOB and cached for up to 10 seconds.

> [!NOTE]
>
> At least for the time being, this endpoint requires a Growth or Enterprise plan. [Learn more](https://dashboard.codex.io/dashboard/billing?utm_source=codex\&utm_medium=docs\&utm_campaign=billing).

## GraphQL

```
type Query {
  # Requires a Growth or Enterprise plan.
  predictionOutcomeOrderBooks(
    outcomeIds: [String!]!
  ): [PredictionOutcomeOrderBook]!
}

enum PredictionProtocol {
  POLYMARKET
  KALSHI
}

type PredictionOrderBookLevel {
  price: Float!
  size: Float!
}

type PredictionOutcomeOrderBook {
  outcomeId: String!
  protocol: PredictionProtocol!
  venueOutcomeId: String!
  bids: [PredictionOrderBookLevel!]!
  asks: [PredictionOrderBookLevel!]!
  timestamp: Int!
  bookLiquidityUsd: String
  bookLiquidityCT: String
}
```

### Example

[Test this query in the Explorer →](https://docs.codex.io/explore.md)

```graphql theme={null}
{
  predictionOutcomeOrderBooks(
    outcomeIds: ["111080671036126109659854287535401661966194360665829017654832975124868412594547:Polymarket:0xc5d563a36ae78145c45a50134d48a1215220f80a:137"]
  ) {
    outcomeId
    protocol
    timestamp
    bookLiquidityUsd
    bids {
      price
      size
    }
    asks {
      price
      size
    }
  }
}
```

### Usage Guidelines

* One entry is returned per requested `outcomeId`, in input order; entries are `null` when the outcome is unknown or the venue is unsupported
* `bids` and `asks` are ordered so the last element is the best (highest) bid or best (lowest) ask; both arrays are empty when no book is available
* `timestamp` is the venue-reported snapshot time in unix seconds, and is `0` when no book is available
* Order books are fetched from the venue's CLOB and cached for up to 10 seconds


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.