> ## Documentation Index
> Fetch the complete documentation index at: https://oddspapi-v4.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart: Your First Odds API Request in 5 Minutes

> Get a free OddsPapi API key and fetch live betting odds in three requests. Copy-paste examples in curl, Python and JavaScript for the v4 REST API.

This page takes you from zero to real bookmaker prices in three requests. You need nothing but an API key.

> [!NOTE]
>
> These steps use **3 requests** of your monthly allowance. The free plan includes 250 requests per month across all sports and bookmakers. A request is one call, however many markets and bookmakers come back.

## 1. Get your API key

[Create a free account](https://oddspapi.io/en/sign-up), then copy your key from [your account settings](https://oddspapi.io/en/account).

Store it in an environment variable so it stays out of your code:

```bash theme={null}
export ODDSPAPI_KEY="YOUR_API_KEY"
```

## 2. Find a sport

Every request needs IDs, so start by listing the sports.

```bash curl theme={null}
curl "https://api.oddspapi.io/v4/sports?apiKey=$ODDSPAPI_KEY"
```

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

BASE = "https://api.oddspapi.io/v4"
KEY = os.environ["ODDSPAPI_KEY"]

sports = requests.get(f"{BASE}/sports", params={"apiKey": KEY}).json()
print(sports[:2])
```

```javascript JavaScript theme={null}
const BASE = "https://api.oddspapi.io/v4";
const KEY = process.env.ODDSPAPI_KEY;

const sports = await fetch(`${BASE}/sports?apiKey=${KEY}`).then((r) => r.json());
console.log(sports.slice(0, 2));
```

```json theme={null}
[
  { "sportId": 10, "slug": "soccer", "sportName": "Soccer" },
  { "sportId": 11, "slug": "basketball", "sportName": "Basketball" }
]
```

Soccer is `sportId` 10. We use it in the next step.

## 3. Pick a tournament

```bash curl theme={null}
curl "https://api.oddspapi.io/v4/tournaments?sportId=10&apiKey=$ODDSPAPI_KEY"
```

```python Python theme={null}
tournaments = requests.get(
    f"{BASE}/tournaments", params={"sportId": 10, "apiKey": KEY}
).json()

for t in tournaments[:5]:
    print(t["tournamentId"], t["categoryName"], t["tournamentName"], t["upcomingFixtures"])
```

```javascript JavaScript theme={null}
const tournaments = await fetch(
  `${BASE}/tournaments?sportId=10&apiKey=${KEY}`
).then((r) => r.json());

for (const t of tournaments.slice(0, 5)) {
  console.log(t.tournamentId, t.categoryName, t.tournamentName, t.upcomingFixtures);
}
```

```json theme={null}
[
  {
    "tournamentId": 17,
    "tournamentSlug": "premier-league",
    "tournamentName": "Premier League",
    "categorySlug": "england",
    "categoryName": "England",
    "futureFixtures": 231,
    "upcomingFixtures": 0,
    "liveFixtures": 0
  }
]
```

The Premier League is `tournamentId` 17. The three counters tell you whether a tournament has fixtures worth requesting right now.

## 4. Get the odds

One call returns every upcoming fixture of a tournament with the odds of one bookmaker. You can pass up to 5 tournament IDs, separated by commas.

> [!NOTE]
>
> The examples use `bookmaker=pinnacle%2B30`. Replace it with a bookmaker slug your plan includes: [`GET /v4/account`](https://oddspapi-v4.mintlify.site/en/docs/get-account) lists them. On self-serve plans Pinnacle is `pinnacle+30`, sent URL-encoded as `pinnacle%2B30`.

```bash curl theme={null}
curl "https://api.oddspapi.io/v4/odds-by-tournaments?bookmaker=pinnacle%2B30&tournamentIds=17&apiKey=$ODDSPAPI_KEY"
```

```python Python theme={null}
fixtures = requests.get(
    f"{BASE}/odds-by-tournaments",
    params={"bookmaker": "pinnacle+30", "tournamentIds": "17", "apiKey": KEY},
).json()

for fixture in fixtures:
    markets = fixture["bookmakerOdds"]["pinnacle+30"]["markets"]
    market = markets.get("101")  # 101 = soccer Full Time Result (1X2)
    if not market:
        continue
    prices = {
        outcome_id: outcome["players"]["0"]["price"]
        for outcome_id, outcome in market["outcomes"].items()
    }
    print(fixture["fixtureId"], fixture["startTime"], prices)
```

```javascript JavaScript theme={null}
const fixtures = await fetch(
  `${BASE}/odds-by-tournaments?bookmaker=pinnacle%2B30&tournamentIds=17&apiKey=${KEY}`
).then((r) => r.json());

for (const fixture of fixtures) {
  const market = fixture.bookmakerOdds["pinnacle+30"].markets["101"]; // 101 = soccer Full Time Result (1X2)
  if (!market) continue;
  const prices = Object.fromEntries(
    Object.entries(market.outcomes).map(([id, o]) => [id, o.players["0"].price])
  );
  console.log(fixture.fixtureId, fixture.startTime, prices);
}
```

## 5. Read a price

The odds response is nested, and the path to one price is always the same:

```text theme={null}
bookmakerOdds → {bookmaker} → markets → {marketId} → outcomes → {outcomeId} → players → {playerId} → price
```

```json theme={null}
{
  "fixtureId": "id1000001764618978",
  "startTime": "2025-12-08T20:00:00.000Z",
  "bookmakerOdds": {
    "pinnacle+30": {
      "markets": {
        "101": {
          "outcomes": {
            "101": { "players": { "0": { "active": true, "price": 5.01, "limit": 5000 } } },
            "102": { "players": { "0": { "active": true, "price": 4.32, "limit": 5000 } } },
            "103": { "players": { "0": { "active": true, "price": 1.649, "limit": 7704 } } }
          }
        }
      }
    }
  }
}
```

| Part | Meaning |
| - | - |
| `marketId` | What is being bet on. `101` is soccer Full Time Result. Look IDs up once with [`/v4/markets`](https://oddspapi-v4.mintlify.site/en/docs/get-markets) and cache them. |
| `outcomeId` | The selection inside the market. Here `101` is home (1), `102` the draw (X), `103` away (2). |
| `playerId` | `0` for normal markets. For player props it is the player's ID. |
| `price` | Decimal odds. |
| `active` | `false` means the bookmaker is not offering this price right now. Don't use it. |
| `limit` | The bookmaker's stake limit for this price, when the bookmaker publishes one. |

## Making the free plan go far

* **Ask for whole fixtures.** One [`/v4/odds`](https://oddspapi-v4.mintlify.site/en/docs/get-odds) call returns every market from every bookmaker on your plan for that fixture. You do not pay per market or per bookmaker.
* **Use history for research.** [`/v4/historical-odds`](https://oddspapi-v4.mintlify.site/en/docs/get-historical-odds) holds every price change and never uses your quota, so backtests are free.
* **Cache the reference data.** Sports, bookmakers, markets and languages rarely change. Fetch them once and store them. See [what counts as a request](https://oddspapi-v4.mintlify.site/en/docs/requests-and-quota.md).
* **The free plan is not slowed down.** You get the same prices at the same speed as a paid plan.

## What to do next

> [card] [Compare bookmakers](https://oddspapi-v4.mintlify.site/en/docs/get-odds.md)
>
> `/v4/odds` returns one fixture with several bookmakers at once.

> [card] [Free historical odds](https://oddspapi-v4.mintlify.site/en/docs/get-historical-odds.md)
>
> Every price change of a fixture. Does not use your quota.

> [card] [Make 250 requests last](https://oddspapi-v4.mintlify.site/en/docs/requests-and-quota.md)
>
> What counts as a request and how to spend fewer.

> [card] [WebSocket (v5)](https://oddspapi-v4.mintlify.site/en/docs/websocket-api.md)
>
> v4 is REST. How to poll well, and where the WebSocket lives.

## Common first-day problems

| You see | Why | Fix |
| - | - | - |
| `401 MISSING_API_KEY` or `INVALID_API_KEY` | The `apiKey` parameter is missing or mistyped | Copy the key again from your account settings |
| `403 RESTRICTED_ACCESS` | Your plan doesn't include that sport or bookmaker | Check [`/v4/account`](https://oddspapi-v4.mintlify.site/en/docs/get-account) for what your key includes |
| `429 RATE_LIMITED` | Two calls to the same endpoint too close together | Wait for `retryMs`, then retry |
| `429 REQUEST_LIMIT_EXCEEDED` | The monthly allowance is used up | The free allowance resets on the 1st of the month. Need more? [Upgrade your plan](https://oddspapi.io/en/pricing) |
| `bookmakerOdds` is empty | That bookmaker has no odds for the fixture yet | Try another bookmaker, or filter fixtures with `hasOdds=true` |

The full list is on the [Errors](https://oddspapi-v4.mintlify.site/en/docs/errors.md) page.


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