# 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,63 +35,79 @@ 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: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"
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
required:true
security:
# again, this is the appservice's token - not a typical client's
- accessToken:[]
responses:
200:
"200":
description:The ping was successful.
schema:
type:object
properties:
duration_ms:
type:integer
description:|-
The duration in milliseconds that the
[`/_matrix/app/v1/ping`](#post_matrixappv1ping)
request took from the homeserver's point of view.
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`.
schema:
$ref:"definitions/errors/error.yaml"
examples:
application/json:{
"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`.
schema:
$ref:"definitions/errors/error.yaml"
examples:
application/json:{
"errcode": "M_FORBIDDEN",
"error": "Provided access token is not the appservice's as_token"
}
502:
content:
application/json:
schema:
type:object
properties:
duration_ms:
type:integer
description:|-
The duration in milliseconds that the
[`/_matrix/app/v1/ping`](#post_matrixappv1ping)
request took from the homeserver's point of view.
required:
- duration_ms
examples:
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
examples:
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`.
content:
application/json:
schema:
$ref:definitions/errors/error.yaml
examples:
response:
value:{
"errcode": "M_FORBIDDEN",
"error": "Provided access token is not the appservice's as_token"
}
"502":
description:|-
The application service returned a bad status, or the connection failed.
The errcode is `M_BAD_STATUS` or `M_CONNECTION_FAILED`.
@ -112,41 +115,68 @@ 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.
schema:
type:object
title:Error
description:A Matrix-level Error
properties:
errcode:
type:string
description:An error code.
enum:[M_BAD_STATUS, M_CONNECTION_FAILED]
error:
type:string
description:A human-readable error message.
example:Ping returned status 401
status:
type:integer
description:The HTTP status code returned by the appservice.
example:401
body:
type:string
description:The HTTP response body returned by the appservice.
example:"{\"errcode\": \"M_UNKNOWN_TOKEN\"}"
required:["errcode"]
examples:
application/json:{
"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`.
schema:
$ref:"definitions/errors/error.yaml"
examples:
application/json:{
"errcode": "M_CONNECTION_TIMEOUT",
"error": "Connection to application service timed out"
}
content:
application/json:
schema:
type:object
title:Error
description:A Matrix-level Error
properties:
errcode:
type:string
description:An error code.
enum:
- M_BAD_STATUS
- M_CONNECTION_FAILED
error:
type:string
description:A human-readable error message.
example:Ping returned status 401
status:
type:integer
description:The HTTP status code returned by the appservice.
example:401
body:
type:string
description:The HTTP response body returned by the appservice.
example:'{"errcode": "M_UNKNOWN_TOKEN"}'
required:
- errcode
examples:
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`.
content:
application/json:
schema:
$ref:definitions/errors/error.yaml
examples:
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:{
}
schema:
type:object
403:
content:
application/json:
schema:
type:object
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.
examples:
application/json:{
"errcode": "M_FORBIDDEN",
"error": "You do not have a high enough power level to ban from this room."
}
schema:
"$ref": "definitions/errors/error.yaml"
content:
application/json:
schema:
$ref:definitions/errors/error.yaml
examples:
response:
value:{
"errcode": "M_FORBIDDEN",
"error": "You do not have a high enough power level to ban from this room."
}
tags:
- Room membership
"/rooms/{roomId}/unban":
@ -101,50 +99,74 @@ 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:object
example:{
"user_id": "@cheeky_monkey:matrix.org",
"reason": "They've been banned long enough"
}
properties:
user_id:
type:string
description:The fully qualified user ID of the user being unbanned.
reason:
x-addedInMatrixVersion:"1.1"
type:string
description:|-
Optional reason to be included as the `reason` on the subsequent
membership event.
required:["user_id"]
type:string
requestBody:
content:
application/json:
schema:
type:object
example:{
"user_id": "@cheeky_monkey:matrix.org",
"reason": "They've been banned long enough"
}
properties:
user_id:
type:string
description:The fully qualified user ID of the user being unbanned.
reason:
x-addedInMatrixVersion:"1.1"
type:string
description:|-
Optional reason to be included as the `reason` on the subsequent
membership event.
required:
- user_id
required:true
responses:
200:
"200":
description:The user has been unbanned from the room.
examples:
application/json:{
}
schema:
type:object
403:
content:
application/json:
schema:
type:object
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.
examples:
application/json:{
"errcode": "M_FORBIDDEN",
"error": "You do not have a high enough power level to unban from this room."
}
schema:
"$ref": "definitions/errors/error.yaml"
content:
application/json:
schema:
$ref:definitions/errors/error.yaml
examples:
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,48 +36,53 @@ 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:object
example:{
"user_id": "@cheeky_monkey:matrix.org",
"reason": "Welcome to the team!"
}
properties:
user_id:
type:string
description:The fully qualified user ID of the invitee.
reason:
x-addedInMatrixVersion:"1.1"
type:string
description:|-
Optional reason to be included as the `reason` on the subsequent
membership event.
required:["user_id"]
responses:
200:
description:The user has been invited to join the room, or was already invited to the room.
examples:
application/json:{
type:string
requestBody:
content:
application/json:
schema:
type:object
example:{
"user_id": "@cheeky_monkey:matrix.org",
"reason": "Welcome to the team!"
}
schema:
type:object
400:
properties:
user_id:
type:string
description:The fully qualified user ID of the invitee.
reason:
x-addedInMatrixVersion:"1.1"
type:string
description:|-
Optional reason to be included as the `reason` on the subsequent
membership event.
required:
- user_id
required:true
responses:
"200":
description:The user has been invited to join the room, or was already invited
to the room.
content:
application/json:
schema:
type:object
examples:
response:
value:{}
"400":
description:|-
The request is invalid. A meaningful `errcode` and description
error text will be returned. Example reasons for rejection include:
@ -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.
schema:
"$ref": "definitions/errors/error.yaml"
403:
content:
application/json:
schema:
$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"}
schema:
"$ref": "definitions/errors/error.yaml"
429:
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"
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 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
responses:
200:
"200":
description:The user has been invited to join the room.
examples:
application/json:{
}
schema:
type:object
403:
content:
application/json:
schema:
type:object
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"}
schema:
"$ref": "definitions/errors/error.yaml"
429:
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"
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.