Skip to main content
The reports module lets end users file reports against entities and comments, and lets moderators read the moderated reports queue.

createReport

Files a report against an entity or comment. Repeat reports of the same target are deduplicated.
const { message, code } = await sublay.reports.createReport({
  targetType: "comment",
  targetId: "cmt_abc123",
  reason: "spam",
  details: "Posting the same link repeatedly.",
});
targetType
"entity" | "comment"
required
The kind of content being reported.
targetId
string
required
The ID of the entity or comment being reported.
reason
string
required
The reason for the report.
details
string
Additional context about the report.
ReturnsPromise<{ message: string; code: "report/created" | "report/updated" | "report/already-reported" }>

fetchModeratedReports

Fetches a paginated list of moderated reports, with optional filters.
const { data, pagination } = await sublay.reports.fetchModeratedReports({
  status: "pending",
  sortBy: "new",
  page: 1,
  limit: 20,
});
spaceId
string
Restrict results to reports within a specific space.
targetType
"entity" | "comment"
Restrict results to reports of a specific target type.
status
"pending" | "on-hold" | "escalated" | "dismissed" | "actioned"
Restrict results to reports with a specific moderation status.
sortBy
"new" | "old"
Sort order for the returned reports.
page
number
The page of results to fetch.
limit
number
The number of reports to return per page.
spaceReputationId
string
Opts each reported target’s author into a spaceReputation number. Accepts a space <uuid>, "none" (the project-general bucket), or "context" (the space derived from the request context — per-row from the space each report belongs to). The empty string and the legacy general / null aliases are rejected. See Reputation.
spaceReputationDescendants
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<Report>> Each Report carries id, spaceId, targetId, targetType, status, reporterCount, timestamps, and optional userReports, target, and space associations.