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

# Get single orderbook

> Read the nested orderbook for one game, plus child markets

Returns the **nested** orderbook for a single game — spreads and totals are objects keyed by spread / total number rather than flattened arrays. Also returns any child games (props, alternate periods) and an `orderSummary` of the caller's own resting orders for the league.

For the simpler flat shape, prefer [Get orderbook](/pages/rest/markets/get-orderbook).

## Request

`GET /exchange/getSingleOrderbook`

<ParamField query="gameID" type="string" required>
  Game id.
</ParamField>

<CodeGroup>
  ```bash curl theme={null}
  curl "https://api.4casters.io/exchange/getSingleOrderbook?gameID=65b67450503180295ade9216" \
    -H "Authorization: Bearer YOUR_TOKEN"
  ```
</CodeGroup>

## Response

<ResponseField name="data.game" type="object">
  Game object with nested-orderbook fields. The standard `Game` fields apply (see [Get games](/pages/rest/markets/get-games#response)), plus:

  <Expandable title="Per-game orderbook fields">
    <ResponseField name="awayMoneylines" type="array">Resting away-side moneyline orders. Sorted best-price first.</ResponseField>
    <ResponseField name="homeMoneylines" type="array">Resting home-side moneyline orders.</ResponseField>
    <ResponseField name="awaySpreads" type="object">Object keyed by spread number (e.g. `"-3.5"`). Each value is an array of orders.</ResponseField>
    <ResponseField name="homeSpreads" type="object">Object keyed by spread number.</ResponseField>
    <ResponseField name="over" type="object">Object keyed by total number (e.g. `"220.5"`). Each value is an array of orders.</ResponseField>

    <ResponseField name="under" type="object" />

    <ResponseField name="homeMoneylines1x2" type="object">**Soccer only.** Object with `homeYes` / `homeNo` arrays.</ResponseField>
    <ResponseField name="awayMoneylines1x2" type="object">**Soccer only.** Object with `awayYes` / `awayNo` arrays.</ResponseField>
    <ResponseField name="draw1x2" type="object">**Soccer only.** Object with `drawYes` / `drawNo` arrays.</ResponseField>
    <ResponseField name="mainHomeSpread" type="string">The currently-displayed main home spread (the consensus line).</ResponseField>

    <ResponseField name="mainAwaySpread" type="number" />

    <ResponseField name="mainTotal" type="string" />

    <ResponseField name="openInterest" type="number" />

    <ResponseField name="matchedVolume" type="number" />
  </Expandable>
</ResponseField>

<ResponseField name="data.orderSummary" type="array">
  The caller's own resting orders across the entire league (not just this game). Useful for rendering "your offers" badges in a UI.
</ResponseField>

<ResponseField name="data.childGames" type="array">
  Child games (alternate periods, etc.) of the requested game. Same shape as `data.game`.
</ResponseField>

<ResponseField name="data.propGames" type="array">
  Prop games tied to the requested game.
</ResponseField>

Each individual order has the standard order shape:

<Snippet file="types/orderbook-order.mdx" />

## Errors

| Status | Meaning           |
| ------ | ----------------- |
| `400`  | `gameID` missing. |


## OpenAPI

````yaml GET /exchange/getSingleOrderbook
openapi: 3.1.0
info:
  title: 4casters REST API
  version: 1.0.0
  description: >-
    Public REST API for the 4casters peer-to-peer betting exchange. Use this API
    to manage your account, query the orderbook and games, and place / edit /
    cancel orders.


    All responses (unless noted otherwise) are JSON envelopes of the form `{
    "data": ... }`.
  contact:
    name: 4casters
    url: https://4casters.io
servers:
  - url: https://api.4casters.io
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Authentication
    description: Login and account session management
  - name: User
    description: Read account info, bets, and orders
  - name: Orders
    description: Place, edit, look up, and cancel orders
  - name: Markets
    description: Browse leagues, games, participants, and orderbooks
  - name: Affiliate
    description: Affiliate / referral commission
paths:
  /exchange/getSingleOrderbook:
    get:
      tags:
        - Markets
      summary: Get single orderbook
      description: >-
        Return the nested orderbook for a single game, plus any child games
        (props, alternate periods) and an `orderSummary` of the caller's own
        resting orders for the league.
      parameters:
        - name: gameID
          in: query
          required: true
          schema:
            type: string
          description: Game id.
      responses:
        '200':
          description: Single-game orderbook
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      game:
                        $ref: '#/components/schemas/GameOrderbookNested'
                      orderSummary:
                        type: array
                        items:
                          type: object
                      childGames:
                        type: array
                        items:
                          $ref: '#/components/schemas/GameOrderbookNested'
                      propGames:
                        type: array
                        items:
                          $ref: '#/components/schemas/GameOrderbookNested'
        '400':
          description: Missing required parameter `gameID`
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  schemas:
    GameOrderbookNested:
      allOf:
        - $ref: '#/components/schemas/Game'
        - type: object
          description: >-
            v1 orderbook: spreads and totals are objects keyed by spread / total
            number; values are arrays of orders.
          properties:
            homeMoneylines:
              type: array
              items:
                $ref: '#/components/schemas/OrderbookOrder'
            awayMoneylines:
              type: array
              items:
                $ref: '#/components/schemas/OrderbookOrder'
            homeSpreads:
              type: object
              additionalProperties:
                type: array
                items:
                  $ref: '#/components/schemas/OrderbookOrder'
              description: Keyed by spread number, e.g. `"-3.5"`.
            awaySpreads:
              type: object
              additionalProperties:
                type: array
                items:
                  $ref: '#/components/schemas/OrderbookOrder'
            over:
              type: object
              additionalProperties:
                type: array
                items:
                  $ref: '#/components/schemas/OrderbookOrder'
              description: Keyed by total number, e.g. `"220.5"`.
            under:
              type: object
              additionalProperties:
                type: array
                items:
                  $ref: '#/components/schemas/OrderbookOrder'
            homeMoneylines1x2:
              type: object
            awayMoneylines1x2:
              type: object
            draw1x2:
              type: object
            mainHomeSpread:
              type:
                - string
                - number
              nullable: true
            mainAwaySpread:
              type:
                - string
                - number
              nullable: true
            mainTotal:
              type:
                - string
                - number
              nullable: true
            openInterest:
              type: number
            matchedVolume:
              type: number
    Game:
      type: object
      description: Game without orderbook data.
      properties:
        id:
          type: string
        parentGameID:
          type: string
          nullable: true
        cheapDataUID:
          type: string
          description: >-
            Stable cross-system identifier for the game (used for line
            correlation).
        league:
          type: string
        sport:
          type: string
        start:
          type: string
          format: date-time
        ended:
          type: boolean
        live:
          type: boolean
        featured:
          type: boolean
        eventName:
          type: string
          nullable: true
        tournamentName:
          type: string
          nullable: true
        periodName:
          type: string
          description: e.g. `Full Time`, `1H`, `Set 1`.
        isSpecials:
          type: boolean
          description: True for futures and other specials markets.
        participants:
          type: array
          items:
            $ref: '#/components/schemas/Participant'
    OrderbookOrder:
      type: object
      description: A single resting order on the book.
      properties:
        id:
          type: string
        type:
          $ref: '#/components/schemas/MarketType'
        createdBy:
          type: string
          description: Present **only** when the order belongs to the caller.
        sumUntaken:
          type: number
          description: Win amount still available (taker pays risk to claim it).
        odds:
          type: integer
          description: American odds.
        bet:
          type: number
          description: Original `bet` amount.
        gameID:
          type: string
        takenRatio:
          type: number
          nullable: true
          description: Fraction of the order that has been matched.
        expiry:
          type: string
          format: date-time
          nullable: true
        createdAt:
          type: string
          format: date-time
        mockOrder:
          type: boolean
        gameStartExpiry:
          type: boolean
          description: True when the order is set to auto-cancel at game start.
        isPostArb:
          type: boolean
          description: 'Present when the order was placed with `orderType: postArb`.'
        participantID:
          type: string
          description: Present for `moneyline` and `spread`.
        spread:
          type: number
          description: Present for `spread`.
        total:
          type: number
          description: Present for `total`.
        OU:
          type: string
          enum:
            - over
            - under
          description: Present for `total`.
        market:
          type: string
          description: Present for `moneyline1x2`.
        side:
          type: string
          enum:
            - 'yes'
            - 'no'
          description: Present for `moneyline1x2`.
    Participant:
      type: object
      properties:
        id:
          type: string
        longName:
          type: string
        shortName:
          type: string
        homeAway:
          type: string
          enum:
            - home
            - away
        mainPitcher:
          type: string
          nullable: true
        rotationNumber:
          type: string
          nullable: true
        futuresSide:
          type: string
          nullable: true
        score:
          type: number
          description: Final score; only present for ended games.
    MarketType:
      type: string
      enum:
        - moneyline
        - spread
        - total
        - moneyline1x2
      description: >-
        Market type. `moneyline1x2` is **soccer-only** (three-way money line:
        home / away / draw).
  responses:
    Unauthorized:
      description: Missing or invalid auth token
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Pass your auth token in the `Authorization` header. The `Bearer` prefix
        is optional; the server also accepts a signed `auth` cookie or a `token`
        field in the request body.

````