> ## 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.

# 归档 Template

> 归档一个 Forward Template。

`POST /api/v1/forward/templates/{template_id}/archive`

归档是软状态变更，不会物理删除历史记录。

## 请求头

| Header          | 是否必填 | 说明             |
| --------------- | ---- | -------------- |
| Authorization   | 是    | `Bearer <PAT>` |
| Idempotency-Key | 否    | 有副作用请求可选的幂等键。  |

## 路径参数

| 参数           | 类型     | 是否必填 | 说明                   |
| ------------ | ------ | ---- | -------------------- |
| template\_id | string | 是    | Forward Template ID。 |

## 示例请求

```bash theme={null}
curl -s -X POST 'https://api.qoder.com/api/v1/forward/templates/tmpl_support/archive' \
  -H "Authorization: Bearer $QODER_PAT"
```

## 示例响应

**HTTP 200 OK**

```json theme={null}
{
  "type": "template",
  "id": "tmpl_support",
  "name": "Support assistant",
  "description": "Handles customer support requests",
  "status": "archived",
  "model": "ultimate",
  "system": "You are a helpful support assistant.",
  "tools": [],
  "mcp_servers": [],
  "skills": [],
  "environment_id": "env_support",
  "vault_ids": [
    "vault_crm"
  ],
  "files": {},
  "environment_variables": {
    "BASE_MODE": "support"
  },
  "metadata": {},
  "created_at": "2026-06-18T10:00:00Z",
  "updated_at": "2026-06-18T10:30:00Z"
}
```

## 响应字段

| 字段  | 类型     | 说明                                      |
| --- | ------ | --------------------------------------- |
| 返回值 | object | 归档后的 Template 对象，`status` 为 `archived`。 |

## 错误

| HTTP | Type                   | Code                      | 触发条件                   |
| ---- | ---------------------- | ------------------------- | ---------------------- |
| 404  | `not_found_error`      | -                         | Template 不存在或当前调用方不可见。 |
| 409  | `conflict_error`       | -                         | 当前状态不允许归档。             |
| 401  | `authentication_error` | `authentication_required` | PAT 无效或已过期。            |

## 注意事项

* 归档后的 Template 默认不会出现在 active 列表中。
* 归档不会删除历史 Session 或配置记录。

## 相关

<CardGroup cols={2}>
  <Card title="列出 Templates" icon="list" href="/cloud-agents/api/forward/templates/list" />

  <Card title="克隆 Template" icon="copy" href="/cloud-agents/api/forward/templates/clone" />
</CardGroup>
