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