> ## 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/{session_id}/events`

カーソルページネーションとフィールドレベルのフィルタリングでセッションイベントを返します。Session で増分ストリーミングが有効な場合、生成された増分イベントも含まれます。

## Headers

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

## Path parameters

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

## Query parameters

| Parameter            | Type    | Required | Default | Description                     |
| -------------------- | ------- | -------- | ------- | ------------------------------- |
| `limit`              | integer | No       | 20      | 1 ページあたりの件数。最大 100。             |
| `after_id`           | string  | No       | -       | 指定した Event ID より後のイベント用のカーソル。   |
| `before_id`          | string  | No       | -       | 指定した Event ID より前のイベント用のカーソル。   |
| `order`              | string  | No       | `asc`   | ソート順: `asc` または `desc`。         |
| `type`               | string  | No       | -       | Event の種類でフィルターします。カンマ区切りの値に対応。 |
| `types[]`            | string  | No       | -       | 配列形式の Event 種類フィルター。            |
| `include_tool_calls` | boolean | No       | `true`  | ツール呼び出しイベントを含めます。               |
| `include_thinking`   | boolean | No       | `true`  | 思考イベントを含めます。                    |

## Example request

```bash theme={null}
curl -s -X GET 'https://api.qoder.com/api/v1/forward/sessions/sess_xxx/events?limit=20&order=asc' \
  -H "Authorization: Bearer $QODER_PAT"
```

## Example response

**HTTP 200 OK**

```json theme={null}
{
  "data": [
    {
      "id": "evt_xxx",
      "type": "agent.message",
      "session_id": "sess_xxx",
      "content": [
        {
          "type": "text",
          "text": "Here is the analysis result."
        }
      ],
      "processed_at": "2026-06-22T11:00:03Z"
    }
  ],
  "first_id": "evt_xxx",
  "last_id": "evt_xxx",
  "has_more": false
}
```

## Response fields

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

## Event fields

| Field          | Type   | Description        |
| -------------- | ------ | ------------------ |
| `id`           | string | Event ID。          |
| `type`         | string | Event の種類。         |
| `session_id`   | string | Session ID。        |
| `processed_at` | string | 利用可能な場合の処理タイムスタンプ。 |
| `content`      | array  | メッセージ系のイベントで返されます。 |

## Event payload fields by type

以下の表は、共通のエンベロープフィールド `id`、`type`、`session_id`、`processed_at` に加えて許可されるペイロードフィールドを示します。

| Event type                  | Payload fields                                                                  |
| --------------------------- | ------------------------------------------------------------------------------- |
| `user.message`              | `content`, `file_attachments`                                                   |
| `user.interrupt`            | `reason`, `session_thread_id`                                                   |
| `user.tool_confirmation`    | `tool_use_id`, `result`, `deny_message`, `session_thread_id`                    |
| `user.tool_result`          | `tool_use_id`, `content`, `is_error`, `session_thread_id`                       |
| `user.custom_tool_result`   | `custom_tool_use_id`, `content`, `is_error`, `session_thread_id`                |
| `user.define_outcome`       | `description`, `rubric`, `outcome_id`, `max_iterations`                         |
| `system.message`            | `content`                                                                       |
| `agent.message`             | `content`                                                                       |
| `agent.thinking`            | None                                                                            |
| `agent.message_start`       | `message_id`, `message`                                                         |
| `agent.content_block_start` | `message_id`, `index`, `content_block`                                          |
| `agent.content_block_delta` | `message_id`, `index`, `delta`                                                  |
| `agent.content_block_stop`  | `message_id`, `index`                                                           |
| `agent.message_delta`       | `message_id`, `delta`, `usage`                                                  |
| `agent.message_stop`        | `message_id`                                                                    |
| `agent.tool_use`            | `name`, `input`, `evaluated_permission`, `session_thread_id`                    |
| `agent.tool_result`         | `tool_use_id`, `content`, `is_error`                                            |
| `agent.custom_tool_use`     | `name`, `input`, `session_thread_id`                                            |
| `agent.mcp_tool_use`        | `mcp_server_name`, `name`, `input`, `evaluated_permission`, `session_thread_id` |
| `agent.mcp_tool_result`     | `mcp_tool_use_id`, `content`, `is_error`                                        |
| `agent.artifact_delivered`  | `file_id`, `original_filename`, `size`, `content_type`                          |
| `session.status_running`    | None                                                                            |
| `session.status_idle`       | `stop_reason`                                                                   |
| `session.status_terminated` | None                                                                            |
| `session.error`             | `error`                                                                         |
| `session.updated`           | `agent`, `metadata`, `title`                                                    |
| Unknown type                | エンベロープのみ。ランタイムのプライベートな生ペイロードは返されません。                                            |

## Errors

| HTTP | Type                    | Code                      | Trigger                  |
| ---- | ----------------------- | ------------------------- | ------------------------ |
| 400  | `invalid_request_error` | `invalid_event_cursor`    | カーソルがこの Session に属していない。 |
| 400  | `invalid_request_error` | `invalid_pagination`      | ページネーションパラメーターが無効。       |
| 401  | `authentication_error`  | `authentication_required` | PAT が無効または期限切れ。          |
| 404  | `not_found_error`       | `session_not_found`       | Session が存在しない。          |

## Notes

* 未知の Event 種類はリクエストを失敗させません。利用可能な場合は最小限のエンベロープで返されます。
* Forward は、エージェント ID、環境 ID、リソース、ボールト、ワーカー ID、トレース、生／デバッグ／内部のペイロードといったランタイムのプライベートフィールドをフィルタリングします。

## Related

<CardGroup cols={2}>
  <Card title="セッションイベントの送信" icon="paper-plane" href="/cloud-agents/api/forward/sessions/send-events" />

  <Card title="セッションイベントのストリーミング" icon="radio" href="/cloud-agents/api/forward/sessions/stream-events" />
</CardGroup>
