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.
2015-11-05 19:11:20 +01:00
swagger : '2.0'
info :
2023-03-08 10:58:29 +01:00
title : "Matrix Client-Server Room Membership API for third-party identifiers"
2015-11-05 19:11:20 +01:00
version : "1.0.0"
host : localhost:8008
schemes :
- https
- http
2021-10-12 19:07:01 +02:00
basePath : /_matrix/client/v3
2015-11-05 19:11:20 +01:00
consumes :
- application/json
produces :
- application/json
securityDefinitions :
2016-05-03 14:57:16 +02:00
$ref : definitions/security.yaml
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.
2015-11-05 19:11:20 +01:00
2017-08-03 01:19:34 +02:00
operationId : inviteBy3PID
2015-11-05 19:11:20 +01:00
security :
- accessToken : [ ]
parameters :
- in : path
type : string
name : roomId
description : The room identifier (not alias) to which to invite the user.
required : true
x-example : "!d41d8cd:matrix.org"
- in : body
name : body
required : true
schema :
type : object
2017-09-26 18:53:28 +02:00
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
}
properties :
id_server :
type : string
2023-03-08 10:58:29 +01:00
description : The hostname+port of the identity server which should be used for third-party identifier lookups.
2019-08-28 23:43:47 +02:00
id_access_token :
type : string
2019-09-05 21:53:58 +02:00
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.
2015-11-05 19:11:20 +01:00
medium :
type : string
2023-01-30 12:36:51 +01:00
description : |-
The kind of address being passed in the address field, for example
`email` (see [the list of recognised values](/appendices/#3pid-types)).
2015-11-05 19:11:20 +01:00
address :
type : string
2023-03-08 10:58:29 +01:00
description : The invitee's third-party identifier.
2019-08-28 23:43:47 +02:00
required : [ "id_server" , "id_access_token" , "medium" , "address" ]
2015-11-05 19:11:20 +01:00
responses :
200 :
description : The user has been invited to join the room.
examples :
2017-09-26 18:53:28 +02:00
application/json : {
}
2015-11-05 19:11:20 +01:00
schema :
type : object
403 :
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.
examples :
2017-09-26 18:53:28 +02:00
application/json : {
"errcode": "M_FORBIDDEN", "error": "@cheeky_monkey:matrix.org is banned from the room" }
2018-07-04 21:51:17 +02:00
schema :
"$ref": "definitions/errors/error.yaml"
2015-11-05 19:11:20 +01:00
429 :
description : This request was rate-limited.
schema :
2018-07-04 21:45:34 +02:00
"$ref": "definitions/errors/rate_limited.yaml"
2015-12-07 13:45:13 +01:00
tags :
- Room membership