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

# Handle Message Report

> Resolve a reported chat message within a space

Resolves a filed report against a chat message in a space's integrated conversation. Requires the caller to be a moderator or admin of that space.

## Path Parameters

<ParamField path="spaceId" type="string" required>
  UUID of the space.
</ParamField>

<ParamField path="reportId" type="string" required>
  UUID of the chat message report to resolve.
</ParamField>

## Body Parameters

<ParamField body="actions" type="string[]" required>
  One or more actions to take. Must contain at least one value. Available actions:

  * `"remove-message"` — marks the reported message as removed via moderation
  * `"ban-user"` — bans the author of the reported content from the space and the child spaces where they are an active member, and ends their membership of those spaces' chats, so they can no longer post to or receive them (they keep read access to messages from before the ban). The same rules as [Ban Member](/v8/api-reference/spaces/membership/ban-member) apply, with the same errors: a moderator cannot ban a moderator or admin, only the space creator can ban an admin, and the last admin of a space cannot be banned. A refused ban rolls back the whole request, including any removal in the same request. An author who is not a member of the space (for example, who left before the report was handled) is banned all the same: the ban is kept as a banned membership, so they can't join the space or its child spaces. If the author is already banned in the space, the ban is not repeated and the rest of the request still applies; it is still re-applied to their active memberships in child spaces, under the same rules (requires `reason`)
  * `"dismiss"` — dismisses the report without action (cannot be combined with other actions)
</ParamField>

<ParamField body="messageId" type="string">
  Optional. The message acted on is the report's own; if sent, `messageId` must be that message.
</ParamField>

<ParamField body="summary" type="string">
  Optional summary of the action taken. Stored as `actionTaken` on the report record.
</ParamField>

<ParamField body="reason" type="string">
  Reason for the ban, kept in the space's ban log. Required when `ban-user` is included in `actions`.
</ParamField>

<ParamField body="actingUserId" type="string">
  Service or master key only: the moderator the key acts for. The request then has exactly that moderator's permissions, so it is refused if they cannot moderate the space or are not allowed the ban.
</ParamField>

## Response

Returns `200 OK`:

```json theme={null}
{ "message": "Report handled successfully.", "code": "report/handled" }
```

## Error Responses

<AccordionGroup>
  <Accordion title="Report Not Found — 404">
    ```json theme={null}
    { "error": "Report not found.", "code": "report/not-found" }
    ```
  </Accordion>

  <Accordion title="Report Not in Space — 404">
    ```json theme={null}
    { "error": "Report does not belong to this space.", "code": "report/not-found-in-space" }
    ```
  </Accordion>

  <Accordion title="Message Not Found — 404">
    ```json theme={null}
    { "error": "Message not found.", "code": "chat/message-not-found" }
    ```
  </Accordion>

  <Accordion title="User Not Found — 404">
    ```json theme={null}
    { "error": "User not found.", "code": "report/user-not-found" }
    ```
  </Accordion>

  <Accordion title="Invalid Action Combination — 400">
    ```json theme={null}
    { "error": "Cannot combine 'dismiss' with other actions.", "code": "report/invalid-actions" }
    ```
  </Accordion>

  <Accordion title="Missing Reason — 400">
    ```json theme={null}
    { "error": "reason is required for banning a user", "code": "report/missing-fields" }
    ```
  </Accordion>

  <Accordion title="userId Not Accepted — 400">
    `ban-user` bans the author of the reported content, so the request takes no `userId`.

    ```json theme={null}
    { "error": "userId is not accepted: ban-user bans the author of the reported content.", "code": "report/user-id-not-accepted" }
    ```
  </Accordion>

  <Accordion title="No Author — 400">
    The reported content has no author to ban (for example, its author deleted their account).

    ```json theme={null}
    { "error": "The reported content has no author to ban.", "code": "report/no-author" }
    ```
  </Accordion>

  <Accordion title="Target Mismatch — 400">
    The `messageId` sent does not match what the report is about, or the report is about another kind of content.

    ```json theme={null}
    { "error": "The supplied target id does not match the target of this report", "code": "report/target-mismatch" }
    ```

    ```json theme={null}
    { "error": "This report targets a comment, not a message", "code": "report/target-type-mismatch" }
    ```
  </Accordion>

  <Accordion title="Not a Moderator — 403">
    The user named by `actingUserId` cannot moderate this space.

    ```json theme={null}
    { "error": "Moderator access required", "code": "space/moderator-required" }
    ```
  </Accordion>

  <Accordion title="Acting User Not Found — 400">
    ```json theme={null}
    { "error": "Acting user not found.", "code": "chat/acting-user-not-found" }
    ```
  </Accordion>

  <Accordion title="Unauthorized — 403">
    A user token sent an `actingUserId` other than its own user.

    ```json theme={null}
    { "error": "Unauthorized", "code": "chat/unauthorized" }
    ```
  </Accordion>
</AccordionGroup>


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