Skip to main content

Create an open channel

Create a single open channel. You can configure the auto-destroy type, freeze settings, allowed senders list, and custom metadata at creation time. Before setting the destroy type, make sure you understand the auto-destroy mechanism.

Request

POST: https://[Base URL](/platform-chat-api/base-url)/v4/open-channel/create

Rate limit: 100 per second

Signature: Required. See API request signature.

Request body

Content type: application/json

ParameterTypeRequiredDescription
channelIdStringYesThe open channel ID.
destroyTypeNumberNoAuto-destroy type. Default: 0.
- 0: Destroy on inactivity. Destroyed after 60 minutes of inactivity (no joins/leaves and no new messages). Use ttlMinutes to change the duration.
- 1: Destroy on schedule. Destroyed 60 minutes after creation. Use ttlMinutes to change the duration.
You can also change this after creation. See Set auto-destroy type.
ttlMinutesNumberNoTime until destruction, in minutes.
- When destroyType is 0: inactivity duration before auto-destroy.
- When destroyType is 1: time-to-live after creation.
Range: 60–10,080 (7 days). Default: 60.
isBanBooleanNoWhether to freeze the open channel (prevent all participants from sending messages). Default: false. You can also set this after creation. See Freeze an open channel.
whiteUserIdsArrayNoUser IDs for the allowed senders list. Users in this list can send messages even when the channel is frozen. Maximum 20 users. You can also set this after creation. See Add to allowed senders list.
metadataOwnerIdStringNoUser ID that owns the custom metadata. Only available when the metadata service is enabled. Must be used together with metadata. Only one user ID is supported. You can also set metadata after creation. See Open channel metadata overview.
metadataJSONNoCustom key-value metadata as a JSON object. Only available when the metadata service is enabled. Must be used together with metadataOwnerId. Maximum 20 entries per request.
- Key: Supports letters, numbers, and +, =, -, _. Case-sensitive. Max 128 characters.
- Value: Max 4,096 characters.

Request example

HTTP
POST /v4/open-channel/create HTTP/1.1
Host: api.sg-light-api.com
App-Key: uwd1c0sxdlx2
Nonce: 14314
Timestamp: 1408710653491
Signature: 45beb7cc7307889a8e711219a47b7cf6a5b000e8
Content-Type: application/json

{
"channelId": "gid1",
"destroyType": 1,
"ttlMinutes": 120
}

Response

FieldTypeDescription
codeNumberReturn code. 0 indicates success.

Response example

HTTP
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{"code":0}