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

# Widget API

> Add and remove the domains allowed to embed the chat widget and call the SDK API via the Public API

Manage the [allowed domains](https://ago.mintlify.site/features/widget-configuration-admin.md#allowed-domains) of the chat widget from your own tools, for example to allow each new customer site as soon as you create it. This is the same list as **Allowed Domains** on the **Widget & SDK** page: it controls which websites can embed the widget and call the [SDK API](https://ago.mintlify.site/api/sdk-api.md).

These endpoints are not available as MCP tools.

## Authentication

Reading requires an API key with the `settings:read` scope; changes require `settings:write`. These scopes can only be granted to API keys, not to OAuth connections.

```bash theme={null}
curl -H "X-API-Key: ago_v1_sk_..." https://your-workspace.api.useago.com/api/v1/widget/allowed-domains
```

See [API Key Authentication](https://ago.mintlify.site/security/api-key-authentication.md) for setup instructions.

Every endpoint returns the list as it is after the call:

```json theme={null}
{
  "domains": ["shop.example.com", "https://portal.example.com"]
}
```

An empty list lets any website embed the widget, but a website that calls the SDK API from the browser must always be in the list.

A domain matches every website address that contains it: `example.com` allows `https://app.example.com`, but also `https://example.com.other.net`. Give full addresses, such as `https://portal.example.com`, to allow only the websites you choose.

***

## List the allowed domains

```
GET /api/v1/widget/allowed-domains
```

## Allow a domain

```
POST /api/v1/widget/allowed-domains
```

```bash theme={null}
curl -X POST https://your-workspace.api.useago.com/api/v1/widget/allowed-domains \
  -H "X-API-Key: ago_v1_sk_..." \
  -H "Content-Type: application/json" \
  -d '{"domain": "https://portal.example.com"}'
```

Adding a domain that is already in the list changes nothing. Spaces around the domain are removed; an empty domain returns `400`.

## Remove a domain

```
DELETE /api/v1/widget/allowed-domains?domain=https://portal.example.com
```

Pass the domain exactly as it appears in the list, URL-encoded. A domain that is not in the list returns `404`.

Removing the last domain leaves the list empty: any website can then embed the widget, and only your [AGO sites](https://ago.mintlify.site/features/ago-sites.md) can still call the SDK API from the browser.

## Replace the list

```
PUT /api/v1/widget/allowed-domains
```

```bash theme={null}
curl -X PUT https://your-workspace.api.useago.com/api/v1/widget/allowed-domains \
  -H "X-API-Key: ago_v1_sk_..." \
  -H "Content-Type: application/json" \
  -d '{"domains": ["shop.example.com", "https://portal.example.com"]}'
```

The request replaces the whole list; duplicates are removed. An empty domain returns `400` and changes nothing.


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