Skip to main content
Fetch Comments by User
Requires the comments bundle. A project without the comments bundle returns 403 database/tables-not-available. See Bundles.
Returns a user’s comments as one flat list — top-level comments and replies alike, across every entity — cursor-paginated. Use it for profile pages and activity views. To render a discussion, use Fetch Many Comments instead. Authentication is optional. The history is read as the caller: the signed-in user, or — with a service key — the user named in actingUserId. Without one (no user token, or a key without actingUserId) the request is anonymous: deleted and moderator-removed comments are left out, no block rule applies, isAuthorBlocked and isUnavailable are always false, and userReaction isn’t populated. Moderation details (moderationReason, moderatedById, moderatedByType) follow the same reader: a key with actingUserId gets exactly what that user’s own token would get, and a key naming nobody gets the anonymous view, with no moderation details. An unknown userId returns an empty page. What’s in the list:
  • Deleted comments are left out.
  • Moderator-removed comments are left out of other people’s history. In the caller’s own history they are included in full, marked moderationStatus: "removed".
  • Reading: comments on entities in spaces the caller can’t read (see who can read content) are left out, the user’s own included, and the page and hasMore count only what’s left. A service key without actingUserId reads as a signed-out caller, so comments on entities in members-only and private spaces are left out; name a member in actingUserId to include them.
  • Blocks: comments by a user the caller is block-edged with are left out by default (see blockedFilter). Comments on an entity whose author has blocked the caller are left out too — except the caller’s own (see Your own comments on an unavailable entity).

Path Parameters

string
required
The Sublay user ID (UUID) of the user whose comments to list.

Query Parameters

Acting user

string
Service key only: the user this request acts as, who reads the history. Leave it out to read anonymously. A user token always acts as its own user and must not send it, and neither may a request with no credentials (400 comment/acting-user-not-allowed). With a key, the response is exactly what that user’s own token would get: the rules below (own removed comments, blocks, blockedFilter, the isAuthorBlocked / isUnavailable flags and userReaction) and the moderation details apply from that user’s perspective.

Filtering

string
Only comments on this entity.
string
Only comments on entities with this exact sourceId. none returns comments on entities with no source. Left out, or sent empty, comments on entities from any source. null and undefined are refused with 400 comment/unsupported-param (see Saying “no value”). Applied whether or not include contains entity. On a project without the entities bundle, a request with sourceId returns an empty page.
string
default:"exclude"
How comments by users the caller is block-edged with are treated. "exclude" (default) leaves them out. "include-outbound-blocked" re-includes comments by users the caller themselves blocked — returned in full and marked isAuthorBlocked: true — and never surfaces content from users who blocked the caller. Has no effect when the moderation bundle is not installed.

Pagination

number
default:"10"
Comments per batch. A whole number of at least 1 — 0, a negative number or a non-integer value returns 400 comment/invalid-query. Values above 100 are treated as 100.
string
Leave it out on the first request (an empty cursor is treated the same way), then pass pagination.nextCursor from the previous response. Must be sent with the same sortBy, sortDir and sortByReaction it was created under. Cursors work as on the thread endpoint — see Cursors.

Sorting

string
default:"createdAt"
createdAt, top (raw count of sortByReaction) or controversial — the same meanings as on Fetch Many Comments.
string
default:"desc"
asc or desc (either case). Applies to createdAt and top. Not accepted with "controversial", which ranks one way only (most controversial first): sending it returns 400 comment/invalid-query.
string
default:"upvote"
With sortBy=top only: the reaction to rank by (upvote, downvote, like, love, wow, sad, angry, funny). Sending it with any other sortBy returns 400.

Optional associations

string
Associations to include in each comment, as a comma-separated value (include=user,entity) or repeated params. Values:
  • user — the comment author, with the avatar file URLs
  • entity — the entity the comment is on, as its stored record: the fields an entity fetch computes or joins (such as commentsCount, userReaction and nsfwEffective) are not included — see The included entity; null when the entity isn’t available to the caller (for example, removed by a moderator) — the comment is still returned
  • space — the entity’s space, as entity.space (also includes entity); when entity is null there is no space
  • parent — parentComment, for replies; null when the parent no longer exists or is on another entity
  • grants — the reputation-grant summary
  • files — the comment’s images and files, in upload order, images with their variants. A placeholder (a deleted, removed or unavailable comment) has files: []. Requires the files-images bundle
include never changes which comments are returned. Matching ignores case; an unknown value returns 400 comment/invalid-query.

Space-scoped reputation

This endpoint accepts the opt-in reputation params, resolved against each comment’s space. They add a spaceReputation field to each populated author user, alongside the always-present reputation total. Only spaces the viewer can read count: a space they can’t read reads 0 (see Who sees space reputation). Requires the reputation bundle. See the Reputation data model.

Response

Comment[]
The user’s comments, in sort order. Each item is a Comment, with isAuthorBlocked and isUnavailable flags. No comment carries nested replies.
string | null
Pass this as cursor to get the next batch. null when there’s nothing more.
boolean
Whether more comments exist after this batch. Exact.
An embedded parentComment follows the same rules as everywhere else: a deleted or removed parent is a placeholder, and a parent whose author blocked the caller is a placeholder with isUnavailable: true.

Your own comments on an unavailable entity

When the caller lists their own history, their comments on an entity whose author has blocked them stay in the list, so they can still find and delete them. On those comments, everything belonging to the entity’s author is blanked: entity (which carries space) and parentComment are null when requested. These comments are read-and-delete only: replying under them, reacting to them, and editing them are refused (404). They aren’t marked by a dedicated field. entity: null only means the entity isn’t available to the caller — it doesn’t say why, so it doesn’t identify these comments.

Error Responses

page isn’t supported — comments use cursor pagination. sortBy=new and sortBy=old are rejected the same way, with param: "sortBy" and a message naming the replacement: sortBy=createdAt (newest first by default) or sortBy=createdAt&sortDir=asc.
null or undefined as the value of sourceId or spaceReputationId. The error names the spelling to use instead.
Returned with code comment/invalid-params when userId isn’t a valid UUID.
Returned with code comment/invalid-query for invalid values — for example an unknown include value, limit below 1 or not a whole number, or sortByReaction without sortBy=top.
A user token, or a request with no credentials, sent actingUserId, even naming its own user. Only a service key names the user it acts as; a user token always acts as its own user.
Returned when a service key names an actingUserId that isn’t a user in this project.

See Also