# Replace allowlist

URL: https://docs.hanzo.ai/docs/openapi/channel/put-channel-allowlist

> Edits the caller org's access policy for one channel and answers the policy as GET would, so both verbs return ONE shape.

`PUT /v1/channel/allowlist`

> [Channel →](https://docs.hanzo.ai/docs/openapi/channel) · [All API references →](https://docs.hanzo.ai/docs/openapi) · [Get started →](https://docs.hanzo.ai/docs/guides)

|               |                                             |
| ------------- | ------------------------------------------- |
| **Address**   | `https://api.hanzo.ai/v1/channel/allowlist` |
| **Method**    | `PUT`                                       |
| **Operation** | `put_channel_allowlist`                     |
| **Auth**      | `Authorization: Bearer $HANZO_API_KEY`      |

Edits the caller org's access policy for one channel and answers
the policy as GET would, so both verbs return ONE shape. It requires ORG ADMIN.
Every field but `channel` is optional and applied only when provided: an empty
policy string leaves that policy alone, an absent or null list leaves that list
alone, and an EMPTY list clears it. It writes only CONFIG-sourced allow entries
— senders approved through pairing belong to the approval flow, so a policy
edit can never revoke one. An unknown channel is a 404.

## Request

8 fields, body `application/json` (required).

| Field              | In   | Type      | Required | Description                                                                                                                               |
| ------------------ | ---- | --------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| `accessGroups`     | body | object    | —        | AccessGroups REPLACES the org's named access groups, as group name -> channel -> entries.                                                 |
| `accessGroups.*`   | body | object    | —        |                                                                                                                                           |
| `accessGroups.*.*` | body | string\[] | —        |                                                                                                                                           |
| `channel`          | body | string    | —        | Channel is the transport to edit: discord, github, linear, slack, teams, telegram or whatsapp.                                            |
| `dm`               | body | string\[] | —        | DM REPLACES the config-managed DM allow entries.                                                                                          |
| `dmPolicy`         | body | string    | —        | DMPolicy sets how direct messages are admitted: "pairing" (a person must be approved first), "allowlist" (only listed senders) or "open". |
| `group`            | body | string\[] | —        | Group REPLACES the config-managed group allow entries.                                                                                    |
| `groupPolicy`      | body | string    | —        | GroupPolicy sets how group and thread rooms are admitted: "open", "allowlist" or "disabled".                                              |

## Response

| Status    | Body                  | Meaning |
| --------- | --------------------- | ------- |
| `200`     | channel.allowlistView | ok      |
| `default` | problem-details       | refused |

`200` body — 8 fields.

| Field              | In   | Type      | Always | Description                                                                                                           |
| ------------------ | ---- | --------- | ------ | --------------------------------------------------------------------------------------------------------------------- |
| `accessGroups`     | body | object    | —      | AccessGroups is the org's named sender sets, as group name -> channel -> member entries, held once for the whole org. |
| `accessGroups.*`   | body | object    | —      |                                                                                                                       |
| `accessGroups.*.*` | body | string\[] | —      |                                                                                                                       |
| `dm`               | body | string\[] | —      | DM is the CONFIG-managed DM allow entries — the list PUT /v1/channel/allowlist owns and replaces wholesale.           |
| `dmPolicy`         | body | string    | —      | DMPolicy decides every inbound DIRECT message, defaulting to "pairing" when the org has never set one.                |
| `group`            | body | string\[] | —      | Group is the CONFIG-managed group allow entries, consulted only while GroupPolicy is "allowlist".                     |
| `groupPolicy`      | body | string    | —      | GroupPolicy decides every inbound GROUP or THREAD message — a thread is a group surface — defaulting to "open".       |
| `paired`           | body | string\[] | —      | Paired is the senders admitted by PAIRING — the entries POST /v1/channel/pairing/approve minted, DM scope only.       |

Failure carries the platform error shape — see [Errors](https://docs.hanzo.ai/docs/errors).

## Examples

**CLI**

```bash
hanzo channel allowlist replace
```

**SDK**

**.ts**

```ts
import { Configuration, ChannelApi } from 'hanzoai';

const api = new ChannelApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.putChannelAllowlist({ accessGroups: {}, channel: "<channel>" });
```

**.py**

```python
from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import ChannelApi

client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = ChannelApi(client).put_channel_allowlist(access_groups={}, channel="<channel>")
```

**.go**

```go
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.ChannelAPI.PutChannelAllowlist(context.Background()).Execute()
if err != nil {
	return err
}
```

**.rs**

```rust
use hanzo_client::apis::{configuration::Configuration, channel_api};

let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();

let result = channel_api::put_channel_allowlist(&cfg, Default::default()).await?;
```

**.java**

```java
import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.ChannelApi;

ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));

var result = new ChannelApi(client).putChannelAllowlist();
```

**HTTP**

```bash
curl -X PUT https://api.hanzo.ai/v1/channel/allowlist \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "accessGroups": {},
       "channel": "<channel>"
     }'
```

**MCP**

MCP reaches **channel** through the `channel` tool, which names its 8 operations with its own verbs — this one among them, under a name only MCP declares. `describe` explains any of them:

```bash
curl -X POST https://api.hanzo.ai/v1/mcp \
  -H "Content-Type: application/json" \
  -d '{
       "jsonrpc": "2.0",
       "id": 1,
       "method": "tools/call",
       "params": {
         "name": "describe",
         "arguments": {
           "op": "list_channels"
         }
       }
     }'
```

---

[Channel API](https://docs.hanzo.ai/docs/openapi/channel) · [All Hanzo APIs](https://docs.hanzo.ai/docs/openapi) · [Interactive reference](https://docs.hanzo.ai/docs/openapi/reference)
