> ## 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.

# Fetch moderated reports

> Fetch content reports for spaces the current user moderates

export const SpaceReputationParams = ({variant = "context", field = "path"}) => {
  const isUser = variant === "user";
  return <>
      <ParamField {...{
    [field]: "spaceReputation",
    type: "object"
  }}>
        Opt-in. Adds a <code>spaceReputation</code> number to each returned user,
        scoped to a single space. Requires the <code>reputation</code> bundle.
        The <code>reputation</code> total is always present regardless;{" "}
        <code>spaceReputation</code> is purely additive and only appears when you
        pass this object. <strong>This object is the primary form</strong> — it
        replaces the deprecated flat props below. See the{" "}
        <a href="/v8/data-models/reputation">Reputation data model</a> for the
        full contract.

        <Expandable title="spaceReputation">
          {isUser ? <ParamField name="spaceId" type="string | &quot;none&quot;" required>
              Which bucket to read. A space <strong><code>&lt;uuid&gt;</code></strong> reads that
              space's bucket; <strong><code>"none"</code></strong> reads the
              project-general (space-less) bucket.{" "}
              <strong><code>"context"</code> is rejected (400)</strong> on this
              endpoint — there is no space context to derive. The empty string
              and the legacy <code>general</code> / <code>null</code> aliases are
              also rejected. Missing buckets read as <code>0</code>.
            </ParamField> : <ParamField name="spaceId" type="string | &quot;none&quot; | &quot;context&quot;" required>
              Which bucket to read. One of: a space <strong><code>&lt;uuid&gt;</code></strong>{" "}
              (that space's bucket), <strong><code>"none"</code></strong> (the
              project-general, space-less bucket), or{" "}
              <strong><code>"context"</code></strong> (the space derived from the
              request context — resolved per-row on lists, or the single space on
              member/team/conversation surfaces). The empty string and the legacy{" "}
              <code>general</code> / <code>null</code> aliases are rejected (400).
              Missing buckets read as <code>0</code>.
            </ParamField>}
          <ParamField name="includeDescendants" type="boolean">
            Only honored when <code>spaceId</code> is an explicit space <code>&lt;uuid&gt;</code>.
            When <code>true</code>, <code>spaceReputation</code> is the{" "}
            <strong>subtree sum</strong> — the named space plus all of its
            descendant spaces (the root space's own bucket included). Ignored for{" "}
            <code>"none"</code>; not allowed with <code>"context"</code>.
          </ParamField>
        </Expandable>
      </ParamField>

      {isUser ? <ParamField {...{
    [field]: "spaceReputationId",
    type: "string",
    deprecated: true
  }}>
          <strong>Deprecated</strong> — use the <code>spaceReputation</code>{" "}
          object instead. The flat form of <code>spaceReputation.spaceId</code>.
          Still accepted (the object wins if both are passed); removal is a later
          major version. Accepts a space <code>&lt;uuid&gt;</code> or <code>"none"</code> only —{" "}
          <code>"context"</code> is rejected (400) on this endpoint.
        </ParamField> : <ParamField {...{
    [field]: "spaceReputationId",
    type: "string",
    deprecated: true
  }}>
          <strong>Deprecated</strong> — use the <code>spaceReputation</code>{" "}
          object instead. The flat form of <code>spaceReputation.spaceId</code>.
          Still accepted (the object wins if both are passed); removal is a later
          major version. Accepts a space <code>&lt;uuid&gt;</code>, <code>"none"</code>, or{" "}
          <code>"context"</code>.
        </ParamField>}

      <ParamField {...{
    [field]: "spaceReputationDescendants",
    type: "boolean",
    deprecated: true
  }}>
        <strong>Deprecated</strong> — use{" "}
        <code>spaceReputation.includeDescendants</code> instead. The flat form,
        only honored alongside an explicit <code>spaceReputationId</code> <code>&lt;uuid&gt;</code>.
      </ParamField>
    </>;
};

## Overview

Returns a function to fetch content reports (entities and comments) from spaces where the current user has an `admin` or `moderator` role.

If `spaceId` is provided, returns reports for that specific space (the user must moderate it). If omitted, returns reports aggregated from **all** spaces the user moderates.

<Note>Requires an authenticated user with `admin` or `moderator` role in at least one space.</Note>

## Usage Example

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

function ModerationQueue({ spaceId }: { spaceId: string }) {
  const fetchModeratedReports = useFetchModeratedReports();
  const [reports, setReports] = useState([]);

  useEffect(() => {
    fetchModeratedReports({ spaceId, status: "pending", page: 1, limit: 20 })
      .then(res => setReports(res.data));
  }, [spaceId]);

  return (
    <ul>
      {reports.map(r => (
        <li key={r.id}>{r.targetType}: {r.reporterCount} reports</li>
      ))}
    </ul>
  );
}
```

## Parameters

<ParamField body="spaceId" type="string">
  Filter reports to a specific space. If omitted, returns reports from all spaces the user moderates.
</ParamField>

<ParamField body="targetType" type="&#x22;comment&#x22; | &#x22;entity&#x22; | &#x22;message&#x22;">
  Filter by target type.
</ParamField>

<ParamField body="status" type="&#x22;pending&#x22; | &#x22;on-hold&#x22; | &#x22;escalated&#x22; | &#x22;dismissed&#x22; | &#x22;actioned&#x22;">
  Filter by report status.
</ParamField>

<ParamField body="sortBy" type="&#x22;new&#x22; | &#x22;old&#x22;">
  Sort order. Defaults to `"new"` (newest first).
</ParamField>

<ParamField body="page" type="number">
  Page number for pagination. Defaults to `1`.
</ParamField>

<ParamField body="limit" type="number">
  Items per page. Defaults to `20`.
</ParamField>

<SpaceReputationParams variant="context" field="body" />

## Returns

Returns `Promise<PaginatedResponse<Report>>`:

```ts theme={null}
{
  data: Report[];
  pagination: {
    page: number;
    pageSize: number;
    totalPages: number;
    totalItems: number;
    hasMore: boolean;
  };
}
```

### Report object

<ResponseField name="id" type="string">UUID of the report record.</ResponseField>
<ResponseField name="projectId" type="string">Project the report belongs to.</ResponseField>
<ResponseField name="spaceId" type="string | null">Space the reported content belongs to.</ResponseField>
<ResponseField name="targetId" type="string">ID of the reported entity, comment, or chat message.</ResponseField>
<ResponseField name="targetType" type="&#x22;comment&#x22; | &#x22;entity&#x22; | &#x22;message&#x22;">Type of the reported content.</ResponseField>
<ResponseField name="reporterCount" type="number">Total number of users who have reported this target.</ResponseField>
<ResponseField name="userReports" type="array">Individual user report entries. Each includes `id`, `userId`, `reason`, `details`, and `createdAt`.</ResponseField>
<ResponseField name="status" type="string">Current moderation status: `pending`, `on-hold`, `escalated`, `dismissed`, or `actioned`.</ResponseField>
<ResponseField name="actionTaken" type="string | null">Free-text description of action taken, if any.</ResponseField>
<ResponseField name="target" type="Entity | Comment | ChatMessage | null">The reported content record (includes the author user object). Populated even if the content was soft-deleted. When `spaceReputation` is requested, the embedded author carries an added `spaceReputation` number. See [Reputation](/v8/data-models/reputation).</ResponseField>
<ResponseField name="space" type="Space | null">The space the reported content belongs to.</ResponseField>
<ResponseField name="createdAt" type="Date">When the first report for this target was submitted.</ResponseField>
<ResponseField name="updatedAt" type="Date">When the report record was last updated.</ResponseField>
<ResponseField name="deletedAt" type="Date | null">Soft-delete timestamp. `null` if the report has not been deleted.</ResponseField>

## Notes

* Message reports appear in this queue only for conversations attached to a space. DM and group chat reports have no space, so they are project-level and appear only in the Sublay dashboard — see [`useCreateReport`](/v8/hooks/reports/use-create-report).


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