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
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 type | Allowed Origins | What 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
| Element | Required attributes | Optional 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 Predictive
From our own Dixon-Coles + xG models. Requires a plan with predictive access.
| Element | Required attributes | Optional attributes |
|---|---|---|
<kickoff-prediction> Paid |
fixture |
label, theme, demo |
<kickoff-seasonsim> Paid |
league, season |
label, theme, demo |
<kickoff-ratings> Paid |
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
| Attribute | Meaning |
|---|---|
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 Ultra / Enterprise | 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 viado_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.
| Platform | Where to paste |
|---|---|
| Wix | Add → Embed Code → Paste the iframe |
| Notion | Type /embed → Paste the iframe URL |
| Squarespace | Add Block → Code → Paste the iframe |
| Webflow | Add Element → Embed → Paste the iframe |
| Shopify | Theme 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:
| Property | Controls | Default (dark) | Default (light) |
|---|---|---|---|
--ko-accent | Highlight color — top-4 rank, live dot, primary bar segment | #FF3D2E | #FF3D2E |
--ko-bg | Card background | #0f1729 | #ffffff |
--ko-font | Card font family | System font stack (-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif) | |
--ko-radius | Card corner radius | 16px | |
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.