---
title: "Deletes all of a user's messages."
method: POST
path: "/user/{sessionId}/deleteMessages"
tags: ["Users"]
---

# Deletes all of a user's messages.

`POST /user/{sessionId}/deleteMessages`

Deletes all messages posted by the given user from one or more rooms, or from all rooms on the server.

The caller must have moderator permission in all given rooms, or be a server moderator for global server deletion.

## Path parameters

- `sessionId` string, required — The Session ID is the fixed byte `05` followed by the 32-byte X25519 pubkey used to sign and encrypt messages.

## Request body

- object
  - `rooms` RoomToken[] — List of room tokens from which messages should be deleted. The invoking user must be a moderator (or admin) or all of the given rooms. Exclusive of `global`.
  - `global` boolean — If true then delete all messages made by this user from all rooms on the server. The invoking user must be a server-level moderator or admin. In particular, this does *not* allow a non-server moderator to delete the user's messages from all rooms they moderate. Exclusive of `rooms`.

## Response `200`

Messages deleted successfully.

- object
  - `id` string — The Session ID is the fixed byte `05` followed by the 32-byte X25519 pubkey used to sign and encrypt messages.
  - `messages_deleted` integer — The number of messages deleted.

## Other responses

- `403` — Permission denied. The user attempting to set the ban does not have moderator permissions for one or more of the given rooms (or server moderator permission for a global ban).

---

[API](https://skmtc.dev/oxen-io/apis/session-open-group-server.md) · [All operations](https://skmtc.dev/oxen-io/apis/session-open-group-server/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/oxen-io/session-open-group-server/revisions/39a4ebc32b95/schema)
