Knock on a room, requesting permission to join.

POST {{baseUrl}}/knock/:roomIdOrAlias?server_name=matrix.org,elsewhere.ca

Note that this API takes either a room ID or alias, unlike other membership APIs.

This API knocks on the room to ask for permission to join, if the user is allowed to knock on the room. Acceptance of the knock happens out of band from this API, meaning that the client will have to watch for updates regarding the acceptance/rejection of the knock.

If the room history settings allow, the user will still be able to see history of the room while being in the knock state. The user will have to accept the invitation to join the room (acceptance of knock) to see messages reliably. See the /join endpoints for more information about history visibility to the user.

The knock will appear as an entry in the response of the /sync API.

Request Params

KeyDatatypeRequiredDescription
server_namestringThe servers to attempt to knock on the room through. One of the servers
must be participating in the room.

Request Body

{"reason"=>"Looking for support"}

HEADERS

KeyDatatypeRequiredDescription
Content-Typestring

RESPONSES

status: OK

{"room_id":"!d41d8cd:matrix.org"}