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

# Agent のアーカイブ

> 指定された Agent をアーカイブします。アーカイブ後、Agent はデフォルト一覧に表示されません。

`POST /api/v1/cloud/agents/{agent_id}/archive`

指定された Agent をアーカイブします。アーカイブ後、Agent はデフォルト一覧に表示されなくなりますが、ID を指定して直接取得することは可能です。

## リクエストヘッダー

| ヘッダー            | 必須 | 説明             |
| --------------- | -- | -------------- |
| `Authorization` | はい | `Bearer <PAT>` |

## パスパラメーター

| パラメーター     | 型      | 必須 | 説明           |
| ---------- | ------ | -- | ------------ |
| `agent_id` | string | はい | Agent の一意識別子 |

## リクエストボディ

リクエストボディは不要です。

## リクエスト例

```bash theme={null}
curl -X POST "https://api.qoder.com/api/v1/cloud/agents/agent_019eXXXX.../archive" \
  -H "Authorization: Bearer $QODER_PAT"
```

## レスポンス例

**HTTP 200 OK**

```json theme={null}
{
  "type": "agent",
  "id": "agent_019eXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  "name": "doc-test-agent-updated",
  "description": "Used for API documentation testing",
  "model": "ultimate",
  "system": "You are an updated documentation testing assistant.",
  "tools": [],
  "mcp_servers": [],
  "skills": [],
  "metadata": {},
  "multiagent": null,
  "version": 2,
  "archived_at": "2026-05-18T15:27:22.698411Z",
  "created_at": "2026-05-18T15:26:39.61669Z",
  "updated_at": "2026-05-18T15:27:22.698411Z"
}
```

## レスポンスフィールド

アーカイブ後の完全な Agent オブジェクトを返します。`updated_at` フィールドはアーカイブ操作の時刻に更新されます。

| フィールド         | 型                                                                           | 説明                                |
| ------------- | --------------------------------------------------------------------------- | --------------------------------- |
| `type`        | string                                                                      | 固定値 `"agent"`                     |
| `id`          | string                                                                      | Agent の一意識別子                      |
| `name`        | string                                                                      | Agent 名                           |
| `description` | string                                                                      | Agent の説明                         |
| `model`       | string                                                                      | モデル識別子                            |
| `system`      | string                                                                      | システムプロンプト                         |
| `tools`       | [Agent tool](/ja/cloud-agents/api/agents/schemas#agent-tool) の配列            | ツール設定リスト                          |
| `mcp_servers` | [MCP server](/ja/cloud-agents/api/agents/schemas#mcp-server) の配列            | MCP サーバー設定                        |
| `skills`      | [Skill binding](/ja/cloud-agents/api/agents/schemas#skill-binding) の配列      | Skill バインディングリスト                  |
| `metadata`    | [Metadata オブジェクト](/ja/cloud-agents/api/conventions/schemas#metadata-object) | カスタムメタデータ                         |
| `multiagent`  | [Multiagent](/ja/cloud-agents/api/agents/schemas#multiagent) \| null        | Agents 設定、未設定時は `null`            |
| `version`     | integer                                                                     | 現在のバージョン                          |
| `archived_at` | string\|null                                                                | アーカイブ時刻（ISO 8601）、未アーカイブ時は `null` |
| `created_at`  | string                                                                      | 作成時刻（ISO 8601）                    |
| `updated_at`  | string                                                                      | 最終更新時刻（ISO 8601）、アーカイブ時に更新        |

## エラー

| HTTP | type                   | 発生条件                    |
| ---- | ---------------------- | ----------------------- |
| 401  | `authentication_error` | PAT が無効または期限切れ          |
| 403  | `permission_error`     | この Agent をアーカイブする権限がない  |
| 404  | `not_found_error`      | 指定された ID の Agent が存在しない |

完全なエラーエンベロープについては[エラー](/ja/cloud-agents/api/conventions/errors)を参照してください。

## 注意事項

* アーカイブしても Agent のデータは保持されます。
* アーカイブされた Agent は `GET /api/v1/cloud/agents` のデフォルト一覧から除外されます。
* `GET /api/v1/cloud/agents` に `include_archived=true` を指定すると、アーカイブ済み Agent も一覧に含まれます。
* アーカイブ済み Agent は `GET /api/v1/cloud/agents/{agent_id}` で直接取得できます。
* アーカイブ操作は冪等です。既にアーカイブ済みの Agent を再度アーカイブしてもエラーにはなりません。
* アーカイブは Agent の `version` をインクリメントせず、バージョンスナップショットも作成しません。

## 関連

<CardGroup cols={2}>
  <Card title="Agent の定義" icon="user-gear" href="/ja/cloud-agents/define-agent">
    再利用可能でバージョン管理された Agent 構成を作成する。
  </Card>
</CardGroup>
