2021-07-07 03:44:14 -06:00
<!DOCTYPE HTML>
< html lang = "en" class = "sidebar-visible no-js light" >
< head >
<!-- Book generated using mdBook -->
< meta charset = "UTF-8" >
< title > Rooms - Synapse< / title >
<!-- Custom HTML head -->
< meta content = "text/html; charset=utf-8" http-equiv = "Content-Type" >
< meta name = "description" content = "" >
< meta name = "viewport" content = "width=device-width, initial-scale=1" >
< meta name = "theme-color" content = "#ffffff" / >
< link rel = "icon" href = "../favicon.svg" >
< link rel = "shortcut icon" href = "../favicon.png" >
< link rel = "stylesheet" href = "../css/variables.css" >
< link rel = "stylesheet" href = "../css/general.css" >
< link rel = "stylesheet" href = "../css/chrome.css" >
< link rel = "stylesheet" href = "../css/print.css" media = "print" >
<!-- Fonts -->
< link rel = "stylesheet" href = "../FontAwesome/css/font-awesome.css" >
< link rel = "stylesheet" href = "../fonts/fonts.css" >
<!-- Highlight.js Stylesheets -->
< link rel = "stylesheet" href = "../highlight.css" >
< link rel = "stylesheet" href = "../tomorrow-night.css" >
< link rel = "stylesheet" href = "../ayu-highlight.css" >
<!-- Custom theme stylesheets -->
< link rel = "stylesheet" href = "../docs/website_files/table-of-contents.css" >
< link rel = "stylesheet" href = "../docs/website_files/remove-nav-buttons.css" >
< link rel = "stylesheet" href = "../docs/website_files/indent-section-headers.css" >
< / head >
< body >
<!-- Provide site root to javascript -->
< script type = "text/javascript" >
var path_to_root = "../";
var default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "navy" : "light";
< / script >
<!-- Work around some values being stored in localStorage wrapped in quotes -->
< script type = "text/javascript" >
try {
var theme = localStorage.getItem('mdbook-theme');
var sidebar = localStorage.getItem('mdbook-sidebar');
if (theme.startsWith('"') & & theme.endsWith('"')) {
localStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1));
}
if (sidebar.startsWith('"') & & sidebar.endsWith('"')) {
localStorage.setItem('mdbook-sidebar', sidebar.slice(1, sidebar.length - 1));
}
} catch (e) { }
< / script >
<!-- Set the theme before any content is loaded, prevents flash -->
< script type = "text/javascript" >
var theme;
try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { }
if (theme === null || theme === undefined) { theme = default_theme; }
var html = document.querySelector('html');
html.classList.remove('no-js')
html.classList.remove('light')
html.classList.add(theme);
html.classList.add('js');
< / script >
<!-- Hide / unhide sidebar before it is displayed -->
< script type = "text/javascript" >
var html = document.querySelector('html');
var sidebar = 'hidden';
if (document.body.clientWidth >= 1080) {
try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { }
sidebar = sidebar || 'visible';
}
html.classList.remove('sidebar-visible');
html.classList.add("sidebar-" + sidebar);
< / script >
< nav id = "sidebar" class = "sidebar" aria-label = "Table of contents" >
< div class = "sidebar-scrollbox" >
2022-11-22 05:22:40 -07:00
< ol class = "chapter" > < li class = "chapter-item expanded affix " > < li class = "part-title" > Introduction< / li > < li class = "chapter-item expanded " > < a href = "../welcome_and_overview.html" > Welcome and Overview< / a > < / li > < li class = "chapter-item expanded affix " > < li class = "part-title" > Setup< / li > < li class = "chapter-item expanded " > < a href = "../setup/installation.html" > Installation< / a > < / li > < li class = "chapter-item expanded " > < a href = "../postgres.html" > Using Postgres< / a > < / li > < li class = "chapter-item expanded " > < a href = "../reverse_proxy.html" > Configuring a Reverse Proxy< / a > < / li > < li class = "chapter-item expanded " > < a href = "../setup/forward_proxy.html" > Configuring a Forward/Outbound Proxy< / a > < / li > < li class = "chapter-item expanded " > < a href = "../turn-howto.html" > Configuring a Turn Server< / a > < / li > < li > < ol class = "section" > < li class = "chapter-item expanded " > < a href = "../setup/turn/coturn.html" > coturn TURN server< / a > < / li > < li class = "chapter-item expanded " > < a href = "../setup/turn/eturnal.html" > eturnal TURN server< / a > < / li > < / ol > < / li > < li class = "chapter-item expanded " > < a href = "../delegate.html" > Delegation< / a > < / li > < li class = "chapter-item expanded affix " > < li class = "part-title" > Upgrading< / li > < li class = "chapter-item expanded " > < a href = "../upgrade.html" > Upgrading between Synapse Versions< / a > < / li > < li class = "chapter-item expanded affix " > < li class = "part-title" > Usage< / li > < li class = "chapter-item expanded " > < a href = "../federate.html" > Federation< / a > < / li > < li class = "chapter-item expanded " > < a href = "../usage/configuration/index.html" > Configuration< / a > < / li > < li > < ol class = "section" > < li class = "chapter-item expanded " > < a href = "../usage/configuration/config_documentation.html" > Configuration Manual< / a > < / li > < li class = "chapter-item expanded " > < a href = "../usage/configuration/homeserver_sample_config.html" > Homeserver Sample Config File< / a > < / li > < li class = "chapter-item expanded " > < a href = "../usage/configuration/logging_sample_config.html" > Logging Sample Config File< / a > < / li > < li class = "chapter-item expanded " > < a href = "../structured_logging.html" > Structured Logging< / a > < / li > < li class = "chapter-item expanded " > < a href = "../templates.html" > Templates< / a > < / li > < li class = "chapter-item expanded " > < a href = "../usage/configuration/user_authentication/index.html" > User Authentication< / a > < / li > < li > < ol class = "section" > < li class = "chapter-item expanded " > < a href = "../usage/configuration/user_authentication/single_sign_on/index.html" > Single-Sign On< / a > < / li > < li > < ol class = "section" > < li class = "chapter-item expanded " > < a href = "../openid.html" > OpenID Connect< / a > < / li > < li class = "chapter-item expanded " > < a href = "../usage/configuration/user_authentication/single_sign_on/saml.html" > SAML< / a > < / li > < li class = "chapter-item expanded " > < a href = "../usage/configuration/user_authentication/single_sign_on/cas.html" > CAS< / a > < / li > < li class = "chapter-item expanded " > < a href = "../sso_mapping_providers.html" > SSO Mapping Providers< / a > < / li > < / ol > < / li > < li class = "chapter-item expanded " > < a href = "../password_auth_providers.html" > Password Auth Providers< / a > < / li > < li class = "chapter-item expanded " > < a href = "../jwt.html" > JSON Web Tokens< / a > < / li > < li class = "chapter-item expanded " > < a href = "../usage/configuration/user_authentication/refresh_tokens.html" > Refresh Tokens< / a > < / li > < / ol > < / li > < li class = "chapter-item expanded " > < a href = "../CAPTCHA_SETUP.html" > Registration Captcha< / a > < / li > < li class = "chapter-item expanded " > < a href = "../application_services.html" > Application Services< / a > < / li > < li class = "chapter-item expanded " > < a href = "../server_notices.html" > Server Notices< / a > < / li > < li class = "chapter-item expanded " > < a href = "../consent_tracking.html" > Consent Tracking< / a > < / li > < li class = "chapter-item expanded " > < a href = "../user_directory.html" > User Directory< / a > < / li > < li class = "chapter-item expanded " > < a href = "../message_retention_policies.html" > Message Retention Policies< / a > < / li > < li class = "chapter-item expanded " > < a href = "../modules/index.html" > Pluggable Modules< / a > < / li > < li > < ol class = "section" > < li class = "chapter-item expanded " > < a href = "../modules/writing_a_module.html" > Writing a module< / a > < / li > < li > < ol class = "section" > < li class = "chapter-item expanded "
2021-07-07 03:44:14 -06:00
< / div >
< div id = "sidebar-resize-handle" class = "sidebar-resize-handle" > < / div >
< / nav >
< div id = "page-wrapper" class = "page-wrapper" >
< div class = "page" >
< div id = "menu-bar-hover-placeholder" > < / div >
< div id = "menu-bar" class = "menu-bar sticky bordered" >
< div class = "left-buttons" >
< button id = "sidebar-toggle" class = "icon-button" type = "button" title = "Toggle Table of Contents" aria-label = "Toggle Table of Contents" aria-controls = "sidebar" >
< i class = "fa fa-bars" > < / i >
< / button >
< button id = "theme-toggle" class = "icon-button" type = "button" title = "Change theme" aria-label = "Change theme" aria-haspopup = "true" aria-expanded = "false" aria-controls = "theme-list" >
< i class = "fa fa-paint-brush" > < / i >
< / button >
< ul id = "theme-list" class = "theme-popup" aria-label = "Themes" role = "menu" >
< li role = "none" > < button role = "menuitem" class = "theme" id = "light" > Light (default)< / button > < / li >
< li role = "none" > < button role = "menuitem" class = "theme" id = "rust" > Rust< / button > < / li >
< li role = "none" > < button role = "menuitem" class = "theme" id = "coal" > Coal< / button > < / li >
< li role = "none" > < button role = "menuitem" class = "theme" id = "navy" > Navy< / button > < / li >
< li role = "none" > < button role = "menuitem" class = "theme" id = "ayu" > Ayu< / button > < / li >
< / ul >
< button id = "search-toggle" class = "icon-button" type = "button" title = "Search. (Shortkey: s)" aria-label = "Toggle Searchbar" aria-expanded = "false" aria-keyshortcuts = "S" aria-controls = "searchbar" >
< i class = "fa fa-search" > < / i >
< / button >
< / div >
< h1 class = "menu-title" > Synapse< / h1 >
< div class = "right-buttons" >
< a href = "../print.html" title = "Print this book" aria-label = "Print this book" >
< i id = "print-button" class = "fa fa-print" > < / i >
< / a >
< a href = "https://github.com/matrix-org/synapse" title = "Git repository" aria-label = "Git repository" >
< i id = "git-repository-button" class = "fa fa-github" > < / i >
< / a >
< a href = "https://github.com/matrix-org/synapse/edit/develop/docs/admin_api/rooms.md" title = "Suggest an edit" aria-label = "Suggest an edit" >
< i id = "git-edit-button" class = "fa fa-edit" > < / i >
< / a >
< / div >
< / div >
< div id = "search-wrapper" class = "hidden" >
< form id = "searchbar-outer" class = "searchbar-outer" >
< input type = "search" id = "searchbar" name = "searchbar" placeholder = "Search this book ..." aria-controls = "searchresults-outer" aria-describedby = "searchresults-header" >
< / form >
< div id = "searchresults-outer" class = "searchresults-outer hidden" >
< div id = "searchresults-header" class = "searchresults-header" > < / div >
< ul id = "searchresults" >
< / ul >
< / div >
< / div >
<!-- Apply ARIA attributes after the sidebar and the sidebar toggle button are added to the DOM -->
< script type = "text/javascript" >
document.getElementById('sidebar-toggle').setAttribute('aria-expanded', sidebar === 'visible');
document.getElementById('sidebar').setAttribute('aria-hidden', sidebar !== 'visible');
Array.from(document.querySelectorAll('#sidebar a')).forEach(function(link) {
link.setAttribute('tabIndex', sidebar === 'visible' ? 0 : -1);
});
< / script >
< div id = "content" class = "content" >
< main >
<!-- Page table of contents -->
< div class = "sidetoc" >
< nav class = "pagetoc" > < / nav >
< / div >
2022-02-08 06:26:46 -07:00
< h1 id = "list-room-api" > < a class = "header" href = "#list-room-api" > List Room API< / a > < / h1 >
2021-07-07 03:44:14 -06:00
< p > The List Room admin API allows server admins to get a list of rooms on their
server. There are various parameters available that allow for filtering and
sorting the returned list. This API supports pagination.< / p >
2022-02-08 06:26:46 -07:00
< p > To use it, you will need to authenticate by providing an < code > access_token< / code >
2023-01-17 05:46:31 -07:00
for a server admin: see < a href = "../usage/administration/admin_api/" > Admin API< / a > .< / p >
2021-07-29 04:09:19 -06:00
< p > < strong > Parameters< / strong > < / p >
2021-07-07 03:44:14 -06:00
< p > The following query parameters are available:< / p >
< ul >
2021-11-17 07:20:12 -07:00
< li >
< p > < code > from< / code > - Offset in the returned list. Defaults to < code > 0< / code > .< / p >
< / li >
< li >
< p > < code > limit< / code > - Maximum amount of rooms to return. Defaults to < code > 100< / code > .< / p >
< / li >
< li >
< p > < code > order_by< / code > - The method in which to sort the returned list of rooms. Valid values are:< / p >
2021-07-07 03:44:14 -06:00
< ul >
< li > < code > alphabetical< / code > - Same as < code > name< / code > . This is deprecated.< / li >
< li > < code > size< / code > - Same as < code > joined_members< / code > . This is deprecated.< / li >
< li > < code > name< / code > - Rooms are ordered alphabetically by room name. This is the default.< / li >
< li > < code > canonical_alias< / code > - Rooms are ordered alphabetically by main alias address of the room.< / li >
< li > < code > joined_members< / code > - Rooms are ordered by the number of members. Largest to smallest.< / li >
< li > < code > joined_local_members< / code > - Rooms are ordered by the number of local members. Largest to smallest.< / li >
< li > < code > version< / code > - Rooms are ordered by room version. Largest to smallest.< / li >
< li > < code > creator< / code > - Rooms are ordered alphabetically by creator of the room.< / li >
< li > < code > encryption< / code > - Rooms are ordered alphabetically by the end-to-end encryption algorithm.< / li >
< li > < code > federatable< / code > - Rooms are ordered by whether the room is federatable.< / li >
< li > < code > public< / code > - Rooms are ordered by visibility in room list.< / li >
< li > < code > join_rules< / code > - Rooms are ordered alphabetically by join rules of the room.< / li >
< li > < code > guest_access< / code > - Rooms are ordered alphabetically by guest access option of the room.< / li >
< li > < code > history_visibility< / code > - Rooms are ordered alphabetically by visibility of history of the room.< / li >
< li > < code > state_events< / code > - Rooms are ordered by number of state events. Largest to smallest.< / li >
< / ul >
< / li >
2021-11-17 07:20:12 -07:00
< li >
< p > < code > dir< / code > - Direction of room order. Either < code > f< / code > for forwards or < code > b< / code > for backwards. Setting
this value to < code > b< / code > will reverse the above sort order. Defaults to < code > f< / code > .< / p >
< / li >
< li >
< p > < code > search_term< / code > - Filter rooms by their room name, canonical alias and room id.
Specifically, rooms are selected if the search term is contained in< / p >
< ul >
< li > the room's name,< / li >
< li > the local part of the room's canonical alias, or< / li >
< li > the complete (local and server part) room's id (case sensitive).< / li >
< / ul >
< p > Defaults to no filtering.< / p >
< / li >
2021-07-07 03:44:14 -06:00
< / ul >
2021-07-29 04:09:19 -06:00
< p > < strong > Response< / strong > < / p >
2021-07-07 03:44:14 -06:00
< p > The following fields are possible in the JSON response body:< / p >
< ul >
< li > < code > rooms< / code > - An array of objects, each containing information about a room.
< ul >
< li > Room objects contain the following fields:
< ul >
< li > < code > room_id< / code > - The ID of the room.< / li >
< li > < code > name< / code > - The name of the room.< / li >
< li > < code > canonical_alias< / code > - The canonical (main) alias address of the room.< / li >
< li > < code > joined_members< / code > - How many users are currently in the room.< / li >
< li > < code > joined_local_members< / code > - How many local users are currently in the room.< / li >
< li > < code > version< / code > - The version of the room as a string.< / li >
< li > < code > creator< / code > - The < code > user_id< / code > of the room creator.< / li >
< li > < code > encryption< / code > - Algorithm of end-to-end encryption of messages. Is < code > null< / code > if encryption is not active.< / li >
< li > < code > federatable< / code > - Whether users on other servers can join this room.< / li >
< li > < code > public< / code > - Whether the room is visible in room directory.< / li >
< li > < code > join_rules< / code > - The type of rules used for users wishing to join this room. One of: [" public" , " knock" , " invite" , " private" ].< / li >
< li > < code > guest_access< / code > - Whether guests can join the room. One of: [" can_join" , " forbidden" ].< / li >
< li > < code > history_visibility< / code > - Who can see the room history. One of: [" invited" , " joined" , " shared" , " world_readable" ].< / li >
< li > < code > state_events< / code > - Total number of state_events of a room. Complexity of the room.< / li >
2022-08-02 04:56:24 -06:00
< li > < code > room_type< / code > - The type of the room taken from the room's creation event; for example " m.space" if the room is a space. If the room does not define a type, the value will be < code > null< / code > .< / li >
2021-07-07 03:44:14 -06:00
< / ul >
< / li >
< / ul >
< / li >
< li > < code > offset< / code > - The current pagination offset in rooms. This parameter should be
used instead of < code > next_token< / code > for room offset as < code > next_token< / code > is
not intended to be parsed.< / li >
< li > < code > total_rooms< / code > - The total number of rooms this query can return. Using this
and < code > offset< / code > , you have enough information to know the current
progression through the list.< / li >
< li > < code > next_batch< / code > - If this field is present, we know that there are potentially
more rooms on the server that did not all fit into this response.
We can use < code > next_batch< / code > to get the " next page" of results. To do
so, simply repeat your request, setting the < code > from< / code > parameter to
the value of < code > next_batch< / code > .< / li >
< li > < code > prev_batch< / code > - If this field is present, it is possible to paginate backwards.
Use < code > prev_batch< / code > for the < code > from< / code > value in the next request to
get the " previous page" of results.< / li >
< / ul >
2021-07-29 04:09:19 -06:00
< p > The API is:< / p >
2021-07-07 03:44:14 -06:00
< p > A standard request with no filtering:< / p >
< pre > < code > GET /_synapse/admin/v1/rooms
< / code > < / pre >
2021-07-29 04:09:19 -06:00
< p > A response body like the following is returned:< / p >
2021-11-17 07:20:12 -07:00
< pre > < code class = "language-json" > {
2021-07-07 03:44:14 -06:00
" rooms" : [
{
" room_id" : " !OGEhHVWSdvArJzumhm:matrix.org" ,
" name" : " Matrix HQ" ,
" canonical_alias" : " #matrix:matrix.org" ,
" joined_members" : 8326,
" joined_local_members" : 2,
" version" : " 1" ,
" creator" : " @foo:matrix.org" ,
" encryption" : null,
" federatable" : true,
" public" : true,
" join_rules" : " invite" ,
" guest_access" : null,
" history_visibility" : " shared" ,
2022-08-02 04:56:24 -06:00
" state_events" : 93534,
" room_type" : " m.space"
2021-07-07 03:44:14 -06:00
},
... (8 hidden items) ...
{
" room_id" : " !xYvNcQPhnkrdUmYczI:matrix.org" ,
" name" : " This Week In Matrix (TWIM)" ,
" canonical_alias" : " #twim:matrix.org" ,
" joined_members" : 314,
" joined_local_members" : 20,
" version" : " 4" ,
" creator" : " @foo:matrix.org" ,
" encryption" : " m.megolm.v1.aes-sha2" ,
" federatable" : true,
" public" : false,
" join_rules" : " invite" ,
" guest_access" : null,
" history_visibility" : " shared" ,
2022-08-02 04:56:24 -06:00
" state_events" : 8345,
" room_type" : null
2021-07-07 03:44:14 -06:00
}
],
" offset" : 0,
" total_rooms" : 10
}
< / code > < / pre >
< p > Filtering by room name:< / p >
< pre > < code > GET /_synapse/admin/v1/rooms?search_term=TWIM
< / code > < / pre >
2021-07-29 04:09:19 -06:00
< p > A response body like the following is returned:< / p >
2021-07-07 03:44:14 -06:00
< pre > < code class = "language-json" > {
" rooms" : [
{
" room_id" : " !xYvNcQPhnkrdUmYczI:matrix.org" ,
" name" : " This Week In Matrix (TWIM)" ,
" canonical_alias" : " #twim:matrix.org" ,
" joined_members" : 314,
" joined_local_members" : 20,
" version" : " 4" ,
" creator" : " @foo:matrix.org" ,
" encryption" : " m.megolm.v1.aes-sha2" ,
" federatable" : true,
" public" : false,
" join_rules" : " invite" ,
" guest_access" : null,
" history_visibility" : " shared" ,
2022-08-02 04:56:24 -06:00
" state_events" : 8,
" room_type" : null
2021-07-07 03:44:14 -06:00
}
],
" offset" : 0,
" total_rooms" : 1
}
< / code > < / pre >
< p > Paginating through a list of rooms:< / p >
< pre > < code > GET /_synapse/admin/v1/rooms?order_by=size
< / code > < / pre >
2021-07-29 04:09:19 -06:00
< p > A response body like the following is returned:< / p >
2021-11-17 07:20:12 -07:00
< pre > < code class = "language-json" > {
2021-07-07 03:44:14 -06:00
" rooms" : [
{
" room_id" : " !OGEhHVWSdvArJzumhm:matrix.org" ,
" name" : " Matrix HQ" ,
" canonical_alias" : " #matrix:matrix.org" ,
" joined_members" : 8326,
" joined_local_members" : 2,
" version" : " 1" ,
" creator" : " @foo:matrix.org" ,
" encryption" : null,
" federatable" : true,
" public" : true,
" join_rules" : " invite" ,
" guest_access" : null,
" history_visibility" : " shared" ,
2022-08-02 04:56:24 -06:00
" state_events" : 93534,
" room_type" : null
2021-07-07 03:44:14 -06:00
},
... (98 hidden items) ...
{
" room_id" : " !xYvNcQPhnkrdUmYczI:matrix.org" ,
" name" : " This Week In Matrix (TWIM)" ,
" canonical_alias" : " #twim:matrix.org" ,
" joined_members" : 314,
" joined_local_members" : 20,
" version" : " 4" ,
" creator" : " @foo:matrix.org" ,
" encryption" : " m.megolm.v1.aes-sha2" ,
" federatable" : true,
" public" : false,
" join_rules" : " invite" ,
" guest_access" : null,
" history_visibility" : " shared" ,
2022-08-02 04:56:24 -06:00
" state_events" : 8345,
" room_type" : " m.space"
2021-07-07 03:44:14 -06:00
}
],
" offset" : 0,
2021-11-17 07:20:12 -07:00
" total_rooms" : 150,
2021-07-07 03:44:14 -06:00
" next_token" : 100
}
< / code > < / pre >
< p > The presence of the < code > next_token< / code > parameter tells us that there are more rooms
than returned in this request, and we need to make another request to get them.
To get the next batch of room results, we repeat our request, setting the < code > from< / code >
parameter to the value of < code > next_token< / code > .< / p >
< pre > < code > GET /_synapse/admin/v1/rooms?order_by=size& from=100
< / code > < / pre >
2021-07-29 04:09:19 -06:00
< p > A response body like the following is returned:< / p >
2021-11-17 07:20:12 -07:00
< pre > < code class = "language-json" > {
2021-07-07 03:44:14 -06:00
" rooms" : [
{
" room_id" : " !mscvqgqpHYjBGDxNym:matrix.org" ,
" name" : " Music Theory" ,
" canonical_alias" : " #musictheory:matrix.org" ,
" joined_members" : 127,
" joined_local_members" : 2,
" version" : " 1" ,
" creator" : " @foo:matrix.org" ,
" encryption" : null,
" federatable" : true,
" public" : true,
" join_rules" : " invite" ,
" guest_access" : null,
" history_visibility" : " shared" ,
2022-08-02 04:56:24 -06:00
" state_events" : 93534,
" room_type" : " m.space"
2021-07-07 03:44:14 -06:00
},
... (48 hidden items) ...
{
" room_id" : " !twcBhHVdZlQWuuxBhN:termina.org.uk" ,
" name" : " weechat-matrix" ,
" canonical_alias" : " #weechat-matrix:termina.org.uk" ,
" joined_members" : 137,
" joined_local_members" : 20,
" version" : " 4" ,
" creator" : " @foo:termina.org.uk" ,
" encryption" : null,
" federatable" : true,
" public" : true,
" join_rules" : " invite" ,
" guest_access" : null,
" history_visibility" : " shared" ,
2022-08-02 04:56:24 -06:00
" state_events" : 8345,
" room_type" : null
2021-07-07 03:44:14 -06:00
}
],
" offset" : 100,
" prev_batch" : 0,
" total_rooms" : 150
}
< / code > < / pre >
< p > Once the < code > next_token< / code > parameter is no longer present, we know we've reached the
end of the list.< / p >
< h1 id = "room-details-api" > < a class = "header" href = "#room-details-api" > Room Details API< / a > < / h1 >
< p > The Room Details admin API allows server admins to get all details of a room.< / p >
< p > The following fields are possible in the JSON response body:< / p >
< ul >
< li > < code > room_id< / code > - The ID of the room.< / li >
< li > < code > name< / code > - The name of the room.< / li >
< li > < code > topic< / code > - The topic of the room.< / li >
< li > < code > avatar< / code > - The < code > mxc< / code > URI to the avatar of the room.< / li >
< li > < code > canonical_alias< / code > - The canonical (main) alias address of the room.< / li >
< li > < code > joined_members< / code > - How many users are currently in the room.< / li >
< li > < code > joined_local_members< / code > - How many local users are currently in the room.< / li >
< li > < code > joined_local_devices< / code > - How many local devices are currently in the room.< / li >
< li > < code > version< / code > - The version of the room as a string.< / li >
< li > < code > creator< / code > - The < code > user_id< / code > of the room creator.< / li >
< li > < code > encryption< / code > - Algorithm of end-to-end encryption of messages. Is < code > null< / code > if encryption is not active.< / li >
< li > < code > federatable< / code > - Whether users on other servers can join this room.< / li >
< li > < code > public< / code > - Whether the room is visible in room directory.< / li >
< li > < code > join_rules< / code > - The type of rules used for users wishing to join this room. One of: [" public" , " knock" , " invite" , " private" ].< / li >
< li > < code > guest_access< / code > - Whether guests can join the room. One of: [" can_join" , " forbidden" ].< / li >
< li > < code > history_visibility< / code > - Who can see the room history. One of: [" invited" , " joined" , " shared" , " world_readable" ].< / li >
< li > < code > state_events< / code > - Total number of state_events of a room. Complexity of the room.< / li >
2022-08-02 04:56:24 -06:00
< li > < code > room_type< / code > - The type of the room taken from the room's creation event; for example " m.space" if the room is a space.
If the room does not define a type, the value will be < code > null< / code > .< / li >
2022-08-31 06:55:41 -06:00
< li > < code > forgotten< / code > - Whether all local users have
< a href = "https://spec.matrix.org/latest/client-server-api/#leaving-rooms" > forgotten< / a > the room.< / li >
2021-07-07 03:44:14 -06:00
< / ul >
2021-07-29 04:09:19 -06:00
< p > The API is:< / p >
2021-07-07 03:44:14 -06:00
< pre > < code > GET /_synapse/admin/v1/rooms/< room_id>
< / code > < / pre >
2021-07-29 04:09:19 -06:00
< p > A response body like the following is returned:< / p >
2021-07-07 03:44:14 -06:00
< pre > < code class = "language-json" > {
" room_id" : " !mscvqgqpHYjBGDxNym:matrix.org" ,
" name" : " Music Theory" ,
" avatar" : " mxc://matrix.org/AQDaVFlbkQoErdOgqWRgiGSV" ,
" topic" : " Theory, Composition, Notation, Analysis" ,
" canonical_alias" : " #musictheory:matrix.org" ,
" joined_members" : 127,
" joined_local_members" : 2,
" joined_local_devices" : 2,
" version" : " 1" ,
" creator" : " @foo:matrix.org" ,
" encryption" : null,
" federatable" : true,
" public" : true,
" join_rules" : " invite" ,
" guest_access" : null,
" history_visibility" : " shared" ,
2022-08-02 04:56:24 -06:00
" state_events" : 93534,
2022-08-31 06:55:41 -06:00
" room_type" : " m.space" ,
" forgotten" : false
2021-07-07 03:44:14 -06:00
}
< / code > < / pre >
2022-08-31 06:55:41 -06:00
< p > < em > Changed in Synapse 1.66:< / em > Added the < code > forgotten< / code > key to the response body.< / p >
2021-07-07 03:44:14 -06:00
< h1 id = "room-members-api" > < a class = "header" href = "#room-members-api" > Room Members API< / a > < / h1 >
< p > The Room Members admin API allows server admins to get a list of all members of a room.< / p >
< p > The response includes the following fields:< / p >
< ul >
< li > < code > members< / code > - A list of all the members that are present in the room, represented by their ids.< / li >
< li > < code > total< / code > - Total number of members in the room.< / li >
< / ul >
2021-07-29 04:09:19 -06:00
< p > The API is:< / p >
2021-07-07 03:44:14 -06:00
< pre > < code > GET /_synapse/admin/v1/rooms/< room_id> /members
< / code > < / pre >
2021-07-29 04:09:19 -06:00
< p > A response body like the following is returned:< / p >
2021-07-07 03:44:14 -06:00
< pre > < code class = "language-json" > {
" members" : [
" @foo:matrix.org" ,
" @bar:matrix.org" ,
" @foobar:matrix.org"
],
" total" : 3
}
< / code > < / pre >
< h1 id = "room-state-api" > < a class = "header" href = "#room-state-api" > Room State API< / a > < / h1 >
< p > The Room State admin API allows server admins to get a list of all state events in a room.< / p >
< p > The response includes the following fields:< / p >
< ul >
< li > < code > state< / code > - The current state of the room at the time of request.< / li >
< / ul >
2021-07-29 04:09:19 -06:00
< p > The API is:< / p >
2021-07-07 03:44:14 -06:00
< pre > < code > GET /_synapse/admin/v1/rooms/< room_id> /state
< / code > < / pre >
2021-07-29 04:09:19 -06:00
< p > A response body like the following is returned:< / p >
2021-07-07 03:44:14 -06:00
< pre > < code class = "language-json" > {
" state" : [
{" type" : " m.room.create" , " state_key" : " " , " etc" : true},
{" type" : " m.room.power_levels" , " state_key" : " " , " etc" : true},
{" type" : " m.room.name" , " state_key" : " " , " etc" : true}
]
}
< / code > < / pre >
2022-09-27 06:50:14 -06:00
< h1 id = "room-messages-api" > < a class = "header" href = "#room-messages-api" > Room Messages API< / a > < / h1 >
< p > The Room Messages admin API allows server admins to get all messages
sent to a room in a given timeframe. There are various parameters available
that allow for filtering and ordering the returned list. This API supports pagination.< / p >
< p > To use it, you will need to authenticate by providing an < code > access_token< / code >
2023-01-17 05:46:31 -07:00
for a server admin: see < a href = "../usage/administration/admin_api/" > Admin API< / a > .< / p >
2022-09-27 06:50:14 -06:00
< p > This endpoint mirrors the < a href = "https://spec.matrix.org/v1.1/client-server-api/#get_matrixclientv3roomsroomidmessages" > Matrix Spec defined Messages API< / a > .< / p >
< p > The API is:< / p >
< pre > < code > GET /_synapse/admin/v1/rooms/< room_id> /messages
< / code > < / pre >
< p > < strong > Parameters< / strong > < / p >
< p > The following path parameters are required:< / p >
< ul >
< li > < code > room_id< / code > - The ID of the room you wish you fetch messages from.< / li >
< / ul >
< p > The following query parameters are available:< / p >
< ul >
< li > < code > from< / code > (required) - The token to start returning events from. This token can be obtained from a prev_batch
or next_batch token returned by the /sync endpoint, or from an end token returned by a previous request to this endpoint.< / li >
< li > < code > to< / code > - The token to spot returning events at.< / li >
< li > < code > limit< / code > - The maximum number of events to return. Defaults to < code > 10< / code > .< / li >
< li > < code > filter< / code > - A JSON RoomEventFilter to filter returned events with.< / li >
< li > < code > dir< / code > - The direction to return events from. Either < code > f< / code > for forwards or < code > b< / code > for backwards. Setting
this value to < code > b< / code > will reverse the above sort order. Defaults to < code > f< / code > .< / li >
< / ul >
< p > < strong > Response< / strong > < / p >
< p > The following fields are possible in the JSON response body:< / p >
< ul >
< li > < code > chunk< / code > - A list of room events. The order depends on the dir parameter.
Note that an empty chunk does not necessarily imply that no more events are available. Clients should continue to paginate until no end property is returned.< / li >
< li > < code > end< / code > - A token corresponding to the end of chunk. This token can be passed back to this endpoint to request further events.
If no further events are available, this property is omitted from the response.< / li >
< li > < code > start< / code > - A token corresponding to the start of chunk.< / li >
< li > < code > state< / code > - A list of state events relevant to showing the chunk.< / li >
< / ul >
< p > < strong > Example< / strong > < / p >
< p > For more details on each chunk, read < a href = "https://spec.matrix.org/v1.1/client-server-api/#get_matrixclientv3roomsroomidmessages" > the Matrix specification< / a > .< / p >
< pre > < code class = "language-json" > {
" chunk" : [
{
" content" : {
" body" : " This is an example text message" ,
" format" : " org.matrix.custom.html" ,
" formatted_body" : " < b> This is an example text message< /b> " ,
" msgtype" : " m.text"
},
" event_id" : " $143273582443PhrSn:example.org" ,
" origin_server_ts" : 1432735824653,
" room_id" : " !636q39766251:example.com" ,
" sender" : " @example:example.org" ,
" type" : " m.room.message" ,
" unsigned" : {
" age" : 1234
}
},
{
" content" : {
" name" : " The room name"
},
" event_id" : " $143273582443PhrSn:example.org" ,
" origin_server_ts" : 1432735824653,
" room_id" : " !636q39766251:example.com" ,
" sender" : " @example:example.org" ,
" state_key" : " " ,
" type" : " m.room.name" ,
" unsigned" : {
" age" : 1234
}
},
{
" content" : {
" body" : " Gangnam Style" ,
" info" : {
" duration" : 2140786,
" h" : 320,
" mimetype" : " video/mp4" ,
" size" : 1563685,
" thumbnail_info" : {
" h" : 300,
" mimetype" : " image/jpeg" ,
" size" : 46144,
" w" : 300
},
" thumbnail_url" : " mxc://example.org/FHyPlCeYUSFFxlgbQYZmoEoe" ,
" w" : 480
},
" msgtype" : " m.video" ,
" url" : " mxc://example.org/a526eYUSFFxlgbQYZmo442"
},
" event_id" : " $143273582443PhrSn:example.org" ,
" origin_server_ts" : 1432735824653,
" room_id" : " !636q39766251:example.com" ,
" sender" : " @example:example.org" ,
" type" : " m.room.message" ,
" unsigned" : {
" age" : 1234
}
}
],
" end" : " t47409-4357353_219380_26003_2265" ,
" start" : " t47429-4392820_219380_26003_2265"
}
< / code > < / pre >
< h1 id = "room-timestamp-to-event-api" > < a class = "header" href = "#room-timestamp-to-event-api" > Room Timestamp to Event API< / a > < / h1 >
< p > The Room Timestamp to Event API endpoint fetches the < code > event_id< / code > of the closest event to the given
timestamp (< code > ts< / code > query parameter) in the given direction (< code > dir< / code > query parameter).< / p >
< p > Useful for cases like jump to date so you can start paginating messages from
a given date in the archive.< / p >
< p > The API is:< / p >
< pre > < code > GET /_synapse/admin/v1/rooms/< room_id> /timestamp_to_event
< / code > < / pre >
< p > < strong > Parameters< / strong > < / p >
< p > The following path parameters are required:< / p >
< ul >
< li > < code > room_id< / code > - The ID of the room you wish to check.< / li >
< / ul >
< p > The following query parameters are available:< / p >
< ul >
< li > < code > ts< / code > - a timestamp in milliseconds where we will find the closest event in
the given direction.< / li >
< li > < code > dir< / code > - can be < code > f< / code > or < code > b< / code > to indicate forwards and backwards in time from the
given timestamp. Defaults to < code > f< / code > .< / li >
< / ul >
< p > < strong > Response< / strong > < / p >
< ul >
< li > < code > event_id< / code > - converted from timestamp< / li >
< / ul >
2021-11-30 07:28:51 -07:00
< h1 id = "block-room-api" > < a class = "header" href = "#block-room-api" > Block Room API< / a > < / h1 >
< p > The Block Room admin API allows server admins to block and unblock rooms,
and query to see if a given room is blocked.
This API can be used to pre-emptively block a room, even if it's unknown to this
homeserver. Users will be prevented from joining a blocked room.< / p >
< h2 id = "block-or-unblock-a-room" > < a class = "header" href = "#block-or-unblock-a-room" > Block or unblock a room< / a > < / h2 >
< p > The API is:< / p >
< pre > < code > PUT /_synapse/admin/v1/rooms/< room_id> /block
< / code > < / pre >
< p > with a body of:< / p >
< pre > < code class = "language-json" > {
" block" : true
}
< / code > < / pre >
< p > A response body like the following is returned:< / p >
< pre > < code class = "language-json" > {
" block" : true
}
< / code > < / pre >
< p > < strong > Parameters< / strong > < / p >
< p > The following parameters should be set in the URL:< / p >
< ul >
< li > < code > room_id< / code > - The ID of the room.< / li >
< / ul >
< p > The following JSON body parameters are available:< / p >
< ul >
< li > < code > block< / code > - If < code > true< / code > the room will be blocked and if < code > false< / code > the room will be unblocked.< / li >
< / ul >
< p > < strong > Response< / strong > < / p >
< p > The following fields are possible in the JSON response body:< / p >
< ul >
< li > < code > block< / code > - A boolean. < code > true< / code > if the room is blocked, otherwise < code > false< / code > < / li >
< / ul >
< h2 id = "get-block-status" > < a class = "header" href = "#get-block-status" > Get block status< / a > < / h2 >
< p > The API is:< / p >
< pre > < code > GET /_synapse/admin/v1/rooms/< room_id> /block
< / code > < / pre >
< p > A response body like the following is returned:< / p >
< pre > < code class = "language-json" > {
" block" : true,
" user_id" : " < user_id> "
}
< / code > < / pre >
< p > < strong > Parameters< / strong > < / p >
< p > The following parameters should be set in the URL:< / p >
< ul >
< li > < code > room_id< / code > - The ID of the room.< / li >
< / ul >
< p > < strong > Response< / strong > < / p >
< p > The following fields are possible in the JSON response body:< / p >
< ul >
< li > < code > block< / code > - A boolean. < code > true< / code > if the room is blocked, otherwise < code > false< / code > < / li >
< li > < code > user_id< / code > - An optional string. If the room is blocked (< code > block< / code > is < code > true< / code > ) shows
the user who has add the room to blocking list. Otherwise it is not displayed.< / li >
< / ul >
2021-07-07 03:44:14 -06:00
< h1 id = "delete-room-api" > < a class = "header" href = "#delete-room-api" > Delete Room API< / a > < / h1 >
2021-11-17 07:20:12 -07:00
< p > The Delete Room admin API allows server admins to remove rooms from the server
2021-07-07 03:44:14 -06:00
and block these rooms.< / p >
< p > Shuts down a room. Moves all local users and room aliases automatically to a
new room if < code > new_room_user_id< / code > is set. Otherwise local users only
leave the room without any information.< / p >
< p > The new room will be created with the user specified by the < code > new_room_user_id< / code > parameter
as room administrator and will contain a message explaining what happened. Users invited
to the new room will have power level < code > -10< / code > by default, and thus be unable to speak.< / p >
2021-11-30 07:28:51 -07:00
< p > If < code > block< / code > is < code > true< / code > , users will be prevented from joining the old room.
This option can in < a href = "#version-1-old-version" > Version 1< / a > also be used to pre-emptively
block a room, even if it's unknown to this homeserver. In this case, the room will be
blocked, and no further action will be taken. If < code > block< / code > is < code > false< / code > , attempting to
delete an unknown room is invalid and will be rejected as a bad request.< / p >
2021-07-07 03:44:14 -06:00
< p > This API will remove all trace of the old room from your database after removing
all local users. If < code > purge< / code > is < code > true< / code > (the default), all traces of the old room will
be removed from your database after removing all local users. If you do not want
this to happen, set < code > purge< / code > to < code > false< / code > .
2021-11-30 07:28:51 -07:00
Depending on the amount of history being purged, a call to the API may take
2021-07-07 03:44:14 -06:00
several minutes or longer.< / p >
< p > The local server will only have the power to move local user and room aliases to
the new room. Users on other servers will be unaffected.< / p >
2021-11-30 07:28:51 -07:00
< h2 id = "version-1-old-version" > < a class = "header" href = "#version-1-old-version" > Version 1 (old version)< / a > < / h2 >
< p > This version works synchronously. That means you only get the response once the server has
finished the action, which may take a long time. If you request the same action
a second time, and the server has not finished the first one, the second request will block.
This is fixed in version 2 of this API. The parameters are the same in both APIs.
This API will become deprecated in the future.< / p >
2021-07-07 03:44:14 -06:00
< p > The API is:< / p >
< pre > < code > DELETE /_synapse/admin/v1/rooms/< room_id>
< / code > < / pre >
< p > with a body of:< / p >
< pre > < code class = "language-json" > {
" new_room_user_id" : " @someuser:example.com" ,
" room_name" : " Content Violation Notification" ,
" message" : " Bad Room has been shutdown due to content violations on this server. Please review our Terms of Service." ,
" block" : true,
" purge" : true
}
< / code > < / pre >
< p > A response body like the following is returned:< / p >
< pre > < code class = "language-json" > {
" kicked_users" : [
" @foobar:example.com"
],
" failed_to_kick_users" : [],
" local_aliases" : [
" #badroom:example.com" ,
" #evilsaloon:example.com"
],
" new_room_id" : " !newroomid:example.com"
}
< / code > < / pre >
2021-11-30 07:28:51 -07:00
< p > The parameters and response values have the same format as
< a href = "#version-2-new-version" > version 2< / a > of the API.< / p >
< h2 id = "version-2-new-version" > < a class = "header" href = "#version-2-new-version" > Version 2 (new version)< / a > < / h2 >
< p > < strong > Note< / strong > : This API is new, experimental and " subject to change" .< / p >
< p > This version works asynchronously, meaning you get the response from server immediately
while the server works on that task in background. You can then request the status of the action
to check if it has completed.< / p >
< p > The API is:< / p >
< pre > < code > DELETE /_synapse/admin/v2/rooms/< room_id>
< / code > < / pre >
< p > with a body of:< / p >
< pre > < code class = "language-json" > {
" new_room_user_id" : " @someuser:example.com" ,
" room_name" : " Content Violation Notification" ,
" message" : " Bad Room has been shutdown due to content violations on this server. Please review our Terms of Service." ,
" block" : true,
" purge" : true
}
< / code > < / pre >
< p > The API starts the shut down and purge running, and returns immediately with a JSON body with
a purge id:< / p >
< pre > < code class = "language-json" > {
" delete_id" : " < opaque id> "
}
< / code > < / pre >
2021-07-29 04:09:19 -06:00
< p > < strong > Parameters< / strong > < / p >
2021-07-07 03:44:14 -06:00
< p > The following parameters should be set in the URL:< / p >
< ul >
< li > < code > room_id< / code > - The ID of the room.< / li >
< / ul >
< p > The following JSON body parameters are available:< / p >
< ul >
< li > < code > new_room_user_id< / code > - Optional. If set, a new room will be created with this user ID
as the creator and admin, and all users in the old room will be moved into that
room. If not set, no new room will be created and the users will just be removed
from the old room. The user ID must be on the local server, but does not necessarily
have to belong to a registered user.< / li >
< li > < code > room_name< / code > - Optional. A string representing the name of the room that new users will be
invited to. Defaults to < code > Content Violation Notification< / code > < / li >
< li > < code > message< / code > - Optional. A string containing the first message that will be sent as
< code > new_room_user_id< / code > in the new room. Ideally this will clearly convey why the
original room was shut down. Defaults to < code > Sharing illegal content on this server is not permitted and rooms in violation will be blocked.< / code > < / li >
2021-11-30 07:28:51 -07:00
< li > < code > block< / code > - Optional. If set to < code > true< / code > , this room will be added to a blocking list,
preventing future attempts to join the room. Rooms can be blocked
even if they're not yet known to the homeserver (only with
< a href = "#version-1-old-version" > Version 1< / a > of the API). Defaults to < code > false< / code > .< / li >
2021-07-07 03:44:14 -06:00
< li > < code > purge< / code > - Optional. If set to < code > true< / code > , it will remove all traces of the room from your database.
Defaults to < code > true< / code > .< / li >
< li > < code > force_purge< / code > - Optional, and ignored unless < code > purge< / code > is < code > true< / code > . If set to < code > true< / code > , it
will force a purge to go ahead even if there are local users still in the room. Do not
use this unless a regular < code > purge< / code > operation fails, as it could leave those users'
clients in a confused state.< / li >
< / ul >
< p > The JSON body must not be empty. The body must be at least < code > {}< / code > .< / p >
2021-11-30 07:28:51 -07:00
< h2 id = "status-of-deleting-rooms" > < a class = "header" href = "#status-of-deleting-rooms" > Status of deleting rooms< / a > < / h2 >
< p > < strong > Note< / strong > : This API is new, experimental and " subject to change" .< / p >
< p > It is possible to query the status of the background task for deleting rooms.
The status can be queried up to 24 hours after completion of the task,
or until Synapse is restarted (whichever happens first).< / p >
< h3 id = "query-by-room_id" > < a class = "header" href = "#query-by-room_id" > Query by < code > room_id< / code > < / a > < / h3 >
< p > With this API you can get the status of all active deletion tasks, and all those completed in the last 24h,
for the given < code > room_id< / code > .< / p >
< p > The API is:< / p >
< pre > < code > GET /_synapse/admin/v2/rooms/< room_id> /delete_status
< / code > < / pre >
< p > A response body like the following is returned:< / p >
< pre > < code class = "language-json" > {
" results" : [
{
" delete_id" : " delete_id1" ,
" status" : " failed" ,
" error" : " error message" ,
" shutdown_room" : {
" kicked_users" : [],
" failed_to_kick_users" : [],
" local_aliases" : [],
" new_room_id" : null
}
}, {
" delete_id" : " delete_id2" ,
" status" : " purging" ,
" shutdown_room" : {
" kicked_users" : [
" @foobar:example.com"
],
" failed_to_kick_users" : [],
" local_aliases" : [
" #badroom:example.com" ,
" #evilsaloon:example.com"
],
" new_room_id" : " !newroomid:example.com"
}
}
]
}
< / code > < / pre >
< p > < strong > Parameters< / strong > < / p >
< p > The following parameters should be set in the URL:< / p >
< ul >
< li > < code > room_id< / code > - The ID of the room.< / li >
< / ul >
< h3 id = "query-by-delete_id" > < a class = "header" href = "#query-by-delete_id" > Query by < code > delete_id< / code > < / a > < / h3 >
< p > With this API you can get the status of one specific task by < code > delete_id< / code > .< / p >
< p > The API is:< / p >
< pre > < code > GET /_synapse/admin/v2/rooms/delete_status/< delete_id>
< / code > < / pre >
< p > A response body like the following is returned:< / p >
< pre > < code class = "language-json" > {
" status" : " purging" ,
" shutdown_room" : {
" kicked_users" : [
" @foobar:example.com"
],
" failed_to_kick_users" : [],
" local_aliases" : [
" #badroom:example.com" ,
" #evilsaloon:example.com"
],
" new_room_id" : " !newroomid:example.com"
}
}
< / code > < / pre >
< p > < strong > Parameters< / strong > < / p >
< p > The following parameters should be set in the URL:< / p >
< ul >
< li > < code > delete_id< / code > - The ID for this delete.< / li >
< / ul >
< h3 id = "response" > < a class = "header" href = "#response" > Response< / a > < / h3 >
2021-07-07 03:44:14 -06:00
< p > The following fields are returned in the JSON response body:< / p >
< ul >
2021-11-30 07:28:51 -07:00
< li > < code > results< / code > - An array of objects, each containing information about one task.
This field is omitted from the result when you query by < code > delete_id< / code > .
Task objects contain the following fields:
< ul >
< li > < code > delete_id< / code > - The ID for this purge if you query by < code > room_id< / code > .< / li >
< li > < code > status< / code > - The status will be one of:
< ul >
< li > < code > shutting_down< / code > - The process is removing users from the room.< / li >
< li > < code > purging< / code > - The process is purging the room and event data from database.< / li >
< li > < code > complete< / code > - The process has completed successfully.< / li >
< li > < code > failed< / code > - The process is aborted, an error has occurred.< / li >
< / ul >
< / li >
< li > < code > error< / code > - A string that shows an error message if < code > status< / code > is < code > failed< / code > .
Otherwise this field is hidden.< / li >
< li > < code > shutdown_room< / code > - An object containing information about the result of shutting down the room.
< em > Note:< / em > The result is shown after removing the room members.
The delete process can still be running. Please pay attention to the < code > status< / code > .
< ul >
2021-07-07 03:44:14 -06:00
< li > < code > kicked_users< / code > - An array of users (< code > user_id< / code > ) that were kicked.< / li >
< li > < code > failed_to_kick_users< / code > - An array of users (< code > user_id< / code > ) that that were not kicked.< / li >
2021-11-30 07:28:51 -07:00
< li > < code > local_aliases< / code > - An array of strings representing the local aliases that were
migrated from the old room to the new.< / li >
< li > < code > new_room_id< / code > - A string representing the room ID of the new room, or < code > null< / code > if
no such room was created.< / li >
< / ul >
< / li >
< / ul >
< / li >
2021-07-07 03:44:14 -06:00
< / ul >
2021-09-21 07:05:07 -06:00
< h2 id = "undoing-room-deletions" > < a class = "header" href = "#undoing-room-deletions" > Undoing room deletions< / a > < / h2 >
< p > < em > Note< / em > : This guide may be outdated by the time you read it. By nature of room deletions being performed at the database level,
2021-07-07 03:44:14 -06:00
the structure can and does change without notice.< / p >
2021-09-21 07:05:07 -06:00
< p > First, it's important to understand that a room deletion is very destructive. Undoing a deletion is not as simple as pretending it
2021-07-07 03:44:14 -06:00
never happened - work has to be done to move forward instead of resetting the past. In fact, in some cases it might not be possible
to recover at all:< / p >
< ul >
< li > If the room was invite-only, your users will need to be re-invited.< / li >
< li > If the room no longer has any members at all, it'll be impossible to rejoin.< / li >
2021-09-21 07:05:07 -06:00
< li > The first user to rejoin will have to do so via an alias on a different
server (or receive an invite from a user on a different server).< / li >
2021-07-07 03:44:14 -06:00
< / ul >
< p > With all that being said, if you still want to try and recover the room:< / p >
< ol >
2021-09-21 07:05:07 -06:00
< li >
< p > If the room was < code > block< / code > ed, you must unblock it on your server. This can be
accomplished as follows:< / p >
< ol >
2021-07-07 03:44:14 -06:00
< li > For safety reasons, shut down Synapse.< / li >
< li > In the database, run < code > DELETE FROM blocked_rooms WHERE room_id = '!example:example.org';< / code >
< ul >
< li > For caution: it's recommended to run this in a transaction: < code > BEGIN; DELETE ...;< / code > , verify you got 1 result, then < code > COMMIT;< / code > .< / li >
2021-09-21 07:05:07 -06:00
< li > The room ID is the same one supplied to the delete room API, not the Content Violation room.< / li >
2021-07-07 03:44:14 -06:00
< / ul >
< / li >
< li > Restart Synapse.< / li >
< / ol >
2021-09-21 07:05:07 -06:00
< p > This step is unnecessary if < code > block< / code > was not set.< / p >
< / li >
< li >
< p > Any room aliases on your server that pointed to the deleted room may have
been deleted, or redirected to the Content Violation room. These will need
to be restored manually.< / p >
< / li >
< li >
< p > Users on your server that were in the deleted room will have been kicked
from the room. Consider whether you want to update their membership
(possibly via the < a href = "room_membership.html" > Edit Room Membership API< / a > ) or let
them handle rejoining themselves.< / p >
< / li >
< li >
< p > If < code > new_room_user_id< / code > was given, a 'Content Violation' will have been
created. Consider whether you want to delete that roomm.< / p >
< / li >
< / ol >
2021-07-07 03:44:14 -06:00
< h1 id = "make-room-admin-api" > < a class = "header" href = "#make-room-admin-api" > Make Room Admin API< / a > < / h1 >
< p > Grants another user the highest power available to a local user who is in the room.
If the user is not in the room, and it is not publicly joinable, then invite the user.< / p >
< p > By default the server admin (the caller) is granted power, but another user can
optionally be specified, e.g.:< / p >
2021-07-29 04:09:19 -06:00
< pre > < code > POST /_synapse/admin/v1/rooms/< room_id_or_alias> /make_room_admin
{
" user_id" : " @foo:example.com"
}
2021-07-07 03:44:14 -06:00
< / code > < / pre >
< h1 id = "forward-extremities-admin-api" > < a class = "header" href = "#forward-extremities-admin-api" > Forward Extremities Admin API< / a > < / h1 >
< p > Enables querying and deleting forward extremities from rooms. When a lot of forward
2021-09-21 07:05:07 -06:00
extremities accumulate in a room, performance can become degraded. For details, see
2021-07-07 03:44:14 -06:00
< a href = "https://github.com/matrix-org/synapse/issues/1760" > #1760< / a > .< / p >
< h2 id = "check-for-forward-extremities" > < a class = "header" href = "#check-for-forward-extremities" > Check for forward extremities< / a > < / h2 >
< p > To check the status of forward extremities for a room:< / p >
2021-07-29 04:09:19 -06:00
< pre > < code > GET /_synapse/admin/v1/rooms/< room_id_or_alias> /forward_extremities
2021-07-07 03:44:14 -06:00
< / code > < / pre >
< p > A response as follows will be returned:< / p >
< pre > < code class = "language-json" > {
" count" : 1,
" results" : [
{
" event_id" : " $M5SP266vsnxctfwFgFLNceaCo3ujhRtg_NiiHabcdefgh" ,
" state_group" : 439,
" depth" : 123,
" received_ts" : 1611263016761
}
]
2021-07-29 04:09:19 -06:00
}
2021-07-07 03:44:14 -06:00
< / code > < / pre >
< h2 id = "deleting-forward-extremities" > < a class = "header" href = "#deleting-forward-extremities" > Deleting forward extremities< / a > < / h2 >
2021-09-21 07:05:07 -06:00
< p > < strong > WARNING< / strong > : Please ensure you know what you're doing and have read
2021-07-07 03:44:14 -06:00
the related issue < a href = "https://github.com/matrix-org/synapse/issues/1760" > #1760< / a > .
Under no situations should this API be executed as an automated maintenance task!< / p >
< p > If a room has lots of forward extremities, the extra can be
deleted as follows:< / p >
2021-07-29 04:09:19 -06:00
< pre > < code > DELETE /_synapse/admin/v1/rooms/< room_id_or_alias> /forward_extremities
2021-07-07 03:44:14 -06:00
< / code > < / pre >
< p > A response as follows will be returned, indicating the amount of forward extremities
that were deleted.< / p >
< pre > < code class = "language-json" > {
" deleted" : 1
}
< / code > < / pre >
< h1 id = "event-context-api" > < a class = "header" href = "#event-context-api" > Event Context API< / a > < / h1 >
< p > This API lets a client find the context of an event. This is designed primarily to investigate abuse reports.< / p >
< pre > < code > GET /_synapse/admin/v1/rooms/< room_id> /context/< event_id>
< / code > < / pre >
< p > This API mimmicks < a href = "https://matrix.org/docs/spec/client_server/r0.6.1#get-matrix-client-r0-rooms-roomid-context-eventid" > GET /_matrix/client/r0/rooms/{roomId}/context/{eventId}< / a > . Please refer to the link for all details on parameters and reseponse.< / p >
< p > Example response:< / p >
< pre > < code class = "language-json" > {
" end" : " t29-57_2_0_2" ,
" events_after" : [
{
" content" : {
" body" : " This is an example text message" ,
" msgtype" : " m.text" ,
" format" : " org.matrix.custom.html" ,
" formatted_body" : " < b> This is an example text message< /b> "
},
" type" : " m.room.message" ,
" event_id" : " $143273582443PhrSn:example.org" ,
" room_id" : " !636q39766251:example.com" ,
" sender" : " @example:example.org" ,
" origin_server_ts" : 1432735824653,
" unsigned" : {
" age" : 1234
}
}
],
" event" : {
" content" : {
" body" : " filename.jpg" ,
" info" : {
" h" : 398,
" w" : 394,
" mimetype" : " image/jpeg" ,
" size" : 31037
},
" url" : " mxc://example.org/JWEIFJgwEIhweiWJE" ,
" msgtype" : " m.image"
},
" type" : " m.room.message" ,
" event_id" : " $f3h4d129462ha:example.com" ,
" room_id" : " !636q39766251:example.com" ,
" sender" : " @example:example.org" ,
" origin_server_ts" : 1432735824653,
" unsigned" : {
" age" : 1234
}
},
" events_before" : [
{
" content" : {
" body" : " something-important.doc" ,
" filename" : " something-important.doc" ,
" info" : {
" mimetype" : " application/msword" ,
" size" : 46144
},
" msgtype" : " m.file" ,
" url" : " mxc://example.org/FHyPlCeYUSFFxlgbQYZmoEoe"
},
" type" : " m.room.message" ,
" event_id" : " $143273582443PhrSn:example.org" ,
" room_id" : " !636q39766251:example.com" ,
" sender" : " @example:example.org" ,
" origin_server_ts" : 1432735824653,
" unsigned" : {
" age" : 1234
}
}
],
" start" : " t27-54_2_0_2" ,
" state" : [
{
" content" : {
" creator" : " @example:example.org" ,
" room_version" : " 1" ,
" m.federate" : true,
" predecessor" : {
" event_id" : " $something:example.org" ,
" room_id" : " !oldroom:example.org"
}
},
" type" : " m.room.create" ,
" event_id" : " $143273582443PhrSn:example.org" ,
" room_id" : " !636q39766251:example.com" ,
" sender" : " @example:example.org" ,
" origin_server_ts" : 1432735824653,
" unsigned" : {
" age" : 1234
},
" state_key" : " "
},
{
" content" : {
" membership" : " join" ,
" avatar_url" : " mxc://example.org/SEsfnsuifSDFSSEF" ,
" displayname" : " Alice Margatroid"
},
" type" : " m.room.member" ,
" event_id" : " $143273582443PhrSn:example.org" ,
" room_id" : " !636q39766251:example.com" ,
" sender" : " @example:example.org" ,
" origin_server_ts" : 1432735824653,
" unsigned" : {
" age" : 1234
},
" state_key" : " @alice:example.org"
}
]
}
< / code > < / pre >
< / main >
< nav class = "nav-wrapper" aria-label = "Page navigation" >
<!-- Mobile navigation buttons -->
< a rel = "prev" href = "../admin_api/room_membership.html" class = "mobile-nav-chapters previous" title = "Previous chapter" aria-label = "Previous chapter" aria-keyshortcuts = "Left" >
< i class = "fa fa-angle-left" > < / i >
< / a >
< a rel = "next" href = "../admin_api/server_notices.html" class = "mobile-nav-chapters next" title = "Next chapter" aria-label = "Next chapter" aria-keyshortcuts = "Right" >
< i class = "fa fa-angle-right" > < / i >
< / a >
< div style = "clear: both" > < / div >
< / nav >
< / div >
< / div >
< nav class = "nav-wide-wrapper" aria-label = "Page navigation" >
< a rel = "prev" href = "../admin_api/room_membership.html" class = "nav-chapters previous" title = "Previous chapter" aria-label = "Previous chapter" aria-keyshortcuts = "Left" >
< i class = "fa fa-angle-left" > < / i >
< / a >
< a rel = "next" href = "../admin_api/server_notices.html" class = "nav-chapters next" title = "Next chapter" aria-label = "Next chapter" aria-keyshortcuts = "Right" >
< i class = "fa fa-angle-right" > < / i >
< / a >
< / nav >
< / div >
< script type = "text/javascript" >
window.playground_copyable = true;
< / script >
< script src = "../elasticlunr.min.js" type = "text/javascript" charset = "utf-8" > < / script >
< script src = "../mark.min.js" type = "text/javascript" charset = "utf-8" > < / script >
< script src = "../searcher.js" type = "text/javascript" charset = "utf-8" > < / script >
< script src = "../clipboard.min.js" type = "text/javascript" charset = "utf-8" > < / script >
< script src = "../highlight.js" type = "text/javascript" charset = "utf-8" > < / script >
< script src = "../book.js" type = "text/javascript" charset = "utf-8" > < / script >
<!-- Custom JS scripts -->
< script type = "text/javascript" src = "../docs/website_files/table-of-contents.js" > < / script >
< / body >
< / html >