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