user_admin_api.rst 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. Query Account
  2. =============
  3. This API returns information about a specific user account.
  4. The api is::
  5. GET /_synapse/admin/v1/whois/<user_id>
  6. including an ``access_token`` of a server admin.
  7. It returns a JSON body like the following:
  8. .. code:: json
  9. {
  10. "user_id": "<user_id>",
  11. "devices": {
  12. "": {
  13. "sessions": [
  14. {
  15. "connections": [
  16. {
  17. "ip": "1.2.3.4",
  18. "last_seen": 1417222374433,
  19. "user_agent": "Mozilla/5.0 ..."
  20. },
  21. {
  22. "ip": "1.2.3.10",
  23. "last_seen": 1417222374500,
  24. "user_agent": "Dalvik/2.1.0 ..."
  25. }
  26. ]
  27. }
  28. ]
  29. }
  30. }
  31. }
  32. ``last_seen`` is measured in milliseconds since the Unix epoch.
  33. Deactivate Account
  34. ==================
  35. This API deactivates an account. It removes active access tokens, resets the
  36. password, and deletes third-party IDs (to prevent the user requesting a
  37. password reset). It can also mark the user as GDPR-erased (stopping their data
  38. from distributed further, and deleting it entirely if there are no other
  39. references to it).
  40. The api is::
  41. POST /_synapse/admin/v1/deactivate/<user_id>
  42. with a body of:
  43. .. code:: json
  44. {
  45. "erase": true
  46. }
  47. including an ``access_token`` of a server admin.
  48. The erase parameter is optional and defaults to 'false'.
  49. An empty body may be passed for backwards compatibility.
  50. Reset password
  51. ==============
  52. Changes the password of another user. This will automatically log the user out of all their devices.
  53. The api is::
  54. POST /_synapse/admin/v1/reset_password/<user_id>
  55. with a body of:
  56. .. code:: json
  57. {
  58. "new_password": "<secret>"
  59. }
  60. including an ``access_token`` of a server admin.
  61. Get whether a user is a server administrator or not
  62. ===================================================
  63. The api is::
  64. GET /_synapse/admin/v1/users/<user_id>/admin
  65. including an ``access_token`` of a server admin.
  66. A response body like the following is returned:
  67. .. code:: json
  68. {
  69. "admin": true
  70. }
  71. Change whether a user is a server administrator or not
  72. ======================================================
  73. Note that you cannot demote yourself.
  74. The api is::
  75. PUT /_synapse/admin/v1/users/<user_id>/admin
  76. with a body of:
  77. .. code:: json
  78. {
  79. "admin": true
  80. }
  81. including an ``access_token`` of a server admin.