> ## 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 をアーカイブします。アーカイブされた Deployment はスケジュールされた実行がすべて停止され、デフォルトの一覧からは非表示になります（List エンドポイントに `include_archived=true` を渡すと表示されます）。`archived_at` タイムスタンプが設定され、`upcoming_runs_at` は空になります。Deployment 名には `_archived_<unix_timestamp>` が付加され、元の名前を再利用できるようになります。

<Note>
  API 経由でのアーカイブは取り消せません。現時点でアーカイブ解除エンドポイントはありません。
</Note>

## パスパラメータ

| パラメータ | 型      | 説明                            |
| ----- | ------ | ----------------------------- |
| `id`  | string | Deployment ID（`dep_` プレフィックス） |

## ヘッダー

| 名称              | 必須 | 値                   |
| --------------- | -- | ------------------- |
| `Authorization` | はい | `Bearer $QODER_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 はすでにアーカイブ済み |

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

## 関連項目

<CardGroup cols={2}>
  <Card title="Deployment 一覧" icon="list" href="/ja/cloud-agents/api/deployments/list">
    `include_archived=true` でアーカイブ済み Deployment も含めて取得します。
  </Card>

  <Card title="Deployment の一時停止" icon="pause" href="/ja/cloud-agents/api/deployments/pause">
    アーカイブの代わりに一時停止で実行を停止することもできます。
  </Card>

  <Card title="Deployment の取得" icon="layer-group" href="/ja/cloud-agents/api/deployments/get">
    アーカイブ後の Deployment 状態を確認します。
  </Card>

  <Card title="エラー" icon="circle-exclamation" href="/ja/cloud-agents/api/conventions/errors">
    共通のエラーエンベロープ仕様を参照します。
  </Card>
</CardGroup>
