> ## 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 | Conditional | Required for `fixed` mode; omit for `pairing` mode.                                                                                                                                                                                                                                           |
| `identity_resolution.mode`        | string | No          | Identity resolution mode: `fixed` (default) or `pairing`.                                                                                                                                                                                                                                     |
| `template_id`                     | string | Conditional | Required for `fixed` mode; omit for `pairing` mode.                                                                                                                                                                                                                                           |
| `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",
    "identity_resolution": {
      "mode": "fixed"
    },
    "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
      }
    }
  }'
```

`pairing` mode creates only the transport connection without specifying an Identity or Template:

```json theme={null}
{
  "identity_resolution": {
    "mode": "pairing"
  },
  "channel_type": "feishu",
  "name": "Support Feishu channel"
}
```

## Example response

**HTTP 201 Created**

```json theme={null}
{
  "id": "channel_019eabc123",
  "type": "channel",
  "identity_id": "idn_019eabc123",
  "identity_resolution": {
    "mode": "fixed"
  },
  "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\|null | Bound Forward Identity ID in `fixed` mode; `null` in `pairing` mode. |
| `identity_resolution.mode`        | string       | Identity resolution mode: `fixed` or `pairing`.                      |
| `template_id`                     | string\|null | Bound Forward Template ID in `fixed` mode; `null` in `pairing` mode. |
| `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.                                           |

## Error codes

| HTTP | Type                    | Trigger                                                                          |
| ---- | ----------------------- | -------------------------------------------------------------------------------- |
| 400  | `invalid_request_error` | Channel type is unsupported.                                                     |
| 400  | `invalid_request_error` | Identity resolution mode does not match `identity_id`/`template_id` combination. |
| 400  | `invalid_request_error` | Required credentials are missing.                                                |
| 401  | `authentication_error`  | PAT is invalid or expired.                                                       |
| 403  | `permission_error`      | Channel quota exceeded.                                                          |
| 404  | `not_found_error`       | Template does not exist or is not visible.                                       |
| 404  | `not_found_error`       | Identity does not exist or is not visible.                                       |
| 409  | `conflict_error`        | Identity is disabled.                                                            |
| 409  | `conflict_error`        | Credential validation conflict.                                                  |
| 502  | `api_error`             | Channel service unavailable.                                                     |

## Notes

* New channels default to `enabled=true`.
* A channel can process inbound messages only when `enabled=true` and `binding_status="bound"`.
* `fixed` mode always uses the Identity and Template specified at creation time.
* `pairing` mode means the channel is only a transport connection; Identity and Template are bound per message scope via the Pairing API.
* `identity_resolution.mode` cannot be changed after creation.
* 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>
