# Using Widget API

In [Customise Widget Configuration](/developers/wistia-plugin/customise-widget-configuration.md) we've setup the Widget, similar to `onSetup` hook the Iframe Client API provides `onReady` hook. Once `onReady` is called, Annoto API actions can be performed:

```markup
<iframe src="https://fast.wistia.net/embed/iframe/r440odi4pc?seo=false&videoFoam=true&&plugin%5Bannoto%5D%5Bsrc%5D=https%3A%2F%2Fcdn.annoto.net%2Fwistia-plugin%2Flatest%2Fplugin.js" title="Borrowed video: Welcome to Wistia!" allow="autoplay; fullscreen" allowtransparency="true" frameborder="0" scrolling="no" class="wistia_embed" name="wistia_embed" allowfullscreen msallowfullscreen width="100%" height="100%"></iframe>
<script src="https://cdn.annoto.net/widget-iframe-api/latest/client.js"></script>
<script>
    var annoto = new AnnotoIframeApi.Client(document.getElementById("wistia-player-id"));
    annoto.onSetup(function(next) {
        next({
            clientId: 'eyJhbGciOiJIUzI1NiJ9...',
        });
    });
    annoto.onReady(function(api) {
        // recomended, so notifications will have URL to valid pages
        api.registerOriginProvider({
            getPageUrl: function() {
                return location.href;
            },
        });
        var token = 'eyJhbGciO...';
        api.auth(token, function(err) {
            if (err) {
                console.error('sso auth error: ', err);
            }
        });
    });
</script>
```

The `api` can be used to accomplish various tasks such as dynamically hide/show the widget, load new configuration and maybe the most common task to perform Single Sign On (SSO) authentication as demonstrated above.

{% hint style="info" %}
For full API documentation, please refer to the [AnnotoApi Reference](https://annoto.github.io/widget-api/interfaces/annoto.annotoapi.html).
{% endhint %}

{% hint style="warning" %}
The api object provided by the Iframe Client `annoto.onReady` has limited capabilities:

1. It does not support Promise based usage. It supports only callbacks.&#x20;
2. It support only the following methods: auth, load, close, show, hide, registerOriginProvider, logout.
3. registerOriginProvider supports only getPageUrl.
   {% endhint %}

{% hint style="success" %}
For more information regarding SSO, please refer to the Annoto SSO Technical Guide or contact us at <support@annoto.net>.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.annoto.net/developers/wistia-plugin/using-widget-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
