Skip to content
datasportsAPI

WidgetsWidget script

Documentation

/

Type to filter the docs by title or path.

WidgetsEndpoint 110 of 116

Widget script

GET

https://datasportsapi.com/embed/v1.js

Plan
Pro + Business
Auth
dsa_pub_… widget key
Parameters
None
Returns
Rendered widgets

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: 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).

In the dashboard, the Widgets tab previews every option with sample data.

Worth knowing

  • Widget keys (dsa_pub_…) 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.

01Example embed

HTML
<div data-dsa-widget="livescore" data-sport="football" data-league="17"></div>
<div data-dsa-widget="standings" data-league="17" data-theme="dark"></div>
<script src="https://datasportsapi.com/embed/v1.js" data-key="dsa_pub_…" async></script>