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

# Create channel QR session

> Create a short-lived QR authorization session for a Channel.

`POST /api/v1/forward/channels/{channel_id}/qr_sessions`

Creates a QR session that can activate or rebind supported channels.

## Headers

| Header            | Required | Description                                   |
| ----------------- | -------- | --------------------------------------------- |
| `Authorization`   | Yes      | `Bearer <PAT>`                                |
| `Content-Type`    | No       | `application/json` if a body is sent.         |
| `Idempotency-Key` | No       | Optional idempotency key for unsafe requests. |

## Path parameters

| Parameter    | Type   | Required | Description |
| ------------ | ------ | -------- | ----------- |
| `channel_id` | string | Yes      | Channel ID. |

## Example request

```bash theme={null}
curl -s -X POST 'https://api.qoder.com/api/v1/forward/channels/channel_dingtalk-001/qr_sessions' \
  -H "Authorization: Bearer $QODER_PAT" \
  -H "Content-Type: application/json" \
  -d '{}'
```

## Example response

**HTTP 200 OK**

```json theme={null}
{
  "session_key": "qr-a1b2c3d4",
  "channel_id": "channel_dingtalk-001",
  "channel_type": "dingtalk",
  "status": "waiting",
  "qr_code_content": "https://login.dingtalk.com/oauth2/...",
  "qr_code_image_base64": "data:image/png;base64,...",
  "expires_at": "2026-06-18T10:05:00Z",
  "poll_interval_seconds": 2
}
```

## Response fields

| Field                   | Type    | Description                                                   |
| ----------------------- | ------- | ------------------------------------------------------------- |
| `session_key`           | string  | Opaque QR session key used for polling.                       |
| `channel_id`            | string  | Associated Channel ID.                                        |
| `channel_type`          | string  | `wechat`, `feishu`, `dingtalk`, or `wecom`.                   |
| `status`                | string  | Initial status, usually `waiting`.                            |
| `qr_code_content`       | string  | Original QR content, usually a third-party authorization URL. |
| `qr_code_image_base64`  | string  | QR image generated by the service.                            |
| `expires_at`            | string  | Expiration timestamp.                                         |
| `poll_interval_seconds` | integer | Recommended polling interval.                                 |

## Errors

| HTTP | Type                    | Code                       | Trigger                                    |
| ---- | ----------------------- | -------------------------- | ------------------------------------------ |
| 400  | `invalid_request_error` | `channel_type_unsupported` | Channel type does not support QR sessions. |
| 404  | `not_found_error`       | `channel_not_found`        | Channel does not exist.                    |
| 409  | `conflict_error`        | `channel_disabled`         | Channel is disabled.                       |
| 502  | `api_error`             | `channel_auth_failed`      | Third-party channel authorization failed.  |

## Notes

* QR sessions currently support `wechat`, `feishu`, `dingtalk`, and `wecom`.
* `qq` does not currently support the unified QR session flow.
* The request body may be omitted or `{}`.

## Related

<CardGroup cols={2}>
  <Card title="Get channel QR session" icon="arrows-rotate" href="/cloud-agents/api/forward/channels/get-qr-session" />

  <Card title="Get a channel" icon="file-lines" href="/cloud-agents/api/forward/channels/get" />
</CardGroup>
