Merge branch 'bugfix/share-mastodon' into 'develop'
[akkoma] / docs / api / 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 - Query Params:
11 - *optional* `query`: **string** search term
12 - *optional* `filters`: **string** comma-separated string of filters:
13 - `local`: only local users
14 - `external`: only external users
15 - `active`: only active users
16 - `deactivated`: only deactivated users
17 - *optional* `page`: **integer** page number
18 - *optional* `page_size`: **integer** number of users per page (default is `50`)
19 - Example: `https://mypleroma.org/api/pleroma/admin/users?query=john&filters=local,active&page=1&page_size=10`
20 - Response:
21
22 ```JSON
23 {
24 "page_size": integer,
25 "count": integer,
26 "users": [
27 {
28 "deactivated": bool,
29 "id": integer,
30 "nickname": string,
31 "roles": {
32 "admin": bool,
33 "moderator": bool
34 },
35 "local": bool,
36 "tags": array
37 },
38 ...
39 ]
40 }
41 ```
42
43 ## `/api/pleroma/admin/user`
44
45 ### Remove a user
46
47 - Method `DELETE`
48 - Params:
49 - `nickname`
50 - Response: User’s nickname
51
52 ### Create a user
53
54 - Method: `POST`
55 - Params:
56 - `nickname`
57 - `email`
58 - `password`
59 - Response: User’s nickname
60
61 ## `/api/pleroma/admin/users/:nickname/toggle_activation`
62
63 ### Toggle user activation
64
65 - Method: `PATCH`
66 - Params:
67 - `nickname`
68 - Response: User’s object
69
70 ```JSON
71 {
72 "deactivated": bool,
73 "id": integer,
74 "nickname": string
75 }
76 ```
77
78 ## `/api/pleroma/admin/users/tag`
79
80 ### Tag a list of users
81
82 - Method: `PUT`
83 - Params:
84 - `nickname`
85 - `tags`
86
87 ### Untag a list of users
88
89 - Method: `DELETE`
90 - Params:
91 - `nickname`
92 - `tags`
93
94 ## `/api/pleroma/admin/permission_group/:nickname`
95
96 ### Get user user permission groups membership
97
98 - Method: `GET`
99 - Params: none
100 - Response:
101
102 ```JSON
103 {
104 "is_moderator": bool,
105 "is_admin": bool
106 }
107 ```
108
109 ## `/api/pleroma/admin/permission_group/:nickname/:permission_group`
110
111 Note: Available `:permission_group` is currently moderator and admin. 404 is returned when the permission group doesn’t exist.
112
113 ### Get user user permission groups membership per permission group
114
115 - Method: `GET`
116 - Params: none
117 - Response:
118
119 ```JSON
120 {
121 "is_moderator": bool,
122 "is_admin": bool
123 }
124 ```
125
126 ### Add user in permission group
127
128 - Method: `POST`
129 - Params: none
130 - Response:
131 - On failure: `{"error": "…"}`
132 - On success: JSON of the `user.info`
133
134 ### Remove user from permission group
135
136 - Method: `DELETE`
137 - Params: none
138 - Response:
139 - On failure: `{"error": "…"}`
140 - On success: JSON of the `user.info`
141 - Note: An admin cannot revoke their own admin status.
142
143 ## `/api/pleroma/admin/activation_status/:nickname`
144
145 ### Active or deactivate a user
146
147 - Method: `PUT`
148 - Params:
149 - `nickname`
150 - `status` BOOLEAN field, false value means deactivation.
151
152 ## `/api/pleroma/admin/users/:nickname`
153
154 ### Retrive the details of a user
155
156 - Method: `GET`
157 - Params:
158 - `nickname`
159 - Response:
160 - On failure: `Not found`
161 - On success: JSON of the user
162
163 ## `/api/pleroma/admin/relay`
164
165 ### Follow a Relay
166
167 - Methods: `POST`
168 - Params:
169 - `relay_url`
170 - Response:
171 - On success: URL of the followed relay
172
173 ### Unfollow a Relay
174
175 - Methods: `DELETE`
176 - Params:
177 - `relay_url`
178 - Response:
179 - On success: URL of the unfollowed relay
180
181 ## `/api/pleroma/admin/invite_token`
182
183 ### Get a account registeration invite token
184
185 - Methods: `GET`
186 - Params: none
187 - Response: invite token (base64 string)
188
189 ## `/api/pleroma/admin/email_invite`
190
191 ### Sends registration invite via email
192
193 - Methods: `POST`
194 - Params:
195 - `email`
196 - `name`, optionnal
197
198 ## `/api/pleroma/admin/password_reset`
199
200 ### Get a password reset token for a given nickname
201
202 - Methods: `GET`
203 - Params: none
204 - Response: password reset token (base64 string)