# 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.
swagger:'2.0'
openapi:3.1.0
info:
title:"Matrix Client-Server Application Service Ping API"
version:"1.0.0"
host:localhost:8008
schemes:
- https
- http
basePath:/_matrix/client/v1
consumes:
- application/json
produces:
- application/json
securityDefinitions:
# Note: this is the same access_token definition used elsewhere in the client
# server API, however this expects an access token for an application service.
$ref:definitions/security.yaml
title:Matrix Client-Server Application Service Ping API
version:1.0.0
paths:
"/appservice/{appserviceId}/ping":
post:
x-addedInMatrixVersion:"1.7"
summary:|-
Ask the homeserver to ping the application service to ensure the connection works.
summary:Ask the homeserver to ping the application service to ensure the
connection works.
description:|-
This API asks the homeserver to call the
[`/_matrix/app/v1/ping`](#post_matrixappv1ping) endpoint on the
@ -48,31 +35,35 @@ paths:
operationId:pingAppservice
parameters:
- in:path
type:string
name:appserviceId
description:|-
The appservice ID of the appservice to ping. This must be the same
as the appservice whose `as_token` is being used to authenticate the
request.
required:true
x-example:"telegram"
- in:body
name:body
required:true
example:telegram
schema:
type:string
requestBody:
content:
application/json:
schema:
type:object
properties:
transaction_id:
type:string
description:|-
An optional transaction ID that is passed through to the `/_matrix/app/v1/ping` call.
example:"mautrix-go_1683636478256400935_123"
description:An optional transaction ID that is passed through to the
`/_matrix/app/v1/ping` call.
example:mautrix-go_1683636478256400935_123
required:true
security:
# again, this is the appservice's token - not a typical client's
- accessToken:[]
responses:
200:
"200":
description:The ping was successful.
content:
application/json:
schema:
type:object
properties:
@ -85,26 +76,38 @@ paths:
required:
- duration_ms
examples:
application/json:{"duration_ms": 123}
400:
description:The application service doesn't have a URL configured. The errcode is `M_URL_NOT_SET`.
response:
value:{
"duration_ms": 123
}
"400":
description:The application service doesn't have a URL configured. The errcode
is `M_URL_NOT_SET`.
content:
application/json:
schema:
$ref:"definitions/errors/error.yaml"
$ref:definitions/errors/error.yaml
examples:
application/json:{
response:
value:{
"errcode": "M_URL_NOT_SET",
"error": "Application service doesn't have a URL configured"
}
403:
description:The access token used to authenticate the request doesn't belong to an appservice, or belongs to a different appservice than the one in the path. The errcode is `M_FORBIDDEN`.
"403":
description:The access token used to authenticate the request doesn't belong to
an appservice, or belongs to a different appservice than the one in
the path. The errcode is `M_FORBIDDEN`.
content:
application/json:
schema:
$ref:"definitions/errors/error.yaml"
$ref:definitions/errors/error.yaml
examples:
application/json:{
response:
value:{
"errcode": "M_FORBIDDEN",
"error": "Provided access token is not the appservice's as_token"
}
502:
"502":
description:|-
The application service returned a bad status, or the connection failed.
The errcode is `M_BAD_STATUS` or `M_CONNECTION_FAILED`.
@ -112,6 +115,8 @@ paths:
For bad statuses, the response may include `status` and `body`
fields containing the HTTP status code and response body text
respectively to aid with debugging.
content:
application/json:
schema:
type:object
title:Error
@ -120,7 +125,9 @@ paths:
errcode:
type:string
description:An error code.
enum:[M_BAD_STATUS, M_CONNECTION_FAILED]
enum:
- M_BAD_STATUS
- M_CONNECTION_FAILED
error:
type:string
description:A human-readable error message.
@ -132,21 +139,44 @@ paths:
body:
type:string
description:The HTTP response body returned by the appservice.
example:"{\"errcode\": \"M_UNKNOWN_TOKEN\"}"
required:["errcode"]
example:'{"errcode": "M_UNKNOWN_TOKEN"}'
required:
- errcode
examples:
application/json:{
response:
value:{
"errcode": "M_BAD_STATUS",
"error": "Ping returned status 401",
"status": 401,
"body": "{\"errcode\": \"M_UNKNOWN_TOKEN\"}"
}
504:
description:The connection to the application service timed out. The errcode is `M_CONNECTION_TIMEOUT`.
"504":
description:The connection to the application service timed out. The errcode is
`M_CONNECTION_TIMEOUT`.
content:
application/json:
schema:
$ref:"definitions/errors/error.yaml"
$ref:definitions/errors/error.yaml
examples:
application/json:{
response:
value:{
"errcode": "M_CONNECTION_TIMEOUT",
"error": "Connection to application service timed out"
}
servers:
- url:"{protocol}://{hostname}{basePath}"
variables:
protocol:
enum:
- http
- https
default:https
hostname:
default:localhost:8008
basePath:
default:/_matrix/client/v1
components:
securitySchemes:
# Note: this is the same access_token definition used elsewhere in the client
# server API, however this expects an access token for an application service.
description:The user has been kicked and banned from the room.
examples:
application/json:{
}
content:
application/json:
schema:
type:object
403:
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:
application/json:{
response:
value:{
"errcode": "M_FORBIDDEN",
"error": "You do not have a high enough power level to ban from this room."
}
schema:
"$ref": "definitions/errors/error.yaml"
tags:
- Room membership
"/rooms/{roomId}/unban":
@ -101,14 +99,16 @@ paths:
- accessToken:[]
parameters:
- in:path
type:string
name:roomId
description:The room identifier (not alias) from which the user should be unbanned.
required:true
x-example:"!e42d8c:matrix.org"
- in:body
name:body
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:{
@ -125,26 +125,48 @@ paths:
description:|-
Optional reason to be included as the `reason` on the subsequent
membership event.
required:["user_id"]
required:
- user_id
required:true
responses:
200:
"200":
description:The user has been unbanned from the room.
examples:
application/json:{
}
content:
application/json:
schema:
type:object
403:
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:
application/json:{
response:
value:{
"errcode": "M_FORBIDDEN",
"error": "You do not have a high enough power level to unban from this room."
# 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.
swagger:'2.0'
openapi:3.1.0
info:
title:"Matrix Client-Server Room Joining API"
version:"1.0.0"
host:localhost:8008
schemes:
- https
- http
basePath:/_matrix/client/v3
consumes:
- application/json
produces:
- application/json
securityDefinitions:
$ref:definitions/security.yaml
title:Matrix Client-Server Room Joining API
version:1.0.0
paths:
# With an extra " " to disambiguate from the 3pid invite endpoint
# The extra space makes it sort first for what I'm sure is a good reason.
@ -47,20 +36,20 @@ paths:
If the user was invited to the room, the homeserver will append a
`m.room.member` event to the room.
operationId:inviteUser
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
example:"!d41d8cd:matrix.org"
schema:
type:string
requestBody:
content:
application/json:
schema:
type:object
example:{
@ -77,16 +66,21 @@ paths:
description:|-
Optional reason to be included as the `reason` on the subsequent
membership event.
required:["user_id"]
required:
- user_id
required:true
responses:
200:
description:The user has been invited to join the room, or was already invited to the room.
examples:
application/json:{
}
"200":
description:The user has been invited to join the room, or was already invited
to the room.
content:
application/json:
schema:
type:object
400:
examples:
response:
value:{}
"400":
description:|-
The request is invalid. A meaningful `errcode` and description
@ -98,9 +92,11 @@ paths:
- One or more users being invited to the room are residents of a
homeserver which does not support the requested room version. The
`errcode` will be `M_UNSUPPORTED_ROOM_VERSION` in these cases.
content:
application/json:
schema:
"$ref": "definitions/errors/error.yaml"
403:
$ref:definitions/errors/error.yaml
"403":
description:|-
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:
@ -108,14 +104,36 @@ paths:
- 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:
application/json:{
"errcode": "M_FORBIDDEN", "error": "@cheeky_monkey:matrix.org is banned from the room"}
content:
application/json:
schema:
"$ref": "definitions/errors/error.yaml"
429:
$ref:definitions/errors/error.yaml
examples:
response:
value:{
"errcode": "M_FORBIDDEN",
"error": "@cheeky_monkey:matrix.org is banned from the room"
If the user is a member of the room this will be the
current state of the room as a list of events. If the user
has left the room then this will be the state of the room
when they left as a list of events.
items:
$ref:"definitions/client_event.yaml"
403:
description:>
You aren't a member of the room and weren't previously a
member of the room.
"403":
description:|
You aren't a member of the room and weren't previously a member of the room.
tags:
- Room participation
"/rooms/{roomId}/members":
get:
summary:Get the m.room.member events for the room.
description:
Get the list of members for this room.
description:Get the list of members for this room.
operationId:getMembersByRoom
parameters:
- in:path
type:string
name:roomId
description:The room to get the member events for.
required:true
x-example:"!636q39766251:example.com"
example:"!636q39766251:example.com"
schema:
type:string
- in:query
name:at
type:string
description:|-
The point in time (pagination token) to return members for in the room.
This token can be obtained from a `prev_batch` token returned for
each room by the sync API. Defaults to the current state of the room,
as determined by the server.
x-example:"YWxsCgpOb25lLDM1ODcwOA"
example:YWxsCgpOb25lLDM1ODcwOA
schema:
type:string
# XXX: As mentioned in MSC1227, replacing `[not_]membership` with a JSON
# filter might be a better alternative.
# See https://github.com/matrix-org/matrix-doc/issues/1337
- in:query
name:membership
description:|-
The kind of membership to filter for. Defaults to no filtering if
unspecified. When specified alongside `not_membership`, the two
parameters create an 'or' condition:either the membership *is*
the same as `membership` **or** *is not* the same as `not_membership`.
example:join
schema:
type:string
enum:
- join
@ -205,14 +219,13 @@ paths:
- knock
- leave
- ban
description:|-
The kind of membership to filter for. Defaults to no filtering if
unspecified. When specified alongside `not_membership`, the two
parameters create an 'or' condition:either the membership *is*
the same as `membership` **or** *is not* the same as `not_membership`.
x-example:"join"
- in:query
name:not_membership
description:|-
The kind of membership to exclude from the results. Defaults to no
filtering if unspecified.
example:leave
schema:
type:string
enum:
- join
@ -220,20 +233,26 @@ paths:
- knock
- leave
- ban
description:|-
The kind of membership to exclude from the results. Defaults to no
filtering if unspecified.
x-example:leave
security:
- accessToken:[]
responses:
200:
"200":
description:|-
A list of members of the room. If you are joined to the room then
this will be the current members of the room. If you have left the
room then this will be the members of the room when you left.
content:
application/json:
schema:
type:object
properties:
chunk:
type:array
items:
$ref:definitions/client_event.yaml
examples:
application/json:{
response:
value:{
"chunk": [
{
"room_id": "!636q39766251:example.com",
@ -241,48 +260,36 @@ paths:
}
]
}
schema:
type:object
properties:
chunk:
type:array
items:
$ref:"definitions/client_event.yaml"
403:
description:>
You aren't a member of the room and weren't previously a
member of the room.
"403":
description:|
You aren't a member of the room and weren't previously a member of the room.
tags:
- Room participation
"/rooms/{roomId}/joined_members":
get:
summary:Gets the list of currently joined users and their profile data.
description:
This API returns a map of MXIDs to member info objects for members of the room. The current user must be in the room for it to work, unless it is an Application Service in which case any of the AS's users must be in the room.
This API is primarily for Application Services and should be faster to respond than `/members` as it can be implemented more efficiently on the server.
description:This API returns a map of MXIDs to member info objects for members
of the room. The current user must be in the room for it to work, unless
it is an Application Service in which case any of the AS's users must be
in the room. This API is primarily for Application Services and should
be faster to respond than `/members` as it can be implemented more
description:The user has been invited to join the room.
examples:
application/json:{
}
content:
application/json:
schema:
type:object
403:
examples:
response:
value:{}
"403":
description:|-
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:
@ -128,14 +125,36 @@ paths:
- 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:
application/json:{
"errcode": "M_FORBIDDEN", "error": "@cheeky_monkey:matrix.org is banned from the room"}
content:
application/json:
schema:
"$ref": "definitions/errors/error.yaml"
429:
$ref:definitions/errors/error.yaml
examples:
response:
value:{
"errcode": "M_FORBIDDEN",
"error": "@cheeky_monkey:matrix.org is banned from the room"
The client's request was invalid in some way. One possible problem could be the `pepper` being invalid after the server has rotated it - this is presented with the `M_INVALID_PEPPER` error code. Clients SHOULD make a call to `/hash_details` to get a new pepper in this scenario, being careful to avoid retry loops.
`M_INVALID_PARAM` can also be returned to indicate the client supplied an `algorithm` that is unknown to the server.