user_admin_api.html 76 KB

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