user_admin_api.html 67 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194
  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>Users - 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">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" class="active">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/user_admin_api.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="user-admin-api"><a class="header" href="#user-admin-api">User Admin API</a></h1>
  150. <p>To use it, you will need to authenticate by providing an <code>access_token</code>
  151. for a server admin: see <a href="../usage/administration/admin_api">Admin API</a>.</p>
  152. <h2 id="query-user-account"><a class="header" href="#query-user-account">Query User Account</a></h2>
  153. <p>This API returns information about a specific user account.</p>
  154. <p>The api is:</p>
  155. <pre><code>GET /_synapse/admin/v2/users/&lt;user_id&gt;
  156. </code></pre>
  157. <p>It returns a JSON body like the following:</p>
  158. <pre><code class="language-jsonc">{
  159. &quot;name&quot;: &quot;@user:example.com&quot;,
  160. &quot;displayname&quot;: &quot;User&quot;, // can be null if not set
  161. &quot;threepids&quot;: [
  162. {
  163. &quot;medium&quot;: &quot;email&quot;,
  164. &quot;address&quot;: &quot;&lt;user_mail_1&gt;&quot;,
  165. &quot;added_at&quot;: 1586458409743,
  166. &quot;validated_at&quot;: 1586458409743
  167. },
  168. {
  169. &quot;medium&quot;: &quot;email&quot;,
  170. &quot;address&quot;: &quot;&lt;user_mail_2&gt;&quot;,
  171. &quot;added_at&quot;: 1586458409743,
  172. &quot;validated_at&quot;: 1586458409743
  173. }
  174. ],
  175. &quot;avatar_url&quot;: &quot;&lt;avatar_url&gt;&quot;, // can be null if not set
  176. &quot;is_guest&quot;: 0,
  177. &quot;admin&quot;: 0,
  178. &quot;deactivated&quot;: 0,
  179. &quot;shadow_banned&quot;: 0,
  180. &quot;creation_ts&quot;: 1560432506,
  181. &quot;appservice_id&quot;: null,
  182. &quot;consent_server_notice_sent&quot;: null,
  183. &quot;consent_version&quot;: null,
  184. &quot;external_ids&quot;: [
  185. {
  186. &quot;auth_provider&quot;: &quot;&lt;provider1&gt;&quot;,
  187. &quot;external_id&quot;: &quot;&lt;user_id_provider_1&gt;&quot;
  188. },
  189. {
  190. &quot;auth_provider&quot;: &quot;&lt;provider2&gt;&quot;,
  191. &quot;external_id&quot;: &quot;&lt;user_id_provider_2&gt;&quot;
  192. }
  193. ],
  194. &quot;user_type&quot;: null
  195. }
  196. </code></pre>
  197. <p>URL parameters:</p>
  198. <ul>
  199. <li><code>user_id</code>: fully-qualified user id: for example, <code>@user:server.com</code>.</li>
  200. </ul>
  201. <h2 id="create-or-modify-account"><a class="header" href="#create-or-modify-account">Create or modify Account</a></h2>
  202. <p>This API allows an administrator to create or modify a user account with a
  203. specific <code>user_id</code>.</p>
  204. <p>This api is:</p>
  205. <pre><code>PUT /_synapse/admin/v2/users/&lt;user_id&gt;
  206. </code></pre>
  207. <p>with a body of:</p>
  208. <pre><code class="language-json">{
  209. &quot;password&quot;: &quot;user_password&quot;,
  210. &quot;displayname&quot;: &quot;User&quot;,
  211. &quot;threepids&quot;: [
  212. {
  213. &quot;medium&quot;: &quot;email&quot;,
  214. &quot;address&quot;: &quot;&lt;user_mail_1&gt;&quot;
  215. },
  216. {
  217. &quot;medium&quot;: &quot;email&quot;,
  218. &quot;address&quot;: &quot;&lt;user_mail_2&gt;&quot;
  219. }
  220. ],
  221. &quot;external_ids&quot;: [
  222. {
  223. &quot;auth_provider&quot;: &quot;&lt;provider1&gt;&quot;,
  224. &quot;external_id&quot;: &quot;&lt;user_id_provider_1&gt;&quot;
  225. },
  226. {
  227. &quot;auth_provider&quot;: &quot;&lt;provider2&gt;&quot;,
  228. &quot;external_id&quot;: &quot;&lt;user_id_provider_2&gt;&quot;
  229. }
  230. ],
  231. &quot;avatar_url&quot;: &quot;&lt;avatar_url&gt;&quot;,
  232. &quot;admin&quot;: false,
  233. &quot;deactivated&quot;: false,
  234. &quot;user_type&quot;: null
  235. }
  236. </code></pre>
  237. <p>Returns HTTP status code:</p>
  238. <ul>
  239. <li><code>201</code> - When a new user object was created.</li>
  240. <li><code>200</code> - When a user was modified.</li>
  241. </ul>
  242. <p>URL parameters:</p>
  243. <ul>
  244. <li><code>user_id</code>: fully-qualified user id: for example, <code>@user:server.com</code>.</li>
  245. </ul>
  246. <p>Body parameters:</p>
  247. <ul>
  248. <li><code>password</code> - string, optional. If provided, the user's password is updated and all
  249. devices are logged out, unless <code>logout_devices</code> is set to <code>false</code>.</li>
  250. <li><code>logout_devices</code> - bool, optional, defaults to <code>true</code>. If set to false, devices aren't
  251. logged out even when <code>password</code> is provided.</li>
  252. <li><code>displayname</code> - string, optional, defaults to the value of <code>user_id</code>.</li>
  253. <li><code>threepids</code> - array, optional, allows setting the third-party IDs (email, msisdn)
  254. <ul>
  255. <li><code>medium</code> - string. Kind of third-party ID, either <code>email</code> or <code>msisdn</code>.</li>
  256. <li><code>address</code> - string. Value of third-party ID.
  257. belonging to a user.</li>
  258. </ul>
  259. </li>
  260. <li><code>external_ids</code> - array, optional. Allow setting the identifier of the external identity
  261. provider for SSO (Single sign-on). Details in the configuration manual under the
  262. sections <a href="../usage/configuration/config_documentation.html#sso">sso</a> and <a href="../usage/configuration/config_documentation.html#oidc_providers">oidc_providers</a>.
  263. <ul>
  264. <li><code>auth_provider</code> - string. ID of the external identity provider. Value of <code>idp_id</code>
  265. in the homeserver configuration. Note that no error is raised if the provided
  266. value is not in the homeserver configuration.</li>
  267. <li><code>external_id</code> - string, user ID in the external identity provider.</li>
  268. </ul>
  269. </li>
  270. <li><code>avatar_url</code> - string, optional, must be a
  271. <a href="https://matrix.org/docs/spec/client_server/r0.6.0#matrix-content-mxc-uris">MXC URI</a>.</li>
  272. <li><code>admin</code> - bool, optional, defaults to <code>false</code>.</li>
  273. <li><code>deactivated</code> - bool, optional. If unspecified, deactivation state will be left
  274. unchanged on existing accounts and set to <code>false</code> for new accounts.
  275. A user cannot be erased by deactivating with this API. For details on
  276. deactivating users see <a href="#deactivate-account">Deactivate Account</a>.</li>
  277. <li><code>user_type</code> - string or null, optional. If provided, the user type will be
  278. adjusted. If <code>null</code> given, the user type will be cleared. Other
  279. allowed options are: <code>bot</code> and <code>support</code>.</li>
  280. </ul>
  281. <p>If the user already exists then optional parameters default to the current value.</p>
  282. <p>In order to re-activate an account <code>deactivated</code> must be set to <code>false</code>. If
  283. users do not login via single-sign-on, a new <code>password</code> must be provided.</p>
  284. <h2 id="list-accounts"><a class="header" href="#list-accounts">List Accounts</a></h2>
  285. <p>This API returns all local user accounts.
  286. By default, the response is ordered by ascending user ID.</p>
  287. <pre><code>GET /_synapse/admin/v2/users?from=0&amp;limit=10&amp;guests=false
  288. </code></pre>
  289. <p>A response body like the following is returned:</p>
  290. <pre><code class="language-json">{
  291. &quot;users&quot;: [
  292. {
  293. &quot;name&quot;: &quot;&lt;user_id1&gt;&quot;,
  294. &quot;is_guest&quot;: 0,
  295. &quot;admin&quot;: 0,
  296. &quot;user_type&quot;: null,
  297. &quot;deactivated&quot;: 0,
  298. &quot;shadow_banned&quot;: 0,
  299. &quot;displayname&quot;: &quot;&lt;User One&gt;&quot;,
  300. &quot;avatar_url&quot;: null,
  301. &quot;creation_ts&quot;: 1560432668000
  302. }, {
  303. &quot;name&quot;: &quot;&lt;user_id2&gt;&quot;,
  304. &quot;is_guest&quot;: 0,
  305. &quot;admin&quot;: 1,
  306. &quot;user_type&quot;: null,
  307. &quot;deactivated&quot;: 0,
  308. &quot;shadow_banned&quot;: 0,
  309. &quot;displayname&quot;: &quot;&lt;User Two&gt;&quot;,
  310. &quot;avatar_url&quot;: &quot;&lt;avatar_url&gt;&quot;,
  311. &quot;creation_ts&quot;: 1561550621000
  312. }
  313. ],
  314. &quot;next_token&quot;: &quot;100&quot;,
  315. &quot;total&quot;: 200
  316. }
  317. </code></pre>
  318. <p>To paginate, check for <code>next_token</code> and if present, call the endpoint again
  319. with <code>from</code> set to the value of <code>next_token</code>. This will return a new page.</p>
  320. <p>If the endpoint does not return a <code>next_token</code> then there are no more users
  321. to paginate through.</p>
  322. <p><strong>Parameters</strong></p>
  323. <p>The following parameters should be set in the URL:</p>
  324. <ul>
  325. <li>
  326. <p><code>user_id</code> - Is optional and filters to only return users with user IDs
  327. that contain this value. This parameter is ignored when using the <code>name</code> parameter.</p>
  328. </li>
  329. <li>
  330. <p><code>name</code> - Is optional and filters to only return users with user ID localparts
  331. <strong>or</strong> displaynames that contain this value.</p>
  332. </li>
  333. <li>
  334. <p><code>guests</code> - string representing a bool - Is optional and if <code>false</code> will <strong>exclude</strong> guest users.
  335. Defaults to <code>true</code> to include guest users.</p>
  336. </li>
  337. <li>
  338. <p><code>deactivated</code> - string representing a bool - Is optional and if <code>true</code> will <strong>include</strong> deactivated users.
  339. Defaults to <code>false</code> to exclude deactivated users.</p>
  340. </li>
  341. <li>
  342. <p><code>limit</code> - string representing a positive integer - Is optional but is used for pagination,
  343. denoting the maximum number of items to return in this call. Defaults to <code>100</code>.</p>
  344. </li>
  345. <li>
  346. <p><code>from</code> - string representing a positive integer - Is optional but used for pagination,
  347. denoting the offset in the returned results. This should be treated as an opaque value and
  348. not explicitly set to anything other than the return value of <code>next_token</code> from a previous call.
  349. Defaults to <code>0</code>.</p>
  350. </li>
  351. <li>
  352. <p><code>order_by</code> - The method by which to sort the returned list of users.
  353. If the ordered field has duplicates, the second order is always by ascending <code>name</code>,
  354. which guarantees a stable ordering. Valid values are:</p>
  355. <ul>
  356. <li><code>name</code> - Users are ordered alphabetically by <code>name</code>. This is the default.</li>
  357. <li><code>is_guest</code> - Users are ordered by <code>is_guest</code> status.</li>
  358. <li><code>admin</code> - Users are ordered by <code>admin</code> status.</li>
  359. <li><code>user_type</code> - Users are ordered alphabetically by <code>user_type</code>.</li>
  360. <li><code>deactivated</code> - Users are ordered by <code>deactivated</code> status.</li>
  361. <li><code>shadow_banned</code> - Users are ordered by <code>shadow_banned</code> status.</li>
  362. <li><code>displayname</code> - Users are ordered alphabetically by <code>displayname</code>.</li>
  363. <li><code>avatar_url</code> - Users are ordered alphabetically by avatar URL.</li>
  364. <li><code>creation_ts</code> - Users are ordered by when the users was created in ms.</li>
  365. </ul>
  366. </li>
  367. <li>
  368. <p><code>dir</code> - Direction of media order. Either <code>f</code> for forwards or <code>b</code> for backwards.
  369. Setting this value to <code>b</code> will reverse the above sort order. Defaults to <code>f</code>.</p>
  370. </li>
  371. </ul>
  372. <p>Caution. The database only has indexes on the columns <code>name</code> and <code>creation_ts</code>.
  373. This means that if a different sort order is used (<code>is_guest</code>, <code>admin</code>,
  374. <code>user_type</code>, <code>deactivated</code>, <code>shadow_banned</code>, <code>avatar_url</code> or <code>displayname</code>),
  375. this can cause a large load on the database, especially for large environments.</p>
  376. <p><strong>Response</strong></p>
  377. <p>The following fields are returned in the JSON response body:</p>
  378. <ul>
  379. <li>
  380. <p><code>users</code> - An array of objects, each containing information about an user.
  381. User objects contain the following fields:</p>
  382. <ul>
  383. <li><code>name</code> - string - Fully-qualified user ID (ex. <code>@user:server.com</code>).</li>
  384. <li><code>is_guest</code> - bool - Status if that user is a guest account.</li>
  385. <li><code>admin</code> - bool - Status if that user is a server administrator.</li>
  386. <li><code>user_type</code> - string - Type of the user. Normal users are type <code>None</code>.
  387. This allows user type specific behaviour. There are also types <code>support</code> and <code>bot</code>. </li>
  388. <li><code>deactivated</code> - bool - Status if that user has been marked as deactivated.</li>
  389. <li><code>shadow_banned</code> - bool - Status if that user has been marked as shadow banned.</li>
  390. <li><code>displayname</code> - string - The user's display name if they have set one.</li>
  391. <li><code>avatar_url</code> - string - The user's avatar URL if they have set one.</li>
  392. <li><code>creation_ts</code> - integer - The user's creation timestamp in ms.</li>
  393. </ul>
  394. </li>
  395. <li>
  396. <p><code>next_token</code>: string representing a positive integer - Indication for pagination. See above.</p>
  397. </li>
  398. <li>
  399. <p><code>total</code> - integer - Total number of media.</p>
  400. </li>
  401. </ul>
  402. <h2 id="query-current-sessions-for-a-user"><a class="header" href="#query-current-sessions-for-a-user">Query current sessions for a user</a></h2>
  403. <p>This API returns information about the active sessions for a specific user.</p>
  404. <p>The endpoints are:</p>
  405. <pre><code>GET /_synapse/admin/v1/whois/&lt;user_id&gt;
  406. </code></pre>
  407. <p>and:</p>
  408. <pre><code>GET /_matrix/client/r0/admin/whois/&lt;userId&gt;
  409. </code></pre>
  410. <p>See also: <a href="https://matrix.org/docs/spec/client_server/r0.6.1#get-matrix-client-r0-admin-whois-userid">Client Server
  411. API Whois</a>.</p>
  412. <p>It returns a JSON body like the following:</p>
  413. <pre><code class="language-json">{
  414. &quot;user_id&quot;: &quot;&lt;user_id&gt;&quot;,
  415. &quot;devices&quot;: {
  416. &quot;&quot;: {
  417. &quot;sessions&quot;: [
  418. {
  419. &quot;connections&quot;: [
  420. {
  421. &quot;ip&quot;: &quot;1.2.3.4&quot;,
  422. &quot;last_seen&quot;: 1417222374433,
  423. &quot;user_agent&quot;: &quot;Mozilla/5.0 ...&quot;
  424. },
  425. {
  426. &quot;ip&quot;: &quot;1.2.3.10&quot;,
  427. &quot;last_seen&quot;: 1417222374500,
  428. &quot;user_agent&quot;: &quot;Dalvik/2.1.0 ...&quot;
  429. }
  430. ]
  431. }
  432. ]
  433. }
  434. }
  435. }
  436. </code></pre>
  437. <p><code>last_seen</code> is measured in milliseconds since the Unix epoch.</p>
  438. <h2 id="deactivate-account"><a class="header" href="#deactivate-account">Deactivate Account</a></h2>
  439. <p>This API deactivates an account. It removes active access tokens, resets the
  440. password, and deletes third-party IDs (to prevent the user requesting a
  441. password reset).</p>
  442. <p>It can also mark the user as GDPR-erased. This means messages sent by the
  443. user will still be visible by anyone that was in the room when these messages
  444. were sent, but hidden from users joining the room afterwards.</p>
  445. <p>The api is:</p>
  446. <pre><code>POST /_synapse/admin/v1/deactivate/&lt;user_id&gt;
  447. </code></pre>
  448. <p>with a body of:</p>
  449. <pre><code class="language-json">{
  450. &quot;erase&quot;: true
  451. }
  452. </code></pre>
  453. <p>The erase parameter is optional and defaults to <code>false</code>.
  454. An empty body may be passed for backwards compatibility.</p>
  455. <p>The following actions are performed when deactivating an user:</p>
  456. <ul>
  457. <li>Try to unbind 3PIDs from the identity server</li>
  458. <li>Remove all 3PIDs from the homeserver</li>
  459. <li>Delete all devices and E2EE keys</li>
  460. <li>Delete all access tokens</li>
  461. <li>Delete all pushers</li>
  462. <li>Delete the password hash</li>
  463. <li>Removal from all rooms the user is a member of</li>
  464. <li>Remove the user from the user directory</li>
  465. <li>Reject all pending invites</li>
  466. <li>Remove all account validity information related to the user</li>
  467. <li>Remove the arbitrary data store known as <em>account data</em>. For example, this includes:
  468. <ul>
  469. <li>list of ignored users;</li>
  470. <li>push rules;</li>
  471. <li>secret storage keys; and</li>
  472. <li>cross-signing keys.</li>
  473. </ul>
  474. </li>
  475. </ul>
  476. <p>The following additional actions are performed during deactivation if <code>erase</code>
  477. is set to <code>true</code>:</p>
  478. <ul>
  479. <li>Remove the user's display name</li>
  480. <li>Remove the user's avatar URL</li>
  481. <li>Mark the user as erased</li>
  482. </ul>
  483. <p>The following actions are <strong>NOT</strong> performed. The list may be incomplete.</p>
  484. <ul>
  485. <li>Remove mappings of SSO IDs</li>
  486. <li><a href="#delete-media-uploaded-by-a-user">Delete media uploaded</a> by user (included avatar images)</li>
  487. <li>Delete sent and received messages</li>
  488. <li>Remove the user's creation (registration) timestamp</li>
  489. <li><a href="#override-ratelimiting-for-users">Remove rate limit overrides</a></li>
  490. <li>Remove from monthly active users</li>
  491. </ul>
  492. <h2 id="reset-password"><a class="header" href="#reset-password">Reset password</a></h2>
  493. <p>Changes the password of another user. This will automatically log the user out of all their devices.</p>
  494. <p>The api is:</p>
  495. <pre><code>POST /_synapse/admin/v1/reset_password/&lt;user_id&gt;
  496. </code></pre>
  497. <p>with a body of:</p>
  498. <pre><code class="language-json">{
  499. &quot;new_password&quot;: &quot;&lt;secret&gt;&quot;,
  500. &quot;logout_devices&quot;: true
  501. }
  502. </code></pre>
  503. <p>The parameter <code>new_password</code> is required.
  504. The parameter <code>logout_devices</code> is optional and defaults to <code>true</code>.</p>
  505. <h2 id="get-whether-a-user-is-a-server-administrator-or-not"><a class="header" href="#get-whether-a-user-is-a-server-administrator-or-not">Get whether a user is a server administrator or not</a></h2>
  506. <p>The api is:</p>
  507. <pre><code>GET /_synapse/admin/v1/users/&lt;user_id&gt;/admin
  508. </code></pre>
  509. <p>A response body like the following is returned:</p>
  510. <pre><code class="language-json">{
  511. &quot;admin&quot;: true
  512. }
  513. </code></pre>
  514. <h2 id="change-whether-a-user-is-a-server-administrator-or-not"><a class="header" href="#change-whether-a-user-is-a-server-administrator-or-not">Change whether a user is a server administrator or not</a></h2>
  515. <p>Note that you cannot demote yourself.</p>
  516. <p>The api is:</p>
  517. <pre><code>PUT /_synapse/admin/v1/users/&lt;user_id&gt;/admin
  518. </code></pre>
  519. <p>with a body of:</p>
  520. <pre><code class="language-json">{
  521. &quot;admin&quot;: true
  522. }
  523. </code></pre>
  524. <h2 id="list-room-memberships-of-a-user"><a class="header" href="#list-room-memberships-of-a-user">List room memberships of a user</a></h2>
  525. <p>Gets a list of all <code>room_id</code> that a specific <code>user_id</code> is member.</p>
  526. <p>The API is:</p>
  527. <pre><code>GET /_synapse/admin/v1/users/&lt;user_id&gt;/joined_rooms
  528. </code></pre>
  529. <p>A response body like the following is returned:</p>
  530. <pre><code class="language-json"> {
  531. &quot;joined_rooms&quot;: [
  532. &quot;!DuGcnbhHGaSZQoNQR:matrix.org&quot;,
  533. &quot;!ZtSaPCawyWtxfWiIy:matrix.org&quot;
  534. ],
  535. &quot;total&quot;: 2
  536. }
  537. </code></pre>
  538. <p>The server returns the list of rooms of which the user and the server
  539. are member. If the user is local, all the rooms of which the user is
  540. member are returned.</p>
  541. <p><strong>Parameters</strong></p>
  542. <p>The following parameters should be set in the URL:</p>
  543. <ul>
  544. <li><code>user_id</code> - fully qualified: for example, <code>@user:server.com</code>.</li>
  545. </ul>
  546. <p><strong>Response</strong></p>
  547. <p>The following fields are returned in the JSON response body:</p>
  548. <ul>
  549. <li><code>joined_rooms</code> - An array of <code>room_id</code>.</li>
  550. <li><code>total</code> - Number of rooms.</li>
  551. </ul>
  552. <h2 id="account-data"><a class="header" href="#account-data">Account Data</a></h2>
  553. <p>Gets information about account data for a specific <code>user_id</code>.</p>
  554. <p>The API is:</p>
  555. <pre><code>GET /_synapse/admin/v1/users/&lt;user_id&gt;/accountdata
  556. </code></pre>
  557. <p>A response body like the following is returned:</p>
  558. <pre><code class="language-json">{
  559. &quot;account_data&quot;: {
  560. &quot;global&quot;: {
  561. &quot;m.secret_storage.key.LmIGHTg5W&quot;: {
  562. &quot;algorithm&quot;: &quot;m.secret_storage.v1.aes-hmac-sha2&quot;,
  563. &quot;iv&quot;: &quot;fwjNZatxg==&quot;,
  564. &quot;mac&quot;: &quot;eWh9kNnLWZUNOgnc=&quot;
  565. },
  566. &quot;im.vector.hide_profile&quot;: {
  567. &quot;hide_profile&quot;: true
  568. },
  569. &quot;org.matrix.preview_urls&quot;: {
  570. &quot;disable&quot;: false
  571. },
  572. &quot;im.vector.riot.breadcrumb_rooms&quot;: {
  573. &quot;rooms&quot;: [
  574. &quot;!LxcBDAsDUVAfJDEo:matrix.org&quot;,
  575. &quot;!MAhRxqasbItjOqxu:matrix.org&quot;
  576. ]
  577. },
  578. &quot;m.accepted_terms&quot;: {
  579. &quot;accepted&quot;: [
  580. &quot;https://example.org/somewhere/privacy-1.2-en.html&quot;,
  581. &quot;https://example.org/somewhere/terms-2.0-en.html&quot;
  582. ]
  583. },
  584. &quot;im.vector.setting.breadcrumbs&quot;: {
  585. &quot;recent_rooms&quot;: [
  586. &quot;!MAhRxqasbItqxuEt:matrix.org&quot;,
  587. &quot;!ZtSaPCawyWtxiImy:matrix.org&quot;
  588. ]
  589. }
  590. },
  591. &quot;rooms&quot;: {
  592. &quot;!GUdfZSHUJibpiVqHYd:matrix.org&quot;: {
  593. &quot;m.fully_read&quot;: {
  594. &quot;event_id&quot;: &quot;$156334540fYIhZ:matrix.org&quot;
  595. }
  596. },
  597. &quot;!tOZwOOiqwCYQkLhV:matrix.org&quot;: {
  598. &quot;m.fully_read&quot;: {
  599. &quot;event_id&quot;: &quot;$xjsIyp4_NaVl2yPvIZs_k1Jl8tsC_Sp23wjqXPno&quot;
  600. }
  601. }
  602. }
  603. }
  604. }
  605. </code></pre>
  606. <p><strong>Parameters</strong></p>
  607. <p>The following parameters should be set in the URL:</p>
  608. <ul>
  609. <li><code>user_id</code> - fully qualified: for example, <code>@user:server.com</code>.</li>
  610. </ul>
  611. <p><strong>Response</strong></p>
  612. <p>The following fields are returned in the JSON response body:</p>
  613. <ul>
  614. <li><code>account_data</code> - A map containing the account data for the user
  615. <ul>
  616. <li><code>global</code> - A map containing the global account data for the user</li>
  617. <li><code>rooms</code> - A map containing the account data per room for the user</li>
  618. </ul>
  619. </li>
  620. </ul>
  621. <h2 id="user-media"><a class="header" href="#user-media">User media</a></h2>
  622. <h3 id="list-media-uploaded-by-a-user"><a class="header" href="#list-media-uploaded-by-a-user">List media uploaded by a user</a></h3>
  623. <p>Gets a list of all local media that a specific <code>user_id</code> has created.
  624. These are media that the user has uploaded themselves
  625. (<a href="../media_repository.html#local-media">local media</a>), as well as
  626. <a href="../media_repository.html#url-previews">URL preview images</a> requested by the user if the
  627. <a href="../usage/configuration/config_documentation.html#url_preview_enabled">feature is enabled</a>.</p>
  628. <p>By default, the response is ordered by descending creation date and ascending media ID.
  629. The newest media is on top. You can change the order with parameters
  630. <code>order_by</code> and <code>dir</code>.</p>
  631. <p>The API is:</p>
  632. <pre><code>GET /_synapse/admin/v1/users/&lt;user_id&gt;/media
  633. </code></pre>
  634. <p>A response body like the following is returned:</p>
  635. <pre><code class="language-json">{
  636. &quot;media&quot;: [
  637. {
  638. &quot;created_ts&quot;: 100400,
  639. &quot;last_access_ts&quot;: null,
  640. &quot;media_id&quot;: &quot;qXhyRzulkwLsNHTbpHreuEgo&quot;,
  641. &quot;media_length&quot;: 67,
  642. &quot;media_type&quot;: &quot;image/png&quot;,
  643. &quot;quarantined_by&quot;: null,
  644. &quot;safe_from_quarantine&quot;: false,
  645. &quot;upload_name&quot;: &quot;test1.png&quot;
  646. },
  647. {
  648. &quot;created_ts&quot;: 200400,
  649. &quot;last_access_ts&quot;: null,
  650. &quot;media_id&quot;: &quot;FHfiSnzoINDatrXHQIXBtahw&quot;,
  651. &quot;media_length&quot;: 67,
  652. &quot;media_type&quot;: &quot;image/png&quot;,
  653. &quot;quarantined_by&quot;: null,
  654. &quot;safe_from_quarantine&quot;: false,
  655. &quot;upload_name&quot;: &quot;test2.png&quot;
  656. }
  657. ],
  658. &quot;next_token&quot;: 3,
  659. &quot;total&quot;: 2
  660. }
  661. </code></pre>
  662. <p>To paginate, check for <code>next_token</code> and if present, call the endpoint again
  663. with <code>from</code> set to the value of <code>next_token</code>. This will return a new page.</p>
  664. <p>If the endpoint does not return a <code>next_token</code> then there are no more
  665. reports to paginate through.</p>
  666. <p><strong>Parameters</strong></p>
  667. <p>The following parameters should be set in the URL:</p>
  668. <ul>
  669. <li>
  670. <p><code>user_id</code> - string - fully qualified: for example, <code>@user:server.com</code>.</p>
  671. </li>
  672. <li>
  673. <p><code>limit</code>: string representing a positive integer - Is optional but is used for pagination,
  674. denoting the maximum number of items to return in this call. Defaults to <code>100</code>.</p>
  675. </li>
  676. <li>
  677. <p><code>from</code>: string representing a positive integer - Is optional but used for pagination,
  678. denoting the offset in the returned results. This should be treated as an opaque value and
  679. not explicitly set to anything other than the return value of <code>next_token</code> from a previous call.
  680. Defaults to <code>0</code>.</p>
  681. </li>
  682. <li>
  683. <p><code>order_by</code> - The method by which to sort the returned list of media.
  684. If the ordered field has duplicates, the second order is always by ascending <code>media_id</code>,
  685. which guarantees a stable ordering. Valid values are:</p>
  686. <ul>
  687. <li><code>media_id</code> - Media are ordered alphabetically by <code>media_id</code>.</li>
  688. <li><code>upload_name</code> - Media are ordered alphabetically by name the media was uploaded with.</li>
  689. <li><code>created_ts</code> - Media are ordered by when the content was uploaded in ms.
  690. Smallest to largest. This is the default.</li>
  691. <li><code>last_access_ts</code> - Media are ordered by when the content was last accessed in ms.
  692. Smallest to largest.</li>
  693. <li><code>media_length</code> - Media are ordered by length of the media in bytes.
  694. Smallest to largest.</li>
  695. <li><code>media_type</code> - Media are ordered alphabetically by MIME-type.</li>
  696. <li><code>quarantined_by</code> - Media are ordered alphabetically by the user ID that
  697. initiated the quarantine request for this media.</li>
  698. <li><code>safe_from_quarantine</code> - Media are ordered by the status if this media is safe
  699. from quarantining.</li>
  700. </ul>
  701. </li>
  702. <li>
  703. <p><code>dir</code> - Direction of media order. Either <code>f</code> for forwards or <code>b</code> for backwards.
  704. Setting this value to <code>b</code> will reverse the above sort order. Defaults to <code>f</code>.</p>
  705. </li>
  706. </ul>
  707. <p>If neither <code>order_by</code> nor <code>dir</code> is set, the default order is newest media on top
  708. (corresponds to <code>order_by</code> = <code>created_ts</code> and <code>dir</code> = <code>b</code>).</p>
  709. <p>Caution. The database only has indexes on the columns <code>media_id</code>,
  710. <code>user_id</code> and <code>created_ts</code>. This means that if a different sort order is used
  711. (<code>upload_name</code>, <code>last_access_ts</code>, <code>media_length</code>, <code>media_type</code>,
  712. <code>quarantined_by</code> or <code>safe_from_quarantine</code>), this can cause a large load on the
  713. database, especially for large environments.</p>
  714. <p><strong>Response</strong></p>
  715. <p>The following fields are returned in the JSON response body:</p>
  716. <ul>
  717. <li><code>media</code> - An array of objects, each containing information about a media.
  718. Media objects contain the following fields:
  719. <ul>
  720. <li><code>created_ts</code> - integer - Timestamp when the content was uploaded in ms.</li>
  721. <li><code>last_access_ts</code> - integer - Timestamp when the content was last accessed in ms.</li>
  722. <li><code>media_id</code> - string - The id used to refer to the media. Details about the format
  723. are documented under
  724. <a href="../media_repository.html">media repository</a>.</li>
  725. <li><code>media_length</code> - integer - Length of the media in bytes.</li>
  726. <li><code>media_type</code> - string - The MIME-type of the media.</li>
  727. <li><code>quarantined_by</code> - string - The user ID that initiated the quarantine request
  728. for this media.</li>
  729. <li><code>safe_from_quarantine</code> - bool - Status if this media is safe from quarantining.</li>
  730. <li><code>upload_name</code> - string - The name the media was uploaded with.</li>
  731. </ul>
  732. </li>
  733. <li><code>next_token</code>: integer - Indication for pagination. See above.</li>
  734. <li><code>total</code> - integer - Total number of media.</li>
  735. </ul>
  736. <h3 id="delete-media-uploaded-by-a-user"><a class="header" href="#delete-media-uploaded-by-a-user">Delete media uploaded by a user</a></h3>
  737. <p>This API deletes the <em>local</em> media from the disk of your own server
  738. that a specific <code>user_id</code> has created. This includes any local thumbnails.</p>
  739. <p>This API will not affect media that has been uploaded to external
  740. media repositories (e.g https://github.com/turt2live/matrix-media-repo/).</p>
  741. <p>By default, the API deletes media ordered by descending creation date and ascending media ID.
  742. The newest media is deleted first. You can change the order with parameters
  743. <code>order_by</code> and <code>dir</code>. If no <code>limit</code> is set the API deletes <code>100</code> files per request.</p>
  744. <p>The API is:</p>
  745. <pre><code>DELETE /_synapse/admin/v1/users/&lt;user_id&gt;/media
  746. </code></pre>
  747. <p>A response body like the following is returned:</p>
  748. <pre><code class="language-json">{
  749. &quot;deleted_media&quot;: [
  750. &quot;abcdefghijklmnopqrstuvwx&quot;
  751. ],
  752. &quot;total&quot;: 1
  753. }
  754. </code></pre>
  755. <p>The following fields are returned in the JSON response body:</p>
  756. <ul>
  757. <li><code>deleted_media</code>: an array of strings - List of deleted <code>media_id</code></li>
  758. <li><code>total</code>: integer - Total number of deleted <code>media_id</code></li>
  759. </ul>
  760. <p><strong>Note</strong>: There is no <code>next_token</code>. This is not useful for deleting media, because
  761. after deleting media the remaining media have a new order.</p>
  762. <p><strong>Parameters</strong></p>
  763. <p>This API has the same parameters as
  764. <a href="#list-media-uploaded-by-a-user">List media uploaded by a user</a>.
  765. With the parameters you can for example limit the number of files to delete at once or
  766. delete largest/smallest or newest/oldest files first.</p>
  767. <h2 id="login-as-a-user"><a class="header" href="#login-as-a-user">Login as a user</a></h2>
  768. <p>Get an access token that can be used to authenticate as that user. Useful for
  769. when admins wish to do actions on behalf of a user.</p>
  770. <p>The API is:</p>
  771. <pre><code>POST /_synapse/admin/v1/users/&lt;user_id&gt;/login
  772. {}
  773. </code></pre>
  774. <p>An optional <code>valid_until_ms</code> field can be specified in the request body as an
  775. integer timestamp that specifies when the token should expire. By default tokens
  776. do not expire.</p>
  777. <p>A response body like the following is returned:</p>
  778. <pre><code class="language-json">{
  779. &quot;access_token&quot;: &quot;&lt;opaque_access_token_string&gt;&quot;
  780. }
  781. </code></pre>
  782. <p>This API does <em>not</em> generate a new device for the user, and so will not appear
  783. their <code>/devices</code> list, and in general the target user should not be able to
  784. tell they have been logged in as.</p>
  785. <p>To expire the token call the standard <code>/logout</code> API with the token.</p>
  786. <p>Note: The token will expire if the <em>admin</em> user calls <code>/logout/all</code> from any
  787. of their devices, but the token will <em>not</em> expire if the target user does the
  788. same.</p>
  789. <h2 id="user-devices"><a class="header" href="#user-devices">User devices</a></h2>
  790. <h3 id="list-all-devices"><a class="header" href="#list-all-devices">List all devices</a></h3>
  791. <p>Gets information about all devices for a specific <code>user_id</code>.</p>
  792. <p>The API is:</p>
  793. <pre><code>GET /_synapse/admin/v2/users/&lt;user_id&gt;/devices
  794. </code></pre>
  795. <p>A response body like the following is returned:</p>
  796. <pre><code class="language-json">{
  797. &quot;devices&quot;: [
  798. {
  799. &quot;device_id&quot;: &quot;QBUAZIFURK&quot;,
  800. &quot;display_name&quot;: &quot;android&quot;,
  801. &quot;last_seen_ip&quot;: &quot;1.2.3.4&quot;,
  802. &quot;last_seen_user_agent&quot;: &quot;Mozilla/5.0 (X11; Linux x86_64; rv:103.0) Gecko/20100101 Firefox/103.0&quot;,
  803. &quot;last_seen_ts&quot;: 1474491775024,
  804. &quot;user_id&quot;: &quot;&lt;user_id&gt;&quot;
  805. },
  806. {
  807. &quot;device_id&quot;: &quot;AUIECTSRND&quot;,
  808. &quot;display_name&quot;: &quot;ios&quot;,
  809. &quot;last_seen_ip&quot;: &quot;1.2.3.5&quot;,
  810. &quot;last_seen_user_agent&quot;: &quot;Mozilla/5.0 (X11; Linux x86_64; rv:103.0) Gecko/20100101 Firefox/103.0&quot;,
  811. &quot;last_seen_ts&quot;: 1474491775025,
  812. &quot;user_id&quot;: &quot;&lt;user_id&gt;&quot;
  813. }
  814. ],
  815. &quot;total&quot;: 2
  816. }
  817. </code></pre>
  818. <p><strong>Parameters</strong></p>
  819. <p>The following parameters should be set in the URL:</p>
  820. <ul>
  821. <li><code>user_id</code> - fully qualified: for example, <code>@user:server.com</code>.</li>
  822. </ul>
  823. <p><strong>Response</strong></p>
  824. <p>The following fields are returned in the JSON response body:</p>
  825. <ul>
  826. <li>
  827. <p><code>devices</code> - An array of objects, each containing information about a device.
  828. Device objects contain the following fields:</p>
  829. <ul>
  830. <li><code>device_id</code> - Identifier of device.</li>
  831. <li><code>display_name</code> - Display name set by the user for this device.
  832. Absent if no name has been set.</li>
  833. <li><code>last_seen_ip</code> - The IP address where this device was last seen.
  834. (May be a few minutes out of date, for efficiency reasons).</li>
  835. <li><code>last_seen_user_agent</code> - The user agent of the device when it was last seen.
  836. (May be a few minutes out of date, for efficiency reasons).</li>
  837. <li><code>last_seen_ts</code> - The timestamp (in milliseconds since the unix epoch) when this
  838. devices was last seen. (May be a few minutes out of date, for efficiency reasons).</li>
  839. <li><code>user_id</code> - Owner of device.</li>
  840. </ul>
  841. </li>
  842. <li>
  843. <p><code>total</code> - Total number of user's devices.</p>
  844. </li>
  845. </ul>
  846. <h3 id="delete-multiple-devices"><a class="header" href="#delete-multiple-devices">Delete multiple devices</a></h3>
  847. <p>Deletes the given devices for a specific <code>user_id</code>, and invalidates
  848. any access token associated with them.</p>
  849. <p>The API is:</p>
  850. <pre><code>POST /_synapse/admin/v2/users/&lt;user_id&gt;/delete_devices
  851. {
  852. &quot;devices&quot;: [
  853. &quot;QBUAZIFURK&quot;,
  854. &quot;AUIECTSRND&quot;
  855. ]
  856. }
  857. </code></pre>
  858. <p>An empty JSON dict is returned.</p>
  859. <p><strong>Parameters</strong></p>
  860. <p>The following parameters should be set in the URL:</p>
  861. <ul>
  862. <li><code>user_id</code> - fully qualified: for example, <code>@user:server.com</code>.</li>
  863. </ul>
  864. <p>The following fields are required in the JSON request body:</p>
  865. <ul>
  866. <li><code>devices</code> - The list of device IDs to delete.</li>
  867. </ul>
  868. <h3 id="show-a-device"><a class="header" href="#show-a-device">Show a device</a></h3>
  869. <p>Gets information on a single device, by <code>device_id</code> for a specific <code>user_id</code>.</p>
  870. <p>The API is:</p>
  871. <pre><code>GET /_synapse/admin/v2/users/&lt;user_id&gt;/devices/&lt;device_id&gt;
  872. </code></pre>
  873. <p>A response body like the following is returned:</p>
  874. <pre><code class="language-json">{
  875. &quot;device_id&quot;: &quot;&lt;device_id&gt;&quot;,
  876. &quot;display_name&quot;: &quot;android&quot;,
  877. &quot;last_seen_ip&quot;: &quot;1.2.3.4&quot;,
  878. &quot;last_seen_user_agent&quot;: &quot;Mozilla/5.0 (X11; Linux x86_64; rv:103.0) Gecko/20100101 Firefox/103.0&quot;,
  879. &quot;last_seen_ts&quot;: 1474491775024,
  880. &quot;user_id&quot;: &quot;&lt;user_id&gt;&quot;
  881. }
  882. </code></pre>
  883. <p><strong>Parameters</strong></p>
  884. <p>The following parameters should be set in the URL:</p>
  885. <ul>
  886. <li><code>user_id</code> - fully qualified: for example, <code>@user:server.com</code>.</li>
  887. <li><code>device_id</code> - The device to retrieve.</li>
  888. </ul>
  889. <p><strong>Response</strong></p>
  890. <p>The following fields are returned in the JSON response body:</p>
  891. <ul>
  892. <li><code>device_id</code> - Identifier of device.</li>
  893. <li><code>display_name</code> - Display name set by the user for this device.
  894. Absent if no name has been set.</li>
  895. <li><code>last_seen_ip</code> - The IP address where this device was last seen.
  896. (May be a few minutes out of date, for efficiency reasons).
  897. <ul>
  898. <li><code>last_seen_user_agent</code> - The user agent of the device when it was last seen.
  899. (May be a few minutes out of date, for efficiency reasons).</li>
  900. </ul>
  901. </li>
  902. <li><code>last_seen_ts</code> - The timestamp (in milliseconds since the unix epoch) when this
  903. devices was last seen. (May be a few minutes out of date, for efficiency reasons).</li>
  904. <li><code>user_id</code> - Owner of device.</li>
  905. </ul>
  906. <h3 id="update-a-device"><a class="header" href="#update-a-device">Update a device</a></h3>
  907. <p>Updates the metadata on the given <code>device_id</code> for a specific <code>user_id</code>.</p>
  908. <p>The API is:</p>
  909. <pre><code>PUT /_synapse/admin/v2/users/&lt;user_id&gt;/devices/&lt;device_id&gt;
  910. {
  911. &quot;display_name&quot;: &quot;My other phone&quot;
  912. }
  913. </code></pre>
  914. <p>An empty JSON dict is returned.</p>
  915. <p><strong>Parameters</strong></p>
  916. <p>The following parameters should be set in the URL:</p>
  917. <ul>
  918. <li><code>user_id</code> - fully qualified: for example, <code>@user:server.com</code>.</li>
  919. <li><code>device_id</code> - The device to update.</li>
  920. </ul>
  921. <p>The following fields are required in the JSON request body:</p>
  922. <ul>
  923. <li><code>display_name</code> - The new display name for this device. If not given,
  924. the display name is unchanged.</li>
  925. </ul>
  926. <h3 id="delete-a-device"><a class="header" href="#delete-a-device">Delete a device</a></h3>
  927. <p>Deletes the given <code>device_id</code> for a specific <code>user_id</code>,
  928. and invalidates any access token associated with it.</p>
  929. <p>The API is:</p>
  930. <pre><code>DELETE /_synapse/admin/v2/users/&lt;user_id&gt;/devices/&lt;device_id&gt;
  931. {}
  932. </code></pre>
  933. <p>An empty JSON dict is returned.</p>
  934. <p><strong>Parameters</strong></p>
  935. <p>The following parameters should be set in the URL:</p>
  936. <ul>
  937. <li><code>user_id</code> - fully qualified: for example, <code>@user:server.com</code>.</li>
  938. <li><code>device_id</code> - The device to delete.</li>
  939. </ul>
  940. <h2 id="list-all-pushers"><a class="header" href="#list-all-pushers">List all pushers</a></h2>
  941. <p>Gets information about all pushers for a specific <code>user_id</code>.</p>
  942. <p>The API is:</p>
  943. <pre><code>GET /_synapse/admin/v1/users/&lt;user_id&gt;/pushers
  944. </code></pre>
  945. <p>A response body like the following is returned:</p>
  946. <pre><code class="language-json">{
  947. &quot;pushers&quot;: [
  948. {
  949. &quot;app_display_name&quot;:&quot;HTTP Push Notifications&quot;,
  950. &quot;app_id&quot;:&quot;m.http&quot;,
  951. &quot;data&quot;: {
  952. &quot;url&quot;:&quot;example.com&quot;
  953. },
  954. &quot;device_display_name&quot;:&quot;pushy push&quot;,
  955. &quot;kind&quot;:&quot;http&quot;,
  956. &quot;lang&quot;:&quot;None&quot;,
  957. &quot;profile_tag&quot;:&quot;&quot;,
  958. &quot;pushkey&quot;:&quot;a@example.com&quot;
  959. }
  960. ],
  961. &quot;total&quot;: 1
  962. }
  963. </code></pre>
  964. <p><strong>Parameters</strong></p>
  965. <p>The following parameters should be set in the URL:</p>
  966. <ul>
  967. <li><code>user_id</code> - fully qualified: for example, <code>@user:server.com</code>.</li>
  968. </ul>
  969. <p><strong>Response</strong></p>
  970. <p>The following fields are returned in the JSON response body:</p>
  971. <ul>
  972. <li>
  973. <p><code>pushers</code> - An array containing the current pushers for the user</p>
  974. <ul>
  975. <li>
  976. <p><code>app_display_name</code> - string - A string that will allow the user to identify
  977. what application owns this pusher.</p>
  978. </li>
  979. <li>
  980. <p><code>app_id</code> - string - This is a reverse-DNS style identifier for the application.
  981. Max length, 64 chars.</p>
  982. </li>
  983. <li>
  984. <p><code>data</code> - A dictionary of information for the pusher implementation itself.</p>
  985. <ul>
  986. <li>
  987. <p><code>url</code> - string - Required if <code>kind</code> is <code>http</code>. The URL to use to send
  988. notifications to.</p>
  989. </li>
  990. <li>
  991. <p><code>format</code> - string - The format to use when sending notifications to the
  992. Push Gateway.</p>
  993. </li>
  994. </ul>
  995. </li>
  996. <li>
  997. <p><code>device_display_name</code> - string - A string that will allow the user to identify
  998. what device owns this pusher.</p>
  999. </li>
  1000. <li>
  1001. <p><code>profile_tag</code> - string - This string determines which set of device specific rules
  1002. this pusher executes.</p>
  1003. </li>
  1004. <li>
  1005. <p><code>kind</code> - string - The kind of pusher. &quot;http&quot; is a pusher that sends HTTP pokes.</p>
  1006. </li>
  1007. <li>
  1008. <p><code>lang</code> - string - The preferred language for receiving notifications
  1009. (e.g. 'en' or 'en-US')</p>
  1010. </li>
  1011. <li>
  1012. <p><code>profile_tag</code> - string - This string determines which set of device specific rules
  1013. this pusher executes.</p>
  1014. </li>
  1015. <li>
  1016. <p><code>pushkey</code> - string - This is a unique identifier for this pusher.
  1017. Max length, 512 bytes.</p>
  1018. </li>
  1019. </ul>
  1020. </li>
  1021. <li>
  1022. <p><code>total</code> - integer - Number of pushers.</p>
  1023. </li>
  1024. </ul>
  1025. <p>See also the
  1026. <a href="https://matrix.org/docs/spec/client_server/latest#get-matrix-client-r0-pushers">Client-Server API Spec on pushers</a>.</p>
  1027. <h2 id="controlling-whether-a-user-is-shadow-banned"><a class="header" href="#controlling-whether-a-user-is-shadow-banned">Controlling whether a user is shadow-banned</a></h2>
  1028. <p>Shadow-banning is a useful tool for moderating malicious or egregiously abusive users.
  1029. A shadow-banned users receives successful responses to their client-server API requests,
  1030. but the events are not propagated into rooms. This can be an effective tool as it
  1031. (hopefully) takes longer for the user to realise they are being moderated before
  1032. pivoting to another account.</p>
  1033. <p>Shadow-banning a user should be used as a tool of last resort and may lead to confusing
  1034. or broken behaviour for the client. A shadow-banned user will not receive any
  1035. notification and it is generally more appropriate to ban or kick abusive users.
  1036. A shadow-banned user will be unable to contact anyone on the server.</p>
  1037. <p>To shadow-ban a user the API is:</p>
  1038. <pre><code>POST /_synapse/admin/v1/users/&lt;user_id&gt;/shadow_ban
  1039. </code></pre>
  1040. <p>To un-shadow-ban a user the API is:</p>
  1041. <pre><code>DELETE /_synapse/admin/v1/users/&lt;user_id&gt;/shadow_ban
  1042. </code></pre>
  1043. <p>An empty JSON dict is returned in both cases.</p>
  1044. <p><strong>Parameters</strong></p>
  1045. <p>The following parameters should be set in the URL:</p>
  1046. <ul>
  1047. <li><code>user_id</code> - The fully qualified MXID: for example, <code>@user:server.com</code>. The user must
  1048. be local.</li>
  1049. </ul>
  1050. <h2 id="override-ratelimiting-for-users"><a class="header" href="#override-ratelimiting-for-users">Override ratelimiting for users</a></h2>
  1051. <p>This API allows to override or disable ratelimiting for a specific user.
  1052. There are specific APIs to set, get and delete a ratelimit.</p>
  1053. <h3 id="get-status-of-ratelimit"><a class="header" href="#get-status-of-ratelimit">Get status of ratelimit</a></h3>
  1054. <p>The API is:</p>
  1055. <pre><code>GET /_synapse/admin/v1/users/&lt;user_id&gt;/override_ratelimit
  1056. </code></pre>
  1057. <p>A response body like the following is returned:</p>
  1058. <pre><code class="language-json">{
  1059. &quot;messages_per_second&quot;: 0,
  1060. &quot;burst_count&quot;: 0
  1061. }
  1062. </code></pre>
  1063. <p><strong>Parameters</strong></p>
  1064. <p>The following parameters should be set in the URL:</p>
  1065. <ul>
  1066. <li><code>user_id</code> - The fully qualified MXID: for example, <code>@user:server.com</code>. The user must
  1067. be local.</li>
  1068. </ul>
  1069. <p><strong>Response</strong></p>
  1070. <p>The following fields are returned in the JSON response body:</p>
  1071. <ul>
  1072. <li><code>messages_per_second</code> - integer - The number of actions that can
  1073. be performed in a second. <code>0</code> mean that ratelimiting is disabled for this user.</li>
  1074. <li><code>burst_count</code> - integer - How many actions that can be performed before
  1075. being limited.</li>
  1076. </ul>
  1077. <p>If <strong>no</strong> custom ratelimit is set, an empty JSON dict is returned.</p>
  1078. <pre><code class="language-json">{}
  1079. </code></pre>
  1080. <h3 id="set-ratelimit"><a class="header" href="#set-ratelimit">Set ratelimit</a></h3>
  1081. <p>The API is:</p>
  1082. <pre><code>POST /_synapse/admin/v1/users/&lt;user_id&gt;/override_ratelimit
  1083. </code></pre>
  1084. <p>A response body like the following is returned:</p>
  1085. <pre><code class="language-json">{
  1086. &quot;messages_per_second&quot;: 0,
  1087. &quot;burst_count&quot;: 0
  1088. }
  1089. </code></pre>
  1090. <p><strong>Parameters</strong></p>
  1091. <p>The following parameters should be set in the URL:</p>
  1092. <ul>
  1093. <li><code>user_id</code> - The fully qualified MXID: for example, <code>@user:server.com</code>. The user must
  1094. be local.</li>
  1095. </ul>
  1096. <p>Body parameters:</p>
  1097. <ul>
  1098. <li><code>messages_per_second</code> - positive integer, optional. The number of actions that can
  1099. be performed in a second. Defaults to <code>0</code>.</li>
  1100. <li><code>burst_count</code> - positive integer, optional. How many actions that can be performed
  1101. before being limited. Defaults to <code>0</code>.</li>
  1102. </ul>
  1103. <p>To disable users' ratelimit set both values to <code>0</code>.</p>
  1104. <p><strong>Response</strong></p>
  1105. <p>The following fields are returned in the JSON response body:</p>
  1106. <ul>
  1107. <li><code>messages_per_second</code> - integer - The number of actions that can
  1108. be performed in a second.</li>
  1109. <li><code>burst_count</code> - integer - How many actions that can be performed before
  1110. being limited.</li>
  1111. </ul>
  1112. <h3 id="delete-ratelimit"><a class="header" href="#delete-ratelimit">Delete ratelimit</a></h3>
  1113. <p>The API is:</p>
  1114. <pre><code>DELETE /_synapse/admin/v1/users/&lt;user_id&gt;/override_ratelimit
  1115. </code></pre>
  1116. <p>An empty JSON dict is returned.</p>
  1117. <pre><code class="language-json">{}
  1118. </code></pre>
  1119. <p><strong>Parameters</strong></p>
  1120. <p>The following parameters should be set in the URL:</p>
  1121. <ul>
  1122. <li><code>user_id</code> - The fully qualified MXID: for example, <code>@user:server.com</code>. The user must
  1123. be local.</li>
  1124. </ul>
  1125. <h3 id="check-username-availability"><a class="header" href="#check-username-availability">Check username availability</a></h3>
  1126. <p>Checks to see if a username is available, and valid, for the server. See <a href="https://matrix.org/docs/spec/client_server/r0.6.0#get-matrix-client-r0-register-available">the client-server
  1127. API</a>
  1128. for more information.</p>
  1129. <p>This endpoint will work even if registration is disabled on the server, unlike
  1130. <code>/_matrix/client/r0/register/available</code>.</p>
  1131. <p>The API is:</p>
  1132. <pre><code>GET /_synapse/admin/v1/username_available?username=$localpart
  1133. </code></pre>
  1134. <p>The request and response format is the same as the
  1135. <a href="https://matrix.org/docs/spec/client_server/r0.6.0#get-matrix-client-r0-register-available">/_matrix/client/r0/register/available</a> API.</p>
  1136. </main>
  1137. <nav class="nav-wrapper" aria-label="Page navigation">
  1138. <!-- Mobile navigation buttons -->
  1139. <a rel="prev" href="../admin_api/statistics.html" class="mobile-nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
  1140. <i class="fa fa-angle-left"></i>
  1141. </a>
  1142. <a rel="next" href="../admin_api/version_api.html" class="mobile-nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
  1143. <i class="fa fa-angle-right"></i>
  1144. </a>
  1145. <div style="clear: both"></div>
  1146. </nav>
  1147. </div>
  1148. </div>
  1149. <nav class="nav-wide-wrapper" aria-label="Page navigation">
  1150. <a rel="prev" href="../admin_api/statistics.html" class="nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
  1151. <i class="fa fa-angle-left"></i>
  1152. </a>
  1153. <a rel="next" href="../admin_api/version_api.html" class="nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
  1154. <i class="fa fa-angle-right"></i>
  1155. </a>
  1156. </nav>
  1157. </div>
  1158. <script type="text/javascript">
  1159. window.playground_copyable = true;
  1160. </script>
  1161. <script src="../elasticlunr.min.js" type="text/javascript" charset="utf-8"></script>
  1162. <script src="../mark.min.js" type="text/javascript" charset="utf-8"></script>
  1163. <script src="../searcher.js" type="text/javascript" charset="utf-8"></script>
  1164. <script src="../clipboard.min.js" type="text/javascript" charset="utf-8"></script>
  1165. <script src="../highlight.js" type="text/javascript" charset="utf-8"></script>
  1166. <script src="../book.js" type="text/javascript" charset="utf-8"></script>
  1167. <!-- Custom JS scripts -->
  1168. <script type="text/javascript" src="../docs/website_files/table-of-contents.js"></script>
  1169. <script type="text/javascript" src="../docs/website_files/version-picker.js"></script>
  1170. <script type="text/javascript" src="../docs/website_files/version.js"></script>
  1171. </body>
  1172. </html>