Deine erste Anfrage an die OddFeeds-API

Vom API-Key zu den Quoten eines Spiels in vier Requests: Jeder nutzt die ID aus der vorherigen Antwort.

6 Min. Lesezeit ·

Jede Antwort der API liefert dir die IDs für den nächsten Request: Länder führen zu ihren Ligen, Ligen zu ihren Spielen und Spiele zu ihren Quoten. Dieser Leitfaden führt diese vier Requests nacheinander aus und zeigt, was jede Antwort enthält.

Dein API-Key

Jeder Request ist ein POST an eine Adresse mit deinem Key im Header: Authorization: Bearer gefolgt vom Key. Du findest deinen Key nach der Registrierung auf deiner Konto-Seite. Wie du einen erhältst, erklärt die Services-Seite.

1. Die Länder

Ein Request ohne scope listet die Länder auf, für die aktuell Quoten vor Anpfiff und InPlay vorliegen.

curl -X POST https://oddfeeds.com/api/v1/feeds \
  -H "Authorization: Bearer ofk_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"prematch":true,"inplay":true}'

Die Antwort · Eine Antwort der API vom 26.11.2026, zeigt die ersten Zeilen. Deine eigene Antwort enthält andere IDs: setze diese in die nächste Anfrage ein.

Die Antwort in JSON: 1. Die Länder
{
  "status": "ok",
  "data": [
    {
      "id": 136,
      "name": "Slovakia",
      "prematch_leagues_cnt": 1,
      "inplay_leagues_cnt": 0
    },
    {
      "id": 42,
      "name": "Costa Rica",
      "prematch_leagues_cnt": 2,
      "inplay_leagues_cnt": 0
    }
  ],
  "time": "2026-11-26T15:14:19",
  "ms": "479us"
}

prematch_leagues_cnt und inplay_leagues_cnt zählen die Ligen eines Landes mit Quoten vor Anpfiff und InPlay. Wähle ein Land, dessen Wert über Null liegt.

2. Die Ligen eines Landes

Setze die id des Landes in tournament_ids ein. Die Antwort listet seine Ligen auf und zeigt, für wie viele ihrer Spiele Quoten vorliegen.

curl -X POST https://oddfeeds.com/api/v1/feeds \
  -H "Authorization: Bearer ofk_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"scope":"leagues","tournament_ids":[136]}'

Die Antwort · Eine Antwort der API vom 26.11.2026. Deine eigene Antwort enthält andere IDs: setze diese in die nächste Anfrage ein.

Die Antwort in JSON: 2. Die Ligen eines Landes
{
  "status": "ok",
  "data": [
    {
      "id": 10618,
      "tournament_id": 136,
      "name": "Super Liga",
      "prematch_matches_cnt": 6,
      "inplay_matches_cnt": 0
    }
  ],
  "time": "2026-11-26T15:14:19",
  "ms": "400us"
}

3. Die Spiele einer Liga

Setze die ID einer Liga in league_ids ein.

curl -X POST https://oddfeeds.com/api/v1/feeds \
  -H "Authorization: Bearer ofk_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"scope":"matches","league_ids":[10618]}'

Die Antwort · Eine Antwort der API vom 26.11.2026, zeigt die ersten Zeilen. Deine eigene Antwort enthält andere IDs: setze diese in die nächste Anfrage ein.

Die Antwort in JSON: 3. Die Spiele einer Liga
{
  "status": "ok",
  "data": [
    {
      "id": 13682297,
      "league_id": 10618,
      "teams": {
        "home": "Dukla Banska Bystrica",
        "away": "MFK Ruzomberok"
      },
      "start": "2026-11-28T14:30:00",
      "active": {
        "prematch": 1,
        "inplay": 0
      },
      "stats": {
        "start": "2026-11-28T14:30:00"
      }
    },
    {
      "id": 13683299,
      "league_id": 10618,
      "teams": {
        "home": "Slovan Bratislava",
        "away": "FC Kosice"
      },
      "start": "2026-11-28T17:00:00",
      "active": {
        "prematch": 1,
        "inplay": 0
      },
      "stats": {
        "start": "2026-11-28T17:00:00"
      }
    }
  ],
  "time": "2026-11-26T15:14:20",
  "ms": "700us"
}

start ist der Anpfiff in UTC. active gibt an, in welchem Modus das Spiel aktuell Quoten hat. Bei InPlay-Spielen enthält stats.runtime zudem Spielminute und Spielstand.

4. Die Quoten eines Spiels

Setze die ID des Spiels in match_ids ein. Ohne bookmaker_ids enthält die Antwort alle Buchmacher, die dein Key freischaltet.

curl -X POST https://oddfeeds.com/api/v1/feeds \
  -H "Authorization: Bearer ofk_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"scope":"odds","match_ids":[13682297]}'

Die Antwort · Eine Antwort der API vom 26.11.2026, zeigt die ersten Zeilen.

Die Antwort in JSON: 4. Die Quoten eines Spiels
{
  "status": "ok",
  "data": {
    "prematch": [
      {
        "id": 390798263,
        "active": 1,
        "match_id": 13682297,
        "event_id": 72533074,
        "bookmaker": {
          "id": 59,
          "name": "Bet8"
        },
        "datetime": "2026-11-26T01:35:42",
        "period_id": 0,
        "type_id": 11,
        "order": 1,
        "back_lay_id": 0,
        "liquidity": -1,
        "hc": 0,
        "hc_as_draw": 0,
        "price": 1.231,
        "nav": "{\"v\":1,\"scope\":\"prematch\",\"eventId\":\"18450709\",\"oddId\":\"4..."
      },
      {
        "id": 390634623,
        "active": 1,
        "match_id": 13682297,
        "event_id": 72531615,
        "bookmaker": {
          "id": 34,
          "name": "Trbet"
        },
        "datetime": "2026-11-26T01:36:24",
        "period_id": 0,
        "type_id": 9,
        "order": 1,
        "back_lay_id": 0,
        "liquidity": -1,
        "hc": 2,
        "hc_as_draw": 0,
        "price": 1.14,
        "nav": "{\"v\":1,\"scope\":\"prematch\",\"eventId\":\"42575268\",\"oddId\":\"7..."
      }
    ],
    "inplay": []
  },
  "time": "2026-11-26T15:15:19",
  "ms": "15.97ms"
}

Die Zeilen verteilen sich auf zwei Listen, prematch und inplay, jeweils eine pro Modus. Jede Zeile steht für einen Quotenwert eines Buchmachers. Das sind die wichtigsten Felder:

Felder einer Quotenzeile
FeldBedeutung
bookmakerid + name of the source bookmaker.
type_idMarket type, see the type_id table.
period_id0 = first half, 1 = full time, 6 = second half.
hcThe handicap / total line, e.g. -0.5 or 2.5. On 1X2 rows (type_id 2, 3, 4) a non-zero hc is a European handicap line, and for correct score (type_id 66) it carries the score; see the type_id table.
priceThe odd, decimal format. On an exchange it's the price as the exchange shows it, with no commission taken off.
datetimeWhen this price last changed (UTC).

Was die einzelnen Zahlen in einer Zeile bedeuten, steht in den Referenztabellen der Dokumentation.

Wenn die API Nein sagt

Das sind die zwei Antworten, auf die ein erster Request am häufigsten trifft, in den Worten der API:

Fehlerantworten
HTTP-StatusBedeutung
400A body that is not valid JSON, a malformed parameter, a scope without its id list, or id lists that count as more requests than one request may (see 429); the error field says what was wrong.
401Missing or unknown API key.

Der gesamte Ablauf in einem Skript

Dieses Skript führt die vier Requests nacheinander aus und übergibt jeweils die ID. Es liest deinen Key aus der Umgebungsvariable ODDFEEDS_KEY, sodass der Key nicht im Code steht.

// The whole walk: the countries, a country's leagues, a league's
// matches and the odds of one match. Run it with your key:
//   ODDFEEDS_KEY=<your key> node first-request.mjs
const API = process.env.ODDFEEDS_URL || 'https://oddfeeds.com/api/v1/feeds';

async function ask(body) {
  const res = await fetch(API, {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${process.env.ODDFEEDS_KEY}`,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify(body),
  });
  const feed = await res.json();
  if (feed.status !== 'ok') throw new Error(`${res.status}: ${feed.error}`);
  return feed.data;
}

const countries = await ask({ prematch: true, inplay: true });
const country = countries.find(
  (c) => c.prematch_leagues_cnt > 0 || c.inplay_leagues_cnt > 0);
if (!country) throw new Error('No country has odds right now.');

const leagues = await ask({ scope: 'leagues', tournament_ids: [country.id] });
const league = leagues.find(
  (l) => l.prematch_matches_cnt > 0 || l.inplay_matches_cnt > 0);

const matches = await ask({ scope: 'matches', league_ids: [league.id] });
const match = matches[0];

const odds = await ask({ scope: 'odds', match_ids: [match.id] });
const rows = [...odds.prematch, ...odds.inplay];

const { home, away } = match.teams;
console.log(`${country.name} / ${league.name} / ${home} - ${away}: ${rows.length} prices`);
for (const r of rows.slice(0, 5)) {
  console.log(r.bookmaker.name, r.type_id, r.hc, r.price);
}

Nächste Schritte

Die Dokumentation enthält alle Scopes, Felder und Wettmarkt-Tabellen, und die Use-Cases-Seite zeigt, was Entwickler auf Basis dieser Requests bauen.

Mit Live-Daten testen

Der Playground im kostenlosen Konto führt diese Anfragen direkt in deinem Browser mit Live-Daten aus.