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

# 归档 Deployment

> 归档 Deployment，停止所有定时运行。

`POST /api/v1/cloud/deployments/{id}/archive`

归档 Deployment。归档后所有定时运行停止，默认列表中不再显示（需传 `include_archived=true`）。`archived_at` 字段被设置，`upcoming_runs_at` 变为空数组。名称会追加 `_archived_<unix_timestamp>` 后缀以释放原名供复用。

<Note>
  归档操作通过 API 不可逆。当前没有取消归档（unarchive）端点。
</Note>

## 路径参数

| 参数   | 类型     | 说明                       |
| ---- | ------ | ------------------------ |
| `id` | string | Deployment ID（`dep_` 前缀） |

## 请求头

| 头部              | 必选 | 说明                 |
| --------------- | -- | ------------------ |
| `Authorization` | 是  | `Bearer <PAT>`     |
| `Content-Type`  | 是  | `application/json` |

## 请求体

无需请求体。

## 示例请求

```bash theme={null}
curl -X POST "https://api.qoder.com/api/v1/cloud/deployments/dep_019ec55a2b687b3f94eee77dd77e4b2a/archive" \
  -H "Authorization: Bearer $QODER_PAT" \
  -H "Content-Type: application/json"
```

## 示例响应

**HTTP 200 OK**

返回 `archived_at` 已设置的完整 Deployment 对象。

```json theme={null}
{
  "agent": {
    "id": "agent_019ebb21ef8e7df6a559052c94875160",
    "type": "agent",
    "version": 1
  },
  "archived_at": "2026-06-14T08:58:42Z",
  "created_at": "2026-06-14T08:58:01Z",
  "description": "Deployment created for API documentation verification",
  "environment_id": "env_019e49a1780171daac1e6b01f290ac2b",
  "environment_variables": "",
  "id": "dep_019ec55a2b687b3f94eee77dd77e4b2a",
  "initial_events": [
    {
      "content": [
        {
          "type": "text",
          "text": "Generate today's status report"
        }
      ],
      "type": "user.message"
    }
  ],
  "metadata": {},
  "name": "api-doc-verification-deployment-v2_archived_1781427523",
  "paused_reason": null,
  "resources": [],
  "schedule": {
    "expression": "30 9 * * 1-5",
    "last_run_at": "2026-06-14T08:58:17Z",
    "timezone": "Asia/Shanghai",
    "type": "cron",
    "upcoming_runs_at": []
  },
  "status": "active",
  "type": "deployment",
  "updated_at": "2026-06-14T08:58:42Z",
  "vault_ids": []
}
```

## 错误码

| HTTP | type                   | 触发条件             |
| ---- | ---------------------- | ---------------- |
| 401  | `authentication_error` | PAT 无效或过期        |
| 404  | `not_found_error`      | Deployment 不存在   |
| 409  | `conflict_error`       | Deployment 已经被归档 |

完整错误信封说明详见 [错误参考](/zh/cloud-agents/api/conventions/errors)。

## 相关

<CardGroup cols={2}>
  <Card title="暂停 Deployment" icon="pause" href="/zh/cloud-agents/api/deployments/pause">
    暂停调度但保留配置（可恢复）。
  </Card>

  <Card title="列出 Deployment" icon="list" href="/zh/cloud-agents/api/deployments/list">
    分页查询账号下的所有 Deployment。
  </Card>

  <Card title="创建 Deployment" icon="plus" href="/zh/cloud-agents/api/deployments/create">
    创建新的 cron 或手动触发 Deployment。
  </Card>

  <Card title="错误参考" icon="circle-exclamation" href="/zh/cloud-agents/api/conventions/errors">
    所有 API 错误码与错误信封约定。
  </Card>
</CardGroup>
