Skip to content

Livematches in play

Demo: Matchboard, opens in a new tab
Docs v2

Widgets

Widget script

GET

https://api.datasportsapi.com/widgets/v1.js

Pro and up

View as Markdown

The script that renders widgets. Place one element wherever each widget should appear, then include the script a single time with your widget key. Widget types (the live match tracker, Enterprise only, has its own page): livescore (data-sport is required, data-league optional — a sport’s live matches grouped by league), match (data-fixture — status, score, goals, cards and substitutions) and standings (data-league, with optional data-season — the season’s main table, defaulting to the latest season). Options: data-size small | medium | large to suit the placement (small for a sidebar — no wider than 340 px, compact, standings showing only P and Pts; medium, the default, for a content column — no wider than 640 px; large for full width with bigger text), data-theme light | dark | auto (auto follows the visitor’s preference), data-accent (#hex) and data-refresh (in seconds, minimum 15; defaults are 30 / 30 / 600).

Widget keys (pk_live_…) are meant to be public. Each one is accepted only from the sites registered on it (matched against the browser’s Origin, either exactly or as https://*.example.com to cover subdomains), only for the endpoints the widgets need (livescores, league seasons and standings, and fixtures with their events / lineups / statistics), and only while your plan includes widgets. Any other use is refused with 403 endpoint_not_in_plan or origin_not_allowed. Each refresh counts as one request against your quota: at the default 30 s, a livescore widget left open in 100 browsers for an hour uses 12,000 requests. Widgets are drawn inside their own shadow root, so your page’s CSS cannot affect them.

Any /v2 call can also come back with one of the common errors.

Example
<div data-sportsapi-widget="livescore" data-sport="football" data-league="17"></div>
<div data-sportsapi-widget="standings" data-league="17" data-theme="dark"></div>
<script src="https://api.datasportsapi.com/widgets/v1.js" data-key="pk_live_…" async></script>