Embeddable Widgets

Two lines of HTML. Real Web Components, not an iframe.

Six widgets ship in widgets/loader.js: three free, key-metered widgets and three predictive widgets built on our own models. Every widget is a Shadow-DOM custom element, so it renders crawlable HTML and can't clash with your page's CSS. See them live at kickoffapi.com/widgets or build an embed interactively at the Widget Builder.

The embed — two lines

<script src="https://cdn.kickoffapi.com/widgets/loader.js" data-key="YOUR_KEY"></script>

<kickoff-standings league="lg_8K3mZ0pQ" season="2025"></kickoff-standings>

The <script> tag goes once per page and carries your key in data-key. Add as many widget elements as you like after it. A widget can also carry its own data-key attribute to override the page-level one.

The key requirement — read this before you embed

The embed key sits in your page's HTML, in plain view of every visitor. It must be a widget-scoped key restricted to your site's own origin — never a full-privilege account key. A full key pasted into public HTML can be lifted by anyone who views source and used to spend your entire quota from wherever they like. An origin-restricted widget key is worthless off your own site: a request carrying it from any other origin is refused.

Mint a widget-scoped key from the panel's Widgets page (My API Keys → Widgets). Minting requires at least one allowed origin — a widget key cannot be created without one, because the origin restriction is what makes a stolen key harmless. Full account keys continue to work everywhere they always have; only use one in a widget embed if you accept that anyone who views your page source can use it.

Allowed origins — what that setting actually enforces

The panel field is Allowed Origins, a comma-separated list of your own domains, stored on the key as allowedOrigins. Here is exactly what the server does with it, and nothing more than this:

Key typeAllowed OriginsWhat happens on a request
Widget key Required — cannot be created or edited with the list empty All three must hold or the call is 403: the request carries an Origin header at all, that origin is on the list, and the path is one of the six widget endpoints. A missing Origin is a refusal here, not a pass.
Full account key Optional — blank means any origin Opt-in: the list is only consulted when the request carries an Origin header, and then the origin must match an entry exactly. A server-to-server call with no Origin is never checked against it.

For a widget key, origins are compared the way a browser means them, not as typed (a full account key compares them exactly as stored): case, a missing https://, a trailing slash and a default port are all normalised, so example.com and https://example.com/ are the same entry. A non-default port is kept (http://localhost:3000 is a different origin from http://localhost), and one host never matches another — example.com does not match evil-example.com. Every refusal above is a 403 with a plain message, so a widget that renders nothing is usually an origin that was typed slightly differently than the browser sends it.

You do not have to keep the two in step by hand: saving a widget in the panel re-derives your account's widget key's list from the domains on your active widgets, plus our own two domains so the in-panel preview can load.

Widgets — free

ElementRequired attributesOptional attributes
<kickoff-standings> Free league, season label, theme, demo
<kickoff-livescores> Free league date (default: today), season, label, theme, demo
<kickoff-fixtures> Free team or league (at least one) count (default: 6), season, label, theme, demo

Widgets — paid

From our own Dixon-Coles + xG models. Requires a plan with predictive access.

ElementRequired attributesOptional attributes
<kickoff-prediction> fixture label, theme, demo
<kickoff-seasonsim> league, season label, theme, demo
<kickoff-ratings> league, season label, theme, demo

A widget missing a required attribute renders "Couldn't load data (missing required attributes)" instead of calling the API.

On a locked plan

If your key can't reach predictive data, a paid widget does not render an error. It shows an upsell card — "Predictions are a paid feature" with a link to pricing — in place of the widget's normal content. This is what the API returns as 403 with code: "predictive_locked"; the loader recognises that specific response and swaps in the upsell card rather than failing.

Attributes common to every widget

AttributeMeaning
theme="light|dark"Defaults to light. Sets the widget's built-in color scheme.
label="…"Overrides the widget's header text — useful for localizing it.
demo="true"Renders sample data with no API call and no key required. Use it for previews, docs, or a page that hasn't been given a key yet. Leave the attribute off for live data — demo="false", demo="0" and demo="off" also mean live.
data-key="…"Overrides the page-level key from the loader's <script> tag for this one element.
hide-brand Removes the "Powered by KickoffAPI" badge. This is a product perk of the Ultra and Enterprise plans, not a licence term — Free, Starter and Pro keep the badge (see terms on the credit condition for those plans). Setting the attribute is only ever a request: the badge disappears solely when your key's own plan confirms it in the API response, so pasting hide-brand onto a Free, Starter or Pro key's widget has no effect — it keeps showing the badge. demo="true" never confirms this (no API call is made), so a demo widget always shows the badge regardless of hide-brand.

Embedding widgets

There are three ways to put a saved widget on your site. Pick the one that matches your platform.

1. HTML — the standard embed

This is the default: a loader script and a custom element. It works on any site where you can paste HTML.

<script src="https://cdn.kickoffapi.com/widgets/loader.js" async></script>
<kickoff-widget id="wg_XXXXXXXXXXXX"></kickoff-widget>

The <script> goes once per page. The <kickoff-widget> element points at your saved widget by its id (looks like wg_XXXXXXXXXXXX). Edit the widget in the panel and every page showing it updates automatically — no re-pasting.

2. WordPress — plugin, shortcode, or block

Install the KickoffAPI Widgets plugin, then use whichever method you prefer.

  • Plugin zip: Download kickoffapi-widgets.zip → Plugins → Add New → Upload Plugin → Activate.
  • Shortcode: [kickoffapi widget="wg_XXXXXXXXXXXX"] — works in posts, pages, widget areas, and theme templates via do_shortcode().
  • Block: Add the KickoffAPI Widget block in the block editor and paste the Widget ID.

The plugin enqueues the loader once per page (async), validates the widget ID, and renders nothing for an invalid one (an HTML comment explains why, visible only to admins).

3. Site builders — iframe embed

For platforms that block custom scripts (Wix, Notion, Squarespace, Webflow, Shopify), use an iframe that loads the widget on our domain. The iframe page sends a strict Content-Security-Policy: frame-ancestors header locked to your widget's allowed domains, so no other site can frame it.

Paste the iframe where the widget should appear. The widget loads on a transparent background and fills the iframe width.

PlatformWhere to paste
WixAdd → Embed Code → Paste the iframe
NotionType /embed → Paste the iframe URL
SquarespaceAdd Block → Code → Paste the iframe
WebflowAdd Element → Embed → Paste the iframe
ShopifyTheme editor → Add section → Custom Liquid → Paste the iframe

Theming

Every widget is a real Web Component with Shadow DOM, so it can't be styled by accident from your page's own CSS — theming happens through theme="light|dark" and four CSS custom properties:

PropertyControlsDefault (dark)Default (light)
--ko-accentHighlight color — top-4 rank, live dot, primary bar segment#FF3D2E#FF3D2E
--ko-bgCard background#0f1729#ffffff
--ko-fontCard font familySystem font stack (-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif)
--ko-radiusCard corner radius16px

Set them on the widget element itself:

kickoff-standings {
  --ko-accent: #7c3aed;
  --ko-font: "Inter", sans-serif;
  --ko-radius: 4px;
}

Quota

Widget calls meter against your account's normal quota — a widget request is not a separate, unlimited allowance. If your embeds are heavily trafficked, watch your usage the same way you would for direct API calls; per-key usage already breaks out what each key (including a widget key) has spent.