# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
swagger:'2.0'
openapi:3.1.0
info:
info:
title:"Matrix Client-Server Application Service Ping API"
title:Matrix Client-Server Application Service Ping API
version:"1.0.0"
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
paths:
paths:
"/appservice/{appserviceId}/ping":
"/appservice/{appserviceId}/ping":
post:
post:
x-addedInMatrixVersion:"1.7"
x-addedInMatrixVersion:"1.7"
summary:|-
summary:Ask the homeserver to ping the application service to ensure the
Ask the homeserver to ping the application service to ensure the connection works.
connection works.
description:|-
description:|-
This API asks the homeserver to call the
This API asks the homeserver to call the
[`/_matrix/app/v1/ping`](#post_matrixappv1ping) endpoint on the
[`/_matrix/app/v1/ping`](#post_matrixappv1ping) endpoint on the
@ -48,31 +35,35 @@ paths:
operationId:pingAppservice
operationId:pingAppservice
parameters:
parameters:
- in:path
- in:path
type:string
name:appserviceId
name:appserviceId
description:|-
description:|-
The appservice ID of the appservice to ping. This must be the same
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
as the appservice whose `as_token` is being used to authenticate the
request.
request.
required:true
required:true
x-example:"telegram"
example:telegram
- in:body
schema:
name:body
type:string
required:true
requestBody:
content:
application/json:
schema:
schema:
type:object
type:object
properties:
properties:
transaction_id:
transaction_id:
type:string
type:string
description:|-
description:An optional transaction ID that is passed through to the
An optional transaction ID that is passed through to the `/_matrix/app/v1/ping` call.
`/_matrix/app/v1/ping` call.
example:"mautrix-go_1683636478256400935_123"
example:mautrix-go_1683636478256400935_123
required:true
security:
security:
# again, this is the appservice's token - not a typical client's
# again, this is the appservice's token - not a typical client's
- accessToken:[]
- accessToken:[]
responses:
responses:
200:
"200":
description:The ping was successful.
description:The ping was successful.
content:
application/json:
schema:
schema:
type:object
type:object
properties:
properties:
@ -85,26 +76,38 @@ paths:
required:
required:
- duration_ms
- duration_ms
examples:
examples:
application/json:{"duration_ms": 123}
response:
400:
value:{
description:The application service doesn't have a URL configured. The errcode is `M_URL_NOT_SET`.
"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:
schema:
$ref:"definitions/errors/error.yaml"
$ref:definitions/errors/error.yaml
examples:
examples:
application/json:{
response:
value:{
"errcode": "M_URL_NOT_SET",
"errcode": "M_URL_NOT_SET",
"error": "Application service doesn't have a URL configured"
"error": "Application service doesn't have a URL configured"
}
}
403:
"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`.
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:
schema:
$ref:"definitions/errors/error.yaml"
$ref:definitions/errors/error.yaml
examples:
examples:
application/json:{
response:
value:{
"errcode": "M_FORBIDDEN",
"errcode": "M_FORBIDDEN",
"error": "Provided access token is not the appservice's as_token"
"error": "Provided access token is not the appservice's as_token"
}
}
502:
"502":
description:|-
description:|-
The application service returned a bad status, or the connection failed.
The application service returned a bad status, or the connection failed.
The errcode is `M_BAD_STATUS` or `M_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`
For bad statuses, the response may include `status` and `body`
fields containing the HTTP status code and response body text
fields containing the HTTP status code and response body text
respectively to aid with debugging.
respectively to aid with debugging.
content:
application/json:
schema:
schema:
type:object
type:object
title:Error
title:Error
@ -120,7 +125,9 @@ paths:
errcode:
errcode:
type:string
type:string
description:An error code.
description:An error code.
enum:[M_BAD_STATUS, M_CONNECTION_FAILED]
enum:
- M_BAD_STATUS
- M_CONNECTION_FAILED
error:
error:
type:string
type:string
description:A human-readable error message.
description:A human-readable error message.
@ -132,21 +139,44 @@ paths:
body:
body:
type:string
type:string
description:The HTTP response body returned by the appservice.
description:The HTTP response body returned by the appservice.
example:"{\"errcode\": \"M_UNKNOWN_TOKEN\"}"
example:'{"errcode": "M_UNKNOWN_TOKEN"}'
required:["errcode"]
required:
- errcode
examples:
examples:
application/json:{
response:
value:{
"errcode": "M_BAD_STATUS",
"errcode": "M_BAD_STATUS",
"error": "Ping returned status 401",
"error": "Ping returned status 401",
"status": 401,
"status": 401,
"body": "{\"errcode\": \"M_UNKNOWN_TOKEN\"}"
"body": "{\"errcode\": \"M_UNKNOWN_TOKEN\"}"
}
}
504:
"504":
description:The connection to the application service timed out. The errcode is `M_CONNECTION_TIMEOUT`.
description:The connection to the application service timed out. The errcode is
`M_CONNECTION_TIMEOUT`.
content:
application/json:
schema:
schema:
$ref:"definitions/errors/error.yaml"
$ref:definitions/errors/error.yaml
examples:
examples:
application/json:{
response:
value:{
"errcode": "M_CONNECTION_TIMEOUT",
"errcode": "M_CONNECTION_TIMEOUT",
"error": "Connection to application service timed out"
"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.
description:The user has been kicked and banned from the room.
examples:
content:
application/json:{
application/json:
}
schema:
schema:
type:object
type:object
403:
examples:
response:
value:{}
"403":
description:|-
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:
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 is not currently in the room.
- The banner's power level is insufficient to ban users from 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:
examples:
application/json:{
response:
value:{
"errcode": "M_FORBIDDEN",
"errcode": "M_FORBIDDEN",
"error": "You do not have a high enough power level to ban from this room."
"error": "You do not have a high enough power level to ban from this room."
}
}
schema:
"$ref": "definitions/errors/error.yaml"
tags:
tags:
- Room membership
- Room membership
"/rooms/{roomId}/unban":
"/rooms/{roomId}/unban":
@ -101,14 +99,16 @@ paths:
- accessToken:[]
- accessToken:[]
parameters:
parameters:
- in:path
- in:path
type:string
name:roomId
name:roomId
description:The room identifier (not alias) from which the user should be unbanned.
description:The room identifier (not alias) from which the user should be
required:true
unbanned.
x-example:"!e42d8c:matrix.org"
- in:body
name:body
required:true
required:true
example:"!e42d8c:matrix.org"
schema:
type:string
requestBody:
content:
application/json:
schema:
schema:
type:object
type:object
example:{
example:{
@ -125,26 +125,48 @@ paths:
description:|-
description:|-
Optional reason to be included as the `reason` on the subsequent
Optional reason to be included as the `reason` on the subsequent
membership event.
membership event.
required:["user_id"]
required:
- user_id
required:true
responses:
responses:
200:
"200":
description:The user has been unbanned from the room.
description:The user has been unbanned from the room.
examples:
content:
application/json:{
application/json:
}
schema:
schema:
type:object
type:object
403:
examples:
response:
value:{}
"403":
description:|-
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:
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.
- The unbanner's power level is insufficient to unban users from the room.
content:
application/json:
schema:
$ref:definitions/errors/error.yaml
examples:
examples:
application/json:{
response:
value:{
"errcode": "M_FORBIDDEN",
"errcode": "M_FORBIDDEN",
"error": "You do not have a high enough power level to unban from this room."
"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.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
swagger:'2.0'
openapi:3.1.0
info:
info:
title:"Matrix Client-Server Room Joining API"
title:Matrix Client-Server Room Joining API
version:"1.0.0"
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
paths:
paths:
# With an extra " " to disambiguate from the 3pid invite endpoint
# 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.
# 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
If the user was invited to the room, the homeserver will append a
`m.room.member` event to the room.
`m.room.member` event to the room.
operationId:inviteUser
operationId:inviteUser
security:
security:
- accessToken:[]
- accessToken:[]
parameters:
parameters:
- in:path
- in:path
type:string
name:roomId
name:roomId
description:The room identifier (not alias) to which to invite the user.
description:The room identifier (not alias) to which to invite the user.
required:true
required:true
x-example:"!d41d8cd:matrix.org"
example:"!d41d8cd:matrix.org"
- in:body
schema:
name:body
type:string
required:true
requestBody:
content:
application/json:
schema:
schema:
type:object
type:object
example:{
example:{
@ -77,16 +66,21 @@ paths:
description:|-
description:|-
Optional reason to be included as the `reason` on the subsequent
Optional reason to be included as the `reason` on the subsequent
membership event.
membership event.
required:["user_id"]
required:
- user_id
required:true
responses:
responses:
200:
"200":
description:The user has been invited to join the room, or was already invited to the room.
description:The user has been invited to join the room, or was already invited
examples:
to the room.
application/json:{
content:
}
application/json:
schema:
schema:
type:object
type:object
400:
examples:
response:
value:{}
"400":
description:|-
description:|-
The request is invalid. A meaningful `errcode` and 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
- One or more users being invited to the room are residents of a
homeserver which does not support the requested room version. The
homeserver which does not support the requested room version. The
`errcode` will be `M_UNSUPPORTED_ROOM_VERSION` in these cases.
`errcode` will be `M_UNSUPPORTED_ROOM_VERSION` in these cases.
content:
application/json:
schema:
schema:
"$ref": "definitions/errors/error.yaml"
$ref:definitions/errors/error.yaml
403:
"403":
description:|-
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:
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 invitee is already a member of the room.
- The inviter is not currently in the room.
- The inviter is not currently in the room.
- The inviter's power level is insufficient to invite users to the room.
- The inviter's power level is insufficient to invite users to the room.
examples:
content:
application/json:{
application/json:
"errcode": "M_FORBIDDEN", "error": "@cheeky_monkey:matrix.org is banned from the room"}
schema:
schema:
"$ref": "definitions/errors/error.yaml"
$ref:definitions/errors/error.yaml
429:
examples:
response:
value:{
"errcode": "M_FORBIDDEN",
"error": "@cheeky_monkey:matrix.org is banned from the room"
You aren't a member of the room and weren't previously a member of the room.
description:|-
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.
tags:
tags:
- Room participation
- Room participation
"/rooms/{roomId}/members":
"/rooms/{roomId}/members":
get:
get:
summary:Get the m.room.member events for the room.
summary:Get the m.room.member events for the room.
description:
description:Get the list of members for this room.
Get the list of members for this room.
operationId:getMembersByRoom
operationId:getMembersByRoom
parameters:
parameters:
- in:path
- in:path
type:string
name:roomId
name:roomId
description:The room to get the member events for.
description:The room to get the member events for.
required:true
required:true
x-example:"!636q39766251:example.com"
example:"!636q39766251:example.com"
schema:
type:string
- in:query
- in:query
name:at
name:at
type:string
description:|-
description:|-
The point in time (pagination token) to return members for in the room.
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
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,
each room by the sync API. Defaults to the current state of the room,
as determined by the server.
as determined by the server.
x-example:"YWxsCgpOb25lLDM1ODcwOA"
example:YWxsCgpOb25lLDM1ODcwOA
schema:
type:string
# XXX: As mentioned in MSC1227, replacing `[not_]membership` with a JSON
# XXX: As mentioned in MSC1227, replacing `[not_]membership` with a JSON
# filter might be a better alternative.
# filter might be a better alternative.
# See https://github.com/matrix-org/matrix-doc/issues/1337
# See https://github.com/matrix-org/matrix-doc/issues/1337
- in:query
- in:query
name:membership
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
type:string
enum:
enum:
- join
- join
@ -205,14 +219,13 @@ paths:
- knock
- knock
- leave
- leave
- ban
- 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
- in:query
name:not_membership
name:not_membership
description:|-
The kind of membership to exclude from the results. Defaults to no
filtering if unspecified.
example:leave
schema:
type:string
type:string
enum:
enum:
- join
- join
@ -220,20 +233,26 @@ paths:
- knock
- knock
- leave
- leave
- ban
- ban
description:|-
The kind of membership to exclude from the results. Defaults to no
filtering if unspecified.
x-example:leave
security:
security:
- accessToken:[]
- accessToken:[]
responses:
responses:
200:
"200":
description:|-
description:|-
A list of members of the room. If you are joined to the room then
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
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.
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:
examples:
application/json:{
response:
value:{
"chunk": [
"chunk": [
{
{
"room_id": "!636q39766251:example.com",
"room_id": "!636q39766251:example.com",
@ -241,48 +260,36 @@ paths:
}
}
]
]
}
}
schema:
"403":
type:object
description:|
properties:
You aren't a member of the room and weren't previously a member of the room.
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.
tags:
tags:
- Room participation
- Room participation
"/rooms/{roomId}/joined_members":
"/rooms/{roomId}/joined_members":
get:
get:
summary:Gets the list of currently joined users and their profile data.
summary:Gets the list of currently joined users and their profile data.
description:
description:This API returns a map of MXIDs to member info objects for members
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.
of the room. The current user must be in the room for it to work, unless
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.
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.
description:The user has been invited to join the room.
examples:
content:
application/json:{
application/json:
}
schema:
schema:
type:object
type:object
403:
examples:
response:
value:{}
"403":
description:|-
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:
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 invitee is already a member of the room.
- The inviter is not currently in the room.
- The inviter is not currently in the room.
- The inviter's power level is insufficient to invite users to the room.
- The inviter's power level is insufficient to invite users to the room.
examples:
content:
application/json:{
application/json:
"errcode": "M_FORBIDDEN", "error": "@cheeky_monkey:matrix.org is banned from the room"}
schema:
schema:
"$ref": "definitions/errors/error.yaml"
$ref:definitions/errors/error.yaml
429:
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.