Skip to main content

Overview

Returns a function to submit a content report on behalf of the authenticated user. Pass targetType: "comment", targetType: "entity", or targetType: "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 report is resolved — dismissed or actioned by a moderator, or auto-closed by the system — 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. Only content users posted can be reported: content with no author (the app’s own, or a deleted account’s) answers 400 report/no-author. Content its author deleted, or a moderator removed, can’t be reported either (404 report/target-not-found). When its author deletes content, or their account is deleted, its open report is closed automatically (status: "auto-closed").
Requires an authenticated user.

Usage Example

Parameters

"comment" | "entity" | "message"
required
The target type this hook instance will report against. Determines the shape of the returned function.

Returned Function

The hook returns createCommentReport, createEntityReport, or createMessageReport depending on the targetType argument. All three accept the same parameters:
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.
ReportReasonKey
required
The reason for the report. Must be one of the following keys: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.
string | null
Optional free-text elaboration on the reason. An empty string is stored as null.

Returns

The returned function returns Promise<CreateReportResponse> — the user’s own report of the target:
It is never the shared report other reporters joined, and it is the same record whether this call filed it or the user had already reported the open report. See Create Report.

Notes

  • If the target has an open report this user already filed, the function resolves with that existing report instead of filing a second one. 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; 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.