Skip to main content
The comments module provides full server-side control over comments on entities. Use it to seed content, build moderation pipelines, or integrate comment data into your backend logic.

createComment

Creates a new comment on an entity.
string
required
The Sublay entity ID to comment on.
string
required
The Sublay user ID of the comment author.
string
The comment text content.
string
Your application’s identifier for this comment.
object
A GIF to attach to the comment (GifData), or null.
array
User mentions embedded in the comment.
string
The Sublay comment ID of the parent, for creating a reply.
string
A comment being directly quoted or referenced.
array
File or media attachments on the comment.
object
Arbitrary metadata attached to the comment.
Date
A Date used to backdate the comment’s creation time.
Date
A Date used to backdate the comment’s last update time.
ReturnsPromise<Comment>

fetchComment

Fetches a single comment by its Sublay 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.
ReturnsPromise<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.
ReturnsPromise<Comment>

updateComment

Updates the content of an existing comment.
string
required
The Sublay comment ID to update.
string
required
The new comment text.
ReturnsPromise<Comment>

deleteComment

Permanently deletes a comment.
string
required
The Sublay comment ID to delete.
ReturnsPromise<void>

fetchManyComments

Fetches a paginated list of comments on an entity. Supports top-level and reply-level fetching.
string
The Sublay entity ID to fetch comments for.
string
Filter to comments authored by a specific user.
string
When provided, fetches replies to this specific comment ID instead of top-level comments.
string
Filter comments by source ID.
number
Page number (1-indexed). Defaults to 1.
number
Results per page. Defaults to 20.
string
Sort order: "createdAt" (newest first; honors sortDir), "top" (highest scored), or "controversial". "new" (createdAt DESC) and "old" (createdAt ASC) 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
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.
ReturnsPromise<PaginatedResponse<Comment>>

addReaction

Adds a reaction from a user to a comment.
string
required
The Sublay comment ID.
string
required
The Sublay user ID of the reactor.
ReactionType
required
One of: "upvote", "downvote", "like", "love", "wow", "sad", "angry", "funny".
ReturnsPromise<Reaction>

removeReaction

Removes a user’s existing reaction from a comment.
string
required
The Sublay comment ID.
string
required
The Sublay user ID whose reaction to remove.
ReturnsPromise<void>

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). Defaults to 1.
number
Results per page. Defaults to 20.
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.
ReturnsPromise<PaginatedResponse<Reaction>>

getUserReaction

Checks what reaction (if any) a specific user has left on a comment.
string
required
The Sublay comment ID.
string
required
The Sublay user ID to check.
ReturnsPromise<{ reactionType: ReactionType | null }>