# Approve pairing

URL: https://docs.hanzo.ai/docs/openapi/channel/post-channel-pairing-approve

> Turns one pending pairing code into a standing allow entry, so that person can DM the org's bot on that channel from now on.

`POST /v1/channel/pairing/approve`

> [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/pairing/approve` |
| **Method**    | `POST`                                            |
| **Operation** | `post_channel_pairing_approve`                    |
| **Auth**      | `Authorization: Bearer $HANZO_API_KEY`            |

Turns one pending pairing code into a standing allow entry, so
that person can DM the org's bot on that channel from now on. It requires ORG
ADMIN, not merely membership. The first approval an org makes on a channel also
bootstraps that sender as the channel's owner, which the answer reports. An
unknown or expired code is a 404, and a code always belongs to exactly one
org, so it can never approve someone into another tenant.

## Request

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

| Field     | In   | Type   | Required | Description                                                                                   |
| --------- | ---- | ------ | -------- | --------------------------------------------------------------------------------------------- |
| `channel` | body | string | —        | Channel is the transport the request came in on: discord, slack, teams, telegram or whatsapp. |
| `code`    | body | string | —        | Code is the pairing code from GET /v1/channel/pairing.                                        |

## Response

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

`200` body — 2 fields.

| Field               | In   | Type    | Always | Description                                                                                                                   |
| ------------------- | ---- | ------- | ------ | ----------------------------------------------------------------------------------------------------------------------------- |
| `ownerBootstrapped` | body | boolean | —      | OwnerBootstrapped is true when this approval was the org's FIRST on the channel and therefore also made the sender its owner. |
| `sender`            | body | string  | —      | Sender is the external chat identity that is now allowed to DM the org's bot.                                                 |

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

## Examples

**CLI**

```bash
hanzo channel pairing approve
```

**SDK**

**.ts**

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

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

**.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).post_channel_pairing_approve(channel="<channel>", code="<code>")
```

**.go**

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

resp, _, err := client.ChannelAPI.PostChannelPairingApprove(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::post_channel_pairing_approve(&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).postChannelPairingApprove();
```

**HTTP**

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

**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)
