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

# 转发

> 管理转发规则和转发地址。

# 转发

管理转发规则和转发地址。

<script src="/locale-bridge.js" />

示例使用 A2A 代码模式。MCP 通过 `execute` 工具公开相同的代码模式。

## 函数

### `forwarding.activate`

```text theme={null}
forwarding.activate(account_id: str, forwarding_id: str, active: bool) -> ForwardingRule
```

转发: `forwarding.activate`.

| 属性        | 值                                                                          | 属性       | 值                   |
| --------- | -------------------------------------------------------------------------- | -------- | ------------------- |
| 所需权限      | `forwarding.manage`                                                        | 需要身份验证   | `是`                 |
| 执行模式      | `sync`                                                                     | 能力       | `forwarding.manage` |
| 资源类型      | `account`                                                                  | 资源 ID 字段 | `account_id`        |
| 公共 API 路由 | `PATCH /v1/public/accounts/{account_id}/forwarding/{forwarding_id}/active` |          |                     |

<AccordionGroup>
  <Accordion title="参数">
    | 名称              | 类型     | 必需 |
    | --------------- | ------ | -- |
    | `account_id`    | `str`  | 是  |
    | `forwarding_id` | `str`  | 是  |
    | `active`        | `bool` | 是  |
  </Accordion>

  <Accordion title="返回值">
    | 字段                         | 类型                                                   | 必需 |
    | -------------------------- | ---------------------------------------------------- | -- |
    | `active`                   | `bool`                                               | 是  |
    | `created_at`               | `str`                                                | 是  |
    | `id`                       | `str`                                                | 是  |
    | `scope_id`                 | `str`                                                | 是  |
    | `scope_type`               | `"account" \| "workspace" \| "domain"`               | 是  |
    | `target_email`             | `str`                                                | 是  |
    | `updated_at`               | `str`                                                | 是  |
    | `verification_required`    | `bool`                                               | 是  |
    | `verification_state`       | `"internal" \| "pending" \| "verified" \| "expired"` | 是  |
    | `verification_expires_at`  | `str \| null`                                        | 否  |
    | `verification_sent_at`     | `str \| null`                                        | 否  |
    | `verification_verified_at` | `str \| null`                                        | 否  |
  </Accordion>

  <Accordion title="A2A 示例">
    请求:

    ```json theme={null}
    {
      "request_id": "example",
      "session_id": "session_123",
      "code": "forwarding.activate(account_id=\"3c90c3cc-0d44-4b50-8888-8dd25736052a\", forwarding_id=\"3c90c3cc-0d44-4b50-8888-8dd25736052a\", active=true)"
    }
    ```

    响应:

    ```json theme={null}
    {
      "request_id": "example",
      "status": "completed",
      "result": {
        "last_value": true
      },
      "responses": [
        {
          "index": 0,
          "function": "forwarding.activate",
          "status": "completed",
          "result": true
        }
      ],
      "complexity_score": 1
    }
    ```
  </Accordion>

  <Accordion title="MCP 示例">
    请求:

    ```json theme={null}
    {
      "jsonrpc": "2.0",
      "id": "example",
      "method": "tools/call",
      "params": {
        "name": "hybridbox_execute",
        "arguments": {
          "code": "forwarding.activate(account_id=\"3c90c3cc-0d44-4b50-8888-8dd25736052a\", forwarding_id=\"3c90c3cc-0d44-4b50-8888-8dd25736052a\", active=true)"
        }
      }
    }
    ```

    响应:

    ```json theme={null}
    {
      "jsonrpc": "2.0",
      "id": "example",
      "result": {
        "content": [
          {
            "type": "text",
            "text": "{\n  \"request_id\": \"example\",\n  \"status\": \"completed\",\n  \"result\": {\n    \"last_value\": true\n  },\n  \"responses\": [\n    {\n      \"index\": 0,\n      \"function\": \"forwarding.activate\",\n      \"status\": \"completed\",\n      \"result\": true\n    }\n  ],\n  \"complexity_score\": 1\n}"
          }
        ],
        "isError": false
      }
    }
    ```
  </Accordion>
</AccordionGroup>

### `forwarding.add`

```text theme={null}
forwarding.add(account_id: str, target_email: str, domain?: str | null, workspace_id?: str | null) -> ForwardingRule
```

转发: `forwarding.add`.

| 属性        | 值                                                  | 属性       | 值                   |
| --------- | -------------------------------------------------- | -------- | ------------------- |
| 所需权限      | `forwarding.manage`                                | 需要身份验证   | `是`                 |
| 执行模式      | `sync`                                             | 能力       | `forwarding.manage` |
| 资源类型      | `account`                                          | 资源 ID 字段 | `account_id`        |
| 公共 API 路由 | `POST /v1/public/accounts/{account_id}/forwarding` |          |                     |

<AccordionGroup>
  <Accordion title="参数">
    | 名称             | 类型            | 必需 |
    | -------------- | ------------- | -- |
    | `account_id`   | `str`         | 是  |
    | `target_email` | `str`         | 是  |
    | `domain`       | `str \| null` | 否  |
    | `workspace_id` | `str \| null` | 否  |
  </Accordion>

  <Accordion title="返回值">
    | 字段                         | 类型                                                   | 必需 |
    | -------------------------- | ---------------------------------------------------- | -- |
    | `active`                   | `bool`                                               | 是  |
    | `created_at`               | `str`                                                | 是  |
    | `id`                       | `str`                                                | 是  |
    | `scope_id`                 | `str`                                                | 是  |
    | `scope_type`               | `"account" \| "workspace" \| "domain"`               | 是  |
    | `target_email`             | `str`                                                | 是  |
    | `updated_at`               | `str`                                                | 是  |
    | `verification_required`    | `bool`                                               | 是  |
    | `verification_state`       | `"internal" \| "pending" \| "verified" \| "expired"` | 是  |
    | `verification_expires_at`  | `str \| null`                                        | 否  |
    | `verification_sent_at`     | `str \| null`                                        | 否  |
    | `verification_verified_at` | `str \| null`                                        | 否  |
  </Accordion>

  <Accordion title="A2A 示例">
    请求:

    ```json theme={null}
    {
      "request_id": "example",
      "session_id": "session_123",
      "code": "forwarding.add(account_id=\"3c90c3cc-0d44-4b50-8888-8dd25736052a\", target_email=\"user@example.com\", domain=\"example.com\", workspace_id=\"3c90c3cc-0d44-4b50-8888-8dd25736052a\")"
    }
    ```

    响应:

    ```json theme={null}
    {
      "request_id": "example",
      "status": "completed",
      "result": {
        "last_value": true
      },
      "responses": [
        {
          "index": 0,
          "function": "forwarding.add",
          "status": "completed",
          "result": true
        }
      ],
      "complexity_score": 1
    }
    ```
  </Accordion>

  <Accordion title="MCP 示例">
    请求:

    ```json theme={null}
    {
      "jsonrpc": "2.0",
      "id": "example",
      "method": "tools/call",
      "params": {
        "name": "hybridbox_execute",
        "arguments": {
          "code": "forwarding.add(account_id=\"3c90c3cc-0d44-4b50-8888-8dd25736052a\", target_email=\"user@example.com\", domain=\"example.com\", workspace_id=\"3c90c3cc-0d44-4b50-8888-8dd25736052a\")"
        }
      }
    }
    ```

    响应:

    ```json theme={null}
    {
      "jsonrpc": "2.0",
      "id": "example",
      "result": {
        "content": [
          {
            "type": "text",
            "text": "{\n  \"request_id\": \"example\",\n  \"status\": \"completed\",\n  \"result\": {\n    \"last_value\": true\n  },\n  \"responses\": [\n    {\n      \"index\": 0,\n      \"function\": \"forwarding.add\",\n      \"status\": \"completed\",\n      \"result\": true\n    }\n  ],\n  \"complexity_score\": 1\n}"
          }
        ],
        "isError": false
      }
    }
    ```
  </Accordion>
</AccordionGroup>

### `forwarding.delete`

```text theme={null}
forwarding.delete(account_id: str, forwarding_id: str) -> {}
```

转发: `forwarding.delete`.

| 属性        | 值                                                                    | 属性       | 值                   |
| --------- | -------------------------------------------------------------------- | -------- | ------------------- |
| 所需权限      | `forwarding.manage`                                                  | 需要身份验证   | `是`                 |
| 执行模式      | `sync`                                                               | 能力       | `forwarding.manage` |
| 资源类型      | `account`                                                            | 资源 ID 字段 | `account_id`        |
| 公共 API 路由 | `DELETE /v1/public/accounts/{account_id}/forwarding/{forwarding_id}` |          |                     |

<AccordionGroup>
  <Accordion title="参数">
    | 名称              | 类型    | 必需 |
    | --------------- | ----- | -- |
    | `account_id`    | `str` | 是  |
    | `forwarding_id` | `str` | 是  |
  </Accordion>

  <Accordion title="返回值">
    | 字段       | 类型   | 必需 |
    | -------- | ---- | -- |
    | `result` | `{}` | 是  |
  </Accordion>

  <Accordion title="A2A 示例">
    请求:

    ```json theme={null}
    {
      "request_id": "example",
      "session_id": "session_123",
      "code": "forwarding.delete(account_id=\"3c90c3cc-0d44-4b50-8888-8dd25736052a\", forwarding_id=\"3c90c3cc-0d44-4b50-8888-8dd25736052a\")"
    }
    ```

    响应:

    ```json theme={null}
    {
      "request_id": "example",
      "status": "completed",
      "result": {
        "last_value": {}
      },
      "responses": [
        {
          "index": 0,
          "function": "forwarding.delete",
          "status": "completed",
          "result": {}
        }
      ],
      "complexity_score": 1
    }
    ```
  </Accordion>

  <Accordion title="MCP 示例">
    请求:

    ```json theme={null}
    {
      "jsonrpc": "2.0",
      "id": "example",
      "method": "tools/call",
      "params": {
        "name": "hybridbox_execute",
        "arguments": {
          "code": "forwarding.delete(account_id=\"3c90c3cc-0d44-4b50-8888-8dd25736052a\", forwarding_id=\"3c90c3cc-0d44-4b50-8888-8dd25736052a\")"
        }
      }
    }
    ```

    响应:

    ```json theme={null}
    {
      "jsonrpc": "2.0",
      "id": "example",
      "result": {
        "content": [
          {
            "type": "text",
            "text": "{\n  \"request_id\": \"example\",\n  \"status\": \"completed\",\n  \"result\": {\n    \"last_value\": {}\n  },\n  \"responses\": [\n    {\n      \"index\": 0,\n      \"function\": \"forwarding.delete\",\n      \"status\": \"completed\",\n      \"result\": {}\n    }\n  ],\n  \"complexity_score\": 1\n}"
          }
        ],
        "isError": false
      }
    }
    ```
  </Accordion>
</AccordionGroup>

### `forwarding.list`

```text theme={null}
forwarding.list(account_id: str, page?: int, page_size?: int) -> Page[ForwardingRule]
```

转发: `forwarding.list`.

| 属性        | 值                                                 | 属性       | 值                 |
| --------- | ------------------------------------------------- | -------- | ----------------- |
| 所需权限      | `forwarding.view`                                 | 需要身份验证   | `是`               |
| 执行模式      | `sync`                                            | 能力       | `forwarding.view` |
| 资源类型      | `account`                                         | 资源 ID 字段 | `account_id`      |
| 公共 API 路由 | `GET /v1/public/accounts/{account_id}/forwarding` |          |                   |

<AccordionGroup>
  <Accordion title="参数">
    | 名称           | 类型    | 必需 |
    | ------------ | ----- | -- |
    | `account_id` | `str` | 是  |
    | `page`       | `int` | 否  |
    | `page_size`  | `int` | 否  |
  </Accordion>

  <Accordion title="返回值">
    | 字段          | 类型                                                                                                                                                                                                                                                                                                                                                                                                | 必需 |
    | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -- |
    | `items`     | `[{"active": bool, "created_at": str, "id": str, "scope_id": str, "scope_type": "account" \| "workspace" \| "domain", "target_email": str, "updated_at": str, "verification_required": bool, "verification_state": "internal" \| "pending" \| "verified" \| "expired", "verification_expires_at"?: str \| null, "verification_sent_at"?: str \| null, "verification_verified_at"?: str \| null}]` | 是  |
    | `page`      | `int`                                                                                                                                                                                                                                                                                                                                                                                             | 是  |
    | `page_size` | `int`                                                                                                                                                                                                                                                                                                                                                                                             | 是  |
    | `total`     | `int`                                                                                                                                                                                                                                                                                                                                                                                             | 是  |
  </Accordion>

  <Accordion title="A2A 示例">
    请求:

    ```json theme={null}
    {
      "request_id": "example",
      "session_id": "session_123",
      "code": "forwarding.list(account_id=\"3c90c3cc-0d44-4b50-8888-8dd25736052a\", page=123, page_size=123)"
    }
    ```

    响应:

    ```json theme={null}
    {
      "request_id": "example",
      "status": "completed",
      "result": {
        "last_value": true
      },
      "responses": [
        {
          "index": 0,
          "function": "forwarding.list",
          "status": "completed",
          "result": true
        }
      ],
      "complexity_score": 1
    }
    ```
  </Accordion>

  <Accordion title="MCP 示例">
    请求:

    ```json theme={null}
    {
      "jsonrpc": "2.0",
      "id": "example",
      "method": "tools/call",
      "params": {
        "name": "hybridbox_execute",
        "arguments": {
          "code": "forwarding.list(account_id=\"3c90c3cc-0d44-4b50-8888-8dd25736052a\", page=123, page_size=123)"
        }
      }
    }
    ```

    响应:

    ```json theme={null}
    {
      "jsonrpc": "2.0",
      "id": "example",
      "result": {
        "content": [
          {
            "type": "text",
            "text": "{\n  \"request_id\": \"example\",\n  \"status\": \"completed\",\n  \"result\": {\n    \"last_value\": true\n  },\n  \"responses\": [\n    {\n      \"index\": 0,\n      \"function\": \"forwarding.list\",\n      \"status\": \"completed\",\n      \"result\": true\n    }\n  ],\n  \"complexity_score\": 1\n}"
          }
        ],
        "isError": false
      }
    }
    ```
  </Accordion>
</AccordionGroup>

### `forwarding.update`

```text theme={null}
forwarding.update(account_id: str, forwarding_id: str, target_email: str) -> ForwardingRule
```

转发: `forwarding.update`.

| 属性        | 值                                                                   | 属性       | 值                   |
| --------- | ------------------------------------------------------------------- | -------- | ------------------- |
| 所需权限      | `forwarding.manage`                                                 | 需要身份验证   | `是`                 |
| 执行模式      | `sync`                                                              | 能力       | `forwarding.manage` |
| 资源类型      | `account`                                                           | 资源 ID 字段 | `account_id`        |
| 公共 API 路由 | `PATCH /v1/public/accounts/{account_id}/forwarding/{forwarding_id}` |          |                     |

<AccordionGroup>
  <Accordion title="参数">
    | 名称              | 类型    | 必需 |
    | --------------- | ----- | -- |
    | `account_id`    | `str` | 是  |
    | `forwarding_id` | `str` | 是  |
    | `target_email`  | `str` | 是  |
  </Accordion>

  <Accordion title="返回值">
    | 字段                         | 类型                                                   | 必需 |
    | -------------------------- | ---------------------------------------------------- | -- |
    | `active`                   | `bool`                                               | 是  |
    | `created_at`               | `str`                                                | 是  |
    | `id`                       | `str`                                                | 是  |
    | `scope_id`                 | `str`                                                | 是  |
    | `scope_type`               | `"account" \| "workspace" \| "domain"`               | 是  |
    | `target_email`             | `str`                                                | 是  |
    | `updated_at`               | `str`                                                | 是  |
    | `verification_required`    | `bool`                                               | 是  |
    | `verification_state`       | `"internal" \| "pending" \| "verified" \| "expired"` | 是  |
    | `verification_expires_at`  | `str \| null`                                        | 否  |
    | `verification_sent_at`     | `str \| null`                                        | 否  |
    | `verification_verified_at` | `str \| null`                                        | 否  |
  </Accordion>

  <Accordion title="A2A 示例">
    请求:

    ```json theme={null}
    {
      "request_id": "example",
      "session_id": "session_123",
      "code": "forwarding.update(account_id=\"3c90c3cc-0d44-4b50-8888-8dd25736052a\", forwarding_id=\"3c90c3cc-0d44-4b50-8888-8dd25736052a\", target_email=\"user@example.com\")"
    }
    ```

    响应:

    ```json theme={null}
    {
      "request_id": "example",
      "status": "completed",
      "result": {
        "last_value": true
      },
      "responses": [
        {
          "index": 0,
          "function": "forwarding.update",
          "status": "completed",
          "result": true
        }
      ],
      "complexity_score": 1
    }
    ```
  </Accordion>

  <Accordion title="MCP 示例">
    请求:

    ```json theme={null}
    {
      "jsonrpc": "2.0",
      "id": "example",
      "method": "tools/call",
      "params": {
        "name": "hybridbox_execute",
        "arguments": {
          "code": "forwarding.update(account_id=\"3c90c3cc-0d44-4b50-8888-8dd25736052a\", forwarding_id=\"3c90c3cc-0d44-4b50-8888-8dd25736052a\", target_email=\"user@example.com\")"
        }
      }
    }
    ```

    响应:

    ```json theme={null}
    {
      "jsonrpc": "2.0",
      "id": "example",
      "result": {
        "content": [
          {
            "type": "text",
            "text": "{\n  \"request_id\": \"example\",\n  \"status\": \"completed\",\n  \"result\": {\n    \"last_value\": true\n  },\n  \"responses\": [\n    {\n      \"index\": 0,\n      \"function\": \"forwarding.update\",\n      \"status\": \"completed\",\n      \"result\": true\n    }\n  ],\n  \"complexity_score\": 1\n}"
          }
        ],
        "isError": false
      }
    }
    ```
  </Accordion>
</AccordionGroup>

### `forwarding.verification.confirm`

```text theme={null}
forwarding.verification.confirm(account_id: str, forwarding_id: str, code: str) -> ForwardingRule
```

转发: `forwarding.verification.confirm`.

| 属性        | 值                                                                                       | 属性       | 值                   |
| --------- | --------------------------------------------------------------------------------------- | -------- | ------------------- |
| 所需权限      | `forwarding.manage`                                                                     | 需要身份验证   | `是`                 |
| 执行模式      | `sync`                                                                                  | 能力       | `forwarding.manage` |
| 资源类型      | `account`                                                                               | 资源 ID 字段 | `account_id`        |
| 公共 API 路由 | `POST /v1/public/accounts/{account_id}/forwarding/{forwarding_id}/verification/confirm` |          |                     |

<AccordionGroup>
  <Accordion title="参数">
    | 名称              | 类型    | 必需 |
    | --------------- | ----- | -- |
    | `account_id`    | `str` | 是  |
    | `forwarding_id` | `str` | 是  |
    | `code`          | `str` | 是  |
  </Accordion>

  <Accordion title="返回值">
    | 字段              | 类型            | 必需 |
    | --------------- | ------------- | -- |
    | `verified`      | `bool`        | 是  |
    | `forwarding_id` | `str \| null` | 否  |
  </Accordion>

  <Accordion title="A2A 示例">
    请求:

    ```json theme={null}
    {
      "request_id": "example",
      "session_id": "session_123",
      "code": "forwarding.verification.confirm(account_id=\"3c90c3cc-0d44-4b50-8888-8dd25736052a\", forwarding_id=\"3c90c3cc-0d44-4b50-8888-8dd25736052a\", code=\"<string>\")"
    }
    ```

    响应:

    ```json theme={null}
    {
      "request_id": "example",
      "status": "completed",
      "result": {
        "last_value": true
      },
      "responses": [
        {
          "index": 0,
          "function": "forwarding.verification.confirm",
          "status": "completed",
          "result": true
        }
      ],
      "complexity_score": 1
    }
    ```
  </Accordion>

  <Accordion title="MCP 示例">
    请求:

    ```json theme={null}
    {
      "jsonrpc": "2.0",
      "id": "example",
      "method": "tools/call",
      "params": {
        "name": "hybridbox_execute",
        "arguments": {
          "code": "forwarding.verification.confirm(account_id=\"3c90c3cc-0d44-4b50-8888-8dd25736052a\", forwarding_id=\"3c90c3cc-0d44-4b50-8888-8dd25736052a\", code=\"<string>\")"
        }
      }
    }
    ```

    响应:

    ```json theme={null}
    {
      "jsonrpc": "2.0",
      "id": "example",
      "result": {
        "content": [
          {
            "type": "text",
            "text": "{\n  \"request_id\": \"example\",\n  \"status\": \"completed\",\n  \"result\": {\n    \"last_value\": true\n  },\n  \"responses\": [\n    {\n      \"index\": 0,\n      \"function\": \"forwarding.verification.confirm\",\n      \"status\": \"completed\",\n      \"result\": true\n    }\n  ],\n  \"complexity_score\": 1\n}"
          }
        ],
        "isError": false
      }
    }
    ```
  </Accordion>
</AccordionGroup>

### `forwarding.verification.send`

```text theme={null}
forwarding.verification.send(account_id: str, forwarding_id: str) -> ForwardingRule
```

转发: `forwarding.verification.send`.

| 属性        | 值                                                                                    | 属性       | 值                   |
| --------- | ------------------------------------------------------------------------------------ | -------- | ------------------- |
| 所需权限      | `forwarding.manage`                                                                  | 需要身份验证   | `是`                 |
| 执行模式      | `sync`                                                                               | 能力       | `forwarding.manage` |
| 资源类型      | `account`                                                                            | 资源 ID 字段 | `account_id`        |
| 公共 API 路由 | `POST /v1/public/accounts/{account_id}/forwarding/{forwarding_id}/verification/send` |          |                     |

<AccordionGroup>
  <Accordion title="参数">
    | 名称              | 类型    | 必需 |
    | --------------- | ----- | -- |
    | `account_id`    | `str` | 是  |
    | `forwarding_id` | `str` | 是  |
  </Accordion>

  <Accordion title="返回值">
    | 字段                 | 类型            | 必需 |
    | ------------------ | ------------- | -- |
    | `cooldown_seconds` | `int`         | 是  |
    | `sent`             | `bool`        | 是  |
    | `expires_at`       | `str \| null` | 否  |
  </Accordion>

  <Accordion title="A2A 示例">
    请求:

    ```json theme={null}
    {
      "request_id": "example",
      "session_id": "session_123",
      "code": "forwarding.verification.send(account_id=\"3c90c3cc-0d44-4b50-8888-8dd25736052a\", forwarding_id=\"3c90c3cc-0d44-4b50-8888-8dd25736052a\")"
    }
    ```

    响应:

    ```json theme={null}
    {
      "request_id": "example",
      "status": "completed",
      "result": {
        "last_value": 123
      },
      "responses": [
        {
          "index": 0,
          "function": "forwarding.verification.send",
          "status": "completed",
          "result": 123
        }
      ],
      "complexity_score": 1
    }
    ```
  </Accordion>

  <Accordion title="MCP 示例">
    请求:

    ```json theme={null}
    {
      "jsonrpc": "2.0",
      "id": "example",
      "method": "tools/call",
      "params": {
        "name": "hybridbox_execute",
        "arguments": {
          "code": "forwarding.verification.send(account_id=\"3c90c3cc-0d44-4b50-8888-8dd25736052a\", forwarding_id=\"3c90c3cc-0d44-4b50-8888-8dd25736052a\")"
        }
      }
    }
    ```

    响应:

    ```json theme={null}
    {
      "jsonrpc": "2.0",
      "id": "example",
      "result": {
        "content": [
          {
            "type": "text",
            "text": "{\n  \"request_id\": \"example\",\n  \"status\": \"completed\",\n  \"result\": {\n    \"last_value\": 123\n  },\n  \"responses\": [\n    {\n      \"index\": 0,\n      \"function\": \"forwarding.verification.send\",\n      \"status\": \"completed\",\n      \"result\": 123\n    }\n  ],\n  \"complexity_score\": 1\n}"
          }
        ],
        "isError": false
      }
    }
    ```
  </Accordion>
</AccordionGroup>
