Skip to main content

Set auto-destroy type

Set the auto-destroy type for an open channel. Before making changes, make sure you understand the auto-destroy mechanism.

  • Destroy on inactivity (destroyType: 0) — Use ttlMinutes to set the inactivity duration (in minutes). The open channel is destroyed after being inactive (no joins/leaves and no new messages) for this duration.
  • Destroy on schedule (destroyType: 1) — Use ttlMinutes to set the time-to-live (in minutes), always counted from creation time. Maximum: 10,080 minutes (7 days).
danger

If an open channel currently uses scheduled destroy, the server still tracks its accumulated inactivity time. Switching the destroy type to destroy on inactivity may cause immediate destruction if the channel has been inactive for a long time.

Request

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

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.
- 0: Destroy on inactivity (default). Destroyed after 60 minutes of inactivity. Adjust with ttlMinutes.
- 1: Destroy on schedule. Destroyed 60 minutes after creation. Adjust with ttlMinutes.
ttlMinutesNumberNoTime condition for auto-destroy, in minutes.
- When destroyType is 0: inactivity duration.
- When destroyType is 1: time-to-live from creation.
Range: 60–10,080 (7 days). Default: 60.

Request example

HTTP
POST /v4/open-channel/destroy-type/set 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": 0,
"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}