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

# 获取 Channel QR Session

> 轮询 Channel 扫码授权会话状态。

`GET /api/v1/forward/qr_sessions/{session_key}`

返回 QR 授权会话的当前状态。

## 请求头

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

## 路径参数

| 参数           | 类型     | 是否必填 | 说明                                            |
| ------------ | ------ | ---- | --------------------------------------------- |
| session\_key | string | 是    | Create Channel QR Session 返回的不透明 session key。 |

## 示例请求

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

## 示例响应

**HTTP 200 OK**

```json theme={null}
{
  "session_key": "qr-a1b2c3d4",
  "channel_id": "channel_dingtalk-001",
  "channel_type": "dingtalk",
  "status": "confirmed",
  "expires_at": "2026-06-18T10:05:00Z"
}
```

## 响应字段

| 字段          | 类型             | 说明                                                            |
| ----------- | -------------- | ------------------------------------------------------------- |
| status      | string         | `waiting`、`scanned`、`confirmed`、`expired`、`denied` 或 `error`。 |
| channel\_id | string         | 关联的 Channel ID。                                               |
| err\_code   | string \| null | 失败时的渠道错误码。                                                    |
| err\_msg    | string \| null | 失败时的渠道错误信息。                                                   |

## 错误

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

## 注意事项

* `session_key` 是短生命周期的不透明凭证。
* 按创建响应中的 `poll_interval_seconds` 轮询。
* 状态为 `confirmed` 后应刷新 Channel 详情。

## 相关

<CardGroup cols={2}>
  <Card title="创建 Channel QR Session" icon="qrcode" href="/cloud-agents/api/forward/channels/create-qr-session" />

  <Card title="获取 Channel" icon="file-lines" href="/cloud-agents/api/forward/channels/get" />
</CardGroup>
