ea9b9308c8dbed8e96f70e3e461dcbd175488be8
[akkoma] / docs / api / admin_api.md
1 # Admin API
2 # Admin API
3
4 Authentication is required and the user must be an admin.
5
6 ## `/api/pleroma/admin/users`
7
8 ### List users
9
10 - Method `GET`
11 - Query Params:
12 - *optional* `query`: **string** search term
13 - *optional* `filters`: **string** comma-separated string of filters:
14 - `local`: only local users
15 - `external`: only external users
16 - `active`: only active users
17 - `deactivated`: only deactivated users
18 - *optional* `page`: **integer** page number
19 - *optional* `page_size`: **integer** number of users per page (default is `50`)
20 - Example: `https://mypleroma.org/api/pleroma/admin/users?query=john&filters=local,active&page=1&page_size=10`
21 - Response:
22
23 ```JSON
24 {
25 "page_size": integer,
26 "count": integer,
27 "users": [
28 {
29 "deactivated": bool,
30 "id": integer,
31 "nickname": string,
32 "roles": {
33 "admin": bool,
34 "moderator": bool
35 },
36 "local": bool,
37 "tags": array
38 },
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 per permission group
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)