---
title: "Ban a user in the room."
method: POST
path: "/_matrix/client/v3/rooms/{roomId}/ban"
tags: ["Room membership"]
---

# Ban a user in the room.

`POST /_matrix/client/v3/rooms/{roomId}/ban`

## Request

- Base URL: `https://matrix.org`
- URL: `https://matrix.org/_matrix/client/v3/rooms/{roomId}/ban`
- Auth: one of:
  - API key in query parameter `access_token`
  - HTTP bearer
- TypeScript: <https://skmtc.dev/matrix/apis/matrix-client-server-api/docs/_matrix/client/v3/rooms/:roomId/ban/post.ts> (a function with typed inputs; its response is checked against the schema)

Ban a user in the room. If the user is currently in the room, also kick them.

When a user is banned from a room, they may not join it or be invited to it until they are unbanned.

The caller must have the required power level in order to perform this operation.

## Path parameters

- `roomId` string, mx-room-id, required

## Request body

- object
  - `reason` string: The reason the user has been banned. This will be supplied as the `reason` on the target's updated [`m.room.member`](https://spec.matrix.org/v1.19/client-server-api/#mroommember) event.
  - `user_id` string, mx-user-id, required: The fully qualified user ID of the user being banned.

## Response `200`

The user has been kicked and banned from the room.

- object

## Other responses

- `403`: You do not have permission to ban the user from the room. A meaningful `errcode` and description error text will be returned. Example reasons for rejections are: - The banner is not currently in the room. - The banner's power level is insufficient to ban users from the room.

---

[API](https://skmtc.dev/matrix/apis/matrix-client-server-api.md) - [All operations](https://skmtc.dev/matrix/apis/matrix-client-server-api/llms.txt) - [OpenAPI document](https://skmtc.dev/matrix/apis/matrix-client-server-api/revisions/c7fe4072c681?raw)
