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

**spaceId** `string` *required*

UUID of the space.

**reportId** `string` *required*

UUID of the chat message report to resolve.

## Body Parameters

**actions** `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](https://docs.sublay.io/v7/api-reference/spaces/membership/ban-member.md) 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 (`reason` is optional)
* `"dismiss"` — dismisses the report without action (cannot be combined with other actions)

**messageId** `string`

Optional. The message acted on is the report's own; if sent, `messageId` must be that message.

**summary** `string`

Optional summary of the action taken. Stored as `actionTaken` on the report record.

**userId** `string`

Optional. The server bans the author of the reported content; if `userId` is sent, it must be that author, or the request is refused with `400 report/user-not-author`.

**reason** `string`

Reason for the ban, kept in the space's ban log. Optional; an empty reason is kept if it is left out.

**actingUserId** `string`

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

## Response

Returns `200 OK`:

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

## Error Responses

> [accordion] Report Not Found — 404
>
> ```json theme={null}
> { "error": "Report not found.", "code": "report/not-found" }
> ```

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

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

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

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

> [accordion] Not the Author — 400
>
> The `userId` sent is not the author of the reported content.
>
> ```json theme={null}
> { "error": "userId must be the author of the reported content.", "code": "report/user-not-author" }
> ```

> [accordion] 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] 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] 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] Acting User Not Found — 400
>
> ```json theme={null}
> { "error": "Acting user not found.", "code": "chat/acting-user-not-found" }
> ```

> [accordion] Unauthorized — 403
>
> A user token sent an `actingUserId` other than its own user.
>
> ```json theme={null}
> { "error": "Unauthorized", "code": "chat/unauthorized" }
> ```


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