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

# 获取 Session 详情

> 根据 ID 获取 Forward Session。

`GET /api/v1/forward/sessions/{session_id}`

返回 Forward 承诺的稳定 Session 字段，默认不暴露运行时私有字段。

## 请求头

| Header        | 是否必填 | 说明             |
| ------------- | ---- | -------------- |
| Authorization | 是    | `Bearer <PAT>` |

## 路径参数

| 参数          | 类型     | 是否必填 | 说明          |
| ----------- | ------ | ---- | ----------- |
| session\_id | string | 是    | Session ID。 |

## 示例请求

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

## 示例响应

**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": "running",
  "title": "Customer support session",
  "incremental_streaming_enabled": true,
  "metadata": {
    "source": "web"
  },
  "config": {
    "environment_variables": {
      "API_KEY": "sk-xxx"
    }
  },
  "stats": {
    "active_seconds": 30,
    "duration_seconds": 3600
  },
  "usage": {
    "credits": 12.5
  },
  "created_at": "2026-06-22T10:00:00Z",
  "updated_at": "2026-06-22T11:00:00Z"
}
```

## 响应字段

| 字段  | 类型     | 说明          |
| --- | ------ | ----------- |
| 返回值 | object | Session 对象。 |

## 错误

| HTTP | Type                   | Code                      | 触发条件                  |
| ---- | ---------------------- | ------------------------- | --------------------- |
| 404  | `not_found_error`      | `session_not_found`       | Session 不存在或当前调用方不可见。 |
| 401  | `authentication_error` | `authentication_required` | PAT 无效或已过期。           |

## 注意事项

* Forward 先校验账号和 Template 归属，再读取运行时事实。
* 运行时 Session 不存在时统一返回 `404 session_not_found`。

## 相关

<CardGroup cols={2}>
  <Card title="更新 Session" icon="pencil" href="/cloud-agents/api/forward/sessions/update" />

  <Card title="列出 Session Events" icon="list" href="/cloud-agents/api/forward/sessions/list-events" />
</CardGroup>
