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

# セッションのアーカイブ

> Forward セッションをアーカイブします。

`POST /api/v1/forward/sessions/{session_id}/archive`

セッションをアーカイブします。アーカイブ済みのセッションは既定で一覧結果から除外されます。

## Headers

| Header            | Required | Description            |
| ----------------- | -------- | ---------------------- |
| `Authorization`   | Yes      | `Bearer <PAT>`         |
| `Idempotency-Key` | No       | 安全でないリクエスト向けの任意の冪等性キー。 |

## Path parameters

| Parameter    | Type   | Required | Description |
| ------------ | ------ | -------- | ----------- |
| `session_id` | string | Yes      | Session ID。 |

## Example request

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

## Example response

**HTTP 200 OK**

```json theme={null}
{
  "id": "sess_xxx",
  "type": "session",
  "identity_id": "idn_xxx",
  "template": {
    "id": "tmpl_support",
    "type": "template",
    "name": "Support assistant",
    "model": "ultimate",
    "version": 3
  },
  "source_type": "api",
  "status": "idle",
  "title": "Customer support session",
  "metadata": {},
  "stats": {
    "active_seconds": 0,
    "duration_seconds": 0
  },
  "usage": {
    "credits": 13.0
  },
  "archived_at": "2026-06-22T12:00:00Z",
  "created_at": "2026-06-22T10:00:00Z",
  "updated_at": "2026-06-22T12:00:00Z"
}
```

## Response fields

`archived_at` が設定されたアーカイブ済みの Session オブジェクトを返します。

## Errors

| HTTP | Type                   | Code                      | Trigger              |
| ---- | ---------------------- | ------------------------- | -------------------- |
| 401  | `authentication_error` | `authentication_required` | PAT が無効または期限切れ。      |
| 404  | `not_found_error`      | `session_not_found`       | Session が存在しない。      |
| 409  | `conflict_error`       | `session_archived`        | Session はすでにアーカイブ済み。 |

## Notes

* 現在の設計では復元用のエンドポイントは提供していません。
* アーカイブ済みのセッションをクエリするには、List Sessions で `include_archived=true` を使用してください。

## Related

<CardGroup cols={2}>
  <Card title="セッションの一覧取得" icon="list" href="/cloud-agents/api/forward/sessions/list" />

  <Card title="セッションの取得" icon="file-lines" href="/cloud-agents/api/forward/sessions/get" />
</CardGroup>
