comments module lets you create, fetch, update, and delete comments, and manage reactions on them. All actions are performed on behalf of the logged-in user.
createComment
Creates a comment on an entity. Optionally a reply, with a GIF, mentions, attachments, metadata, images or files.The comment’s text content.
null or an empty string stores none — a comment needs content, a gif, attachments, images or files.Images on the comment, processed into sizes per
options (mode is required). With images or files, the request is sent as multipart/form-data. A request takes at most 20 files in all. Requires the files-images bundle.Files on the comment, stored as uploaded. Each file’s
type comes from its MIME type; an image sent here isn’t processed, so it has no image data. Requires the files-images bundle.Promise<Comment>. With the files-images bundle installed, the created comment carries files ([] for none).
When the server refuses the comment, the call rejects with its error — among them 403 comment/parent-deleted and 403 comment/parent-removed for a reply to a deleted or removed comment, 403 comment/referenced-deleted and 403 comment/referenced-removed for a quote of one, and 409 comment/foreign-id-taken for a foreignId already in use. See Create Comment → Error Responses for the full list.
fetchComment
Fetches a single comment by its ID.Associations to populate, as a single value or an array:
"user", "entity", "space", "parent", "grants", "files" (the comment’s images and files; requires the files-images bundle).Promise<Comment>
fetchCommentByForeignId
Fetches a comment by your application’s own identifier.Associations to populate, as a single value or an array:
"user", "entity", "space", "parent", "grants", "files" (the comment’s images and files; requires the files-images bundle).Promise<Comment>
updateComment
Updates a comment’s content.Promise<Comment>
deleteComment
Deletes a comment.Promise<void>
fetchManyComments
Fetches one level of a comment thread, cursor-paginated: an entity’s top-level comments (entityId) or a comment’s direct replies (parentCommentId). Exactly one of the two is required; the props type refuses neither and both. Optionally nests a few levels of replies inside each returned comment. See Fetch Many Comments for the full contract — placeholders, block flags and the request size limit.
users.fetchCommentsByUserId.
pagination.nextCursor from the previous response, passed as returned. Omit it, or pass null, for the first page. Send the same sortBy, sortDir and sortByReaction as the request that returned it.Sort for the level being fetched.
"top" ranks by the raw count of sortByReaction. Server default "createdAt".Applies to
"createdAt" and "top"; not accepted with "controversial", which ranks one way only. Server default "desc".Sort direction for the nested levels. Defaults to
sortDir. Not sent when the nested sort is "controversial".Related data to populate, at every level.
"files" adds the comment’s images and files (requires the files-images bundle).Promise<CursorPaginatedResponse<Comment>> — { data, pagination: { nextCursor, hasMore } }. With replyDepth above 0, each comment carries nested replies in the same shape.
addReaction
Adds the logged-in user’s reaction to a comment and returns the full populated comment.Promise<Comment>
removeReaction
Removes the logged-in user’s reaction from a comment and returns the full populated comment.Promise<Comment>
fetchReactions
Fetches a paginated list of reactions on a comment, optionally filtered by reaction type.Results per page: a whole number from
1 to 100. Defaults to 20. A larger value is rejected with 400 comment/invalid-query, never lowered to 100.Promise<{ data: Reaction[]; pagination: { page: number; pageSize: number; totalPages: number; totalItems: number; hasMore: boolean } }>
getUserReaction
Gets the logged-in user’s reaction on a comment. Returnsnull if there is no reaction.
Promise<{ reactionType: ReactionType | null }>. Rejects with 404 comment/not-found when the comment doesn’t exist, or is on an entity whose author has blocked the user (the user’s own comments excepted).
