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.
ReturnsPromise<PaginatedResponse<Report>> Each Report carries id, spaceId, targetId, targetType, status, reporterCount, timestamps, and optional userReports, target, and space associations.