# Copyright 2016 OpenMarket Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. openapi: 3.1.0 info: title: Matrix Client-Server Room Banning API version: 1.0.0 paths: "/rooms/{roomId}/ban": post: summary: Ban a user in the room. description: |- 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. operationId: ban security: - accessToken: [] parameters: - in: path name: roomId description: The room identifier (not alias) from which the user should be banned. required: true example: "!e42d8c:matrix.org" schema: type: string requestBody: content: application/json: schema: type: object example: { "reason": "Telling unfunny jokes", "user_id": "@cheeky_monkey:matrix.org" } properties: user_id: type: string description: The fully qualified user ID of the user being banned. reason: x-addedInMatrixVersion: "1.1" type: string description: The reason the user has been banned. This will be supplied as the `reason` on the target's updated [`m.room.member`](/client-server-api/#mroommember) event. required: - user_id required: true responses: "200": description: The user has been kicked and banned from the room. content: application/json: schema: type: object examples: response: value: {} "403": description: |- 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. content: application/json: schema: $ref: definitions/errors/error.yaml examples: response: value: { "errcode": "M_FORBIDDEN", "error": "You do not have a high enough power level to ban from this room." } tags: - Room membership "/rooms/{roomId}/unban": post: summary: Unban a user from the room. description: |- Unban a user from the room. This allows them to be invited to the room, and join if they would otherwise be allowed to join according to its join rules. The caller must have the required power level in order to perform this operation. operationId: unban security: - accessToken: [] parameters: - in: path name: roomId description: The room identifier (not alias) from which the user should be unbanned. required: true example: "!e42d8c:matrix.org" schema: type: string requestBody: content: application/json: schema: type: object example: { "user_id": "@cheeky_monkey:matrix.org", "reason": "They've been banned long enough" } properties: user_id: type: string description: The fully qualified user ID of the user being unbanned. reason: x-addedInMatrixVersion: "1.1" type: string description: |- Optional reason to be included as the `reason` on the subsequent membership event. required: - user_id required: true responses: "200": description: The user has been unbanned from the room. content: application/json: schema: type: object examples: response: value: {} "403": description: |- You do not have permission to unban the user from the room. A meaningful `errcode` and description error text will be returned. Example reasons for rejections are: - The unbanner's power level is insufficient to unban users from the room. content: application/json: schema: $ref: definitions/errors/error.yaml examples: response: value: { "errcode": "M_FORBIDDEN", "error": "You do not have a high enough power level to unban from this room." } tags: - Room membership servers: - url: "{protocol}://{hostname}{basePath}" variables: protocol: enum: - http - https default: https hostname: default: localhost:8008 basePath: default: /_matrix/client/v3 components: securitySchemes: $ref: definitions/security.yaml