> ## 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 セッションを一覧取得します。

`GET /api/v1/forward/sessions`

認証されたアカウント配下のセッションを一覧取得します。アーカイブ済みのセッションは既定で除外されます。

## Headers

| Header          | Required | Description    |
| --------------- | -------- | -------------- |
| `Authorization` | Yes      | `Bearer <PAT>` |

## Query parameters

| Parameter          | Type            | Required | Default | Description                                           |
| ------------------ | --------------- | -------- | ------- | ----------------------------------------------------- |
| `identity_ids`     | string or array | No       | -       | 1 つ以上の Identity ID でフィルターします。カンマ区切りの文字列に対応。           |
| `template_id`      | string          | No       | -       | Forward Template ID でフィルターします。                        |
| `source_type`      | string          | No       | -       | `api`、`im`、または `schedule` でフィルターします。                  |
| `created_at[gt]`   | string          | No       | -       | この RFC 3339 タイムスタンプより後に作成。                            |
| `created_at[gte]`  | string          | No       | -       | この RFC 3339 タイムスタンプ以降に作成。                             |
| `created_at[lt]`   | string          | No       | -       | この RFC 3339 タイムスタンプより前に作成。                            |
| `created_at[lte]`  | string          | No       | -       | この RFC 3339 タイムスタンプ以前に作成。                             |
| `updated_at[gt]`   | string          | No       | -       | この RFC 3339 タイムスタンプより後に更新。                            |
| `updated_at[gte]`  | string          | No       | -       | この RFC 3339 タイムスタンプ以降に更新。                             |
| `updated_at[lt]`   | string          | No       | -       | この RFC 3339 タイムスタンプより前に更新。                            |
| `updated_at[lte]`  | string          | No       | -       | この RFC 3339 タイムスタンプ以前に更新。                             |
| `limit`            | integer         | No       | 20      | 1 ページあたりの件数。最大 100。                                   |
| `after_id`         | string          | No       | -       | 指定した Session ID より後のレコード用のカーソル。`before_id` とは併用できません。 |
| `before_id`        | string          | No       | -       | 指定した Session ID より前のレコード用のカーソル。`after_id` とは併用できません。  |
| `order`            | string          | No       | `desc`  | ソート順: `desc` または `asc`。                               |
| `include_archived` | boolean         | No       | `false` | アーカイブ済みのセッションを含めます。                                   |

## Example request

```bash theme={null}
curl -s -X GET 'https://api.qoder.com/api/v1/forward/sessions?identity_ids=idn_xxx,idn_yyy&template_id=tmpl_support&source_type=im&created_at[gte]=2026-06-01T00:00:00Z&limit=20' \
  -H "Authorization: Bearer $QODER_PAT"
```

## Example response

**HTTP 200 OK**

```json theme={null}
{
  "data": [
    {
      "id": "sess_xxx",
      "type": "session",
      "identity_id": "idn_xxx",
      "template": {
        "id": "tmpl_support",
        "type": "template",
        "name": "Support assistant",
        "model": "ultimate",
        "version": 3
      },
      "source_type": "im",
      "status": "idle",
      "title": "Customer support session",
      "incremental_streaming_enabled": true,
      "metadata": {
        "source": "dingtalk"
      },
      "config": {
        "environment_variables": {
          "API_KEY": "sk-xxx"
        }
      },
      "stats": {
        "active_seconds": 30,
        "duration_seconds": 3600
      },
      "usage": {
        "credits": 12.5
      },
      "archived_at": null,
      "created_at": "2026-06-22T10:00:00Z",
      "updated_at": "2026-06-22T11:00:00Z"
    }
  ],
  "first_id": "sess_xxx",
  "last_id": "sess_xxx",
  "has_more": false
}
```

## Response fields

| Field      | Type         | Description             |
| ---------- | ------------ | ----------------------- |
| `data`     | array        | 現在のページの Session オブジェクト。 |
| `first_id` | string\|null | このページの最初のレコードの ID。      |
| `last_id`  | string\|null | このページの最後のレコードの ID。      |
| `has_more` | boolean      | さらにレコードが残っているかどうか。      |

## Errors

| HTTP | Type                    | Code                      | Trigger            |
| ---- | ----------------------- | ------------------------- | ------------------ |
| 400  | `invalid_request_error` | `invalid_time_range`      | 時間フィルターが無効。        |
| 400  | `invalid_request_error` | `invalid_pagination`      | ページネーションパラメーターが無効。 |
| 401  | `authentication_error`  | `authentication_required` | PAT が無効または期限切れ。    |

## Notes

* `after_id` と `before_id` は併用できません。
* 現在の設計では `status` によるフィルタリングはサポートしていません。
* クレジットモジュールが有効でない場合、`usage.credits` は省略されることがあります。

## Related

<CardGroup cols={2}>
  <Card title="セッションの作成" icon="plus" href="/cloud-agents/api/forward/sessions/create" />

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