> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sublay.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Moderation

> Moderate content and handle reports within a space

Space moderators and admins can review and act on content in their space. Moderation includes directly approving or removing entities and comments, as well as handling reports submitted by members — on entities, comments, and chat messages in space conversations.

## Direct Moderation

Moderators can act on specific entities or comments without a report being filed:

```tsx theme={null}
import { useModerateSpaceEntity, useModerateSpaceComment } from "@sublay/react-js";

const moderateEntity = useModerateSpaceEntity();
const moderateComment = useModerateSpaceComment();

// Approve or remove an entity
await moderateEntity({ spaceId, entityId, action: "approve" });
await moderateEntity({ spaceId, entityId, action: "remove" });

// Approve or remove a comment
await moderateComment({ spaceId, commentId, action: "approve" });
await moderateComment({ spaceId, commentId, action: "remove" });
```

<Note>Both hooks require the caller to be a moderator or admin of the space.</Note>

## Handling Reports

When members report content, moderators receive those reports and can resolve them:

```tsx theme={null}
import {
  useHandleSpaceEntityReport,
  useHandleSpaceCommentReport,
  useHandleSpaceChatReport,
} from "@sublay/react-js";

const handleEntityReport = useHandleSpaceEntityReport();
const handleCommentReport = useHandleSpaceCommentReport();
const handleChatReport = useHandleSpaceChatReport();

// `actions` is an array — you can combine a removal with a ban in one call.
await handleEntityReport({
  spaceId,
  reportId,
  entityId,
  actions: ["dismiss"],
  summary: "No violation found",
});

await handleCommentReport({
  spaceId,
  reportId,
  commentId,
  actions: ["remove-comment"],
  summary: "Removed for harassment",
});

await handleChatReport({
  spaceId,
  reportId,
  messageId,
  actions: ["remove-message", "ban-user"],
  reason: "Harassment",
  summary: "Removed and banned",
});
```

Each target type has its own removal action — `remove-entity`, `remove-comment`,
`remove-message` — alongside the shared `ban-user` and `dismiss`.

<Note>
  `ban-user` is **space-scoped**: it bans the user from this space and the child spaces they belong to, and ends their membership of those spaces' chats.
  Project-wide suspension is a dashboard action — a space moderator cannot
  suspend someone across the whole project.
</Note>

## Fetching Reports

Use `useFetchModeratedReports` to retrieve pending reports for a space:

```tsx theme={null}
import { useFetchModeratedReports } from "@sublay/react-js";

const fetchReports = useFetchModeratedReports();
const reports = await fetchReports({ spaceId });
```

<Tip>Reports appear in the list until they are resolved. Filter by `status: "pending"` in your UI to show actionable items.</Tip>

## Chat Moderation

Spaces with integrated chat also support message moderation via the API. See the [Space Chat API](/v8/api-reference/spaces/chat/get-space-conversation) for details on moderating chat messages within a space.

## Hook Reference

| Hook | Description |
| - | - |
| [`useModerateSpaceEntity`](/v8/hooks/spaces/use-moderate-space-entity) | Approve or remove an entity in a space |
| [`useModerateSpaceComment`](/v8/hooks/spaces/use-moderate-space-comment) | Approve or remove a comment in a space |
| [`useFetchModeratedReports`](/v8/hooks/reports/use-fetch-moderated-reports) | Fetch pending content reports |
| [`useHandleSpaceEntityReport`](/v8/hooks/reports/use-handle-space-entity-report) | Resolve a reported entity |
| [`useHandleSpaceCommentReport`](/v8/hooks/reports/use-handle-space-comment-report) | Resolve a reported comment |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.