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

# Lines (V1)

> V1 legacy line endpoints for moneyline, spread, total, team totals, and best lines

> [!WARNING]
>
> V1 line endpoints use a **flat line-based model** with separate moneyline, spread, and total objects. For new integrations, use the [V2 Markets](https://docs.therundown.io/api-reference/v2/markets) endpoints which provide a more flexible market-based structure.

> [!NOTE]
>
> V1 REST `GET` endpoints that return odds accept the optional `odds_format` query parameter. It defaults to `american`; see [Choose an odds format](https://docs.therundown.io/guides/odds-formats.md) for supported values and which response fields change.

## Overview

The V1 lines endpoints return the recorded price history of one sportsbook's line (moneyline, spread, total, team total) for an event, and compute best-available lines across sportsbooks.

### The `{id}` path parameter is a line ID, not an event ID

`/api/v1/lines/{id}/moneyline`, `/spread`, `/total`, and `/team_total` look up prices by **line ID**. A line ID identifies one sportsbook's line for one event, so each request returns that one sportsbook's prices. Passing an event ID does not work: it returns an empty array or `404`.

Get the line ID from a V1 event response, such as `GET /api/v1/events/{eventId}` or `GET /api/v1/sports/{sportID}/events/{date}`:

* `lines.{affiliate_id}.line_id` (the same value appears as `lines.{affiliate_id}.moneyline.line_id`, `.spread.line_id`, and `.total.line_id`), or
* with `include=all_periods`, `line_periods.{affiliate_id}.{period}.moneyline.line_id`. Every period of a sportsbook's line uses the same line ID, so any period gives you the value you need.

```json theme={null}
{
  "event_id": "EVENT_ID",
  "lines": {
    "6": {
      "line_id": 19558127,
      "moneyline": { "line_id": 19558127, "moneyline_away": -120, "moneyline_home": -120 }
    }
  }
}
```

To get every sportsbook's history for an event, call the endpoint once per `line_id`.

### Price history and row limits

These endpoints return price history, not just the current price. Rows come back newest first (by `date_updated`). Each period table is capped at the newest **1,000 rows**, and there is no pagination, offset, or cursor to fetch older rows. Your plan's sportsbook access and data delay also apply.

### The `include=all_periods` parameter

Without `include`, the response contains only the pregame full-game history in a flat array (`moneylines`, `spreads`, or `totals`). In-play prices and period lines are **not** included.

With `include=all_periods`, the response is grouped by period under `moneyline_periods`, `spread_periods`, or `total_periods`:

| Key | Contents |
| - | - |
| `period_full_game` | Pregame full-game prices |
| `period_first_half`, `period_second_half` | Pregame half prices |
| `period_first_period` through `period_fourth_period` | Pregame quarter or period prices |
| `period_live_full_game` | **All in-play rows**: live full game plus live halves and live quarters/periods |

All in-play rows are returned together under `period_live_full_game`. Use each row's `period_id` and `period_description` to tell them apart:

| `period_id` | `period_description` |
| - | - |
| `7` | `PERIOD_LIVE_FULL_GAME` |
| `13` | `PERIOD_LIVE_FIRST_HALF` |
| `14` | `PERIOD_LIVE_SECOND_HALF` |
| `15` | `PERIOD_LIVE_FIRST_PERIOD` |
| `16` | `PERIOD_LIVE_SECOND_PERIOD` |
| `17` | `PERIOD_LIVE_THIRD_PERIOD` |
| `18` | `PERIOD_LIVE_FOURTH_PERIOD` |

Each live period is read separately (newest 1,000 rows each) and then combined, so `period_live_full_game` is not sorted as a whole. Sort by `date_updated` if you need one timeline. Keys with no data are omitted.

Live rows are returned only when your subscription includes live odds access. Without it, the live keys are left out and only pregame periods come back.

> [!TIP]
>
> **For full in-play history, use V2.** V1 caps each period at 1,000 rows with no paging, so a busy game can lose its earliest in-play prices. `GET /api/v2/events/{event_id}/markets/history?market_ids=41,42,43,96&affiliate_ids=19` returns live moneyline, spread, total, and team-total history. You can walk through the game in time windows with `from` and `to`, and `limit` goes up to 5000 rows (default 1000). On this endpoint, ask for the live market IDs `41,42,43,96` explicitly: requesting `1,2,3` does not add them. `affiliate_ids` is required (1 to 3 sportsbooks). See [Historical Odds](https://docs.therundown.io/guides/historical-odds.md).

***

> [!NOTE]
>
> Store your key in the `THERUNDOWN_API_KEY` environment variable and send it in the `X-TheRundown-Key` header. Legacy query authentication remains available for compatibility; use [header authentication](https://docs.therundown.io/authentication.md) for new integrations. Do not put keys in URLs.

## Endpoints

> [accordion] GET /api/v1/lines/\{id}/moneyline — Get moneylines for a line
>
> Returns the price history of one sportsbook's moneyline, newest first. Without `include`, only pregame full-game rows are returned.
>
> ### Parameters
>
> | Parameter | Type | Required | Description |
> | - | - | - | - |
> | `id` | path | Yes | Line ID (`line_id`) from the event's `lines` or `line_periods`. Not an event ID. See the Overview above for where to find it. |
> | `include` | query | No | Set to `all_periods` to group rows by period and add in-play (`period_live_full_game`) and period moneylines |
>
> ```bash cURL theme={null}
> if [ -z "${THERUNDOWN_API_KEY:-}" ]; then
>   echo "Set THERUNDOWN_API_KEY" >&2
>   exit 1
> fi
> curl --fail-with-body -sS --connect-timeout 5 --max-time 20 \
>   -H "X-TheRundown-Key: $THERUNDOWN_API_KEY" \
>   "https://therundown.io/api/v1/lines/LINE_ID/moneyline"
> ```
>
> ```bash With all periods theme={null}
> if [ -z "${THERUNDOWN_API_KEY:-}" ]; then
>   echo "Set THERUNDOWN_API_KEY" >&2
>   exit 1
> fi
> curl --fail-with-body -sS --connect-timeout 5 --max-time 20 \
>   -H "X-TheRundown-Key: $THERUNDOWN_API_KEY" \
>   "https://therundown.io/api/v1/lines/LINE_ID/moneyline?include=all_periods"
> ```
>
> ### Response
>
> ```json theme={null}
> {
>   "moneylines": [
>     {
>       "line_id": 19558127,
>       "event_id": "EVENT_ID",
>       "affiliate_id": 6,
>       "moneyline_away": 150,
>       "moneyline_home": -175,
>       "date_updated": "2026-10-17T02:08:35Z"
>     },
>     {
>       "line_id": 19558127,
>       "event_id": "EVENT_ID",
>       "affiliate_id": 6,
>       "moneyline_away": 145,
>       "moneyline_home": -170,
>       "date_updated": "2026-10-16T18:40:12Z"
>     }
>   ]
> }
> ```
>
> With `include=all_periods`:
>
> ```json theme={null}
> {
>   "moneyline_periods": {
>     "period_full_game": [
>       { "line_id": 19558127, "affiliate_id": 6, "moneyline_away": 150, "moneyline_home": -175, "period_id": 0, "period_description": "PERIOD_FULL_GAME", "date_updated": "2026-10-17T02:08:35Z" }
>     ],
>     "period_first_period": [
>       { "line_id": 19558127, "affiliate_id": 6, "moneyline_away": 175, "moneyline_home": -210, "period_id": 3, "period_description": "PERIOD_FIRST_PERIOD", "date_updated": "2026-10-17T02:05:10Z" }
>     ],
>     "period_live_full_game": [
>       { "line_id": 19558127, "affiliate_id": 6, "moneyline_away": -120, "moneyline_home": -120, "period_id": 7, "period_description": "PERIOD_LIVE_FULL_GAME", "date_updated": "2026-10-17T04:21:05Z" },
>       { "line_id": 19558127, "affiliate_id": 6, "moneyline_away": 130, "moneyline_home": -160, "period_id": 15, "period_description": "PERIOD_LIVE_FIRST_PERIOD", "date_updated": "2026-10-17T02:12:06Z" }
>     ]
>   }
> }
> ```

> [accordion] GET /api/v1/lines/\{id}/spread — Get spreads for a line
>
> Returns the price history of one sportsbook's point spread, newest first. Without `include`, only pregame full-game rows are returned.
>
> ### Parameters
>
> | Parameter | Type | Required | Description |
> | - | - | - | - |
> | `id` | path | Yes | Line ID (`line_id`) from the event's `lines` or `line_periods`. Not an event ID. See the Overview above for where to find it. |
> | `include` | query | No | Set to `all_periods` to group rows by period and add in-play (`period_live_full_game`) and period spreads |
>
> ```bash cURL theme={null}
> if [ -z "${THERUNDOWN_API_KEY:-}" ]; then
>   echo "Set THERUNDOWN_API_KEY" >&2
>   exit 1
> fi
> curl --fail-with-body -sS --connect-timeout 5 --max-time 20 \
>   -H "X-TheRundown-Key: $THERUNDOWN_API_KEY" \
>   "https://therundown.io/api/v1/lines/LINE_ID/spread"
> ```
>
> ```bash With all periods theme={null}
> if [ -z "${THERUNDOWN_API_KEY:-}" ]; then
>   echo "Set THERUNDOWN_API_KEY" >&2
>   exit 1
> fi
> curl --fail-with-body -sS --connect-timeout 5 --max-time 20 \
>   -H "X-TheRundown-Key: $THERUNDOWN_API_KEY" \
>   "https://therundown.io/api/v1/lines/LINE_ID/spread?include=all_periods"
> ```
>
> ### Response
>
> Without `include`, rows are in `spreads`. With `include=all_periods`, they are grouped under `spread_periods` using the same period keys as moneylines.
>
> ```json theme={null}
> {
>   "spreads": [
>     {
>       "line_id": 19558127,
>       "event_id": "EVENT_ID",
>       "affiliate_id": 6,
>       "point_spread_away": 4.5,
>       "point_spread_away_money": -110,
>       "point_spread_home": -4.5,
>       "point_spread_home_money": -110,
>       "date_updated": "2026-10-17T02:08:35Z"
>     }
>   ]
> }
> ```

> [accordion] GET /api/v1/lines/\{id}/total — Get totals (over/under) for a line
>
> Returns the price history of one sportsbook's total (over/under), newest first. Without `include`, only pregame full-game rows are returned.
>
> ### Parameters
>
> | Parameter | Type | Required | Description |
> | - | - | - | - |
> | `id` | path | Yes | Line ID (`line_id`) from the event's `lines` or `line_periods`. Not an event ID. See the Overview above for where to find it. |
> | `include` | query | No | Set to `all_periods` to group rows by period and add in-play (`period_live_full_game`) and period totals |
>
> ```bash cURL theme={null}
> if [ -z "${THERUNDOWN_API_KEY:-}" ]; then
>   echo "Set THERUNDOWN_API_KEY" >&2
>   exit 1
> fi
> curl --fail-with-body -sS --connect-timeout 5 --max-time 20 \
>   -H "X-TheRundown-Key: $THERUNDOWN_API_KEY" \
>   "https://therundown.io/api/v1/lines/LINE_ID/total"
> ```
>
> ```bash With all periods theme={null}
> if [ -z "${THERUNDOWN_API_KEY:-}" ]; then
>   echo "Set THERUNDOWN_API_KEY" >&2
>   exit 1
> fi
> curl --fail-with-body -sS --connect-timeout 5 --max-time 20 \
>   -H "X-TheRundown-Key: $THERUNDOWN_API_KEY" \
>   "https://therundown.io/api/v1/lines/LINE_ID/total?include=all_periods"
> ```
>
> ### Response
>
> Without `include`, rows are in `totals`. With `include=all_periods`, they are grouped under `total_periods` using the same period keys as moneylines.
>
> ```json theme={null}
> {
>   "totals": [
>     {
>       "line_id": 19558127,
>       "event_id": "EVENT_ID",
>       "affiliate_id": 6,
>       "total_over": 220.5,
>       "total_over_money": -110,
>       "total_under": 220.5,
>       "total_under_money": -110,
>       "date_updated": "2026-10-17T02:08:35Z"
>     }
>   ]
> }
> ```

> [accordion] GET /api/v1/lines/\{id}/team\_total — Get team totals for a line
>
> Returns one sportsbook's team total lines (how many points or goals a single team will score) for the line ID.
>
> > [!NOTE]
> >
> > V1 team-total rows are not updated for current events, so this route currently returns no rows: `{}`, or empty `team_total_periods_away` and `team_total_periods_home` objects with `include=all_periods`. For current team totals, use V2 market `94` (Team Totals) on the V2 event endpoints.
>
> ### Parameters
>
> | Parameter | Type | Required | Description |
> | - | - | - | - |
> | `id` | path | Yes | Line ID (`line_id`) from the event's `lines` or `line_periods`. Not an event ID. See the Overview above for where to find it. |
> | `include` | query | No | Set to `all_periods` to group rows by period and add in-play (`period_live_full_game`) and period team totals |
>
> ```bash theme={null}
> if [ -z "${THERUNDOWN_API_KEY:-}" ]; then
>   echo "Set THERUNDOWN_API_KEY" >&2
>   exit 1
> fi
> curl --fail-with-body -sS --connect-timeout 5 --max-time 20 \
>   -H "X-TheRundown-Key: $THERUNDOWN_API_KEY" \
>   "https://therundown.io/api/v1/lines/LINE_ID/team_total"
> ```

> [accordion] GET /api/v1/lines/best — Get best lines for multiple events
>
> Computes the best available line across all tracked sportsbooks for one or more events. Returns the most favorable moneyline, spread, and total for each side.
>
> ### Parameters
>
> | Parameter | Type | Required | Description |
> | - | - | - | - |
> | `event_ids` | query | Yes | Comma-separated event UUIDs |
> | `period` | query | No | Period to compare (default: `period_full_game`). Options: `period_full_game`, `period_first_half`, `period_second_half`, `period_first_period` through `period_fourth_period`, plus live equivalents. |
> | `affiliate_ids` | query | No | Comma-separated sportsbook IDs to include in comparison |
>
> ```bash Best lines for multiple events theme={null}
> if [ -z "${THERUNDOWN_API_KEY:-}" ]; then
>   echo "Set THERUNDOWN_API_KEY" >&2
>   exit 1
> fi
> curl --fail-with-body -sS --connect-timeout 5 --max-time 20 \
>   -H "X-TheRundown-Key: $THERUNDOWN_API_KEY" \
>   "https://therundown.io/api/v1/lines/best?event_ids=UUID1,UUID2,UUID3"
> ```
>
> ```bash Best first-half lines from specific books theme={null}
> if [ -z "${THERUNDOWN_API_KEY:-}" ]; then
>   echo "Set THERUNDOWN_API_KEY" >&2
>   exit 1
> fi
> curl --fail-with-body -sS --connect-timeout 5 --max-time 20 \
>   -H "X-TheRundown-Key: $THERUNDOWN_API_KEY" \
>   "https://therundown.io/api/v1/lines/best?event_ids=UUID1&period=period_first_half&affiliate_ids=19,23,22"
> ```
>
> The response is keyed by event ID, with each entry containing the best moneyline, spread, and total with the affiliate that offers it.

***

## LinePeriods Structure (V1 events)

V1 event endpoints (`/api/v1/events/{eventId}`, `/api/v1/sports/{sportID}/events/{date}`, openers, and closing) accept `include=all_periods` too. There it adds a `line_periods` map with the latest price for each sportsbook and period, keyed by `affiliate_id`. This is where to find line IDs for the endpoints above:

```json theme={null}
{
  "line_periods": {
    "6": {
      "period_full_game": {
        "moneyline": { "line_id": 19558127, "moneyline_away": 150, "moneyline_home": -175 },
        "spread": { "line_id": 19558127, "point_spread_away": 4.5, "point_spread_away_money": -110, ... },
        "total": { "line_id": 19558127, "total_over": 220.5, "total_over_money": -110, ... }
      },
      "period_first_half": { "moneyline": { ... }, "spread": { ... }, "total": { ... } },
      "period_second_half": { ... },
      "period_first_period": { ... },
      "period_second_period": { ... },
      "period_third_period": { ... },
      "period_fourth_period": { ... },
      "period_live_full_game": { ... },
      "period_live_first_half": { ... },
      "period_live_second_half": { ... },
      "period_live_first_period": { ... },
      "period_live_second_period": { ... },
      "period_live_third_period": { ... },
      "period_live_fourth_period": { ... }
    }
  }
}
```

> [!NOTE]
>
> Not all periods are available for all sports. For example, NHL games have three regulation periods, while NBA games have four quarters. The API returns only the periods that apply to the sport.


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