---
url: /apidocs/channel.md
---
## Channel API

Channel API handles textchat conversations between users.

| Endpoint | Method | Description |
|-----|-----|-----|
| [/api/v0/channel/listMessages/{channelId}](#list-channel-messages-web-request-) | webRequest | List channel messages (web request) |
| [channel:getDirectChannel](#get-direct-channel) | websocket | Get direct channel |
| [channel:getChannelForRoom](#get-channel-for-room) | websocket | Get channel for room |
| [channel:getChannelForProp](#get-channel-for-prop) | websocket | Get channel for prop |
| [channel:getChannelForDirectAI](#get-channel-for-direct-ai) | websocket | Get channel for direct aI |
| [channel:getChannelForRoomAI](#get-channel-for-room-ai) | websocket | Get channel for room aI |
| [channel:spawnDirectAIAgentChannel](#spawn-direct-ai-agent-channel) | websocket | Spawn direct aI agent channel |
| [channel:getUserNotesChannel](#get-user-notes-channel) | websocket | Get user notes channel |
| [channel:getGroupChannel](#get-group-channel) | websocket | Get group channel |
| [channel:getChannelForCommunityPost](#get-channel-for-community-post) | websocket | Get channel for community post |
| [channel:getChannelForUserPosts](#get-channel-for-user-posts) | websocket | Get channel for user posts |
| [channel:getThreadChannelForMessage](#get-thread-channel-for-message) | websocket | Get thread channel for message |
| [channel:getChannelBySource](#get-channel-by-source) | websocket | Get channel by source |
| [channel:getChannelById](#get-channel-by-id) | websocket | Get channel by id |
| [channel:searchUserChannels](#search-user-channels) | websocket | Search user channels |
| [channel:getCountOfUnreadChannels](#get-count-of-unread-channels) | websocket | Get count of unread channels |
| [channel:deleteSpawnChannel](#delete-spawn-channel) | websocket | Delete spawn channel |
| [channel:updateTitle](#update-channel-title) | websocket | Update channel title |
| [channel:setHighAlert](#set-channel-to-high-alert) | websocket | Set channel to high alert |
| [channel:pin](#pin-channel) | websocket | Pin channel |
| [channel:createMessage](#create-channel-message) | websocket | Create channel message |
| [channel:editMessageBody](#edit-channel-message-body) | websocket | Edit channel message body |
| [channel:addMessageAttachments](#add-channel-message-attachments) | websocket | Add channel message attachments |
| [channel:deleteMessageAttachments](#delete-channel-message-attachments) | websocket | Delete channel message attachments |
| [channel:blockMessage](#block-channel-message) | websocket | Block channel message |
| [channel:unblockMessage](#unblock-channel-message) | websocket | Unblock channel message |
| ~~[channel:deleteMessage](#delete-channel-message)~~ | websocket | Delete channel message |
| ~~[channel:restoreMessage](#restore-channel-message)~~ | websocket | Restore channel message |
| [channel:updateMessageDeletedStatus](#update-channel-message-deleted-status) | websocket | Update channel message deleted status |
| [channel:deleteMessageFromChannel](#delete-message-from-channel) | websocket | Delete message from channel |
| [channel:generateAIWelcomeMessage](#generate-ai-welcome-message) | websocket | Generate aI welcome message |
| [channel:getLastMessage](#get-last-channel-message) | websocket | Get last channel message |
| [channel:listMessages](#list-channel-messages) | websocket | List channel messages |
| [channel:listMessagesWithEngagement](#list-channel-messages-with-engagement) | websocket | List channel messages with engagement |
| [channel:searchMessages](#search-channel-messages) | websocket | Search channel messages |
| [channel:setChannelLastReadMessage](#set-channel-last-read-message) | websocket | Set channel last read message |
| [channel:setVoteForMessage](#set-vote-for-channel-message) | websocket | Set vote for channel message |
| [channel:createPollMessage](#create-channel-poll-message) | websocket | Create channel poll message |
| [channel:postPollVote](#post-poll-vote) | websocket | Post poll vote |
| [channel:getPollStats](#get-poll-stats) | websocket | Get poll stats |
| [channel:reactToMessage](#react-to-message) | websocket | React to message |
| [channel:listUsersReactedToMessage](#list-users-reacted-to-message) | websocket | List users reacted to message |
| [channel:searchAttachmentsOfChannel](#search-attachments-of-channel) | websocket | Search attachments of channel |
| [channel:createSubChannel](#create-sub-channel) | websocket | Create sub channel |
| [channel:deleteSubChannel](#delete-sub-channel) | websocket | Delete sub channel |
| [channel:updateSubChannel](#update-sub-channel) | websocket | Update sub channel |
| [channel:listSubChannels](#list-sub-channels) | websocket | List sub channels |
| [channel:getSubChannelAndParents](#get-sub-channel-and-parents) | websocket | Get sub channel and parents |
| [channel:getZAddressesForParticipants](#get-z-addresses-for-channel-participants) | websocket | Get z addresses for channel participants |
| ~~[channel:createEncryptionEpoch](#create-channel-encryption-epoch)~~ | websocket | Create channel encryption epoch |
| ~~[channel:updateEncryptionEpoch](#update-channel-encryption-epoch)~~ | websocket | Update channel encryption epoch |
| ~~[channel:listEncryptionEpoches](#list-channel-encryption-epoches)~~ | websocket | List channel encryption epoches |
| ~~[channel:listEncryptionEpochesByTuples](#list-channel-encryption-epoches-by-tuples)~~ | websocket | List channel encryption epoches by tuples |
| ~~[channel:listEncryptionEpochesByZAddress](#list-channel-encryption-epoches-by-z-address)~~ | websocket | List channel encryption epoches by z address |
| ~~[channel:getLastEncryptionEpoch](#get-last-channel-encryption-epoch)~~ | websocket | Get last channel encryption epoch |
| [channel:requestNewEncryptionEpoch](#request-new-encryption-epoch-for-channel) | websocket | Request new encryption epoch for channel |
| [channel:onMessageCreated](#on-message-created-event) | websocketEvent | On message created event |
| [channel:onMessageDeleted](#on-message-deleted-event) | websocketEvent | On message deleted event |
| [channel:onMessageEdited](#on-message-edited-event) | websocketEvent | On message edited event |
| [channel:onMessageBlockedStatusUpdated](#on-message-blocked-status-updated-event) | websocketEvent | On message blocked status updated event |
| [channel:onMessageDeletedStatusUpdated](#on-message-deleted-status-updated-event) | websocketEvent | On message deleted status updated event |
| [channel:onMessageRead](#on-message-read-event) | websocketEvent | On message read event |
| [channel:onUnreadCountUpdated](#on-unread-count-updated-event) | websocketEvent | On unread count updated event |
| [channel:onMessageReaction](#on-message-reaction-event) | websocketEvent | On message reaction event |
| [channel:onPollVote](#on-poll-vote-event) | websocketEvent | On poll vote event |
| [channel:onSubChannelCreated](#on-sub-channel-created-event) | websocketEvent | On sub channel created event |
| [channel:onSubChannelDeleted](#on-sub-channel-deleted-event) | websocketEvent | On sub channel deleted event |
| [channel:onSubChannelUpdated](#on-sub-channel-updated-event) | websocketEvent | On sub channel updated event |
| ~~[channel:onEpochCreated](#on-channel-encryption-epoch-created-event)~~ | websocketEvent | On channel encryption epoch created event |
| [channel:onLastEpochUpdated](#on-last-epoch-updated-event) | websocketEvent | On last epoch updated event |

### List channel messages (web request)

**HTTP Method:** GET

**Path:** /api/v0/channel/listMessages/{channelId}

**Parameters:**

subChannelId: string

messageId: string

direction: string (before, after, bilateral, single)

limit: int

**Request:**

**Response:**

### Get direct channel

**Method:** websocket

**Endpoint:** channel:getDirectChannel

**Description:** Api gets/creates direct textchat channel. Api subscribes user socket to broadcast events of channel. User can have channel with himself by putting his own user id to targetUser field.

**Request:**

**Response:**

### Get channel for room

**Method:** websocket

**Endpoint:** channel:getChannelForRoom

**Description:** Api gets/creates textchat channel for room and subscribes socket to that channel. Api subscribes user socket to broadcast events of channel.

**Request:**

**Response:**

### Get channel for prop

**Method:** websocket

**Endpoint:** channel:getChannelForProp

**Description:** Api gets/creates textchat channel for prop. Api subscribes user socket to broadcast events of channel.

**Request:**

**Response:**

### Get channel for direct aI

**Method:** websocket

**Endpoint:** channel:getChannelForDirectAI

**Description:** Api gets/creates channel for direct AI textchat. Api subscribes user socket to broadcast events of channel.

**Request:**

**Response:**

### Get channel for room aI

**Method:** websocket

**Endpoint:** channel:getChannelForRoomAI

**Description:** Api gets/creates channel for user AI textchat within room context. Api subscribes user socket to broadcast events of channel.

**Request:**

**Response:**

### Spawn direct aI agent channel

**Method:** websocket

**Endpoint:** channel:spawnDirectAIAgentChannel

**Description:** Api creates a channel spawned by an AI agent from a parent direct channel. Api subscribes user socket to broadcast events of the spawned channel. Spawned channel unread state is reflected on the parent direct channel.

**Request:**

**Response:**

### Get user notes channel

**Method:** websocket

**Endpoint:** channel:getUserNotesChannel

**Description:** Api gets/creates textchat channel for user notes (user chat with himself). Api subscribes user socket to broadcast events of channel.

**Request:**

**Response:**

### Get group channel

**Method:** websocket

**Endpoint:** channel:getGroupChannel

**Description:** Api gets/creates group textchat channel. Api subscribes user socket to broadcast events of channel.

**Request:**

**Response:**

### Get channel for community post

**Method:** websocket

**Endpoint:** channel:getChannelForCommunityPost

**Description:** Api gets/creates channel for community post discussion textchat. Api subscribes user socket to broadcast events of channel.

**Request:**

**Response:**

### Get channel for user posts

**Method:** websocket

**Endpoint:** channel:getChannelForUserPosts

**Description:** Api gets/creates textchat channel for user posts (public channel of a user). Api subscribes user socket to broadcast events of channel.

**Request:**

**Response:**

### Get thread channel for message

**Method:** websocket

**Endpoint:** channel:getThreadChannelForMessage

**Description:** Api gets/creates sub channel (thread) for given message. Threads are available for community posts (+comments) and user public posts (+comments). Api subscribes user socket to broadcast events of channel.

**Request:**

**Response:**

### Get channel by source

**Method:** websocket

**Endpoint:** channel:getChannelBySource

**Description:** Api returns textchat channel by its source. Api subscribes user socket to broadcast events of channel.

Channel source examples:

* room:{networkId}:{roomId}
* group:{networkId}:{groupId}
* userPosts:{userId}
* userAIAgent:{userId}:{aiAgentId}
* communityAll:{networkId}:{communityId}
* communityAdmin:{networkId}:{communityId}

**Request:**

**Response:**

### Get channel by id

**Method:** websocket

**Endpoint:** channel:getChannelById

**Description:** Api returns textchat channel by its id. Api subscribes user socket to broadcast events of channel.

**Request:**

**Response:**

### Search user channels

**Method:** websocket

**Endpoint:** channel:searchUserChannels

**Description:** Api returns list of textchat channels depending on filters.

Api subscribes user socket to broadcast events of all channels.

Filter could be one of the following:

* all - return all channels
* unread - return all unread channels
* direct - return direct channels
* group - return all non-direct channels
* groups - return channel for groups
* allWithinRoom - return all non-direct channels within the room
* rooms - return only room channels
* noProps - return all channels (excluding prop channels)
* spawned - return channels spawned by parent channel

**Request:**

**Response:**

### Get count of unread channels

**Method:** websocket

**Endpoint:** channel:getCountOfUnreadChannels

**Description:** Api returns amount of unread textchat channels.

**Request:**

**Response:**

### Delete spawn channel

**Method:** websocket

**Endpoint:** channel:deleteSpawnChannel

**Request:**

**Response:**

### Update channel title

**Method:** websocket

**Endpoint:** channel:updateTitle

**Request:**

**Response:**

### Set channel to high alert

**Method:** websocket

**Endpoint:** channel:setHighAlert

**Description:** Sets the selected channel on/off high alert

**Request:**

**Response:**

### Pin channel

**Method:** websocket

**Endpoint:** channel:pin

**Description:** pin/unpin user's channel

**Request:**

**Response:**

### Create channel message

**Method:** websocket

**Endpoint:** channel:createMessage

**Description:** Api creates new message in a textchat channel.

**Request:**

**Response:**

### Edit channel message body

**Method:** websocket

**Endpoint:** channel:editMessageBody

**Description:** Api edits message body in a textchat channel.

**Request:**

**Response:**

### Add channel message attachments

**Method:** websocket

**Endpoint:** channel:addMessageAttachments

**Description:** Api add attachments to a message in a textchat channel.

**Request:**

**Response:**

### Delete channel message attachments

**Method:** websocket

**Endpoint:** channel:deleteMessageAttachments

**Description:** Api deletes attachments from a message in a textchat channel.

**Request:**

**Response:**

### Block channel message

**Method:** websocket

**Endpoint:** channel:blockMessage

**Description:** Api blocks message in a textchat channel. Only channel manager in group channel can block message.

**Request:**

**Response:**

### Unblock channel message

**Method:** websocket

**Endpoint:** channel:unblockMessage

**Description:** Api unblock blocked message in a textchat channel. Only channel manager in group channel can unblock message.

**Request:**

**Response:**

### Delete channel message

**Method:** websocket

**Endpoint:** channel:deleteMessage

**DEPRECATED**

**Description:** DEPRECATED, use `channel:updateMessageDeletedStatus` instead.

**Request:**

**Response:**

### Restore channel message

**Method:** websocket

**Endpoint:** channel:restoreMessage

**DEPRECATED**

**Description:** DEPRECATED, use `channel:updateMessageDeletedStatus` instead.

**Request:**

**Response:**

### Update channel message deleted status

**Method:** websocket

**Endpoint:** channel:updateMessageDeletedStatus

**Description:** Api updates deletes status for a message in a textchat channel. Only message author can restore message.

**Request:**

**Response:**

### Delete message from channel

**Method:** websocket

**Endpoint:** channel:deleteMessageFromChannel

**Description:** Api completely deletes message from a textchat channel. Api is available for a limited number of channel types (community and user posts).

**Request:**

**Response:**

### Generate aI welcome message

**Method:** websocket

**Endpoint:** channel:generateAIWelcomeMessage

**Description:** Api generates welcome message in AI textchat channel.

**Request:**

**Response:**

### Get last channel message

**Method:** websocket

**Endpoint:** channel:getLastMessage

**Description:** Api returns last message of textchat channel (does not update last read timestamp).

**Request:**

**Response:**

### List channel messages

**Method:** websocket

**Endpoint:** channel:listMessages

**Description:** Api returns list of textchat channel messages. Api subscribes user socket to broadcast events of channel.

Field `messageType` could be one of:

* 0 - my message
* 1 - user message
* 3 - system message
* 4 - system json message
* 100 - Open AI question message
* 101 - Open AI answer message
* 102 - Rav AI question message
* 103 - Rav AI answer message

In case of system json message, parsed json is sent in message body:

Field `event` could be one of:

* 1 - user entered booth
* 2 - user wrote to booth
* 3 - user entered social circle
* 4 - user wrote to social circle

**Request:**

**Response:**

### List channel messages with engagement

**Method:** websocket

**Endpoint:** channel:listMessagesWithEngagement

**Description:** Api does the same as `listMessages` but also returns user votes for messages.

**Request:**

**Response:**

### Search channel messages

**Method:** websocket

**Endpoint:** channel:searchMessages

**Description:** Api searches messages across community channels. Results are ranked by relevance when a text query is provided, or by message creation time (newest first) when a text query is empty.

Scope — exactly one (`channelIds`, `communityIds` or `networkIds`) must be non-empty.

Optional filters:

* `query`      — full-text search across message body and title
* `authorIds`  — restrict to messages written by any of the listed user ids
* `tags`       — restrict to messages that carry ALL the listed option tags
* `dateFrom`   — lower bound on message creation time (inclusive)
* `dateTo`     — upper bound on message creation time (inclusive)
* `limit`      — maximum number of results per page (1–100; defaults to 20)

**Request:**

**Response:**

### Set channel last read message

**Method:** websocket

**Endpoint:** channel:setChannelLastReadMessage

**Description:** Api updates last read timestamp for textchat channel participant.

**Request:**

**Response:**

### Set vote for channel message

**Method:** websocket

**Endpoint:** channel:setVoteForMessage

**Request:**

**Response:**

### Create channel poll message

**Method:** websocket

**Endpoint:** channel:createPollMessage

**Description:** Api creates a new poll message in a textchat channel.

**Request:**

**Response:**

### Post poll vote

**Method:** websocket

**Endpoint:** channel:postPollVote

**Description:** Api casts a vote in the poll.

**Request:**

**Response:**

### Get poll stats

**Method:** websocket

**Endpoint:** channel:getPollStats

**Description:** Api gets a map of user votes for non-anonymous polls.

**Request:**

**Response:**

### React to message

**Method:** websocket

**Endpoint:** channel:reactToMessage

**Description:** Api sends a reaction to the specified message in a textchat channel.

**Request:**

**Response:**

### List users reacted to message

**Method:** websocket

**Endpoint:** channel:listUsersReactedToMessage

**Description:** Api returns a list of users to reacted to the specified message in a textchat channel.

**Request:**

**Response:**

### Search attachments of channel

**Method:** websocket

**Endpoint:** channel:searchAttachmentsOfChannel

**Request:**

**Response:**

### Create sub channel

**Method:** websocket

**Endpoint:** channel:createSubChannel

**Request:**

**Response:**

### Delete sub channel

**Method:** websocket

**Endpoint:** channel:deleteSubChannel

**Request:**

**Response:**

### Update sub channel

**Method:** websocket

**Endpoint:** channel:updateSubChannel

**Request:**

**Response:**

### List sub channels

**Method:** websocket

**Endpoint:** channel:listSubChannels

**Request:**

**Response:**

### Get sub channel and parents

**Method:** websocket

**Endpoint:** channel:getSubChannelAndParents

**Request:**

**Response:**

### Get z addresses for channel participants

**Method:** websocket

**Endpoint:** channel:getZAddressesForParticipants

**Description:** Api returns z-addresses of channel participants.

Api is now available only for direct and group channels.

Api returns map of userId -> zAddress for all channel participants. If user does not have z-address, empty string is returned for that userId. Participants with empty zAddress would not be able to decrypt messages in the channel. Application should detect this situation and inform user about it.

**Request:**

**Response:**

### Create channel encryption epoch

**Method:** websocket

**Endpoint:** channel:createEncryptionEpoch

**DEPRECATED**

**Description:** Api creates new epoch for channel message encryption. Client application need to provide encrypted viewing key for each channel participant.

**Request:**

**Response:**

### Update channel encryption epoch

**Method:** websocket

**Endpoint:** channel:updateEncryptionEpoch

**DEPRECATED**

**Description:** Api updates epoch for participant in channel. This is useful in case when user has changed his zAddress and wants to update viewing keys correspondingly.

**Request:**

**Response:**

### List channel encryption epoches

**Method:** websocket

**Endpoint:** channel:listEncryptionEpoches

**DEPRECATED**

**Description:** Api returns list of all epoches for provided channel.

**Request:**

**Response:**

### List channel encryption epoches by tuples

**Method:** websocket

**Endpoint:** channel:listEncryptionEpochesByTuples

**DEPRECATED**

**Description:** Api returns list of epoches for provided channels-epoch tuples.

**Request:**

**Response:**

### List channel encryption epoches by z address

**Method:** websocket

**Endpoint:** channel:listEncryptionEpochesByZAddress

**DEPRECATED**

**Description:** Api returns list of epoches for provided user zAddress.

**Request:**

**Response:**

### Get last channel encryption epoch

**Method:** websocket

**Endpoint:** channel:getLastEncryptionEpoch

**DEPRECATED**

**Description:** Api returns last epoch for participant in channel.

**Request:**

**Response:**

### Request new encryption epoch for channel

**Method:** websocket

**Endpoint:** channel:requestNewEncryptionEpoch

**Description:** Api marks channel as needing new encryption epoch.

**Request:**

**Response:**

### On message created event

**Event:** channel:onMessageCreated

**Description:** Event is triggered when a new message is created in a channel.

**Data:**

### On message deleted event

**Event:** channel:onMessageDeleted

**Description:** Event is triggered when message is deleted from a channel.

**Data:**

### On message edited event

**Event:** channel:onMessageEdited

**Description:** Event is triggered when message body is updated in a channel.

**Data:**

### On message blocked status updated event

**Event:** channel:onMessageBlockedStatusUpdated

**Description:** Event is triggered when message blocked status updated in a channel.

**Data:**

### On message deleted status updated event

**Event:** channel:onMessageDeletedStatusUpdated

**Description:** Event is triggered when message deleted status updated in a channel.

**Data:**

### On message read event

**Event:** channel:onMessageRead

**Description:** Event is triggered when a user requests a message that has been previously not read by him.

**Data:**

### On unread count updated event

**Event:** channel:onUnreadCountUpdated

**Description:** Event is triggered when counter of unread channels for user is updated.

**Data:**

### On message reaction event

**Event:** channel:onMessageReaction

**Description:** Event is triggered when a new reaction is added to a message

**Data:**

### On poll vote event

**Event:** channel:onPollVote

**Description:** Event is triggered when someone votes in a channel poll.

**Data:**

### On sub channel created event

**Event:** channel:onSubChannelCreated

**Description:** Event is triggered when sub channel is created within channel.

**Data:**

### On sub channel deleted event

**Event:** channel:onSubChannelDeleted

**Description:** Event is triggered when sub channel is deleted within channel.

**Data:**

### On sub channel updated event

**Event:** channel:onSubChannelUpdated

**Description:** Event is triggered when sub channel is updated within channel.

**Data:**

### On channel encryption epoch created event

**Event:** channel:onEpochCreated

**DEPRECATED**

**Description:** Event is triggered when new epoch is created within channel.

**Data:**

### On last epoch updated event

**Event:** channel:onLastEpochUpdated

**Description:** Event is triggered when epoch info is changed in channel model (requested or created new epoch).

**Data:**

## Models

#### Resource

#### Resource Origin

#### Geolocation

#### Dimensions

#### Resource Data Audio

#### Resource Data Video

#### Resource Data Amazon

#### Resource Data Imdb

#### Resource Data Youtube

#### Resource Data Vimeo

#### Resource Data Pinterest

#### Resource Data Pixabay

#### Resource Data Facebook

#### Resource Data Remote Url

#### Live Stream Data

#### AI Generation Data

#### Resource Data Directory

#### Google Drive

#### Channel Data

#### Enrichment Data

#### Programmatic Action with children

#### Programmatic Action
