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-05-29 16:37:44 +02:00
swagger : '2.0'
info :
2015-12-04 12:09:35 +01:00
title : "Matrix Client-Server Profile API"
2015-05-29 16:37:44 +02:00
version : "1.0.0"
host : localhost:8008
schemes :
- https
- http
2021-10-12 19:07:01 +02:00
basePath : /_matrix/client/v3
2015-05-29 16:37:44 +02:00
consumes :
- application/json
produces :
- application/json
securityDefinitions :
2016-05-03 14:57:16 +02:00
$ref : definitions/security.yaml
2015-05-29 16:37:44 +02:00
paths :
2015-05-29 17:50:22 +02:00
"/profile/{userId}/displayname" :
2015-05-29 16:37:44 +02:00
put :
summary : Set the user's display name.
2015-06-01 15:34:13 +02:00
description : |-
This API sets the given user's display name. You must have permission to
2021-01-27 21:14:31 +01:00
set this user's display name, e.g. you need to have their `access_token`.
2017-08-03 01:19:34 +02:00
operationId : setDisplayName
2015-05-29 16:37:44 +02:00
security :
- accessToken : [ ]
parameters :
- in : path
type : string
name : userId
description : The user whose display name to set.
required : true
2015-06-01 15:20:24 +02:00
x-example : "@alice:example.com"
2015-05-29 16:37:44 +02:00
- in : body
name : displayName
2020-05-28 14:11:47 +02:00
description : The new display name information.
2015-05-29 16:37:44 +02:00
required : true
schema :
type : object
2017-09-26 18:53:28 +02:00
example : {
2015-06-01 15:20:24 +02:00
"displayname": "Alice Margatroid"
}
2015-05-29 16:37:44 +02:00
properties :
displayname :
type : string
description : The new display name for this user.
responses :
200 :
description : The display name was set.
2015-06-01 11:44:03 +02:00
examples :
2017-09-26 18:53:28 +02:00
application/json : {
}
2015-05-29 16:37:44 +02:00
schema :
type : object # empty json object
2015-05-29 16:48:48 +02: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 :
- User data
2015-05-29 16:37:44 +02:00
get :
summary : Get the user's display name.
2015-06-01 17:29:19 +02:00
description : |-
Get the user's display name. This API may be used to fetch the user's
own displayname or to query the name of other users; either locally or
on remote homeservers.
2017-08-03 01:19:34 +02:00
operationId : getDisplayName
2015-05-29 16:37:44 +02:00
parameters :
- in : path
type : string
name : userId
description : The user whose display name to get.
required : true
2015-06-01 15:20:24 +02:00
x-example : "@alice:example.com"
2015-05-29 16:37:44 +02:00
responses :
200 :
description : The display name for this user.
2015-06-01 11:44:03 +02:00
examples :
2017-09-26 18:53:28 +02:00
application/json : {
2015-06-01 11:44:03 +02:00
"displayname": "Alice Margatroid"
}
2015-05-29 16:37:44 +02:00
schema :
type : object
properties :
displayname :
type : string
2016-02-03 15:54:29 +01:00
description : The user's display name if they have set one, otherwise not present.
2015-05-29 16:37:44 +02:00
404 :
description : There is no display name for this user or this user does not exist.
2015-12-07 13:45:13 +01:00
tags :
- User data
2015-05-29 17:50:22 +02:00
"/profile/{userId}/avatar_url" :
2015-05-29 16:37:44 +02:00
put :
summary : Set the user's avatar URL.
2015-06-01 15:34:13 +02:00
description : |-
This API sets the given user's avatar URL. You must have permission to
2021-01-27 21:14:31 +01:00
set this user's avatar URL, e.g. you need to have their `access_token`.
2017-08-03 01:19:34 +02:00
operationId : setAvatarUrl
2015-05-29 16:37:44 +02:00
security :
- accessToken : [ ]
parameters :
- in : path
type : string
name : userId
description : The user whose avatar URL to set.
required : true
2015-06-01 15:20:24 +02:00
x-example : "@alice:example.com"
2015-05-29 16:37:44 +02:00
- in : body
name : avatar_url
2020-05-28 14:11:47 +02:00
description : The new avatar information.
2015-05-29 16:37:44 +02:00
required : true
schema :
type : object
2017-09-26 18:53:28 +02:00
example : {
2015-06-01 16:26:48 +02:00
"avatar_url": "mxc://matrix.org/wefh34uihSDRGhw34"
2015-06-01 15:20:24 +02:00
}
2015-05-29 16:37:44 +02:00
properties :
avatar_url :
type : string
2021-08-09 08:54:34 +02:00
format : uri
2015-05-29 16:37:44 +02:00
description : The new avatar URL for this user.
responses :
200 :
description : The avatar URL was set.
2015-06-01 11:44:03 +02:00
examples :
2017-09-26 18:53:28 +02:00
application/json : {
}
2015-05-29 16:37:44 +02:00
schema :
type : object # empty json object
2015-05-29 16:48:48 +02: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 :
- User data
2015-05-29 16:37:44 +02:00
get :
summary : Get the user's avatar URL.
2015-06-01 17:29:19 +02:00
description : |-
Get the user's avatar URL. This API may be used to fetch the user's
own avatar URL or to query the URL of other users; either locally or
on remote homeservers.
2017-08-03 01:19:34 +02:00
operationId : getAvatarUrl
2015-05-29 16:37:44 +02:00
parameters :
- in : path
type : string
name : userId
description : The user whose avatar URL to get.
required : true
2015-06-01 15:20:24 +02:00
x-example : "@alice:example.com"
2015-05-29 16:37:44 +02:00
responses :
200 :
description : The avatar URL for this user.
2015-06-01 11:44:03 +02:00
examples :
2017-09-26 18:53:28 +02:00
application/json : {
2015-06-01 11:44:03 +02:00
"avatar_url": "mxc://matrix.org/SDGdghriugerRg"
}
2015-05-29 16:37:44 +02:00
schema :
type : object
properties :
avatar_url :
type : string
2021-08-09 08:54:34 +02:00
format : uri
2016-02-03 15:54:29 +01:00
description : The user's avatar URL if they have set one, otherwise not present.
2015-05-29 16:37:44 +02:00
404 :
2015-06-01 17:29:19 +02:00
description : There is no avatar URL for this user or this user does not exist.
2015-12-07 13:45:13 +01:00
tags :
- User data
2015-06-01 17:29:19 +02:00
"/profile/{userId}" :
get :
summary : Get this user's profile information.
description : |-
Get the combined profile information for this user. This API may be used
to fetch the user's own profile information or other users; either
locally or on remote homeservers. This API may return keys which are not
2021-01-27 21:14:31 +01:00
limited to `displayname` or `avatar_url`.
2023-02-22 13:17:16 +01:00
_Please note that access token is required if require_auth_for_profile_requests is true [in configuration](https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html#require_auth_for_profile_requests)._
2017-08-03 01:19:34 +02:00
operationId : getUserProfile
2015-06-01 17:29:19 +02:00
parameters :
- in : path
type : string
name : userId
2016-04-11 12:47:40 +02:00
description : The user whose profile information to get.
2015-06-01 17:29:19 +02:00
required : true
x-example : "@alice:example.com"
responses :
200 :
2022-09-22 17:04:50 +02:00
description : The profile information for this user.
2015-06-01 17:29:19 +02:00
examples :
2017-09-26 18:53:28 +02:00
application/json : {
2015-06-01 17:29:19 +02:00
"avatar_url": "mxc://matrix.org/SDGdghriugerRg" ,
"displayname": "Alice Margatroid"
}
schema :
type : object
properties :
avatar_url :
type : string
2021-08-09 08:54:34 +02:00
format : uri
2016-02-03 15:54:29 +01:00
description : The user's avatar URL if they have set one, otherwise not present.
2015-06-01 17:29:19 +02:00
displayname :
type : string
2016-02-03 15:54:29 +01:00
description : The user's display name if they have set one, otherwise not present.
2023-02-22 13:17:16 +01:00
401 :
description : The access token is not provided or is invalid.
examples :
application/json : {
"errcode": "M_MISSING_TOKEN" ,
"error": "Missing access token"
}
schema :
"$ref": "definitions/errors/error.yaml"
2021-12-29 19:30:32 +01:00
403 :
x-addedInMatrixVersion : "1.2"
description : The server is unwilling to disclose whether the user exists and/or has profile information.
examples :
application/json : {
"errcode": "M_FORBIDDEN" ,
"error": "Profile lookup over federation is disabled on this homeserver"
}
schema :
"$ref": "definitions/errors/error.yaml"
2015-06-01 17:29:19 +02:00
404 :
2015-12-07 13:45:13 +01:00
description : There is no profile information for this user or this user does not exist.
2021-12-29 19:30:32 +01:00
examples :
application/json : {
"errcode": "M_NOT_FOUND" ,
"error": "Profile not found"
}
schema :
"$ref": "definitions/errors/error.yaml"
2015-12-07 13:45:13 +01:00
tags :
- User data