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

# Betting Lines

> Get betting lines, spreads, and totals for basketball games

<Warning>
  **V1 Legacy Endpoint** — This is a V1 API endpoint. For new integrations, we recommend using the [Basketball V2 API](/api-reference/basketball-v2/overview) which provides richer data and more endpoints.
</Warning>

## Overview

Returns betting lines for basketball games including point spreads, moneylines, and over/under totals from multiple sportsbooks.

## Query Parameters

<ParamField query="gameId" type="integer" required>
  Game ID to get lines for
</ParamField>

## Code Examples

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET "https://v1.basketball.sportsapipro.com/bets/lines?gameId=12345" \
    -H "x-api-key: YOUR_API_KEY"
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    'https://v1.basketball.sportsapipro.com/bets/lines?gameId=12345',
    { headers: { 'x-api-key': 'YOUR_API_KEY' } }
  );
  const { lines } = await response.json();

  // Calculate implied probability from moneyline
  const homeOdds = lines.markets.moneyline.home;
  const homeProb = homeOdds < 0
    ? Math.abs(homeOdds) / (Math.abs(homeOdds) + 100)
    : 100 / (homeOdds + 100);
    
  console.log(`Home win probability: ${(homeProb * 100).toFixed(1)}%`);
  ```

  ```python Python theme={null}
  import requests

  response = requests.get(
      'https://v1.basketball.sportsapipro.com/bets/lines',
      params={'gameId': 12345},
      headers={'x-api-key': 'YOUR_API_KEY'}
  )
  ```
</CodeGroup>

## Response Structure

<ResponseField name="lines" type="object">
  Betting lines for the game

  <Expandable title="Properties">
    <ResponseField name="gameId" type="integer">
      Game identifier
    </ResponseField>

    <ResponseField name="homeTeam" type="string">
      Home team name
    </ResponseField>

    <ResponseField name="awayTeam" type="string">
      Away team name
    </ResponseField>

    <ResponseField name="markets" type="object">
      Available betting markets

      <Expandable title="Markets">
        <ResponseField name="spread" type="object">
          Point spread betting line

          <Expandable title="Spread">
            <ResponseField name="home" type="object">
              Home spread (line, odds)
            </ResponseField>

            <ResponseField name="away" type="object">
              Away spread (line, odds)
            </ResponseField>
          </Expandable>
        </ResponseField>

        <ResponseField name="moneyline" type="object">
          Moneyline odds (American format)

          <Expandable title="Moneyline">
            <ResponseField name="home" type="integer">
              Home moneyline odds
            </ResponseField>

            <ResponseField name="away" type="integer">
              Away moneyline odds
            </ResponseField>
          </Expandable>
        </ResponseField>

        <ResponseField name="total" type="object">
          Over/under total points

          <Expandable title="Total">
            <ResponseField name="line" type="number">
              Total points line
            </ResponseField>

            <ResponseField name="over" type="integer">
              Over odds
            </ResponseField>

            <ResponseField name="under" type="integer">
              Under odds
            </ResponseField>
          </Expandable>
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="books" type="array">
      Lines from individual sportsbooks
    </ResponseField>
  </Expandable>
</ResponseField>

## Example Response

```json theme={null}
{
  "lines": {
    "gameId": 12345,
    "homeTeam": "Los Angeles Lakers",
    "awayTeam": "Boston Celtics",
    "markets": {
      "spread": {
        "home": { "line": -3.5, "odds": -110 },
        "away": { "line": 3.5, "odds": -110 }
      },
      "moneyline": {
        "home": -165,
        "away": 140
      },
      "total": {
        "line": 224.5,
        "over": -110,
        "under": -110
      }
    }
  }
}
```

## Odds Format

<Info>
  All odds are returned in **American format**:

  * **Negative odds** (e.g., -150): Amount to bet to win \$100
  * **Positive odds** (e.g., +130): Amount won on a \$100 bet
</Info>


## OpenAPI

````yaml openapi-basketball GET /bets/lines
openapi: 3.1.0
info:
  title: SportsAPI Pro - Basketball API
  description: >-
    Professional basketball data API providing live scores, standings, player
    statistics, betting odds, and more for NBA, EuroLeague, and 50+ leagues
    worldwide.
  version: 1.0.0
  contact:
    name: SportsAPI Pro Support
    email: support@sportsapipro.com
servers:
  - url: https://v1.basketball.sportsapipro.com
    description: Production API Server
security:
  - ApiKeyAuth: []
tags:
  - name: Games
    description: Live scores, fixtures, and game data
  - name: Competitions
    description: Leagues and tournaments
  - name: Standings
    description: League standings and rankings
  - name: Athletes
    description: Player statistics and data
  - name: Betting
    description: Betting lines, props, and predictions
  - name: Search
    description: Search entities
  - name: Account
    description: Account status and usage
paths:
  /bets/lines:
    get:
      tags:
        - Betting
      summary: Betting Lines
      description: >-
        Get betting lines for a basketball game including spreads, moneylines,
        and totals
      operationId: getBettingLines
      parameters:
        - name: gameId
          in: query
          required: true
          description: Game ID
          schema:
            type: integer
            example: 12345
      responses:
        '200':
          description: Betting lines retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  lines:
                    $ref: '#/components/schemas/BettingLine'
components:
  schemas:
    BettingLine:
      type: object
      properties:
        gameId:
          type: integer
        markets:
          type: object
          properties:
            spread:
              type: object
              properties:
                home:
                  type: object
                  properties:
                    line:
                      type: number
                    odds:
                      type: integer
                away:
                  type: object
                  properties:
                    line:
                      type: number
                    odds:
                      type: integer
            moneyline:
              type: object
              properties:
                home:
                  type: integer
                away:
                  type: integer
            total:
              type: object
              properties:
                line:
                  type: number
                over:
                  type: integer
                under:
                  type: integer
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: Your SportsAPI Pro API key

````