Add missing docs and tests
[akkoma] / docs / Admin-API.md
1 # Admin API
2
3 Authentication is required and the user must be an admin.
4
5 ## `/api/pleroma/admin/users`
6
7 ### List users
8
9 - Method `GET`
10 - Response:
11
12 ```JSON
13 [
14 {
15 "deactivated": bool,
16 "id": integer,
17 "nickname": string
18 },
19 ...
20 ]
21 ```
22
23 ## `/api/pleroma/admin/user`
24
25 ### Remove a user
26
27 - Method `DELETE`
28 - Params:
29 - `nickname`
30 - Response: User’s nickname
31
32 ### Create a user
33
34 - Method: `POST`
35 - Params:
36 - `nickname`
37 - `email`
38 - `password`
39 - Response: User’s nickname
40
41 ## `/api/pleroma/admin/users/:nickname/toggle_activation`
42
43 ### Toggle user activation
44
45 - Method: `PATCH`
46 - Params:
47 - `nickname`
48 - Response: User’s object
49
50 ```JSON
51 {
52 "deactivated": bool,
53 "id": integer,
54 "nickname": string
55 }
56 ```
57
58 ## `/api/pleroma/admin/users/tag`
59
60 ### Tag a list of users
61
62 - Method: `PUT`
63 - Params:
64 - `nickname`
65 - `tags`
66
67 ### Untag a list of users
68
69 - Method: `DELETE`
70 - Params:
71 - `nickname`
72 - `tags`
73
74 ## `/api/pleroma/admin/permission_group/:nickname`
75
76 ### Get user user permission groups membership
77
78 - Method: `GET`
79 - Params: none
80 - Response:
81
82 ```JSON
83 {
84 "is_moderator": bool,
85 "is_admin": bool
86 }
87 ```
88
89 ## `/api/pleroma/admin/permission_group/:nickname/:permission_group`
90
91 Note: Available `:permission_group` is currently moderator and admin. 404 is returned when the permission group doesn’t exist.
92
93 ### Get user user permission groups membership
94
95 - Method: `GET`
96 - Params: none
97 - Response:
98
99 ```JSON
100 {
101 "is_moderator": bool,
102 "is_admin": bool
103 }
104 ```
105
106 ### Add user in permission group
107
108 - Method: `POST`
109 - Params: none
110 - Response:
111 - On failure: `{"error": "…"}`
112 - On success: JSON of the `user.info`
113
114 ### Remove user from permission group
115
116 - Method: `DELETE`
117 - Params: none
118 - Response:
119 - On failure: `{"error": "…"}`
120 - On success: JSON of the `user.info`
121 - Note: An admin cannot revoke their own admin status.
122
123 ## `/api/pleroma/admin/activation_status/:nickname`
124
125 ### Active or deactivate a user
126
127 - Method: `PUT`
128 - Params:
129 - `nickname`
130 - `status` BOOLEAN field, false value means deactivation.
131
132 ## `/api/pleroma/admin/relay`
133
134 ### Follow a Relay
135
136 - Methods: `POST`
137 - Params:
138 - `relay_url`
139 - Response:
140 - On success: URL of the followed relay
141
142 ### Unfollow a Relay
143
144 - Methods: `DELETE`
145 - Params:
146 - `relay_url`
147 - Response:
148 - On success: URL of the unfollowed relay
149
150 ## `/api/pleroma/admin/invite_token`
151
152 ### Get a account registeration invite token
153
154 - Methods: `GET`
155 - Params: none
156 - Response: invite token (base64 string)
157
158 ## `/api/pleroma/admin/email_invite`
159
160 ### Sends registration invite via email
161
162 - Methods: `POST`
163 - Params:
164 - `email`
165 - `name`, optionnal
166
167 ## `/api/pleroma/admin/password_reset`
168
169 ### Get a password reset token for a given nickname
170
171 - Methods: `GET`
172 - Params: none
173 - Response: password reset token (base64 string)