Skip to main content
This page covers the moderation and administrative functions on the spaces module: report handling, content moderation actions, and community rules management.

Reports

handleSpaceReport

Handles a report filed in a space, whatever was reported: an entity, a comment or a chat message in the space’s conversation (PATCH /spaces/:spaceId/reports/:reportId). The server reads the reported content and its author from the report, so the call names neither. See Handle Report for every rule and error.
string
required
The Sublay space ID where the report was filed.
string
required
The user the request acts as: they must be a moderator or admin of the space, and the action is recorded as theirs.
string
required
The Sublay report ID.
SpaceReportAction[]
required
One or more actions to apply. Which ones a report takes depends on what was reported:
  • an entity report: "remove-entity", "ban-user", "dismiss"
  • a comment report: "remove-comment", "ban-user", "dismiss"
  • a chat message report: "remove-message", "ban-user", "dismiss"
An action the report’s type doesn’t take is refused with 400 report/invalid-actions, and "dismiss" can’t be combined with other actions. "ban-user" bans the author of the reported content from the space and requires reason; it is refused with 400 report/cannot-ban-self when that author is the acting user.
string
required
The resolution note stored on the report, up to 1000 characters. Required for every report type; without it (or with only whitespace) the request is refused with 400 report/missing-fields.
string
Reason for the ban, kept in the space’s ban log, up to 1000 characters. Required when actions includes "ban-user".
Returns — Promise<void>. It resolves with no value once the actions are applied. SpaceReportAction is "remove-entity" | "remove-comment" | "remove-message" | "ban-user" | "dismiss".
Reports on DM and group conversations are project-level and are resolved in the Sublay dashboard, not through this SDK.

Content Moderation

moderateSpaceEntity

Approves or removes an entity within a space. A draft can’t be moderated: it answers 404 moderation/entity-not-found, like a missing entity.
string
required
The Sublay space ID.
string
required
The user the request acts as: they must be a moderator or admin of the space, and the action is recorded as theirs.
string
required
The Sublay entity ID to moderate.
string
required
"approve" — makes the entity visible, or "remove" — hides/removes it from the space.
string
Optional reason for the moderation action, stored for audit purposes.
Returns — Promise<{ moderationStatus: "approved" | "removed" | null }>: the status after the request. Content its owner deleted takes no moderation change and answers with its existing status, which can be null.

setSpaceEntityNsfw

Sets the NSFW own-flag on an entity within a space — including other users’ entities. This is a separate axis from moderateSpaceEntity: it labels the entity (nsfw), it does not approve/remove it. Requires the acting user to be an admin or moderator of the space. A draft can’t be flagged: it answers 404 moderation/entity-not-found, like a missing entity.
string
required
The Sublay space ID containing the entity.
string
required
The user the request acts as: they must be a moderator or admin of the space, and the action is recorded as theirs.
string
required
The Sublay entity ID to flag or unflag.
boolean
required
The NSFW own-flag to set on the entity.
Returns — Promise<{ nsfw: boolean }>

moderateSpaceComment

Approves or removes a comment within a space.
string
required
The Sublay space ID.
string
required
The user the request acts as: they must be a moderator or admin of the space, and the action is recorded as theirs.
string
required
The Sublay comment ID to moderate.
string
required
"approve" or "remove".
string
Optional reason for the moderation action.
Returns — Promise<{ moderationStatus: "approved" | "removed" | null }>: the status after the request. Content its owner deleted takes no moderation change and answers with its existing status, which can be null.

Rules

Rules are community guidelines displayed to members. They are ordered and each consists of a title and optional description.

fetchManyRules

Fetches all rules for a space. The rules of a space the viewer can’t see are answered 404 space/not-found.
string
required
The Sublay space ID.
string
Read as this user: exactly what their own access token would get. Omit it for the anonymous view.
Returns — Promise<FetchManyRulesResponse>

fetchRule

Fetches a single rule by its ID. A rule of a space the viewer can’t see is answered 404 space/not-found.
string
required
The Sublay space ID.
string
required
The Sublay rule ID.
string
Read as this user: exactly what their own access token would get. Omit it for the anonymous view.
Returns — Promise<Rule>

createRule

Creates a new rule for a space.
string
required
The Sublay space ID.
string
required
The user the request acts as: they must be an admin of the space, and the action is recorded as theirs.
string
required
Short title for the rule.
string | null
Extended explanation of the rule.
Returns — Promise<Rule>

updateRule

Updates an existing rule’s title or description.
string
required
The Sublay space ID.
string
required
The user the request acts as: they must be an admin of the space, and the action is recorded as theirs.
string
required
The Sublay rule ID to update.
string
New title.
string | null
New description. null clears it.
Returns — Promise<Rule>

deleteRule

Deletes a rule from a space.
string
required
The Sublay space ID.
string
required
The user the request acts as: they must be an admin of the space, and the action is recorded as theirs.
string
required
The Sublay rule ID to delete.
Returns — Promise<void>. It resolves with no value once the rule is deleted.

reorderRules

Sets the display order of all rules for a space by providing an ordered array of rule IDs.
string
required
The Sublay space ID.
string
required
The user the request acts as: they must be an admin of the space, and the action is recorded as theirs.
string[]
required
Complete ordered array of all rule IDs for the space.
Returns — Promise<Rule[]> — the full list of rules in their new order.