> ## Documentation Index
> Fetch the complete documentation index at: https://docs.beyondwords.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Widget API

The BeyondWords widget API lets you control and interact with the widget programmatically: controlling playback, reading state, listening to events, and updating widget properties at runtime.

The API is available on all widget platforms. On iOS and Android, the native SDKs expose the same properties and methods through their `PlayerView` wrappers.

When you set a property both in the dashboard and in your embed code or SDK configuration, the value passed at initialization takes precedence. See [programmatic control](https://docs.beyondwords.io/docs-and-guides/widget/developer-guides/programmatic-control.md) for override order details.

> [!NOTE]
>
> **Widget or player?** The widget used to be called the player. You'll still see `player` in API endpoints, SDK methods, and embed code. These refer to the widget, and existing integrations keep working without changes.

## Get a widget instance

Before you can use the API, you need a reference to the widget instance.

**Embed script**:

```html theme={null}
<script async defer
  src="https://proxy.beyondwords.io/npm/@beyondwords/player@latest/dist/umd.js"
  onload="const player = new BeyondWords.Player({
    target: this,
    projectId: YOUR_PROJECT_ID,
    contentId: 'YOUR_CONTENT_ID',
  })">
</script>
```

**NPM**:

```javascript theme={null}
import BeyondWords from '@beyondwords/player';

const player = new BeyondWords.Player({
  target: '#beyondwords-player',
  projectId: YOUR_PROJECT_ID,
  contentId: 'YOUR_CONTENT_ID',
});
```

Once you have a widget instance, you can use the properties, events, and methods documented in the sections below.

> [card] [Properties](https://docs.beyondwords.io/docs-and-guides/widget/developer-guides/properties.md)
>
> Read and set widget configuration and state.

> [card] [Events](https://docs.beyondwords.io/docs-and-guides/widget/developer-guides/events.md)
>
> Listen and respond to widget lifecycle events.

> [card] [Programmatic control](https://docs.beyondwords.io/docs-and-guides/widget/developer-guides/programmatic-control.md)
>
> Control playback, navigation, and widget behavior from your code.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.