product:chat

Update channels in batch

Changed on

Update channels in batch. By default returns task_id for an asynchronous task. With synchronous: true, updateData and hide accept at most 100 explicit CIDs (hide also at most 10 distinct members) and return success_channels_count of channels selected after the database write completes, without task_id. A synchronous hide where none of the member users exist hides nothing and omits success_channels_count. Always poll a returned task_id, including when an older node ignores synchronous.

Sends events:

  • channel.frozen
  • channel.hidden
  • channel.unfrozen
  • channel.updated
  • channel.visible
  • member.added
  • member.removed
  • member.updated
put/channels/batch

Request

  • Base URL
    https://chat.stream-io-api.com
  • URL
    https://chat.stream-io-api.com/channels/batch
  • Auth
    • API key in header Authorization and API key in query parameter api_key and API key in header Stream-Auth-Type
    • or API key in query parameter api_key and API key in header Stream-Auth-Type

Request body

custom_setobject

updateData only. Merges these keys into each channel's existing custom object, leaving every other custom key untouched. Keys are dot-paths, so a.b sets key b inside object a (the parent object must already exist). Cannot be combined with data.custom

custom_unsetstring[]

updateData only. Deletes these keys from each channel's existing custom object, leaving every other custom key untouched. Keys are dot-paths; deleting a key that does not exist is a no-op. Cannot be combined with data.custom

filterobject required

Filter to apply to the query

hide_history_beforestring date-time

Required with the addMembersHideHistory operation, and rejected with every other operation including addMembers. Hides each matched channel's history before this time from the members the operation adds. Members that already belong to a matched channel are never affected. Must be in RFC3339 format (e.g., "2024-01-01T10:00:00Z") and in the past.

operation'addMembers' | 'addMembersHideHistory' | 'removeMembers' | 'inviteMembers' | 'invites' | 'assignRoles' | 'addModerators' | 'demoteModerators' | 'hide' | 'show' | 'archive' | 'unarchive' | 'updateData' required
synchronousboolean

For updateData and hide only. Requires a root cids $eq or $in filter with at most 100 CIDs and no root $or/$and. A synchronous hide also requires 1 to 10 distinct member user IDs. Split larger selections into requests of at most 100 CIDs. A success_channels_count response means the database update completed; a task_id response means it was queued and must be polled, including on older API nodes.

Response

Successful response

durationstring required
success_channels_countinteger

Count of channels selected for a completed synchronous database update, not an affected-row count. Concurrent deletion may reduce the rows written. Omitted when the count is 0, which happens for a synchronous hide where none of the member users exist. task_id is absent.

task_idstring

Present for asynchronous updates. Poll this task even if synchronous was requested: an older API node may have queued the update.

Changes

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status

    • info

      added the new optional request property

    • info

      added the optional property to the response with the status