---
title: "Global SIR API"
canonical_url: "https://apidocs.sportradar.com/resources/widgets/docs/tutorials/SIR"
markdown_url: "https://apidocs.sportradar.com/resources/widgets/docs/tutorials/SIR.md"
last_updated: "2026-09-02T08:08:38Z"
---

# Global SIR API

The SIR API is exposed as a global `SIR` function that provides the primary interface for integrating and managing Sportradar widgets on your page.

## Global Configuration Options

The following options can be configured in the widgetloader script initialization:

| Option              | Type                | Description                                                                                                                                                                                                                              |
| ------------------- | ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `language`          | `string`            | Language code for widget content. See [Languages](https://apidocs.sportradar.com/resources/widgets/docs/tutorials/references/languages.md) for supported codes.                                                                          |
| `clockType`         | `string`            | Clock format: `'12'` or `'24'`. Controls time display across widgets.                                                                                                                                                                    |
| `oddsType`          | `string`            | Odds format: `'eu'` (decimal), `'uk'` (fractional), or `'us'` (american).                                                                                                                                                                |
| `theme`             | `string` \| `false` | Theme identifier or `false` for no theme. Available public themes: `'betradar'`, `'sportradar'`, `'betradardark'`, `'sportradardark'`. Create custom themes on the [Widgets demo page](https://widgets.sir.sportradar.com/widgets-demo). |
| `s5ClientAlias`     | `string`            | Statistics client alias for widgets like tournament preview and match preview.                                                                                                                                                           |
| `unitType`          | `string`            | Unit system: `'metric'` or `'imperial'`. Affects length, height, weight, temperature, and speed displays. **Init-only** — there is no `changeUnitType` runtime method; changing units requires re-initializing the widget loader.        |
| `debug`             | `boolean`           | Enable debug mode. When `true`, sets `logLevel` to `'info'`. When `false`, disables logging.                                                                                                                                             |
| `adapterDataSource` | `string`            | Enable integrated adapter. String value will be given to you by setup team.                                                                                                                                                              |
| `displayTimezone`   | `string`            | Timezone used when widgets format dates and times. Use IANA identifiers such as `'Europe/London'` or `'America/New_York'`. Invalid values fall back to UTC. On older browsers, provide polyfills for `Intl.DateTimeFormat` if needed.    |

***

## Initialization

**Standard Initialization**

Initialize the widget framework with configuration options. Commands executed before the framework loads are queued and run after initialization completes.

**View Initialization Code**

```html
<script type="text/javascript">
    (function(a,b,c,d,e,f,g,h,i){a[e]||(i=a[e]=function(){(a[e].q=a[e].q||[]).push(arguments)},i.l=1*new Date,i.o=f,
    g=b.createElement(c),h=b.getElementsByTagName(c)[0],g.async=1,g.src=d,g.setAttribute("n",e),h.parentNode.insertBefore(g,h)
    )})(window,document,"script","https://widgets.sir.sportradar.com/YOUR_CLIENT_ID/widgetloader","SIR", {
        language: 'en',
        debug: true
    });
</script>
```

> **Warning**
>
> Replace `YOUR_CLIENT_ID` in the URL with your actual Client ID.

**Adding a Widget:**

```html
<script>
     // Syntax: SIR(<methodName>[, ...arguments]);
     SIR('addWidget', '#my-div', 'match.scoreboard');
</script>
<div id="my-div"></div>
```

**Custom Variable Name**

The global variable name can be customized to avoid conflicts or match your naming conventions. Replace `"SIR"` with your preferred name in the initialization.

**View Custom Name Example**

```html
<script type="text/javascript">
    (function(a,b,c,d,e,f,g,h,i){a[e]||(i=a[e]=function(){(a[e].q=a[e].q||[]).push(arguments)},i.l=1*new Date,i.o=f,
    g=b.createElement(c),h=b.getElementsByTagName(c)[0],g.async=1,g.src=d,g.setAttribute("n",e),h.parentNode.insertBefore(g,h)
    )})(window,document,"script","https://widgets.sir.sportradar.com/YOUR_CLIENT_ID/widgetloader","SirWidgets", {
        language: 'en',
        debug: true
    });
    SirWidgets('addWidget', '#my-div', 'match.scoreboard');
</script>
<div id="my-div"></div>
```

***

## API Methods

All methods are invoked using the global SIR function with the method name as the first parameter, followed by method-specific arguments.

> **Tip**
>
> API method names are **case-insensitive** at runtime — they are lowercased internally before dispatch. `SIR('addWidget', ...)` and `SIR('AddWidget', ...)` are equivalent.

### `addWidget` {#addWidget}

Adds a widget to a specified DOM element or selector.

> **Warning**
>
> This method replaces the entire content of the target element with the widget.

#### Parameters

| Name              | Type                     | Attributes   | Description                                                                                                                                                                                                                            |
| ----------------- | ------------------------ | ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `method`          | `'addWidget'`            | `<required>` | Method name.                                                                                                                                                                                                                           |
| `domElOrSelector` | `string` \| `DomElement` | `<required>` | Widget DOM element or selector. For widget integrations within ShadowDOM, check [shadowDOM mutation observer example](https://apidocs.sportradar.com/resources/widgets/docs/tutorials/examples/example-shadowdom-mutationobserver.md). |
| `name`            | `string`                 | `<required>` | Widget name.                                                                                                                                                                                                                           |
| `props`           | `object`                 |              | Widget configuration properties. See sub-properties below.                                                                                                                                                                             |

**`props` sub-properties:**

| Name          | Type       | Attributes     | Description                                                                                                                                         |
| ------------- | ---------- | -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| `silent`      | `boolean`  |                | When `true`, suppresses widget error displays.                                                                                                      |
| `onTrack`     | `function` |                | Event tracking callback. See [Event Tracking Guide](https://apidocs.sportradar.com/resources/widgets/docs/tutorials/tracking-guide.md) for details. |
| `widgetProps` | `*`        | `<repeatable>` | Additional widget-specific properties passed through to the widget.                                                                                 |
| `callback`    | `function` |                | Triggered only once, when widget is rendered (does not trigger on widget changes due to user action or async data loading.)                         |

### `updateWidget` {#updateWidget}

Updates a widget on given DOM element or selector.

#### Parameters

| Name               | Type                     | Attributes   | Description                                                                                                                                                                                                                            |
| ------------------ | ------------------------ | ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `method`           | `'updateWidget'`         | `<required>` | Method name.                                                                                                                                                                                                                           |
| `domElOrSelector`  | `string` \| `DomElement` | `<required>` | Widget DOM element or selector. For widget integrations within ShadowDOM, check [shadowDOM mutation observer example](https://apidocs.sportradar.com/resources/widgets/docs/tutorials/examples/example-shadowdom-mutationobserver.md). |
| `props`            | `object`                 |              | Widget props.                                                                                                                                                                                                                          |
| `callback`         | `function`               |              | Triggered only once, when widget is rendered (does not trigger on widget changes due to user action or async data loading.)                                                                                                            |
| `onlyServerRender` | `boolean`                |              | If true, server will render the widget and populate the given element. User interaction will not work.                                                                                                                                 |

### `removeWidget` {#removeWidget}

Removes a widget on given DOM element or selector.

#### Parameters

| Name              | Type                     | Description                                                                                                                                                                                                                            |
| ----------------- | ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `method`          | `'removeWidget'`         | Method name.                                                                                                                                                                                                                           |
| `domElOrSelector` | `string` \| `DomElement` | Widget DOM element or selector. For widget integrations within ShadowDOM, check [shadowDOM mutation observer example](https://apidocs.sportradar.com/resources/widgets/docs/tutorials/examples/example-shadowdom-mutationobserver.md). |

### `registerAdapter` {#registerAdapter}

Registers a data adapter for retrieving information from your page or custom APIs.

> **Info**
>
> Adapters enable widgets to access client-specific data sources and integrate with your existing infrastructure.

**Self Service adapter**

#### Parameters

| Name      | Type                                                                                                     | Description                                                    |
| --------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------- |
| `method`  | `'registerAdapter'`                                                                                      | Method name.                                                   |
| `adapter` | [`AdapterObject`](https://apidocs.sportradar.com/resources/widgets/docs/adapter/Types.md#adapter-object) | Hosted adapter name provided by us or your own implementation. |

**Extension of integrated adapter**

> **Info**
>
> Integrated adapter needs to be activated via licensing or it can be manually overridden in [Global Configuration Options](#global-configuration-options) over adapterDataSource.

#### Parameters

| Name      | Type                                                                                                     | Description                                                    |
| --------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------- |
| `method`  | `'registerAdapter'`                                                                                      | Method name.                                                   |
| `adapter` | [`AdapterObject`](https://apidocs.sportradar.com/resources/widgets/docs/adapter/Types.md#adapter-object) | Hosted adapter name provided by us or your own implementation. |

**Hosted adapter**

#### Parameters

| Name          | Type                | Description                                                    |
| ------------- | ------------------- | -------------------------------------------------------------- |
| `method`      | `'registerAdapter'` | Method name.                                                   |
| `adapterName` | `string`            | Hosted adapter name provided by us or your own implementation. |

**Hosted adapter with extension**

#### Parameters

| Name          | Type                                                                                                     | Description                                                    |
| ------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------- |
| `method`      | `'registerAdapter'`                                                                                      | Method name.                                                   |
| `adapterName` | `string`                                                                                                 | Hosted adapter name provided by us or your own implementation. |
| `adapter`     | [`AdapterObject`](https://apidocs.sportradar.com/resources/widgets/docs/adapter/Types.md#adapter-object) | Hosted adapter name provided by us or your own implementation. |

**V1 adapter (deprecated)**

#### Parameters

| Name      | Type                    | Description                                                    |
| --------- | ----------------------- | -------------------------------------------------------------- |
| `method`  | `'registerAdapter'`     | Method name.                                                   |
| `adapter` | `function` \| `Promise` | Hosted adapter name provided by us or your own implementation. |

### `check` {#check}

Scans the DOM for elements with the `data-sr-widget` attribute and initializes any uninitialized widgets. Also destroys widget instances when their DOM nodes are removed.

> **Tip**
>
> Use this method after dynamically adding widget elements to the page or when using declarative HTML integration.

#### Parameters

| Name       | Type       | Description                                                                                                                                                             |
| ---------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `method`   | `'check'`  | Method name.                                                                                                                                                            |
| `callback` | `function` | Callback triggered with array of all widgets instantiated. Each array item is an object with following properties: `widgetDomElement`, `widgetInstance`, `widgetClass`. |

### `changeLanguage` {#changeLanguage}

Changes the display language for all widgets.

> **Warning**
>
> Forces a complete reload of all widgets. Internal widget state will be lost.

#### Parameters

| Name       | Type               | Description                                                                                                                       |
| ---------- | ------------------ | --------------------------------------------------------------------------------------------------------------------------------- |
| `method`   | `'changeLanguage'` | Method name.                                                                                                                      |
| `language` | `string`           | For available languages see [Languages](https://apidocs.sportradar.com/resources/widgets/docs/tutorials/references/languages.md). |

### `changeClockType` {#changeClockType}

Changes the clock format between 12-hour and 24-hour display.

> **Warning**
>
> Forces a complete reload of all widgets. Internal widget state will be lost.

#### Parameters

| Name        | Type                | Description      |
| ----------- | ------------------- | ---------------- |
| `method`    | `'changeClockType'` | Method name.     |
| `clockType` | `string`            | `'12'` or `'24'` |

### `changeOddsType` {#changeOddsType}

Changes the odds display format across all widgets.

> **Warning**
>
> Forces a complete reload of all widgets. Internal widget state will be lost.

#### Parameters

| Name       | Type               | Description                              |
| ---------- | ------------------ | ---------------------------------------- |
| `method`   | `'changeOddsType'` | Method name.                             |
| `oddsType` | `string`           | Must be one of `'eu'`, `'us'` or `'uk'`. |

### `changeTeamInvert` {#changeTeamInvert}

Controls the left/right positioning of home and away teams in widget displays.

> **Info**
>
> By default, home teams appear on the left and away teams on the right, except for NFL and baseball which are inverted.

> **Warning**
>
> Forces a complete reload of all widgets. Internal widget state will be lost.

#### Parameters

| Name         | Type                       | Description                                                            |
| ------------ | -------------------------- | ---------------------------------------------------------------------- |
| `method`     | `'changeTeamInvert'`       | Method name.                                                           |
| `teamInvert` | `object`                   | Example: `{ sid: { 3: true }}` inverts teams for all baseball matches. |
| `all`        | `boolean`                  | Invert all matches.                                                    |
| `sid`        | `Object.<string, boolean>` | Dictionary of sport ids to invert.                                     |
| `rcid`       | `Object.<string, boolean>` | Dictionary of real category ids to invert.                             |
| `utid`       | `Object.<string, boolean>` | Dictionary of unique tournament ids to invert.                         |

**Example:**

```javascript
// Invert all baseball matches (sport ID 3)
SIR('changeTeamInvert', { sid: { 3: true } });

// Invert all matches across every sport
SIR('changeTeamInvert', { all: true });

// Invert matches in a specific real category (rcid)
SIR('changeTeamInvert', { rcid: { 44: true } }); // e.g. UEFA Champions League

// Invert matches in a specific unique tournament (utid)
SIR('changeTeamInvert', { utid: { 1: true, 17: true } }); // e.g. specific competitions

// Combine multiple scopes
SIR('changeTeamInvert', { sid: { 3: true }, utid: { 1: true } });
```

### `changeLogLevel` {#changeLogLevel}

Changes the logging verbosity level for debugging purposes.

> **Tip**
>
> Use higher log levels (like `'info'`) when troubleshooting widget issues.

#### Parameters

| Name       | Type               | Description                                                 |
| ---------- | ------------------ | ----------------------------------------------------------- |
| `method`   | `'changeLogLevel'` | Method name.                                                |
| `logLevel` | `string`           | Must be one of `'error'`, `'warn'`, `'info'` or `'silent'`. |

**Example:**

```javascript
// Enable info-level logging while troubleshooting
SIR('changeLogLevel', 'info');

// Reduce output to warnings and errors only
SIR('changeLogLevel', 'warn');
```

### `setClientTheme` {#setClientTheme}

Dynamically loads and applies a widget theme.

> **Info**
>
> You can use a theme URL or a client alias configured in your client setup.

#### Parameters

| Name       | Type               | Description                                                                            |
| ---------- | ------------------ | -------------------------------------------------------------------------------------- |
| `method`   | `'setClientTheme'` | Method name.                                                                           |
| `theme`    | `string`           | Theme to load. Use an HTTPS URL or a client alias from your setup (e.g. `'betradar'`). |
| `callback` | `function`         | Optional. Called when the theme has finished loading.                                  |

**Example:**

```javascript
// Apply a theme by client alias
SIR('setClientTheme', 'betradar');

// Apply a theme from a URL
SIR('setClientTheme', 'https://example.com/my-theme.css');

// Apply a theme and run code when loading completes
SIR('setClientTheme', 'sportradardark', () => {
  console.log('Theme loaded');
});
```
