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

# OpenClaw 配置导出 / 导入

> 使用 PPClaw 导出和导入 OpenClaw Gateway 配置，支持跨沙箱迁移、备份与恢复。

<Warning>
  本文档中的功能需要 PPClaw v1.9.0 及以上版本，请先升级 CLI：

  **macOS / Linux：**

  ```bash theme={null}
  curl -fsSL https://ppclaw.ppio.com/install.sh | bash
  ```

  **Windows (PowerShell)：**

  ```powershell theme={null}
  irm https://ppclaw.ppio.com/install.ps1 | iex
  ```

  **或通过 pipx：**

  ```bash theme={null}
  pipx install ppclaw
  ```
</Warning>

<Tip>
  还没部署过 OpenClaw？请先阅读[新手快速部署](/sandbox/openclaw-quickstart)完成首次安装和启动。
</Tip>

## 导出配置

使用 `gateway config export` 命令从沙箱导出 OpenClaw Gateway 配置文件。

```bash theme={null}
# 输出到终端
ppclaw gateway config export <sandbox_id>

# 保存到文件
ppclaw gateway config export <sandbox_id> -o config.json

# JSON 模式（供脚本 / Agent 使用）
ppclaw --json gateway config export <sandbox_id>
```

<Warning>
  导出的配置可能包含 API Key，请妥善保管导出文件。
</Warning>

## 导入配置

使用 `gateway config import` 命令将本地 JSON 配置全量覆盖写入沙箱。

```bash theme={null}
# 导入并自动重启 Gateway（默认行为）
ppclaw gateway config import <sandbox_id> config.json

# 导入但不重启 Gateway
ppclaw gateway config import <sandbox_id> config.json --no-restart

# 跳过确认提示
ppclaw gateway config import <sandbox_id> config.json --yes
```

导入时会进行 JSON 合法性校验，非法 JSON 将被拒绝。非 JSON 模式下需要双重确认（显示覆盖警告 + `Are you sure?` 提示），`--yes / -y` 可跳过。

## 典型用法：跨沙箱迁移

```bash theme={null}
# 从源沙箱导出
ppclaw gateway config export <source_id> -o config.json

# 手动编辑（可选）
vim config.json

# 导入到目标沙箱
ppclaw gateway config import <target_id> config.json
```

## 命令参考

| 命令                                                                | 说明                   |
| ----------------------------------------------------------------- | -------------------- |
| `ppclaw gateway config export <id> [-o FILE]`                     | 导出 OpenClaw 配置       |
| `ppclaw gateway config import <id> <FILE> [--no-restart] [--yes]` | 导入 OpenClaw 配置（全量覆盖） |
