> ## 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 a channel

> Create an external IM channel bound to an Identity and Template.

`POST /api/v1/forward/channels`

Creates a channel instance for an external messaging platform. The channel receives inbound IM messages and sends replies through the configured provider.

## Headers

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

## Body parameters

| Parameter                         | Type   | Required    | Description                                                                                                                                                                                                                                                                                   |
| --------------------------------- | ------ | ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `identity_id`                     | string | Yes         | Forward Identity ID. Must belong to the caller and be enabled.                                                                                                                                                                                                                                |
| `template_id`                     | string | Yes         | Forward Template ID used when the channel creates sessions.                                                                                                                                                                                                                                   |
| `channel_type`                    | string | Yes         | Channel type. Currently supports `wechat`, `wecom`, `feishu`, and `dingtalk`.                                                                                                                                                                                                                 |
| `name`                            | string | No          | Channel display name.                                                                                                                                                                                                                                                                         |
| `channel_config.credentials`      | object | Conditional | Channel runtime credentials. QR authorization channels may omit it. Direct credential channels use provider-specific fields: `feishu` uses `app_id`/`app_secret`, `dingtalk` uses `client_id`/`client_secret`, and `wecom` uses `bot_id`/`secret`. Credentials are not returned in plaintext. |
| `channel_config.response_options` | object | No          | Reply visibility settings.                                                                                                                                                                                                                                                                    |

## Example request

```bash theme={null}
curl -s -X POST 'https://api.qoder.com/api/v1/forward/channels' \
  -H "Authorization: Bearer $QODER_PAT" \
  -H "Content-Type: application/json" \
  -d '{
    "identity_id": "idn_019eabc123",
    "template_id": "tmpl_support",
    "channel_type": "feishu",
    "name": "Support Feishu channel",
    "channel_config": {
      "credentials": {
        "app_id": "...",
        "app_secret": "..."
      },
      "response_options": {
        "include_tool_calls": false,
        "include_thinking": false
      }
    }
  }'
```

## Example response

**HTTP 201 Created**

```json theme={null}
{
  "id": "channel_019eabc123",
  "type": "channel",
  "identity_id": "idn_019eabc123",
  "template_id": "tmpl_support",
  "channel_type": "feishu",
  "name": "Support Feishu channel",
  "enabled": true,
  "binding_status": "bound",
  "channel_config": {
    "response_options": {
      "include_tool_calls": false,
      "include_thinking": false
    }
  },
  "created_at": "2026-06-18T10:00:00Z",
  "updated_at": "2026-06-18T10:00:00Z"
}
```

## Response fields

| Field                             | Type    | Description                               |
| --------------------------------- | ------- | ----------------------------------------- |
| `id`                              | string  | Channel ID. Example prefix is `channel_`. |
| `type`                            | string  | Always `channel`.                         |
| `identity_id`                     | string  | Bound Forward Identity ID.                |
| `template_id`                     | string  | Bound Forward Template ID.                |
| `channel_type`                    | string  | External channel type.                    |
| `enabled`                         | boolean | Manual enable or disable switch.          |
| `binding_status`                  | string  | `unbound`, `bound`, or `expired`.         |
| `channel_config.response_options` | object  | Reply visibility settings.                |

## Errors

| HTTP | Type                    | Code                         | Trigger                                               |
| ---- | ----------------------- | ---------------------------- | ----------------------------------------------------- |
| 400  | `invalid_request_error` | `channel_type_unsupported`   | Channel type is unsupported.                          |
| 404  | `not_found_error`       | `channel_template_not_found` | Template does not exist or is not visible.            |
| 404  | `not_found_error`       | `channel_identity_not_found` | Identity does not exist or is not visible.            |
| 409  | `conflict_error`        | `channel_identity_disabled`  | Identity is disabled.                                 |
| 409  | `conflict_error`        | `channel_auth_required`      | Required credentials or QR authorization are missing. |
| 502  | `api_error`             | `channel_auth_failed`        | Underlying channel authorization failed.              |

## Notes

* New channels default to `enabled=true`.
* A channel can process inbound messages only when `enabled=true` and `binding_status="bound"`.
* To pause inbound processing temporarily, prefer Update Channel with `enabled=false`.

## Related

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

  <Card title="List channels" icon="list" href="/cloud-agents/api/forward/channels/list" />
</CardGroup>
