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

# Create report

> Submit a report against an entity, comment, or chat message

## Overview

Returns a function to submit a content report on behalf of the authenticated user. Pass `type: "comment"`, `type: "entity"`, or `type: "message"` when calling the hook — the returned function is pre-configured for that target type.

If the same target already has an **open** report, the user's report is appended to it (reports are deduplicated per user, so reporting the same target twice has no additional effect).

Once a moderator resolves a report — dismissed or actioned — it is closed. A later report of that same target opens a **fresh** report rather than reopening the closed one, so previously-dismissed content can be re-reported and returns to the moderation queue.

<Note>Requires an authenticated user.</Note>

## Usage Example

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

function ReportEntityButton({ entityId }: { entityId: string }) {
  const createEntityReport = useCreateReport({ type: "entity" });

  const handleReport = async () => {
    await createEntityReport({
      targetId: entityId,
      reason: "spam",
    });
    alert("Report submitted.");
  };

  return <button onClick={handleReport}>Report</button>;
}
```

## Parameters

<ParamField path="type" type="&#x22;comment&#x22; | &#x22;entity&#x22; | &#x22;message&#x22;" required>
  The target type this hook instance will report against. Determines the shape of the returned function.
</ParamField>

## Returned Function

The hook returns `createCommentReport`, `createEntityReport`, or `createMessageReport` depending on the `type` argument. All three accept the same parameters:

<ParamField body="targetId" type="string" required>
  The ID of the comment, entity, or chat message being reported. For messages
  this is the message id — the conversation is resolved server-side, so no
  `conversationId` is needed.
</ParamField>

<ParamField body="reason" type="ReportReasonKey" required>
  The reason for the report. Must be one of the following keys:

  | Key | Label |
  | - | - |
  | `spam` | It's spam |
  | `inappropriateContent` | Contains inappropriate content |
  | `harassment` | It's harassment or bullying |
  | `misinformation` | Spreads false information |
  | `hateSpeech` | Contains hate speech or symbols |
  | `violence` | Promotes violence or dangerous behavior |
  | `illegalActivity` | Promotes illegal activity |
  | `selfHarm` | Promotes self-harm or suicide |
  | `other` | Other |

  These are enforced by the API: any other value is rejected with
  `report/invalid-body`. Use `other` plus `details` for anything the taxonomy
  doesn't cover.
</ParamField>

<ParamField body="details" type="string">
  Optional free-text elaboration on the reason.
</ParamField>

## Returns

The returned function returns `Promise<void>`. It resolves when the report is accepted (whether created or appended to an existing one).

## Notes

* If the target has an open report this user already filed, the server returns `200` with code `report/already-reported` without error. The hook function resolves normally in this case. After that report is resolved, the same user may report the target again.
* You cannot report your own content — the API rejects it with `report/self-report`.
* Reporting a message requires membership of its conversation; a non-member gets `chat/not-a-member`.
* Where a message report lands depends on the conversation: reports on **space** conversations reach space moderators via [`useFetchModeratedReports`](/v8/hooks/reports/use-fetch-moderated-reports); reports on **DMs and group chats** have no space, so they are project-level and appear only in the Sublay dashboard.
* Reports are scoped to the space the content belongs to, enabling space moderators to action them. See [`useFetchModeratedReports`](/v8/hooks/reports/use-fetch-moderated-reports).


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