Skip to content
datasportsAPI

01Live score apps

A live score app that keeps pace with the match.

Open on a board of every match in play, let people tap into the one they follow, and keep both screens moving without burning through your quota. Four calls carry the whole app, from first paint to full time.

The play

Four calls. Final whistle: live app.

Each marker is a request. Each run carries its ids to the next.

read it left to right
  1. 1

    Paint the live board

    One request returns every match in play across all 24 sports, or one sport's board with ?sport=. Each row already carries the score, status and running clock, so the list renders without a second call.

    GETLive scores: /v2/livescoresAll plans
  2. 2

    Open the match

    When someone taps a match, pull its incidents in order: goals with scorers, cards, substitutions, period markers and added-time boards. Lineups sit one sibling call away on the same fixture id.

    GETEvents: /v2/fixtures/{id}/eventsAll plans
  3. 3

    Fill the stats tab

    Possession, shots, passes and the rest, grouped by period and category. Coverage is graded per fixture: a top division gets every group, a lower tier may carry only the basics.

    GETStatistics: /v2/fixtures/{id}/statisticsAll plans
  4. 4

    Stop polling

    On Business, open one WebSocket and subscribe to livescores or sport:football. A match that kicks off arrives whole, then every score, status and clock change lands as a small delta. The SDK merges them and replays what you missed after a reconnect.

    WSConnect: wss://api.datasportsapi.com/?ticket={ticket}Business

In code

First paint from REST, then deltas

Render once from the live board, then let the stream keep those same objects current. The SDK mints the single-use stream ticket, reconnects and replays for you.

Install
npm install datasportsapi
Key
export DATASPORTSAPI_API_KEY=dsa_live_…
All SDKs and the CLI
import { DataSportsAPI } from 'datasportsapi';

const client = new DataSportsAPI({ apiKey: process.env.DATASPORTSAPI_API_KEY });

// 1. First paint (every plan)
const { data: live } = await client.livescores.list({ sport: 'football' });
renderBoard(live);

// 2. The match someone opened
const { data: events } = await client.fixtures.events(live[0].id);
renderTimeline(events);

// 3. Push instead of polling (Business)
const stream = client.stream(['sport:football']);
stream.on('delta', () => renderBoard(stream.fixtures('sport:football')));

Field notes

Worth knowing before launch.

  1. A row drops off the board by itself once it has gone 45 minutes without a change and kicked off longer ago than a match in that sport can run.

  2. On the stream, a match that kicks off arrives as a full fixture frame. Handle it, or new matches never appear.

  3. Decide on error.code alone; treat the message text as human-readable only.

Which plan

Goes live on Business.

The WebSocket behind step four is a Business feature. Until you need push, poll the live board from your own server and serve it from cache: a refresh every 30 seconds is about 86,000 requests a month, comfortably inside Starter.

  1. Free

    01

    $0/ month

    1,000 requests / day

    Build and test the whole app. Live data is never limited by the history window.

  2. Starter

    02

    $49/ month

    250,000 requests / month

    Poll the board server-side every 30 seconds and serve every user from one cached copy.

  3. Pro

    03

    $199/ month

    1,000,000 requests / month

    Match screens on demand, plus play-by-play, shot maps and the win model for richer pages.

  4. Fits this play

    Business

    04

    $999/ month

    10,000,000 requests / month

    The WebSocket stream with replay: changes pushed as they happen, no polling budget to manage.

Your live board is one request away.

1,000 free requests a day during the beta. No card, no sales call.