rooms.html 62 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030
  1. <!DOCTYPE HTML>
  2. <html lang="en" class="sidebar-visible no-js light">
  3. <head>
  4. <!-- Book generated using mdBook -->
  5. <meta charset="UTF-8">
  6. <title>Rooms - Synapse</title>
  7. <!-- Custom HTML head -->
  8. <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  9. <meta name="description" content="">
  10. <meta name="viewport" content="width=device-width, initial-scale=1">
  11. <meta name="theme-color" content="#ffffff" />
  12. <link rel="icon" href="../favicon.svg">
  13. <link rel="shortcut icon" href="../favicon.png">
  14. <link rel="stylesheet" href="../css/variables.css">
  15. <link rel="stylesheet" href="../css/general.css">
  16. <link rel="stylesheet" href="../css/chrome.css">
  17. <link rel="stylesheet" href="../css/print.css" media="print">
  18. <!-- Fonts -->
  19. <link rel="stylesheet" href="../FontAwesome/css/font-awesome.css">
  20. <link rel="stylesheet" href="../fonts/fonts.css">
  21. <!-- Highlight.js Stylesheets -->
  22. <link rel="stylesheet" href="../highlight.css">
  23. <link rel="stylesheet" href="../tomorrow-night.css">
  24. <link rel="stylesheet" href="../ayu-highlight.css">
  25. <!-- Custom theme stylesheets -->
  26. <link rel="stylesheet" href="../docs/website_files/table-of-contents.css">
  27. <link rel="stylesheet" href="../docs/website_files/remove-nav-buttons.css">
  28. <link rel="stylesheet" href="../docs/website_files/indent-section-headers.css">
  29. <link rel="stylesheet" href="../docs/website_files/version-picker.css">
  30. </head>
  31. <body>
  32. <!-- Provide site root to javascript -->
  33. <script type="text/javascript">
  34. var path_to_root = "../";
  35. var default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "navy" : "light";
  36. </script>
  37. <!-- Work around some values being stored in localStorage wrapped in quotes -->
  38. <script type="text/javascript">
  39. try {
  40. var theme = localStorage.getItem('mdbook-theme');
  41. var sidebar = localStorage.getItem('mdbook-sidebar');
  42. if (theme.startsWith('"') && theme.endsWith('"')) {
  43. localStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1));
  44. }
  45. if (sidebar.startsWith('"') && sidebar.endsWith('"')) {
  46. localStorage.setItem('mdbook-sidebar', sidebar.slice(1, sidebar.length - 1));
  47. }
  48. } catch (e) { }
  49. </script>
  50. <!-- Set the theme before any content is loaded, prevents flash -->
  51. <script type="text/javascript">
  52. var theme;
  53. try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { }
  54. if (theme === null || theme === undefined) { theme = default_theme; }
  55. var html = document.querySelector('html');
  56. html.classList.remove('no-js')
  57. html.classList.remove('light')
  58. html.classList.add(theme);
  59. html.classList.add('js');
  60. </script>
  61. <!-- Hide / unhide sidebar before it is displayed -->
  62. <script type="text/javascript">
  63. var html = document.querySelector('html');
  64. var sidebar = 'hidden';
  65. if (document.body.clientWidth >= 1080) {
  66. try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { }
  67. sidebar = sidebar || 'visible';
  68. }
  69. html.classList.remove('sidebar-visible');
  70. html.classList.add("sidebar-" + sidebar);
  71. </script>
  72. <nav id="sidebar" class="sidebar" aria-label="Table of contents">
  73. <div class="sidebar-scrollbox">
  74. <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 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 "><a href="../modules/spam_checker_callbacks.html">Spam checker callbacks</a></li><li class="chapter-item expanded "><a href="../modules/third_party_rules_callbacks.html">Third-party rules callbacks</a></li><li class="chapter-item expanded "><a href="../modules/presence_router_callbacks.html">Presence router callbacks</a></li><li class="chapter-item expanded "><a href="../modules/account_validity_callbacks.html">Account validity callbacks</a></li><li class="chapter-item expanded "><a href="../modules/password_auth_provider_callbacks.html">Password auth provider callbacks</a></li><li class="chapter-item expanded "><a href="../modules/background_update_controller_callbacks.html">Background update controller callbacks</a></li><li class="chapter-item expanded "><a href="../modules/account_data_callbacks.html">Account data callbacks</a></li><li class="chapter-item expanded "><a href="../modules/porting_legacy_module.html">Porting a legacy module to the new interface</a></li></ol></li></ol></li><li class="chapter-item expanded "><a href="../workers.html">Workers</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="../synctl_workers.html">Using synctl with Workers</a></li><li class="chapter-item expanded "><a href="../systemd-with-workers/index.html">Systemd</a></li></ol></li></ol></li><li class="chapter-item expanded "><a href="../usage/administration/index.html">Administration</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="../usage/administration/admin_api/index.html">Admin API</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="../admin_api/account_validity.html">Account Validity</a></li><li class="chapter-item expanded "><a href="../usage/administration/admin_api/background_updates.html">Background Updates</a></li><li class="chapter-item expanded "><a href="../admin_api/event_reports.html">Event Reports</a></li><li class="chapter-item expanded "><a href="../admin_api/media_admin_api.html">Media</a></li><li class="chapter-item expanded "><a href="../admin_api/purge_history_api.html">Purge History</a></li><li class="chapter-item expanded "><a href="../admin_api/register_api.html">Register Users</a></li><li class="chapter-item expanded "><a href="../usage/administration/admin_api/registration_tokens.html">Registration Tokens</a></li><li class="chapter-item expanded "><a href="../admin_api/room_membership.html">Manipulate Room Membership</a></li><li class="chapter-item expanded "><a href="../admin_api/rooms.html" class="active">Rooms</a></li><li class="chapter-item expanded "><a href="../admin_api/server_notices.html">Server Notices</a></li><li class="chapter-item expanded "><a href="../admin_api/statistics.html">Statistics</a></li><li class="chapter-item expanded "><a href="../admin_api/user_admin_api.html">Users</a></li><li class="chapter-item expanded "><a href="../admin_api/version_api.html">Server Version</a></li><li class="chapter-item expanded "><a href="../usage/administration/admin_api/federation.html">Federation</a></li></ol></li><li class="chapter-item expanded "><a href="../manhole.html">Manhole</a></li><li class="chapter-item expanded "><a href="../metrics-howto.html">Monitoring</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="../usage/administration/monitoring/reporting_homeserver_usage_statistics.html">Reporting Homeserver Usage Statistics</a></li></ol></li><li class="chapter-item expanded "><a href="../usage/administration/understanding_synapse_through_grafana_graphs.html">Understanding Synapse Through Grafana Graphs</a></li><li class="chapter-item expanded "><a href="../usage/administration/useful_sql_for_admins.html">Useful SQL for Admins</a></li><li class="chapter-item expanded "><a href="../usage/administration/database_maintenance_tools.html">Database Maintenance Tools</a></li><li class="chapter-item expanded "><a href="../usage/administration/state_groups.html">State Groups</a></li><li class="chapter-item expanded "><a href="../usage/administration/request_log.html">Request log format</a></li><li class="chapter-item expanded "><a href="../usage/administration/admin_faq.html">Admin FAQ</a></li><li class="chapter-item expanded "><div>Scripts</div></li></ol></li><li class="chapter-item expanded "><li class="part-title">Development</li><li class="chapter-item expanded "><a href="../development/contributing_guide.html">Contributing Guide</a></li><li class="chapter-item expanded "><a href="../code_style.html">Code Style</a></li><li class="chapter-item expanded "><a href="../development/reviews.html">Reviewing Code</a></li><li class="chapter-item expanded "><a href="../development/releases.html">Release Cycle</a></li><li class="chapter-item expanded "><a href="../development/git.html">Git Usage</a></li><li class="chapter-item expanded "><div>Testing</div></li><li><ol class="section"><li class="chapter-item expanded "><a href="../development/demo.html">Demo scripts</a></li></ol></li><li class="chapter-item expanded "><a href="../opentracing.html">OpenTracing</a></li><li class="chapter-item expanded "><a href="../development/database_schema.html">Database Schemas</a></li><li class="chapter-item expanded "><a href="../development/experimental_features.html">Experimental features</a></li><li class="chapter-item expanded "><a href="../development/dependencies.html">Dependency management</a></li><li class="chapter-item expanded "><div>Synapse Architecture</div></li><li><ol class="section"><li class="chapter-item expanded "><a href="../development/synapse_architecture/cancellation.html">Cancellation</a></li><li class="chapter-item expanded "><a href="../log_contexts.html">Log Contexts</a></li><li class="chapter-item expanded "><a href="../replication.html">Replication</a></li><li class="chapter-item expanded "><a href="../tcp_replication.html">TCP Replication</a></li></ol></li><li class="chapter-item expanded "><a href="../development/internal_documentation/index.html">Internal Documentation</a></li><li><ol class="section"><li class="chapter-item expanded "><div>Single Sign-On</div></li><li><ol class="section"><li class="chapter-item expanded "><a href="../development/saml.html">SAML</a></li><li class="chapter-item expanded "><a href="../development/cas.html">CAS</a></li></ol></li><li class="chapter-item expanded "><a href="../development/room-dag-concepts.html">Room DAG concepts</a></li><li class="chapter-item expanded "><div>State Resolution</div></li><li><ol class="section"><li class="chapter-item expanded "><a href="../auth_chain_difference_algorithm.html">The Auth Chain Difference Algorithm</a></li></ol></li><li class="chapter-item expanded "><a href="../media_repository.html">Media Repository</a></li><li class="chapter-item expanded "><a href="../room_and_user_statistics.html">Room and User Statistics</a></li></ol></li><li class="chapter-item expanded "><div>Scripts</div></li><li class="chapter-item expanded affix "><li class="part-title">Other</li><li class="chapter-item expanded "><a href="../deprecation_policy.html">Dependency Deprecation Policy</a></li><li class="chapter-item expanded "><a href="../other/running_synapse_on_single_board_computers.html">Running Synapse on a Single-Board Computer</a></li></ol>
  75. </div>
  76. <div id="sidebar-resize-handle" class="sidebar-resize-handle"></div>
  77. </nav>
  78. <div id="page-wrapper" class="page-wrapper">
  79. <div class="page">
  80. <div id="menu-bar-hover-placeholder"></div>
  81. <div id="menu-bar" class="menu-bar sticky bordered">
  82. <div class="left-buttons">
  83. <button id="sidebar-toggle" class="icon-button" type="button" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar">
  84. <i class="fa fa-bars"></i>
  85. </button>
  86. <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">
  87. <i class="fa fa-paint-brush"></i>
  88. </button>
  89. <ul id="theme-list" class="theme-popup" aria-label="Themes" role="menu">
  90. <li role="none"><button role="menuitem" class="theme" id="light">Light (default)</button></li>
  91. <li role="none"><button role="menuitem" class="theme" id="rust">Rust</button></li>
  92. <li role="none"><button role="menuitem" class="theme" id="coal">Coal</button></li>
  93. <li role="none"><button role="menuitem" class="theme" id="navy">Navy</button></li>
  94. <li role="none"><button role="menuitem" class="theme" id="ayu">Ayu</button></li>
  95. </ul>
  96. <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">
  97. <i class="fa fa-search"></i>
  98. </button>
  99. <div class="version-picker">
  100. <div class="dropdown">
  101. <div class="select">
  102. <span></span>
  103. <i class="fa fa-chevron-down"></i>
  104. </div>
  105. <input type="hidden" name="version">
  106. <ul class="dropdown-menu">
  107. <!-- Versions will be added dynamically in version-picker.js -->
  108. </ul>
  109. </div>
  110. </div>
  111. </div>
  112. <h1 class="menu-title">Synapse</h1>
  113. <div class="right-buttons">
  114. <a href="../print.html" title="Print this book" aria-label="Print this book">
  115. <i id="print-button" class="fa fa-print"></i>
  116. </a>
  117. <a href="https://github.com/matrix-org/synapse" title="Git repository" aria-label="Git repository">
  118. <i id="git-repository-button" class="fa fa-github"></i>
  119. </a>
  120. <a href="https://github.com/matrix-org/synapse/edit/develop/docs/admin_api/rooms.md" title="Suggest an edit" aria-label="Suggest an edit">
  121. <i id="git-edit-button" class="fa fa-edit"></i>
  122. </a>
  123. </div>
  124. </div>
  125. <div id="search-wrapper" class="hidden">
  126. <form id="searchbar-outer" class="searchbar-outer">
  127. <input type="search" id="searchbar" name="searchbar" placeholder="Search this book ..." aria-controls="searchresults-outer" aria-describedby="searchresults-header">
  128. </form>
  129. <div id="searchresults-outer" class="searchresults-outer hidden">
  130. <div id="searchresults-header" class="searchresults-header"></div>
  131. <ul id="searchresults">
  132. </ul>
  133. </div>
  134. </div>
  135. <!-- Apply ARIA attributes after the sidebar and the sidebar toggle button are added to the DOM -->
  136. <script type="text/javascript">
  137. document.getElementById('sidebar-toggle').setAttribute('aria-expanded', sidebar === 'visible');
  138. document.getElementById('sidebar').setAttribute('aria-hidden', sidebar !== 'visible');
  139. Array.from(document.querySelectorAll('#sidebar a')).forEach(function(link) {
  140. link.setAttribute('tabIndex', sidebar === 'visible' ? 0 : -1);
  141. });
  142. </script>
  143. <div id="content" class="content">
  144. <main>
  145. <!-- Page table of contents -->
  146. <div class="sidetoc">
  147. <nav class="pagetoc"></nav>
  148. </div>
  149. <h1 id="list-room-api"><a class="header" href="#list-room-api">List Room API</a></h1>
  150. <p>The List Room admin API allows server admins to get a list of rooms on their
  151. server. There are various parameters available that allow for filtering and
  152. sorting the returned list. This API supports pagination.</p>
  153. <p>To use it, you will need to authenticate by providing an <code>access_token</code>
  154. for a server admin: see <a href="../usage/administration/admin_api">Admin API</a>.</p>
  155. <p><strong>Parameters</strong></p>
  156. <p>The following query parameters are available:</p>
  157. <ul>
  158. <li>
  159. <p><code>from</code> - Offset in the returned list. Defaults to <code>0</code>.</p>
  160. </li>
  161. <li>
  162. <p><code>limit</code> - Maximum amount of rooms to return. Defaults to <code>100</code>.</p>
  163. </li>
  164. <li>
  165. <p><code>order_by</code> - The method in which to sort the returned list of rooms. Valid values are:</p>
  166. <ul>
  167. <li><code>alphabetical</code> - Same as <code>name</code>. This is deprecated.</li>
  168. <li><code>size</code> - Same as <code>joined_members</code>. This is deprecated.</li>
  169. <li><code>name</code> - Rooms are ordered alphabetically by room name. This is the default.</li>
  170. <li><code>canonical_alias</code> - Rooms are ordered alphabetically by main alias address of the room.</li>
  171. <li><code>joined_members</code> - Rooms are ordered by the number of members. Largest to smallest.</li>
  172. <li><code>joined_local_members</code> - Rooms are ordered by the number of local members. Largest to smallest.</li>
  173. <li><code>version</code> - Rooms are ordered by room version. Largest to smallest.</li>
  174. <li><code>creator</code> - Rooms are ordered alphabetically by creator of the room.</li>
  175. <li><code>encryption</code> - Rooms are ordered alphabetically by the end-to-end encryption algorithm.</li>
  176. <li><code>federatable</code> - Rooms are ordered by whether the room is federatable.</li>
  177. <li><code>public</code> - Rooms are ordered by visibility in room list.</li>
  178. <li><code>join_rules</code> - Rooms are ordered alphabetically by join rules of the room.</li>
  179. <li><code>guest_access</code> - Rooms are ordered alphabetically by guest access option of the room.</li>
  180. <li><code>history_visibility</code> - Rooms are ordered alphabetically by visibility of history of the room.</li>
  181. <li><code>state_events</code> - Rooms are ordered by number of state events. Largest to smallest.</li>
  182. </ul>
  183. </li>
  184. <li>
  185. <p><code>dir</code> - Direction of room order. Either <code>f</code> for forwards or <code>b</code> for backwards. Setting
  186. this value to <code>b</code> will reverse the above sort order. Defaults to <code>f</code>.</p>
  187. </li>
  188. <li>
  189. <p><code>search_term</code> - Filter rooms by their room name, canonical alias and room id.
  190. Specifically, rooms are selected if the search term is contained in</p>
  191. <ul>
  192. <li>the room's name,</li>
  193. <li>the local part of the room's canonical alias, or</li>
  194. <li>the complete (local and server part) room's id (case sensitive).</li>
  195. </ul>
  196. <p>Defaults to no filtering.</p>
  197. </li>
  198. </ul>
  199. <p><strong>Response</strong></p>
  200. <p>The following fields are possible in the JSON response body:</p>
  201. <ul>
  202. <li><code>rooms</code> - An array of objects, each containing information about a room.
  203. <ul>
  204. <li>Room objects contain the following fields:
  205. <ul>
  206. <li><code>room_id</code> - The ID of the room.</li>
  207. <li><code>name</code> - The name of the room.</li>
  208. <li><code>canonical_alias</code> - The canonical (main) alias address of the room.</li>
  209. <li><code>joined_members</code> - How many users are currently in the room.</li>
  210. <li><code>joined_local_members</code> - How many local users are currently in the room.</li>
  211. <li><code>version</code> - The version of the room as a string.</li>
  212. <li><code>creator</code> - The <code>user_id</code> of the room creator.</li>
  213. <li><code>encryption</code> - Algorithm of end-to-end encryption of messages. Is <code>null</code> if encryption is not active.</li>
  214. <li><code>federatable</code> - Whether users on other servers can join this room.</li>
  215. <li><code>public</code> - Whether the room is visible in room directory.</li>
  216. <li><code>join_rules</code> - The type of rules used for users wishing to join this room. One of: [&quot;public&quot;, &quot;knock&quot;, &quot;invite&quot;, &quot;private&quot;].</li>
  217. <li><code>guest_access</code> - Whether guests can join the room. One of: [&quot;can_join&quot;, &quot;forbidden&quot;].</li>
  218. <li><code>history_visibility</code> - Who can see the room history. One of: [&quot;invited&quot;, &quot;joined&quot;, &quot;shared&quot;, &quot;world_readable&quot;].</li>
  219. <li><code>state_events</code> - Total number of state_events of a room. Complexity of the room.</li>
  220. <li><code>room_type</code> - The type of the room taken from the room's creation event; for example &quot;m.space&quot; if the room is a space. If the room does not define a type, the value will be <code>null</code>.</li>
  221. </ul>
  222. </li>
  223. </ul>
  224. </li>
  225. <li><code>offset</code> - The current pagination offset in rooms. This parameter should be
  226. used instead of <code>next_token</code> for room offset as <code>next_token</code> is
  227. not intended to be parsed.</li>
  228. <li><code>total_rooms</code> - The total number of rooms this query can return. Using this
  229. and <code>offset</code>, you have enough information to know the current
  230. progression through the list.</li>
  231. <li><code>next_batch</code> - If this field is present, we know that there are potentially
  232. more rooms on the server that did not all fit into this response.
  233. We can use <code>next_batch</code> to get the &quot;next page&quot; of results. To do
  234. so, simply repeat your request, setting the <code>from</code> parameter to
  235. the value of <code>next_batch</code>.</li>
  236. <li><code>prev_batch</code> - If this field is present, it is possible to paginate backwards.
  237. Use <code>prev_batch</code> for the <code>from</code> value in the next request to
  238. get the &quot;previous page&quot; of results.</li>
  239. </ul>
  240. <p>The API is:</p>
  241. <p>A standard request with no filtering:</p>
  242. <pre><code>GET /_synapse/admin/v1/rooms
  243. </code></pre>
  244. <p>A response body like the following is returned:</p>
  245. <pre><code class="language-json">{
  246. &quot;rooms&quot;: [
  247. {
  248. &quot;room_id&quot;: &quot;!OGEhHVWSdvArJzumhm:matrix.org&quot;,
  249. &quot;name&quot;: &quot;Matrix HQ&quot;,
  250. &quot;canonical_alias&quot;: &quot;#matrix:matrix.org&quot;,
  251. &quot;joined_members&quot;: 8326,
  252. &quot;joined_local_members&quot;: 2,
  253. &quot;version&quot;: &quot;1&quot;,
  254. &quot;creator&quot;: &quot;@foo:matrix.org&quot;,
  255. &quot;encryption&quot;: null,
  256. &quot;federatable&quot;: true,
  257. &quot;public&quot;: true,
  258. &quot;join_rules&quot;: &quot;invite&quot;,
  259. &quot;guest_access&quot;: null,
  260. &quot;history_visibility&quot;: &quot;shared&quot;,
  261. &quot;state_events&quot;: 93534,
  262. &quot;room_type&quot;: &quot;m.space&quot;
  263. },
  264. ... (8 hidden items) ...
  265. {
  266. &quot;room_id&quot;: &quot;!xYvNcQPhnkrdUmYczI:matrix.org&quot;,
  267. &quot;name&quot;: &quot;This Week In Matrix (TWIM)&quot;,
  268. &quot;canonical_alias&quot;: &quot;#twim:matrix.org&quot;,
  269. &quot;joined_members&quot;: 314,
  270. &quot;joined_local_members&quot;: 20,
  271. &quot;version&quot;: &quot;4&quot;,
  272. &quot;creator&quot;: &quot;@foo:matrix.org&quot;,
  273. &quot;encryption&quot;: &quot;m.megolm.v1.aes-sha2&quot;,
  274. &quot;federatable&quot;: true,
  275. &quot;public&quot;: false,
  276. &quot;join_rules&quot;: &quot;invite&quot;,
  277. &quot;guest_access&quot;: null,
  278. &quot;history_visibility&quot;: &quot;shared&quot;,
  279. &quot;state_events&quot;: 8345,
  280. &quot;room_type&quot;: null
  281. }
  282. ],
  283. &quot;offset&quot;: 0,
  284. &quot;total_rooms&quot;: 10
  285. }
  286. </code></pre>
  287. <p>Filtering by room name:</p>
  288. <pre><code>GET /_synapse/admin/v1/rooms?search_term=TWIM
  289. </code></pre>
  290. <p>A response body like the following is returned:</p>
  291. <pre><code class="language-json">{
  292. &quot;rooms&quot;: [
  293. {
  294. &quot;room_id&quot;: &quot;!xYvNcQPhnkrdUmYczI:matrix.org&quot;,
  295. &quot;name&quot;: &quot;This Week In Matrix (TWIM)&quot;,
  296. &quot;canonical_alias&quot;: &quot;#twim:matrix.org&quot;,
  297. &quot;joined_members&quot;: 314,
  298. &quot;joined_local_members&quot;: 20,
  299. &quot;version&quot;: &quot;4&quot;,
  300. &quot;creator&quot;: &quot;@foo:matrix.org&quot;,
  301. &quot;encryption&quot;: &quot;m.megolm.v1.aes-sha2&quot;,
  302. &quot;federatable&quot;: true,
  303. &quot;public&quot;: false,
  304. &quot;join_rules&quot;: &quot;invite&quot;,
  305. &quot;guest_access&quot;: null,
  306. &quot;history_visibility&quot;: &quot;shared&quot;,
  307. &quot;state_events&quot;: 8,
  308. &quot;room_type&quot;: null
  309. }
  310. ],
  311. &quot;offset&quot;: 0,
  312. &quot;total_rooms&quot;: 1
  313. }
  314. </code></pre>
  315. <p>Paginating through a list of rooms:</p>
  316. <pre><code>GET /_synapse/admin/v1/rooms?order_by=size
  317. </code></pre>
  318. <p>A response body like the following is returned:</p>
  319. <pre><code class="language-json">{
  320. &quot;rooms&quot;: [
  321. {
  322. &quot;room_id&quot;: &quot;!OGEhHVWSdvArJzumhm:matrix.org&quot;,
  323. &quot;name&quot;: &quot;Matrix HQ&quot;,
  324. &quot;canonical_alias&quot;: &quot;#matrix:matrix.org&quot;,
  325. &quot;joined_members&quot;: 8326,
  326. &quot;joined_local_members&quot;: 2,
  327. &quot;version&quot;: &quot;1&quot;,
  328. &quot;creator&quot;: &quot;@foo:matrix.org&quot;,
  329. &quot;encryption&quot;: null,
  330. &quot;federatable&quot;: true,
  331. &quot;public&quot;: true,
  332. &quot;join_rules&quot;: &quot;invite&quot;,
  333. &quot;guest_access&quot;: null,
  334. &quot;history_visibility&quot;: &quot;shared&quot;,
  335. &quot;state_events&quot;: 93534,
  336. &quot;room_type&quot;: null
  337. },
  338. ... (98 hidden items) ...
  339. {
  340. &quot;room_id&quot;: &quot;!xYvNcQPhnkrdUmYczI:matrix.org&quot;,
  341. &quot;name&quot;: &quot;This Week In Matrix (TWIM)&quot;,
  342. &quot;canonical_alias&quot;: &quot;#twim:matrix.org&quot;,
  343. &quot;joined_members&quot;: 314,
  344. &quot;joined_local_members&quot;: 20,
  345. &quot;version&quot;: &quot;4&quot;,
  346. &quot;creator&quot;: &quot;@foo:matrix.org&quot;,
  347. &quot;encryption&quot;: &quot;m.megolm.v1.aes-sha2&quot;,
  348. &quot;federatable&quot;: true,
  349. &quot;public&quot;: false,
  350. &quot;join_rules&quot;: &quot;invite&quot;,
  351. &quot;guest_access&quot;: null,
  352. &quot;history_visibility&quot;: &quot;shared&quot;,
  353. &quot;state_events&quot;: 8345,
  354. &quot;room_type&quot;: &quot;m.space&quot;
  355. }
  356. ],
  357. &quot;offset&quot;: 0,
  358. &quot;total_rooms&quot;: 150,
  359. &quot;next_token&quot;: 100
  360. }
  361. </code></pre>
  362. <p>The presence of the <code>next_token</code> parameter tells us that there are more rooms
  363. than returned in this request, and we need to make another request to get them.
  364. To get the next batch of room results, we repeat our request, setting the <code>from</code>
  365. parameter to the value of <code>next_token</code>.</p>
  366. <pre><code>GET /_synapse/admin/v1/rooms?order_by=size&amp;from=100
  367. </code></pre>
  368. <p>A response body like the following is returned:</p>
  369. <pre><code class="language-json">{
  370. &quot;rooms&quot;: [
  371. {
  372. &quot;room_id&quot;: &quot;!mscvqgqpHYjBGDxNym:matrix.org&quot;,
  373. &quot;name&quot;: &quot;Music Theory&quot;,
  374. &quot;canonical_alias&quot;: &quot;#musictheory:matrix.org&quot;,
  375. &quot;joined_members&quot;: 127,
  376. &quot;joined_local_members&quot;: 2,
  377. &quot;version&quot;: &quot;1&quot;,
  378. &quot;creator&quot;: &quot;@foo:matrix.org&quot;,
  379. &quot;encryption&quot;: null,
  380. &quot;federatable&quot;: true,
  381. &quot;public&quot;: true,
  382. &quot;join_rules&quot;: &quot;invite&quot;,
  383. &quot;guest_access&quot;: null,
  384. &quot;history_visibility&quot;: &quot;shared&quot;,
  385. &quot;state_events&quot;: 93534,
  386. &quot;room_type&quot;: &quot;m.space&quot;
  387. },
  388. ... (48 hidden items) ...
  389. {
  390. &quot;room_id&quot;: &quot;!twcBhHVdZlQWuuxBhN:termina.org.uk&quot;,
  391. &quot;name&quot;: &quot;weechat-matrix&quot;,
  392. &quot;canonical_alias&quot;: &quot;#weechat-matrix:termina.org.uk&quot;,
  393. &quot;joined_members&quot;: 137,
  394. &quot;joined_local_members&quot;: 20,
  395. &quot;version&quot;: &quot;4&quot;,
  396. &quot;creator&quot;: &quot;@foo:termina.org.uk&quot;,
  397. &quot;encryption&quot;: null,
  398. &quot;federatable&quot;: true,
  399. &quot;public&quot;: true,
  400. &quot;join_rules&quot;: &quot;invite&quot;,
  401. &quot;guest_access&quot;: null,
  402. &quot;history_visibility&quot;: &quot;shared&quot;,
  403. &quot;state_events&quot;: 8345,
  404. &quot;room_type&quot;: null
  405. }
  406. ],
  407. &quot;offset&quot;: 100,
  408. &quot;prev_batch&quot;: 0,
  409. &quot;total_rooms&quot;: 150
  410. }
  411. </code></pre>
  412. <p>Once the <code>next_token</code> parameter is no longer present, we know we've reached the
  413. end of the list.</p>
  414. <h1 id="room-details-api"><a class="header" href="#room-details-api">Room Details API</a></h1>
  415. <p>The Room Details admin API allows server admins to get all details of a room.</p>
  416. <p>The following fields are possible in the JSON response body:</p>
  417. <ul>
  418. <li><code>room_id</code> - The ID of the room.</li>
  419. <li><code>name</code> - The name of the room.</li>
  420. <li><code>topic</code> - The topic of the room.</li>
  421. <li><code>avatar</code> - The <code>mxc</code> URI to the avatar of the room.</li>
  422. <li><code>canonical_alias</code> - The canonical (main) alias address of the room.</li>
  423. <li><code>joined_members</code> - How many users are currently in the room.</li>
  424. <li><code>joined_local_members</code> - How many local users are currently in the room.</li>
  425. <li><code>joined_local_devices</code> - How many local devices are currently in the room.</li>
  426. <li><code>version</code> - The version of the room as a string.</li>
  427. <li><code>creator</code> - The <code>user_id</code> of the room creator.</li>
  428. <li><code>encryption</code> - Algorithm of end-to-end encryption of messages. Is <code>null</code> if encryption is not active.</li>
  429. <li><code>federatable</code> - Whether users on other servers can join this room.</li>
  430. <li><code>public</code> - Whether the room is visible in room directory.</li>
  431. <li><code>join_rules</code> - The type of rules used for users wishing to join this room. One of: [&quot;public&quot;, &quot;knock&quot;, &quot;invite&quot;, &quot;private&quot;].</li>
  432. <li><code>guest_access</code> - Whether guests can join the room. One of: [&quot;can_join&quot;, &quot;forbidden&quot;].</li>
  433. <li><code>history_visibility</code> - Who can see the room history. One of: [&quot;invited&quot;, &quot;joined&quot;, &quot;shared&quot;, &quot;world_readable&quot;].</li>
  434. <li><code>state_events</code> - Total number of state_events of a room. Complexity of the room.</li>
  435. <li><code>room_type</code> - The type of the room taken from the room's creation event; for example &quot;m.space&quot; if the room is a space.
  436. If the room does not define a type, the value will be <code>null</code>.</li>
  437. <li><code>forgotten</code> - Whether all local users have
  438. <a href="https://spec.matrix.org/latest/client-server-api/#leaving-rooms">forgotten</a> the room.</li>
  439. </ul>
  440. <p>The API is:</p>
  441. <pre><code>GET /_synapse/admin/v1/rooms/&lt;room_id&gt;
  442. </code></pre>
  443. <p>A response body like the following is returned:</p>
  444. <pre><code class="language-json">{
  445. &quot;room_id&quot;: &quot;!mscvqgqpHYjBGDxNym:matrix.org&quot;,
  446. &quot;name&quot;: &quot;Music Theory&quot;,
  447. &quot;avatar&quot;: &quot;mxc://matrix.org/AQDaVFlbkQoErdOgqWRgiGSV&quot;,
  448. &quot;topic&quot;: &quot;Theory, Composition, Notation, Analysis&quot;,
  449. &quot;canonical_alias&quot;: &quot;#musictheory:matrix.org&quot;,
  450. &quot;joined_members&quot;: 127,
  451. &quot;joined_local_members&quot;: 2,
  452. &quot;joined_local_devices&quot;: 2,
  453. &quot;version&quot;: &quot;1&quot;,
  454. &quot;creator&quot;: &quot;@foo:matrix.org&quot;,
  455. &quot;encryption&quot;: null,
  456. &quot;federatable&quot;: true,
  457. &quot;public&quot;: true,
  458. &quot;join_rules&quot;: &quot;invite&quot;,
  459. &quot;guest_access&quot;: null,
  460. &quot;history_visibility&quot;: &quot;shared&quot;,
  461. &quot;state_events&quot;: 93534,
  462. &quot;room_type&quot;: &quot;m.space&quot;,
  463. &quot;forgotten&quot;: false
  464. }
  465. </code></pre>
  466. <p><em>Changed in Synapse 1.66:</em> Added the <code>forgotten</code> key to the response body.</p>
  467. <h1 id="room-members-api"><a class="header" href="#room-members-api">Room Members API</a></h1>
  468. <p>The Room Members admin API allows server admins to get a list of all members of a room.</p>
  469. <p>The response includes the following fields:</p>
  470. <ul>
  471. <li><code>members</code> - A list of all the members that are present in the room, represented by their ids.</li>
  472. <li><code>total</code> - Total number of members in the room.</li>
  473. </ul>
  474. <p>The API is:</p>
  475. <pre><code>GET /_synapse/admin/v1/rooms/&lt;room_id&gt;/members
  476. </code></pre>
  477. <p>A response body like the following is returned:</p>
  478. <pre><code class="language-json">{
  479. &quot;members&quot;: [
  480. &quot;@foo:matrix.org&quot;,
  481. &quot;@bar:matrix.org&quot;,
  482. &quot;@foobar:matrix.org&quot;
  483. ],
  484. &quot;total&quot;: 3
  485. }
  486. </code></pre>
  487. <h1 id="room-state-api"><a class="header" href="#room-state-api">Room State API</a></h1>
  488. <p>The Room State admin API allows server admins to get a list of all state events in a room.</p>
  489. <p>The response includes the following fields:</p>
  490. <ul>
  491. <li><code>state</code> - The current state of the room at the time of request.</li>
  492. </ul>
  493. <p>The API is:</p>
  494. <pre><code>GET /_synapse/admin/v1/rooms/&lt;room_id&gt;/state
  495. </code></pre>
  496. <p>A response body like the following is returned:</p>
  497. <pre><code class="language-json">{
  498. &quot;state&quot;: [
  499. {&quot;type&quot;: &quot;m.room.create&quot;, &quot;state_key&quot;: &quot;&quot;, &quot;etc&quot;: true},
  500. {&quot;type&quot;: &quot;m.room.power_levels&quot;, &quot;state_key&quot;: &quot;&quot;, &quot;etc&quot;: true},
  501. {&quot;type&quot;: &quot;m.room.name&quot;, &quot;state_key&quot;: &quot;&quot;, &quot;etc&quot;: true}
  502. ]
  503. }
  504. </code></pre>
  505. <h1 id="block-room-api"><a class="header" href="#block-room-api">Block Room API</a></h1>
  506. <p>The Block Room admin API allows server admins to block and unblock rooms,
  507. and query to see if a given room is blocked.
  508. This API can be used to pre-emptively block a room, even if it's unknown to this
  509. homeserver. Users will be prevented from joining a blocked room.</p>
  510. <h2 id="block-or-unblock-a-room"><a class="header" href="#block-or-unblock-a-room">Block or unblock a room</a></h2>
  511. <p>The API is:</p>
  512. <pre><code>PUT /_synapse/admin/v1/rooms/&lt;room_id&gt;/block
  513. </code></pre>
  514. <p>with a body of:</p>
  515. <pre><code class="language-json">{
  516. &quot;block&quot;: true
  517. }
  518. </code></pre>
  519. <p>A response body like the following is returned:</p>
  520. <pre><code class="language-json">{
  521. &quot;block&quot;: true
  522. }
  523. </code></pre>
  524. <p><strong>Parameters</strong></p>
  525. <p>The following parameters should be set in the URL:</p>
  526. <ul>
  527. <li><code>room_id</code> - The ID of the room.</li>
  528. </ul>
  529. <p>The following JSON body parameters are available:</p>
  530. <ul>
  531. <li><code>block</code> - If <code>true</code> the room will be blocked and if <code>false</code> the room will be unblocked.</li>
  532. </ul>
  533. <p><strong>Response</strong></p>
  534. <p>The following fields are possible in the JSON response body:</p>
  535. <ul>
  536. <li><code>block</code> - A boolean. <code>true</code> if the room is blocked, otherwise <code>false</code></li>
  537. </ul>
  538. <h2 id="get-block-status"><a class="header" href="#get-block-status">Get block status</a></h2>
  539. <p>The API is:</p>
  540. <pre><code>GET /_synapse/admin/v1/rooms/&lt;room_id&gt;/block
  541. </code></pre>
  542. <p>A response body like the following is returned:</p>
  543. <pre><code class="language-json">{
  544. &quot;block&quot;: true,
  545. &quot;user_id&quot;: &quot;&lt;user_id&gt;&quot;
  546. }
  547. </code></pre>
  548. <p><strong>Parameters</strong></p>
  549. <p>The following parameters should be set in the URL:</p>
  550. <ul>
  551. <li><code>room_id</code> - The ID of the room.</li>
  552. </ul>
  553. <p><strong>Response</strong></p>
  554. <p>The following fields are possible in the JSON response body:</p>
  555. <ul>
  556. <li><code>block</code> - A boolean. <code>true</code> if the room is blocked, otherwise <code>false</code></li>
  557. <li><code>user_id</code> - An optional string. If the room is blocked (<code>block</code> is <code>true</code>) shows
  558. the user who has add the room to blocking list. Otherwise it is not displayed.</li>
  559. </ul>
  560. <h1 id="delete-room-api"><a class="header" href="#delete-room-api">Delete Room API</a></h1>
  561. <p>The Delete Room admin API allows server admins to remove rooms from the server
  562. and block these rooms.</p>
  563. <p>Shuts down a room. Moves all local users and room aliases automatically to a
  564. new room if <code>new_room_user_id</code> is set. Otherwise local users only
  565. leave the room without any information.</p>
  566. <p>The new room will be created with the user specified by the <code>new_room_user_id</code> parameter
  567. as room administrator and will contain a message explaining what happened. Users invited
  568. to the new room will have power level <code>-10</code> by default, and thus be unable to speak.</p>
  569. <p>If <code>block</code> is <code>true</code>, users will be prevented from joining the old room.
  570. This option can in <a href="#version-1-old-version">Version 1</a> also be used to pre-emptively
  571. block a room, even if it's unknown to this homeserver. In this case, the room will be
  572. blocked, and no further action will be taken. If <code>block</code> is <code>false</code>, attempting to
  573. delete an unknown room is invalid and will be rejected as a bad request.</p>
  574. <p>This API will remove all trace of the old room from your database after removing
  575. all local users. If <code>purge</code> is <code>true</code> (the default), all traces of the old room will
  576. be removed from your database after removing all local users. If you do not want
  577. this to happen, set <code>purge</code> to <code>false</code>.
  578. Depending on the amount of history being purged, a call to the API may take
  579. several minutes or longer.</p>
  580. <p>The local server will only have the power to move local user and room aliases to
  581. the new room. Users on other servers will be unaffected.</p>
  582. <h2 id="version-1-old-version"><a class="header" href="#version-1-old-version">Version 1 (old version)</a></h2>
  583. <p>This version works synchronously. That means you only get the response once the server has
  584. finished the action, which may take a long time. If you request the same action
  585. a second time, and the server has not finished the first one, the second request will block.
  586. This is fixed in version 2 of this API. The parameters are the same in both APIs.
  587. This API will become deprecated in the future.</p>
  588. <p>The API is:</p>
  589. <pre><code>DELETE /_synapse/admin/v1/rooms/&lt;room_id&gt;
  590. </code></pre>
  591. <p>with a body of:</p>
  592. <pre><code class="language-json">{
  593. &quot;new_room_user_id&quot;: &quot;@someuser:example.com&quot;,
  594. &quot;room_name&quot;: &quot;Content Violation Notification&quot;,
  595. &quot;message&quot;: &quot;Bad Room has been shutdown due to content violations on this server. Please review our Terms of Service.&quot;,
  596. &quot;block&quot;: true,
  597. &quot;purge&quot;: true
  598. }
  599. </code></pre>
  600. <p>A response body like the following is returned:</p>
  601. <pre><code class="language-json">{
  602. &quot;kicked_users&quot;: [
  603. &quot;@foobar:example.com&quot;
  604. ],
  605. &quot;failed_to_kick_users&quot;: [],
  606. &quot;local_aliases&quot;: [
  607. &quot;#badroom:example.com&quot;,
  608. &quot;#evilsaloon:example.com&quot;
  609. ],
  610. &quot;new_room_id&quot;: &quot;!newroomid:example.com&quot;
  611. }
  612. </code></pre>
  613. <p>The parameters and response values have the same format as
  614. <a href="#version-2-new-version">version 2</a> of the API.</p>
  615. <h2 id="version-2-new-version"><a class="header" href="#version-2-new-version">Version 2 (new version)</a></h2>
  616. <p><strong>Note</strong>: This API is new, experimental and &quot;subject to change&quot;.</p>
  617. <p>This version works asynchronously, meaning you get the response from server immediately
  618. while the server works on that task in background. You can then request the status of the action
  619. to check if it has completed.</p>
  620. <p>The API is:</p>
  621. <pre><code>DELETE /_synapse/admin/v2/rooms/&lt;room_id&gt;
  622. </code></pre>
  623. <p>with a body of:</p>
  624. <pre><code class="language-json">{
  625. &quot;new_room_user_id&quot;: &quot;@someuser:example.com&quot;,
  626. &quot;room_name&quot;: &quot;Content Violation Notification&quot;,
  627. &quot;message&quot;: &quot;Bad Room has been shutdown due to content violations on this server. Please review our Terms of Service.&quot;,
  628. &quot;block&quot;: true,
  629. &quot;purge&quot;: true
  630. }
  631. </code></pre>
  632. <p>The API starts the shut down and purge running, and returns immediately with a JSON body with
  633. a purge id:</p>
  634. <pre><code class="language-json">{
  635. &quot;delete_id&quot;: &quot;&lt;opaque id&gt;&quot;
  636. }
  637. </code></pre>
  638. <p><strong>Parameters</strong></p>
  639. <p>The following parameters should be set in the URL:</p>
  640. <ul>
  641. <li><code>room_id</code> - The ID of the room.</li>
  642. </ul>
  643. <p>The following JSON body parameters are available:</p>
  644. <ul>
  645. <li><code>new_room_user_id</code> - Optional. If set, a new room will be created with this user ID
  646. as the creator and admin, and all users in the old room will be moved into that
  647. room. If not set, no new room will be created and the users will just be removed
  648. from the old room. The user ID must be on the local server, but does not necessarily
  649. have to belong to a registered user.</li>
  650. <li><code>room_name</code> - Optional. A string representing the name of the room that new users will be
  651. invited to. Defaults to <code>Content Violation Notification</code></li>
  652. <li><code>message</code> - Optional. A string containing the first message that will be sent as
  653. <code>new_room_user_id</code> in the new room. Ideally this will clearly convey why the
  654. 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>
  655. <li><code>block</code> - Optional. If set to <code>true</code>, this room will be added to a blocking list,
  656. preventing future attempts to join the room. Rooms can be blocked
  657. even if they're not yet known to the homeserver (only with
  658. <a href="#version-1-old-version">Version 1</a> of the API). Defaults to <code>false</code>.</li>
  659. <li><code>purge</code> - Optional. If set to <code>true</code>, it will remove all traces of the room from your database.
  660. Defaults to <code>true</code>.</li>
  661. <li><code>force_purge</code> - Optional, and ignored unless <code>purge</code> is <code>true</code>. If set to <code>true</code>, it
  662. will force a purge to go ahead even if there are local users still in the room. Do not
  663. use this unless a regular <code>purge</code> operation fails, as it could leave those users'
  664. clients in a confused state.</li>
  665. </ul>
  666. <p>The JSON body must not be empty. The body must be at least <code>{}</code>.</p>
  667. <h2 id="status-of-deleting-rooms"><a class="header" href="#status-of-deleting-rooms">Status of deleting rooms</a></h2>
  668. <p><strong>Note</strong>: This API is new, experimental and &quot;subject to change&quot;.</p>
  669. <p>It is possible to query the status of the background task for deleting rooms.
  670. The status can be queried up to 24 hours after completion of the task,
  671. or until Synapse is restarted (whichever happens first).</p>
  672. <h3 id="query-by-room_id"><a class="header" href="#query-by-room_id">Query by <code>room_id</code></a></h3>
  673. <p>With this API you can get the status of all active deletion tasks, and all those completed in the last 24h,
  674. for the given <code>room_id</code>.</p>
  675. <p>The API is:</p>
  676. <pre><code>GET /_synapse/admin/v2/rooms/&lt;room_id&gt;/delete_status
  677. </code></pre>
  678. <p>A response body like the following is returned:</p>
  679. <pre><code class="language-json">{
  680. &quot;results&quot;: [
  681. {
  682. &quot;delete_id&quot;: &quot;delete_id1&quot;,
  683. &quot;status&quot;: &quot;failed&quot;,
  684. &quot;error&quot;: &quot;error message&quot;,
  685. &quot;shutdown_room&quot;: {
  686. &quot;kicked_users&quot;: [],
  687. &quot;failed_to_kick_users&quot;: [],
  688. &quot;local_aliases&quot;: [],
  689. &quot;new_room_id&quot;: null
  690. }
  691. }, {
  692. &quot;delete_id&quot;: &quot;delete_id2&quot;,
  693. &quot;status&quot;: &quot;purging&quot;,
  694. &quot;shutdown_room&quot;: {
  695. &quot;kicked_users&quot;: [
  696. &quot;@foobar:example.com&quot;
  697. ],
  698. &quot;failed_to_kick_users&quot;: [],
  699. &quot;local_aliases&quot;: [
  700. &quot;#badroom:example.com&quot;,
  701. &quot;#evilsaloon:example.com&quot;
  702. ],
  703. &quot;new_room_id&quot;: &quot;!newroomid:example.com&quot;
  704. }
  705. }
  706. ]
  707. }
  708. </code></pre>
  709. <p><strong>Parameters</strong></p>
  710. <p>The following parameters should be set in the URL:</p>
  711. <ul>
  712. <li><code>room_id</code> - The ID of the room.</li>
  713. </ul>
  714. <h3 id="query-by-delete_id"><a class="header" href="#query-by-delete_id">Query by <code>delete_id</code></a></h3>
  715. <p>With this API you can get the status of one specific task by <code>delete_id</code>.</p>
  716. <p>The API is:</p>
  717. <pre><code>GET /_synapse/admin/v2/rooms/delete_status/&lt;delete_id&gt;
  718. </code></pre>
  719. <p>A response body like the following is returned:</p>
  720. <pre><code class="language-json">{
  721. &quot;status&quot;: &quot;purging&quot;,
  722. &quot;shutdown_room&quot;: {
  723. &quot;kicked_users&quot;: [
  724. &quot;@foobar:example.com&quot;
  725. ],
  726. &quot;failed_to_kick_users&quot;: [],
  727. &quot;local_aliases&quot;: [
  728. &quot;#badroom:example.com&quot;,
  729. &quot;#evilsaloon:example.com&quot;
  730. ],
  731. &quot;new_room_id&quot;: &quot;!newroomid:example.com&quot;
  732. }
  733. }
  734. </code></pre>
  735. <p><strong>Parameters</strong></p>
  736. <p>The following parameters should be set in the URL:</p>
  737. <ul>
  738. <li><code>delete_id</code> - The ID for this delete.</li>
  739. </ul>
  740. <h3 id="response"><a class="header" href="#response">Response</a></h3>
  741. <p>The following fields are returned in the JSON response body:</p>
  742. <ul>
  743. <li><code>results</code> - An array of objects, each containing information about one task.
  744. This field is omitted from the result when you query by <code>delete_id</code>.
  745. Task objects contain the following fields:
  746. <ul>
  747. <li><code>delete_id</code> - The ID for this purge if you query by <code>room_id</code>.</li>
  748. <li><code>status</code> - The status will be one of:
  749. <ul>
  750. <li><code>shutting_down</code> - The process is removing users from the room.</li>
  751. <li><code>purging</code> - The process is purging the room and event data from database.</li>
  752. <li><code>complete</code> - The process has completed successfully.</li>
  753. <li><code>failed</code> - The process is aborted, an error has occurred.</li>
  754. </ul>
  755. </li>
  756. <li><code>error</code> - A string that shows an error message if <code>status</code> is <code>failed</code>.
  757. Otherwise this field is hidden.</li>
  758. <li><code>shutdown_room</code> - An object containing information about the result of shutting down the room.
  759. <em>Note:</em> The result is shown after removing the room members.
  760. The delete process can still be running. Please pay attention to the <code>status</code>.
  761. <ul>
  762. <li><code>kicked_users</code> - An array of users (<code>user_id</code>) that were kicked.</li>
  763. <li><code>failed_to_kick_users</code> - An array of users (<code>user_id</code>) that that were not kicked.</li>
  764. <li><code>local_aliases</code> - An array of strings representing the local aliases that were
  765. migrated from the old room to the new.</li>
  766. <li><code>new_room_id</code> - A string representing the room ID of the new room, or <code>null</code> if
  767. no such room was created.</li>
  768. </ul>
  769. </li>
  770. </ul>
  771. </li>
  772. </ul>
  773. <h2 id="undoing-room-deletions"><a class="header" href="#undoing-room-deletions">Undoing room deletions</a></h2>
  774. <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,
  775. the structure can and does change without notice.</p>
  776. <p>First, it's important to understand that a room deletion is very destructive. Undoing a deletion is not as simple as pretending it
  777. 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
  778. to recover at all:</p>
  779. <ul>
  780. <li>If the room was invite-only, your users will need to be re-invited.</li>
  781. <li>If the room no longer has any members at all, it'll be impossible to rejoin.</li>
  782. <li>The first user to rejoin will have to do so via an alias on a different
  783. server (or receive an invite from a user on a different server).</li>
  784. </ul>
  785. <p>With all that being said, if you still want to try and recover the room:</p>
  786. <ol>
  787. <li>
  788. <p>If the room was <code>block</code>ed, you must unblock it on your server. This can be
  789. accomplished as follows:</p>
  790. <ol>
  791. <li>For safety reasons, shut down Synapse.</li>
  792. <li>In the database, run <code>DELETE FROM blocked_rooms WHERE room_id = '!example:example.org';</code>
  793. <ul>
  794. <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>
  795. <li>The room ID is the same one supplied to the delete room API, not the Content Violation room.</li>
  796. </ul>
  797. </li>
  798. <li>Restart Synapse.</li>
  799. </ol>
  800. <p>This step is unnecessary if <code>block</code> was not set.</p>
  801. </li>
  802. <li>
  803. <p>Any room aliases on your server that pointed to the deleted room may have
  804. been deleted, or redirected to the Content Violation room. These will need
  805. to be restored manually.</p>
  806. </li>
  807. <li>
  808. <p>Users on your server that were in the deleted room will have been kicked
  809. from the room. Consider whether you want to update their membership
  810. (possibly via the <a href="room_membership.html">Edit Room Membership API</a>) or let
  811. them handle rejoining themselves.</p>
  812. </li>
  813. <li>
  814. <p>If <code>new_room_user_id</code> was given, a 'Content Violation' will have been
  815. created. Consider whether you want to delete that roomm.</p>
  816. </li>
  817. </ol>
  818. <h1 id="make-room-admin-api"><a class="header" href="#make-room-admin-api">Make Room Admin API</a></h1>
  819. <p>Grants another user the highest power available to a local user who is in the room.
  820. If the user is not in the room, and it is not publicly joinable, then invite the user.</p>
  821. <p>By default the server admin (the caller) is granted power, but another user can
  822. optionally be specified, e.g.:</p>
  823. <pre><code>POST /_synapse/admin/v1/rooms/&lt;room_id_or_alias&gt;/make_room_admin
  824. {
  825. &quot;user_id&quot;: &quot;@foo:example.com&quot;
  826. }
  827. </code></pre>
  828. <h1 id="forward-extremities-admin-api"><a class="header" href="#forward-extremities-admin-api">Forward Extremities Admin API</a></h1>
  829. <p>Enables querying and deleting forward extremities from rooms. When a lot of forward
  830. extremities accumulate in a room, performance can become degraded. For details, see
  831. <a href="https://github.com/matrix-org/synapse/issues/1760">#1760</a>.</p>
  832. <h2 id="check-for-forward-extremities"><a class="header" href="#check-for-forward-extremities">Check for forward extremities</a></h2>
  833. <p>To check the status of forward extremities for a room:</p>
  834. <pre><code>GET /_synapse/admin/v1/rooms/&lt;room_id_or_alias&gt;/forward_extremities
  835. </code></pre>
  836. <p>A response as follows will be returned:</p>
  837. <pre><code class="language-json">{
  838. &quot;count&quot;: 1,
  839. &quot;results&quot;: [
  840. {
  841. &quot;event_id&quot;: &quot;$M5SP266vsnxctfwFgFLNceaCo3ujhRtg_NiiHabcdefgh&quot;,
  842. &quot;state_group&quot;: 439,
  843. &quot;depth&quot;: 123,
  844. &quot;received_ts&quot;: 1611263016761
  845. }
  846. ]
  847. }
  848. </code></pre>
  849. <h2 id="deleting-forward-extremities"><a class="header" href="#deleting-forward-extremities">Deleting forward extremities</a></h2>
  850. <p><strong>WARNING</strong>: Please ensure you know what you're doing and have read
  851. the related issue <a href="https://github.com/matrix-org/synapse/issues/1760">#1760</a>.
  852. Under no situations should this API be executed as an automated maintenance task!</p>
  853. <p>If a room has lots of forward extremities, the extra can be
  854. deleted as follows:</p>
  855. <pre><code>DELETE /_synapse/admin/v1/rooms/&lt;room_id_or_alias&gt;/forward_extremities
  856. </code></pre>
  857. <p>A response as follows will be returned, indicating the amount of forward extremities
  858. that were deleted.</p>
  859. <pre><code class="language-json">{
  860. &quot;deleted&quot;: 1
  861. }
  862. </code></pre>
  863. <h1 id="event-context-api"><a class="header" href="#event-context-api">Event Context API</a></h1>
  864. <p>This API lets a client find the context of an event. This is designed primarily to investigate abuse reports.</p>
  865. <pre><code>GET /_synapse/admin/v1/rooms/&lt;room_id&gt;/context/&lt;event_id&gt;
  866. </code></pre>
  867. <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>
  868. <p>Example response:</p>
  869. <pre><code class="language-json">{
  870. &quot;end&quot;: &quot;t29-57_2_0_2&quot;,
  871. &quot;events_after&quot;: [
  872. {
  873. &quot;content&quot;: {
  874. &quot;body&quot;: &quot;This is an example text message&quot;,
  875. &quot;msgtype&quot;: &quot;m.text&quot;,
  876. &quot;format&quot;: &quot;org.matrix.custom.html&quot;,
  877. &quot;formatted_body&quot;: &quot;&lt;b&gt;This is an example text message&lt;/b&gt;&quot;
  878. },
  879. &quot;type&quot;: &quot;m.room.message&quot;,
  880. &quot;event_id&quot;: &quot;$143273582443PhrSn:example.org&quot;,
  881. &quot;room_id&quot;: &quot;!636q39766251:example.com&quot;,
  882. &quot;sender&quot;: &quot;@example:example.org&quot;,
  883. &quot;origin_server_ts&quot;: 1432735824653,
  884. &quot;unsigned&quot;: {
  885. &quot;age&quot;: 1234
  886. }
  887. }
  888. ],
  889. &quot;event&quot;: {
  890. &quot;content&quot;: {
  891. &quot;body&quot;: &quot;filename.jpg&quot;,
  892. &quot;info&quot;: {
  893. &quot;h&quot;: 398,
  894. &quot;w&quot;: 394,
  895. &quot;mimetype&quot;: &quot;image/jpeg&quot;,
  896. &quot;size&quot;: 31037
  897. },
  898. &quot;url&quot;: &quot;mxc://example.org/JWEIFJgwEIhweiWJE&quot;,
  899. &quot;msgtype&quot;: &quot;m.image&quot;
  900. },
  901. &quot;type&quot;: &quot;m.room.message&quot;,
  902. &quot;event_id&quot;: &quot;$f3h4d129462ha:example.com&quot;,
  903. &quot;room_id&quot;: &quot;!636q39766251:example.com&quot;,
  904. &quot;sender&quot;: &quot;@example:example.org&quot;,
  905. &quot;origin_server_ts&quot;: 1432735824653,
  906. &quot;unsigned&quot;: {
  907. &quot;age&quot;: 1234
  908. }
  909. },
  910. &quot;events_before&quot;: [
  911. {
  912. &quot;content&quot;: {
  913. &quot;body&quot;: &quot;something-important.doc&quot;,
  914. &quot;filename&quot;: &quot;something-important.doc&quot;,
  915. &quot;info&quot;: {
  916. &quot;mimetype&quot;: &quot;application/msword&quot;,
  917. &quot;size&quot;: 46144
  918. },
  919. &quot;msgtype&quot;: &quot;m.file&quot;,
  920. &quot;url&quot;: &quot;mxc://example.org/FHyPlCeYUSFFxlgbQYZmoEoe&quot;
  921. },
  922. &quot;type&quot;: &quot;m.room.message&quot;,
  923. &quot;event_id&quot;: &quot;$143273582443PhrSn:example.org&quot;,
  924. &quot;room_id&quot;: &quot;!636q39766251:example.com&quot;,
  925. &quot;sender&quot;: &quot;@example:example.org&quot;,
  926. &quot;origin_server_ts&quot;: 1432735824653,
  927. &quot;unsigned&quot;: {
  928. &quot;age&quot;: 1234
  929. }
  930. }
  931. ],
  932. &quot;start&quot;: &quot;t27-54_2_0_2&quot;,
  933. &quot;state&quot;: [
  934. {
  935. &quot;content&quot;: {
  936. &quot;creator&quot;: &quot;@example:example.org&quot;,
  937. &quot;room_version&quot;: &quot;1&quot;,
  938. &quot;m.federate&quot;: true,
  939. &quot;predecessor&quot;: {
  940. &quot;event_id&quot;: &quot;$something:example.org&quot;,
  941. &quot;room_id&quot;: &quot;!oldroom:example.org&quot;
  942. }
  943. },
  944. &quot;type&quot;: &quot;m.room.create&quot;,
  945. &quot;event_id&quot;: &quot;$143273582443PhrSn:example.org&quot;,
  946. &quot;room_id&quot;: &quot;!636q39766251:example.com&quot;,
  947. &quot;sender&quot;: &quot;@example:example.org&quot;,
  948. &quot;origin_server_ts&quot;: 1432735824653,
  949. &quot;unsigned&quot;: {
  950. &quot;age&quot;: 1234
  951. },
  952. &quot;state_key&quot;: &quot;&quot;
  953. },
  954. {
  955. &quot;content&quot;: {
  956. &quot;membership&quot;: &quot;join&quot;,
  957. &quot;avatar_url&quot;: &quot;mxc://example.org/SEsfnsuifSDFSSEF&quot;,
  958. &quot;displayname&quot;: &quot;Alice Margatroid&quot;
  959. },
  960. &quot;type&quot;: &quot;m.room.member&quot;,
  961. &quot;event_id&quot;: &quot;$143273582443PhrSn:example.org&quot;,
  962. &quot;room_id&quot;: &quot;!636q39766251:example.com&quot;,
  963. &quot;sender&quot;: &quot;@example:example.org&quot;,
  964. &quot;origin_server_ts&quot;: 1432735824653,
  965. &quot;unsigned&quot;: {
  966. &quot;age&quot;: 1234
  967. },
  968. &quot;state_key&quot;: &quot;@alice:example.org&quot;
  969. }
  970. ]
  971. }
  972. </code></pre>
  973. </main>
  974. <nav class="nav-wrapper" aria-label="Page navigation">
  975. <!-- Mobile navigation buttons -->
  976. <a rel="prev" href="../admin_api/room_membership.html" class="mobile-nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
  977. <i class="fa fa-angle-left"></i>
  978. </a>
  979. <a rel="next" href="../admin_api/server_notices.html" class="mobile-nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
  980. <i class="fa fa-angle-right"></i>
  981. </a>
  982. <div style="clear: both"></div>
  983. </nav>
  984. </div>
  985. </div>
  986. <nav class="nav-wide-wrapper" aria-label="Page navigation">
  987. <a rel="prev" href="../admin_api/room_membership.html" class="nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
  988. <i class="fa fa-angle-left"></i>
  989. </a>
  990. <a rel="next" href="../admin_api/server_notices.html" class="nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
  991. <i class="fa fa-angle-right"></i>
  992. </a>
  993. </nav>
  994. </div>
  995. <script type="text/javascript">
  996. window.playground_copyable = true;
  997. </script>
  998. <script src="../elasticlunr.min.js" type="text/javascript" charset="utf-8"></script>
  999. <script src="../mark.min.js" type="text/javascript" charset="utf-8"></script>
  1000. <script src="../searcher.js" type="text/javascript" charset="utf-8"></script>
  1001. <script src="../clipboard.min.js" type="text/javascript" charset="utf-8"></script>
  1002. <script src="../highlight.js" type="text/javascript" charset="utf-8"></script>
  1003. <script src="../book.js" type="text/javascript" charset="utf-8"></script>
  1004. <!-- Custom JS scripts -->
  1005. <script type="text/javascript" src="../docs/website_files/table-of-contents.js"></script>
  1006. <script type="text/javascript" src="../docs/website_files/version-picker.js"></script>
  1007. <script type="text/javascript" src="../docs/website_files/version.js"></script>
  1008. </body>
  1009. </html>