2016-07-12 18:22:33 +02:00
# 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.
2023-06-07 14:16:29 +02:00
openapi : 3.1 .0
2015-11-05 19:11:20 +01:00
info :
2023-06-07 14:16:29 +02:00
title : Matrix Client-Server Room Membership API for third-party identifiers
version : 1.0 .0
2015-11-05 19:11:20 +01:00
paths :
"/rooms/{roomId}/invite" :
post :
summary : Invite a user to participate in a particular room.
description : |-
*Note that there are two forms of this API, which are documented separately.
This version of the API does not require that the inviter know the Matrix
2023-03-08 10:58:29 +01:00
identifier of the invitee, and instead relies on third-party identifiers.
2018-08-31 23:03:48 +02:00
The homeserver uses an identity server to perform the mapping from
2023-03-08 10:58:29 +01:00
third-party identifier to a Matrix identifier. The other is documented in the*
2021-10-12 19:07:01 +02:00
[ joining rooms section](/client-server-api/#post_matrixclientv3roomsroomidinvite).
2015-11-05 19:11:20 +01:00
This API invites a user to participate in a particular room.
They do not start participating in the room until they actually join the
room.
Only users currently in a particular room can invite other users to
join that room.
2018-08-31 23:03:48 +02:00
If the identity server did know the Matrix user identifier for the
2023-03-08 10:58:29 +01:00
third-party identifier, the homeserver will append a `m.room.member`
2015-11-05 19:11:20 +01:00
event to the room.
2018-08-31 23:03:48 +02:00
If the identity server does not know a Matrix user identifier for the
2023-03-08 10:58:29 +01:00
passed third-party identifier, the homeserver will issue an invitation
which can be accepted upon providing proof of ownership of the third-
2018-08-31 23:03:48 +02:00
party identifier. This is achieved by the identity server generating a
2015-11-05 19:11:20 +01:00
token, which it gives to the inviting homeserver. The homeserver will
2021-01-27 21:14:31 +01:00
add an `m.room.third_party_invite` event into the graph for the room,
2015-11-05 19:11:20 +01:00
containing that token.
2023-03-08 10:58:29 +01:00
When the invitee binds the invited third-party identifier to a Matrix
2018-08-31 23:03:48 +02:00
user ID, the identity server will give the user a list of pending
2015-11-05 19:11:20 +01:00
invitations, each containing :
- The room ID to which they were invited
- The token given to the homeserver
2018-08-31 23:03:48 +02:00
- A signature of the token, signed with the identity server's private key
2015-11-05 19:11:20 +01:00
- The matrix user ID who invited them to the room
2018-08-31 23:03:48 +02:00
If a token is requested from the identity server, the homeserver will
2021-01-27 21:14:31 +01:00
append a `m.room.third_party_invite` event to the room.
2017-08-03 01:19:34 +02:00
operationId : inviteBy3PID
2015-11-05 19:11:20 +01:00
security :
- accessToken : [ ]
parameters :
- in : path
name : roomId
description : The room identifier (not alias) to which to invite the user.
required : true
2023-06-07 14:16:29 +02:00
example : "!d41d8cd:matrix.org"
2015-11-05 19:11:20 +01:00
schema :
2023-06-07 14:16:29 +02:00
type : string
requestBody :
content :
application/json :
schema :
type : object
example : {
2015-11-05 19:11:20 +01:00
"id_server": "matrix.org" ,
2019-08-28 23:43:47 +02:00
"id_access_token": "abc123_OpaqueString" ,
2015-11-05 19:11:20 +01:00
"medium": "email" ,
2015-11-09 18:30:18 +01:00
"address": "cheeky@monkey.com"
2015-11-05 19:11:20 +01:00
}
2023-06-07 14:16:29 +02:00
properties :
id_server :
type : string
description : The hostname+port of the identity server which should be used for
third-party identifier lookups.
id_access_token :
type : string
description : |-
An access token previously registered with the identity server. Servers
can treat this as optional to distinguish between r0.5-compatible clients
and this specification version.
medium :
type : string
description : |-
The kind of address being passed in the address field, for example
`email` (see [the list of recognised values](/appendices/#3pid-types)).
address :
type : string
description : The invitee's third-party identifier.
required :
- id_server
- id_access_token
- medium
- address
required : true
2015-11-05 19:11:20 +01:00
responses :
2023-06-07 14:16:29 +02:00
"200" :
2015-11-05 19:11:20 +01:00
description : The user has been invited to join the room.
2023-06-07 14:16:29 +02:00
content :
application/json :
schema :
type : object
examples :
response :
value : {}
"403" :
2015-11-05 19:11:20 +01:00
description : |-
2021-01-27 21:14:31 +01:00
You do not have permission to invite the user to the room. A meaningful `errcode` and description error text will be returned. Example reasons for rejections are :
2015-11-05 19:11:20 +01:00
- The invitee has been banned from the room.
- The invitee is already a member of the room.
- The inviter is not currently in the room.
- The inviter's power level is insufficient to invite users to the room.
2023-06-07 14:16:29 +02:00
content :
application/json :
schema :
$ref : definitions/errors/error.yaml
examples :
response :
value : {
"errcode": "M_FORBIDDEN" ,
"error": "@cheeky_monkey:matrix.org is banned from the room"
}
"429" :
2015-11-05 19:11:20 +01:00
description : This request was rate-limited.
2023-06-07 14:16:29 +02:00
content :
application/json :
schema :
$ref : definitions/errors/rate_limited.yaml
2015-12-07 13:45:13 +01:00
tags :
- Room membership
2023-06-07 14:16:29 +02:00
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