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, or metadata.string
required
The Sublay entity ID the comment belongs to.
string
Your application’s identifier for this comment.
string
The comment’s text content.
GifData | null
An optional GIF attached to the comment.
Mention[]
User mentions embedded in the comment.
string | null
The ID of the parent comment when this is a reply.
string
The ID of another comment this comment references.
Record<string, any>[]
File or media attachments.
Record<string, any>
Arbitrary public metadata.
Promise<Comment>
fetchComment
Fetches a single comment by its ID.string
required
The Sublay comment ID.
string
Comma-separated list of associations to populate.
string
Opts the returned comment’s author into a
spaceReputation number. Accepts a space <uuid>, "none" (the project-general bucket), or "context" (the space derived from the request context). The empty string and the legacy general / null aliases are rejected. See Reputation.boolean
Only honored alongside an explicit space
<uuid>. When true, spaceReputation is the subtree sum — the named space plus all of its descendants.Promise<Comment>
fetchCommentByForeignId
Fetches a comment by your application’s own identifier.string
required
Your application’s comment identifier.
string
Comma-separated list of associations to populate.
Promise<Comment>
updateComment
Updates a comment’s content.string
required
The Sublay comment ID to update.
string
required
The new content for the comment.
Promise<Comment>
deleteComment
Deletes a comment.string
required
The Sublay comment ID to delete.
Promise<void>
fetchManyComments
Fetches a paginated list of comments, filterable by entity, user, or parent.string
Filter to comments on a specific entity.
string
Filter to comments authored by a given user.
string
Filter to replies of a specific parent comment.
number
Page number (1-indexed).
number
Results per page.
string
Sort order:
"createdAt" (newest first; honors sortDir), "top", or "controversial". "new" and "old" are deprecated aliases for "createdAt" (removed in v8) — the server still accepts them but responds with a deprecation header.string
Comma-separated list of associations to populate.
string
Filter by source ID.
string
Opts each returned comment’s author into a
spaceReputation number. Accepts a space <uuid>, "none" (the project-general bucket), or "context" (the space derived from the request context — resolved per-row from the space each comment belongs to). The empty string and the legacy general / null aliases are rejected. See Reputation.boolean
Only honored alongside an explicit space
<uuid>. When true, spaceReputation is the subtree sum — the named space plus all of its descendants.Promise<PaginatedResponse<Comment>>
addReaction
Adds the logged-in user’s reaction to a comment and returns the full populated comment.string
required
The Sublay comment ID.
ReactionType
required
One of:
"upvote", "downvote", "like", "love", "wow", "sad", "angry", "funny".Promise<Comment>
removeReaction
Removes the logged-in user’s reaction from a comment and returns the full populated comment.string
required
The Sublay comment ID.
Promise<Comment>
fetchReactions
Fetches a paginated list of reactions on a comment, optionally filtered by reaction type.string
required
The Sublay comment ID.
ReactionType
Filter to a specific reaction type.
number
Page number (1-indexed).
number
Results per page.
string
Sort direction:
"asc" or "desc".string
Opts each returned reactor into a
spaceReputation number. Accepts a space <uuid>, "none" (the project-general bucket), or "context" (the space derived from the request context). The empty string and the legacy general / null aliases are rejected. See Reputation.boolean
Only honored alongside an explicit space
<uuid>. When true, spaceReputation is the subtree sum — the named space plus all of its descendants.Promise<{ data: Reaction[]; pagination: { page: number; limit: number; total: number; totalPages: number; hasMore: boolean } }>
getUserReaction
Gets the logged-in user’s reaction on a comment. Returnsnull if there is no reaction.
string
required
The Sublay comment ID.
Promise<{ reactionType: ReactionType | null }>
