How to Get Football Data in JavaScript: Live Scores, Standings & Fixtures

Get live football scores, standings and fixtures in JavaScript with GOAL API — built-in fetch on Node 18+, the official SDK and WebSocket, with runnable code.

GOAL API

2 min read
JavaScript fetch code calling GOAL API to print live football scores in a Node terminal — getting football data in JavaScript.

JavaScript runs most of the web, and plenty of football products — live-score sites, Discord and Telegram bots, dashboards — are built on Node. This guide shows how to get football data in JavaScript with GOAL API: live scores, standings and fixtures, with plain fetch and the official SDK, every snippet ready to run on Node 18+.

Get a free API key

Create a free GOAL API key — no credit card. The free tier uses the same endpoints as the paid plans. Keep your key in an environment variable:

Text
export GOAL_API_KEY="your_key_here"

Pull live football scores

Node 18+ ships fetch built in, so you need no dependencies for a first call:

JavaScript
const res = await fetch("https://api.goal-api.com/v1/fixtures/live", {
  headers: { Authorization: `Bearer ${process.env.GOAL_API_KEY}` },
});
const { data } = await res.json();
for (const m of data) {
  console.log(`${m.homeTeam.name} ${m.homeScore}-${m.awayScore} ${m.awayTeam.name}`);
}
Text
Arsenal 2-1 Chelsea
Barcelona 0-0 Sevilla
Inter 3-1 Napoli

That's live football data across 1,000+ competitions with the standard library alone.

Find a competition, then list its fixtures

Fixtures are filtered by a competition's league ID, so look it up by name first, then fetch a date:

JavaScript
const auth = { Authorization: `Bearer ${process.env.GOAL_API_KEY}` };

const leagues = await (await fetch(
  "https://api.goal-api.com/v1/leagues?search=premier%20league", { headers: auth }
)).json();
const leagueId = leagues.data[0].id; // England's comes first; cache this

const fixtures = await (await fetch(
  `https://api.goal-api.com/v1/fixtures/date/2026-09-20?leagueId=${leagueId}&limit=100`,
  { headers: auth }
)).json();

for (const m of fixtures.data) {
  const kickoff = new Date(m.kickoffUtc).toLocaleString();
  console.log(`${kickoff} ${m.homeTeam.name} vs ${m.awayTeam.name} [${m.matchStatus}]`);
}

Filter on the server with leagueId — a busy date spans many pages, so filtering one page client-side misses most matches.

Render a league table

The standings endpoint returns the table already ordered:

JavaScript
const table = (await (await fetch(
  `https://api.goal-api.com/v1/standings/${leagueId}`, { headers: auth }
)).json()).data;

for (const row of table) {
  const gd = row.overallLeagueGF - row.overallLeagueGA;
  console.log(row.overallLeaguePosition, row.team.name, row.overallLeaguePTS, `(GD ${gd})`);
}

Prefer the official SDK?

There's an official JavaScript/TypeScript SDK that handles auth, retries and pagination:

Text
npm install @goalapi/sdk

It's typed, so you get autocomplete on responses — handy in a larger codebase. For quick scripts and bots, the fetch calls above are all you need.

Go real-time with WebSocket

Polling the live endpoint on a timer works, but for a live app you want goals pushed the instant they happen. GOAL API offers a WebSocket: request a short-lived token, connect, and subscribe to matches to receive goals, cards and substitutions in real time. The live scores over WebSocket guide covers connect, subscribe and reconnect.

What you can build with football data in JavaScript

Grab a free key and you're pulling live football data in JavaScript in minutes.

FAQ

How do I get football data in JavaScript? Create a GOAL API key, then call the REST API with fetch — Node 18+ has it built in. GET /v1/fixtures/live returns live scores; standings and fixtures have their own endpoints. A free key covers it.

Do I need an SDK or library? No. Node's built-in fetch is enough. GOAL API also ships an official JavaScript/TypeScript SDK (npm install @goalapi/sdk) that adds typing, retries and pagination if you want it.

How do I get live scores in real time in Node? Use the WebSocket: request a short-lived token, connect, and subscribe to matches to receive goals, cards and substitutions the moment they happen, instead of polling.

Is there a free football API for JavaScript? Yes. GOAL API's permanent free tier, with no credit card, works with fetch or the official SDK on the same endpoints as the paid plans.

Keep reading

How to Get Football Data in JavaScript | GOAL API