Skip to main content
Channels

Pair a channel

POST /api/v1/forward/channel_pairings Only applicable to Channels with identity_resolution.mode=pairing.

Headers

HeaderRequiredDescription
AuthorizationYesBearer <PAT or SAT>
Content-TypeYesapplication/json
Idempotency-KeyNoClient-generated unique idempotency key for safe retries.

Body parameters

ParameterTypeRequiredDescription
codestringYes6-digit pairing code displayed in the Channel message.
identity_idstringYesForward Identity ID to bind.
template_idstringYesForward Template ID to bind.

Example request

curl -s -X POST 'https://api.qoder.com.cn/api/v1/forward/channel_pairings' \
  -H "Authorization: Bearer $QODER_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: pairing-K7MP92" \
  -d '{
    "code": "K7MP92",
    "identity_id": "idn_019eabc123",
    "template_id": "tmpl_workspace_dev"
  }'

Example response

HTTP 200 OK
{
  "id": "pair_019eabc123",
  "type": "channel_pairing",
  "channel_id": "channel_019eabc123",
  "identity_id": "idn_019eabc123",
  "template_id": "tmpl_workspace_dev",
  "status": "active",
  "paired_at": "2026-07-16T10:00:00Z"
}

Response fields

FieldTypeDescription
idstringPairing ID, used when unpairing.
typestringAlways channel_pairing.
channel_idstringChannel ID.
identity_idstringBound Forward Identity ID.
template_idstringBound Forward Template ID.
statusstringactive on successful pairing.
paired_atstringPairing completion time.

Error codes

HTTPTypeTrigger
400invalid_request_errorPairing code format is invalid, does not exist, or the Channel is not in pairing mode.
401authentication_errorPAT is invalid or expired.
404not_found_errorChannel, Identity, or Template does not exist or is not visible to the caller.
409conflict_errorPairing code is already bound to a different Identity or Template.

Notes

  • The server uses the user_id resolved from the PAT and the normalized code to locate the pending pairing record — the request does not need channel_id.
  • Pairing codes are unique within a single user scope; the response returns the channel_id resolved by the server.
  • Submitting the same code with the same Identity and Template is idempotent and returns the existing Pairing; any different binding value returns a conflict.
  • A Channel is a transport connection; a Pairing is the actual execution context binding for that direct/room scope.
  • After successful pairing, Forward best-efforts a success notification to the original conversation; notification failure does not roll back the Pairing.