chat module powers direct, group, and space conversations — sending and
editing messages (with file attachments), managing members, reacting, and tracking
read state. All actions are performed as the logged-in user.
Two list endpoints page by cursor, not
page/limit:
listConversations takes the opaque cursor the
previous page returned, and listMessages pages before or
after a message id. See each below.listConversations
Lists the user’s conversations, newest activity first, with cursor pagination.Only conversations of these types: any of
"direct", "group", "space". Omitted, every type is listed.pagination.nextCursor from the previous response, passed as returned; omit
it (or pass null) for the first page. It is opaque: don’t build or parse it.
One the server can’t read is rejected with 400 chat/invalid-cursor.Promise<CursorPaginatedResponse<ConversationPreview>>: { data: ConversationPreview[]; pagination: { nextCursor: string | null; hasMore: boolean } }. nextCursor is null when hasMore is false.
A ConversationPreview is the conversation’s own fields plus:
unreadCountandmemberCount(active members).mutedUntilandmutedForever: the user’s mute on the conversation (see muteConversation).otherMembers— up to 5 active members other than the current user (id,name,username,avatar) fordirect/groupconversations, so a DM/group can render the counterparty without a separate members fetch. Capped at 5 (usememberCountfor the group total); empty forspaceconversations.lastMessage(ConversationPreviewLastMessage | null): a preview of the newest top-level message —id,conversationId,content(cut to 100 characters),gif,userId,moderationStatus,userDeletedAt,createdAt,files, anduser({ id, name, username, avatar, reputation }, ongroupandspacerows only;nullondirectrows). It has no mentions, quotes or reactions. A deleted or removed last message is its placeholder.
createDirectConversation
Returns the 1:1 direct conversation with another user, or creates it when there is none. Props type:CreateDirectConversationProps.
Promise<CreateDirectConversationResult>: { conversation: Conversation; created: boolean }. created is true when this call created the conversation (HTTP 201) and false when it already existed (HTTP 200).
createGroupConversation
Creates a group conversation.The group’s avatar image and its processing options (a
mode and the fields
it needs; see Image Processing Modes).
The request is then sent as multipart/form-data. Requires the
files-images bundle.Promise<Conversation>
getConversation
Fetches a single conversation by ID.Promise<Conversation>
updateConversation
Updates a conversation’s settings.New avatar image and its processing options (a
mode and the fields it
needs; see Image Processing Modes).
The request is then sent as multipart/form-data, and the previous avatar,
if any, is deleted.Files to remove: the conversation’s
avatarFileId, nothing else. Removing it
clears the avatar. Works alone or with a new avatarFile. Any other id throws
a 400 (chat/invalid-remove-file-ids, with invalidIds).Space conversations only: who may post — any active member (
"members") or only the space’s active admins and moderators ("team").Promise<Conversation>
deleteConversation
Deletes a conversation.Promise<void>
getUnreadCount
Returns the user’s total unread message count and unread-conversation count. Takes no arguments.Promise<{ totalUnread: number; unreadConversationCount: number }>
listMembers
Lists the members of a conversation (standard page-based pagination).Results per page: a whole number from
1 to 100. Defaults to 50. A larger value is rejected with 400 chat/invalid-query, never lowered to 100.Promise<PaginatedResponse<ConversationMember>>
addMember
Adds a user as a member of a conversation.Promise<ConversationMember>
removeMember
Removes another member from a conversation. Passing the logged-in user’s own id is refused with400 chat/own-member-id: to leave, use leaveConversation.
Promise<void>
changeMemberRole
Changes another member’s role within a conversation. Passing the logged-in user’s own id is refused with400 chat/own-member-id.
Promise<ConversationMember>
checkMyConversationMembership
Reads the logged-in user’s own membership in a conversation (GET /chat/conversations/:conversationId/members/me).
Promise<CheckMyConversationMembershipResponse>, a flat object where a field that doesn’t apply is left out:
- an active member:
{ isMember: true, role, lastReadAt, mutedForever, mutedUntil } - a user who left or was removed:
{ isMember: false, leftAt } - a user with no membership yet (a space conversation they haven’t opened):
{ isMember: false }
404 chat/not-found or 403 chat/not-a-member). See Check My Membership.
leaveConversation
The logged-in user leaves a conversation (DELETE /chat/conversations/:conversationId/members/me).
Promise<void>. It resolves with no value once the user has left.
listMessages
Lists messages in a conversation, a page at a time before or after a message.A message id: return the
limit messages just before it. Pass the oldest
message you hold to load older ones. It must be a message of this conversation
at the same thread level (parentMessageId), or the call is rejected with
400 chat/invalid-cursor. Mutually exclusive with after.A message id: return the
limit messages just after it. Pass the newest
message you hold to load newer ones. Same rules as before. Mutually
exclusive with before.The order of the page by creation time. Defaults to
"desc" for the main
stream and "asc" for a thread. With before or after, the anchor decides
which messages are in the page; sortDir only orders them.Associations to populate, as a single value or an array:
"files" (the message’s images and files) and "grants" (each message’s reputation-grant summary). Pass ["files", "grants"] for both.Optional filters.
filters.hasReplies (boolean): when true, returns only
messages that have thread replies (threadReplyCount > 0); when false, only
messages with none. Filters by thread replies, not quotings.Threads are one level deep, so hasReplies: true together with parentMessageId
always returns an empty list — the response’s notice field explains why.Promise<{ data: ChatMessage[]; pagination: { hasMore: boolean }; notice?: string }>. hasMore says whether more messages exist past this page in the direction of travel: older with before, newer with after; with neither, older for "desc" and newer for "asc". See List Messages › Paging.
sendMessage
Sends a message to a conversation, optionally with images and files. Whenimages
or files is provided the request is sent as multipart/form-data (pass browser
File / Blob objects); otherwise it is a plain JSON body. A message needs
content, a GIF, or at least one image or file.
Images, at most 50 MB each, processed into sizes per
options (mode is
required); each comes back with image and its variants. A request takes at
most 20 files in all. Triggers a multipart/form-data upload. Requires the
files-images bundle.Files, at most 50 MB each, stored as uploaded (
image is null, an image sent
here included). Triggers a multipart/form-data upload. Requires the
files-images bundle.Promise<SendMessageResponse>: the created message as a SentChatMessage (a ChatMessage without reactionCounts, userReactions and grants), with localId when you passed one.
getMessage
Fetches a single message by ID.A single value or an array. The only value is
"grants" — it attaches the message’s reputation-grant summary at message.grants. The message’s files are always returned.Promise<ChatMessage>
editMessage
Edits an existing message.A GifData attachment, or
null to clear it.Replaces the message’s metadata. Send
{} to clear it; null isn’t accepted (400 chat/invalid-body).Promise<SentChatMessage>: the edited message, without reactionCounts, userReactions and grants.
deleteMessage
Deletes a message in a conversation.Promise<void>. It resolves with no value once the message is deleted.
Reporting a message
Message reports go through the shared reports API, not a chat-specific function — the same call that reports entities and comments.targetId is the message id; the conversation is resolved server-side, so no
conversationId is needed. The reporter must be a member of the conversation
and cannot report their own message. See createReport.
Returns — Promise<CreateReportResponse> — the user’s own report of the message (see createReport).
toggleReaction
Toggles (adds or removes) an emoji reaction on a message for the logged-in user. A deleted or removed message takes no new reaction: adding one fails with404 chat/message-not-found, while taking back your own still works.
Promise<{ reactionCounts: Record<string, number>; userReactions: string[]; delta: 1 | -1 }>
listReactions
Lists the users who reacted to a message with a given emoji.Results per page: a whole number from
1 to 100. Defaults to 50. A larger value is rejected with 400 chat/invalid-query, never lowered to 100.Promise<{ data: MessageReaction[]; pagination: { page: number; pageSize: number; totalPages: number; totalItems: number; hasMore: boolean } }>,
where MessageReaction is { emoji: string; user: UserSummary; createdAt: string } and the user is { id, name, username, avatar, reputation } (plus spaceReputation when requested).
markAsRead
Marks a conversation as read up to a given message.Promise<void>
muteConversation
Sets or clears the signed-in user’s mute on a conversation. Muting suppresses themessage push for this conversation only; the message is still delivered and readable. See Notification Preferences & Mute.
The mute duration choice, or
null to clear the mute. Send the choice, never a raw timestamp — the server resolves the window.Promise<{ currentMember: ConversationMember }> — the signed-in user’s own member row.
“Forever” is an explicit signal. A
forever mute returns mutedForever: true with mutedUntil: null; a timed mute returns mutedForever: false with a real ISO mutedUntil. Read the boolean — never string-match a far-future date.
