Merge branch 'develop' into gun
[akkoma] / docs / API / admin_api.md
1 # Admin API
2
3 Authentication is required and the user must be an admin.
4
5 Configuration options:
6
7 * `[:auth, :enforce_oauth_admin_scope_usage]` — OAuth admin scope requirement toggle.
8 If `true`, admin actions explicitly demand admin OAuth scope(s) presence in OAuth token (client app must support admin scopes).
9 If `false` and token doesn't have admin scope(s), `is_admin` user flag grants access to admin-specific actions.
10 Note that client app needs to explicitly support admin scopes and request them when obtaining auth token.
11
12 ## `GET /api/pleroma/admin/users`
13
14 ### List users
15
16 - Query Params:
17 - *optional* `query`: **string** search term (e.g. nickname, domain, nickname@domain)
18 - *optional* `filters`: **string** comma-separated string of filters:
19 - `local`: only local users
20 - `external`: only external users
21 - `active`: only active users
22 - `deactivated`: only deactivated users
23 - `is_admin`: users with admin role
24 - `is_moderator`: users with moderator role
25 - *optional* `page`: **integer** page number
26 - *optional* `page_size`: **integer** number of users per page (default is `50`)
27 - *optional* `tags`: **[string]** tags list
28 - *optional* `name`: **string** user display name
29 - *optional* `email`: **string** user email
30 - Example: `https://mypleroma.org/api/pleroma/admin/users?query=john&filters=local,active&page=1&page_size=10&tags[]=some_tag&tags[]=another_tag&name=display_name&email=email@example.com`
31 - Response:
32
33 ```json
34 {
35 "page_size": integer,
36 "count": integer,
37 "users": [
38 {
39 "deactivated": bool,
40 "id": integer,
41 "nickname": string,
42 "roles": {
43 "admin": bool,
44 "moderator": bool
45 },
46 "local": bool,
47 "tags": array,
48 "avatar": string,
49 "display_name": string
50 },
51 ...
52 ]
53 }
54 ```
55
56 ## DEPRECATED `DELETE /api/pleroma/admin/users`
57
58 ### Remove a user
59
60 - Params:
61 - `nickname`
62 - Response: User’s nickname
63
64 ## `DELETE /api/pleroma/admin/users`
65
66 ### Remove a user
67
68 - Params:
69 - `nicknames`
70 - Response: Array of user nicknames
71
72 ### Create a user
73
74 - Method: `POST`
75 - Params:
76 `users`: [
77 {
78 `nickname`,
79 `email`,
80 `password`
81 }
82 ]
83 - Response: User’s nickname
84
85 ## `POST /api/pleroma/admin/users/follow`
86
87 ### Make a user follow another user
88
89 - Params:
90 - `follower`: The nickname of the follower
91 - `followed`: The nickname of the followed
92 - Response:
93 - "ok"
94
95 ## `POST /api/pleroma/admin/users/unfollow`
96
97 ### Make a user unfollow another user
98
99 - Params:
100 - `follower`: The nickname of the follower
101 - `followed`: The nickname of the followed
102 - Response:
103 - "ok"
104
105 ## `PATCH /api/pleroma/admin/users/:nickname/toggle_activation`
106
107 ### Toggle user activation
108
109 - Params:
110 - `nickname`
111 - Response: User’s object
112
113 ```json
114 {
115 "deactivated": bool,
116 "id": integer,
117 "nickname": string
118 }
119 ```
120
121 ## `PUT /api/pleroma/admin/users/tag`
122
123 ### Tag a list of users
124
125 - Params:
126 - `nicknames` (array)
127 - `tags` (array)
128
129 ## `DELETE /api/pleroma/admin/users/tag`
130
131 ### Untag a list of users
132
133 - Params:
134 - `nicknames` (array)
135 - `tags` (array)
136
137 ## `GET /api/pleroma/admin/users/:nickname/permission_group`
138
139 ### Get user user permission groups membership
140
141 - Params: none
142 - Response:
143
144 ```json
145 {
146 "is_moderator": bool,
147 "is_admin": bool
148 }
149 ```
150
151 ## `GET /api/pleroma/admin/users/:nickname/permission_group/:permission_group`
152
153 Note: Available `:permission_group` is currently moderator and admin. 404 is returned when the permission group doesn’t exist.
154
155 ### Get user user permission groups membership per permission group
156
157 - Params: none
158 - Response:
159
160 ```json
161 {
162 "is_moderator": bool,
163 "is_admin": bool
164 }
165 ```
166
167 ## DEPRECATED `POST /api/pleroma/admin/users/:nickname/permission_group/:permission_group`
168
169 ### Add user to permission group
170
171 - Params: none
172 - Response:
173 - On failure: `{"error": "…"}`
174 - On success: JSON of the user
175
176 ## `POST /api/pleroma/admin/users/permission_group/:permission_group`
177
178 ### Add users to permission group
179
180 - Params:
181 - `nicknames`: nicknames array
182 - Response:
183 - On failure: `{"error": "…"}`
184 - On success: JSON of the user
185
186 ## DEPRECATED `DELETE /api/pleroma/admin/users/:nickname/permission_group/:permission_group`
187
188 ## `DELETE /api/pleroma/admin/users/:nickname/permission_group/:permission_group`
189
190 ### Remove user from permission group
191
192 - Params: none
193 - Response:
194 - On failure: `{"error": "…"}`
195 - On success: JSON of the user
196 - Note: An admin cannot revoke their own admin status.
197
198 ## `DELETE /api/pleroma/admin/users/permission_group/:permission_group`
199
200 ### Remove users from permission group
201
202 - Params:
203 - `nicknames`: nicknames array
204 - Response:
205 - On failure: `{"error": "…"}`
206 - On success: JSON of the user
207 - Note: An admin cannot revoke their own admin status.
208
209 ## `PATCH /api/pleroma/admin/users/activate`
210
211 ### Activate user
212
213 - Params:
214 - `nicknames`: nicknames array
215 - Response:
216
217 ```json
218 {
219 users: [
220 {
221 // user object
222 }
223 ]
224 }
225 ```
226
227 ## `PATCH /api/pleroma/admin/users/deactivate`
228
229 ### Deactivate user
230
231 - Params:
232 - `nicknames`: nicknames array
233 - Response:
234
235 ```json
236 {
237 users: [
238 {
239 // user object
240 }
241 ]
242 }
243 ```
244
245 ## `GET /api/pleroma/admin/users/:nickname_or_id`
246
247 ### Retrive the details of a user
248
249 - Params:
250 - `nickname` or `id`
251 - Response:
252 - On failure: `Not found`
253 - On success: JSON of the user
254
255 ## `GET /api/pleroma/admin/users/:nickname_or_id/statuses`
256
257 ### Retrive user's latest statuses
258
259 - Params:
260 - `nickname` or `id`
261 - *optional* `page_size`: number of statuses to return (default is `20`)
262 - *optional* `godmode`: `true`/`false` – allows to see private statuses
263 - *optional* `with_reblogs`: `true`/`false` – allows to see reblogs (default is false)
264 - Response:
265 - On failure: `Not found`
266 - On success: JSON array of user's latest statuses
267
268 ## `GET /api/pleroma/admin/instances/:instance/statuses`
269
270 ### Retrive instance's latest statuses
271
272 - Params:
273 - `instance`: instance name
274 - *optional* `page_size`: number of statuses to return (default is `20`)
275 - *optional* `godmode`: `true`/`false` – allows to see private statuses
276 - *optional* `with_reblogs`: `true`/`false` – allows to see reblogs (default is false)
277 - Response:
278 - On failure: `Not found`
279 - On success: JSON array of instance's latest statuses
280
281 ## `GET /api/pleroma/admin/statuses`
282
283 ### Retrives all latest statuses
284
285 - Params:
286 - *optional* `page_size`: number of statuses to return (default is `20`)
287 - *optional* `local_only`: excludes remote statuses
288 - *optional* `godmode`: `true`/`false` – allows to see private statuses
289 - *optional* `with_reblogs`: `true`/`false` – allows to see reblogs (default is false)
290 - Response:
291 - On failure: `Not found`
292 - On success: JSON array of user's latest statuses
293
294 ## `POST /api/pleroma/admin/relay`
295
296 ### Follow a Relay
297
298 - Params:
299 - `relay_url`
300 - Response:
301 - On success: URL of the followed relay
302
303 ## `DELETE /api/pleroma/admin/relay`
304
305 ### Unfollow a Relay
306
307 - Params:
308 - `relay_url`
309 - Response:
310 - On success: URL of the unfollowed relay
311
312 ## `GET /api/pleroma/admin/relay`
313
314 ### List Relays
315
316 - Params: none
317 - Response:
318 - On success: JSON array of relays
319
320 ## `POST /api/pleroma/admin/users/invite_token`
321
322 ### Create an account registration invite token
323
324 - Params:
325 - *optional* `max_use` (integer)
326 - *optional* `expires_at` (date string e.g. "2019-04-07")
327 - Response:
328
329 ```json
330 {
331 "id": integer,
332 "token": string,
333 "used": boolean,
334 "expires_at": date,
335 "uses": integer,
336 "max_use": integer,
337 "invite_type": string (possible values: `one_time`, `reusable`, `date_limited`, `reusable_date_limited`)
338 }
339 ```
340
341 ## `GET /api/pleroma/admin/users/invites`
342
343 ### Get a list of generated invites
344
345 - Params: none
346 - Response:
347
348 ```json
349 {
350
351 "invites": [
352 {
353 "id": integer,
354 "token": string,
355 "used": boolean,
356 "expires_at": date,
357 "uses": integer,
358 "max_use": integer,
359 "invite_type": string (possible values: `one_time`, `reusable`, `date_limited`, `reusable_date_limited`)
360 },
361 ...
362 ]
363 }
364 ```
365
366 ## `POST /api/pleroma/admin/users/revoke_invite`
367
368 ### Revoke invite by token
369
370 - Params:
371 - `token`
372 - Response:
373
374 ```json
375 {
376 "id": integer,
377 "token": string,
378 "used": boolean,
379 "expires_at": date,
380 "uses": integer,
381 "max_use": integer,
382 "invite_type": string (possible values: `one_time`, `reusable`, `date_limited`, `reusable_date_limited`)
383
384 }
385 ```
386
387 ## `POST /api/pleroma/admin/users/email_invite`
388
389 ### Sends registration invite via email
390
391 - Params:
392 - `email`
393 - `name`, optional
394
395 ## `GET /api/pleroma/admin/users/:nickname/password_reset`
396
397 ### Get a password reset token for a given nickname
398
399 - Params: none
400 - Response:
401
402 ```json
403 {
404 "token": "base64 reset token",
405 "link": "https://pleroma.social/api/pleroma/password_reset/url-encoded-base64-token"
406 }
407 ```
408
409 ## `PATCH /api/pleroma/admin/users/force_password_reset`
410
411 ### Force passord reset for a user with a given nickname
412
413 - Params:
414 - `nicknames`
415 - Response: none (code `204`)
416
417 ## `GET /api/pleroma/admin/reports`
418
419 ### Get a list of reports
420
421 - Params:
422 - *optional* `state`: **string** the state of reports. Valid values are `open`, `closed` and `resolved`
423 - *optional* `limit`: **integer** the number of records to retrieve
424 - *optional* `page`: **integer** page number
425 - *optional* `page_size`: **integer** number of log entries per page (default is `50`)
426 - Response:
427 - On failure: 403 Forbidden error `{"error": "error_msg"}` when requested by anonymous or non-admin
428 - On success: JSON, returns a list of reports, where:
429 - `account`: the user who has been reported
430 - `actor`: the user who has sent the report
431 - `statuses`: list of statuses that have been included to the report
432
433 ```json
434 {
435 "totalReports" : 1,
436 "reports": [
437 {
438 "account": {
439 "acct": "user",
440 "avatar": "https://pleroma.example.org/images/avi.png",
441 "avatar_static": "https://pleroma.example.org/images/avi.png",
442 "bot": false,
443 "created_at": "2019-04-23T17:32:04.000Z",
444 "display_name": "User",
445 "emojis": [],
446 "fields": [],
447 "followers_count": 1,
448 "following_count": 1,
449 "header": "https://pleroma.example.org/images/banner.png",
450 "header_static": "https://pleroma.example.org/images/banner.png",
451 "id": "9i6dAJqSGSKMzLG2Lo",
452 "locked": false,
453 "note": "",
454 "pleroma": {
455 "confirmation_pending": false,
456 "hide_favorites": true,
457 "hide_followers": false,
458 "hide_follows": false,
459 "is_admin": false,
460 "is_moderator": false,
461 "relationship": {},
462 "tags": []
463 },
464 "source": {
465 "note": "",
466 "pleroma": {},
467 "sensitive": false
468 },
469 "tags": ["force_unlisted"],
470 "statuses_count": 3,
471 "url": "https://pleroma.example.org/users/user",
472 "username": "user"
473 },
474 "actor": {
475 "acct": "lain",
476 "avatar": "https://pleroma.example.org/images/avi.png",
477 "avatar_static": "https://pleroma.example.org/images/avi.png",
478 "bot": false,
479 "created_at": "2019-03-28T17:36:03.000Z",
480 "display_name": "Roger Braun",
481 "emojis": [],
482 "fields": [],
483 "followers_count": 1,
484 "following_count": 1,
485 "header": "https://pleroma.example.org/images/banner.png",
486 "header_static": "https://pleroma.example.org/images/banner.png",
487 "id": "9hEkA5JsvAdlSrocam",
488 "locked": false,
489 "note": "",
490 "pleroma": {
491 "confirmation_pending": false,
492 "hide_favorites": false,
493 "hide_followers": false,
494 "hide_follows": false,
495 "is_admin": false,
496 "is_moderator": false,
497 "relationship": {},
498 "tags": []
499 },
500 "source": {
501 "note": "",
502 "pleroma": {},
503 "sensitive": false
504 },
505 "tags": ["force_unlisted"],
506 "statuses_count": 1,
507 "url": "https://pleroma.example.org/users/lain",
508 "username": "lain"
509 },
510 "content": "Please delete it",
511 "created_at": "2019-04-29T19:48:15.000Z",
512 "id": "9iJGOv1j8hxuw19bcm",
513 "state": "open",
514 "statuses": [
515 {
516 "account": { ... },
517 "application": {
518 "name": "Web",
519 "website": null
520 },
521 "bookmarked": false,
522 "card": null,
523 "content": "<span class=\"h-card\"><a data-user=\"9hEkA5JsvAdlSrocam\" class=\"u-url mention\" href=\"https://pleroma.example.org/users/lain\">@<span>lain</span></a></span> click on my link <a href=\"https://www.google.com/\">https://www.google.com/</a>",
524 "created_at": "2019-04-23T19:15:47.000Z",
525 "emojis": [],
526 "favourited": false,
527 "favourites_count": 0,
528 "id": "9i6mQ9uVrrOmOime8m",
529 "in_reply_to_account_id": null,
530 "in_reply_to_id": null,
531 "language": null,
532 "media_attachments": [],
533 "mentions": [
534 {
535 "acct": "lain",
536 "id": "9hEkA5JsvAdlSrocam",
537 "url": "https://pleroma.example.org/users/lain",
538 "username": "lain"
539 },
540 {
541 "acct": "user",
542 "id": "9i6dAJqSGSKMzLG2Lo",
543 "url": "https://pleroma.example.org/users/user",
544 "username": "user"
545 }
546 ],
547 "muted": false,
548 "pinned": false,
549 "pleroma": {
550 "content": {
551 "text/plain": "@lain click on my link https://www.google.com/"
552 },
553 "conversation_id": 28,
554 "in_reply_to_account_acct": null,
555 "local": true,
556 "spoiler_text": {
557 "text/plain": ""
558 }
559 },
560 "reblog": null,
561 "reblogged": false,
562 "reblogs_count": 0,
563 "replies_count": 0,
564 "sensitive": false,
565 "spoiler_text": "",
566 "tags": [],
567 "uri": "https://pleroma.example.org/objects/8717b90f-8e09-4b58-97b0-e3305472b396",
568 "url": "https://pleroma.example.org/notice/9i6mQ9uVrrOmOime8m",
569 "visibility": "direct"
570 }
571 ]
572 }
573 ]
574 }
575 ```
576
577 ## `GET /api/pleroma/admin/grouped_reports`
578
579 ### Get a list of reports, grouped by status
580
581 - Params: none
582 - On success: JSON, returns a list of reports, where:
583 - `date`: date of the latest report
584 - `account`: the user who has been reported (see `/api/pleroma/admin/reports` for reference)
585 - `status`: reported status (see `/api/pleroma/admin/reports` for reference)
586 - `actors`: users who had reported this status (see `/api/pleroma/admin/reports` for reference)
587 - `reports`: reports (see `/api/pleroma/admin/reports` for reference)
588
589 ```json
590 "reports": [
591 {
592 "date": "2019-10-07T12:31:39.615149Z",
593 "account": { ... },
594 "status": { ... },
595 "actors": [{ ... }, { ... }],
596 "reports": [{ ... }]
597 }
598 ]
599 ```
600
601 ## `GET /api/pleroma/admin/reports/:id`
602
603 ### Get an individual report
604
605 - Params:
606 - `id`
607 - Response:
608 - On failure:
609 - 403 Forbidden `{"error": "error_msg"}`
610 - 404 Not Found `"Not found"`
611 - On success: JSON, Report object (see above)
612
613 ## `PATCH /api/pleroma/admin/reports`
614
615 ### Change the state of one or multiple reports
616
617 - Params:
618
619 ```json
620 `reports`: [
621 {
622 `id`, // required, report id
623 `state` // required, the new state. Valid values are `open`, `closed` and `resolved`
624 },
625 ...
626 ]
627 ```
628
629 - Response:
630 - On failure:
631 - 400 Bad Request, JSON:
632
633 ```json
634 [
635 {
636 `id`, // report id
637 `error` // error message
638 }
639 ]
640 ```
641
642 - On success: `204`, empty response
643
644 ## `POST /api/pleroma/admin/reports/:id/notes`
645
646 ### Create report note
647
648 - Params:
649 - `id`: required, report id
650 - `content`: required, the message
651 - Response:
652 - On failure:
653 - 400 Bad Request `"Invalid parameters"` when `status` is missing
654 - On success: `204`, empty response
655
656 ## `POST /api/pleroma/admin/reports/:report_id/notes/:id`
657
658 ### Delete report note
659
660 - Params:
661 - `report_id`: required, report id
662 - `id`: required, note id
663 - Response:
664 - On failure:
665 - 400 Bad Request `"Invalid parameters"` when `status` is missing
666 - On success: `204`, empty response
667
668 ## `PUT /api/pleroma/admin/statuses/:id`
669
670 ### Change the scope of an individual reported status
671
672 - Params:
673 - `id`
674 - `sensitive`: optional, valid values are `true` or `false`
675 - `visibility`: optional, valid values are `public`, `private` and `unlisted`
676 - Response:
677 - On failure:
678 - 400 Bad Request `"Unsupported visibility"`
679 - 403 Forbidden `{"error": "error_msg"}`
680 - 404 Not Found `"Not found"`
681 - On success: JSON, Mastodon Status entity
682
683 ## `DELETE /api/pleroma/admin/statuses/:id`
684
685 ### Delete an individual reported status
686
687 - Params:
688 - `id`
689 - Response:
690 - On failure:
691 - 403 Forbidden `{"error": "error_msg"}`
692 - 404 Not Found `"Not found"`
693 - On success: 200 OK `{}`
694
695 ## `GET /api/pleroma/admin/restart`
696
697 ### Restarts pleroma application
698
699 - Params: none
700 - Response:
701 - On failure:
702 - 400 Bad Request `"To use this endpoint you need to enable configuration from database."`
703
704 ```json
705 {}
706 ```
707
708 ## `GET /api/pleroma/admin/config`
709
710 ### Get list of merged default settings with saved in database.
711
712 *If `need_reboot` flag exists in response, instance must be restarted, so reboot time settings can take effect.*
713
714 **Only works when configuration from database is enabled.**
715
716 - Params:
717 - `only_db`: true (*optional*, get only saved in database settings)
718 - Response:
719 - On failure:
720 - 400 Bad Request `"To use this endpoint you need to enable configuration from database."`
721
722 ```json
723 {
724 "configs": [
725 {
726 "group": ":pleroma",
727 "key": "Pleroma.Upload",
728 "value": []
729 }
730 ],
731 "need_reboot": true
732 }
733 ```
734 need_reboot - *optional*, if were changed reboot time settings.
735
736 ## `POST /api/pleroma/admin/config`
737
738 ### Update config settings
739
740 *If `need_reboot` flag exists in response, instance must be restarted, so reboot time settings can take effect.*
741
742 **Only works when configuration from database is enabled.**
743
744 Some modifications are necessary to save the config settings correctly:
745
746 - strings which start with `Pleroma.`, `Phoenix.`, `Tesla.` or strings like `Oban`, `Ueberauth` will be converted to modules;
747 ```
748 "Pleroma.Upload" -> Pleroma.Upload
749 "Oban" -> Oban
750 ```
751 - strings starting with `:` will be converted to atoms;
752 ```
753 ":pleroma" -> :pleroma
754 ```
755 - objects with `tuple` key and array value will be converted to tuples;
756 ```
757 {"tuple": ["string", "Pleroma.Upload", []]} -> {"string", Pleroma.Upload, []}
758 ```
759 - arrays with *tuple objects* will be converted to keywords;
760 ```
761 [{"tuple": [":key1", "value"]}, {"tuple": [":key2", "value"]}] -> [key1: "value", key2: "value"]
762 ```
763
764 Most of the settings will be applied in `runtime`, this means that you don't need to restart the instance. But some settings are applied in `compile time` and require a reboot of the instance, such as:
765 - all settings inside these keys:
766 - `:hackney_pools`
767 - `:connections_pool`
768 - `:pools`
769 - `:chat`
770 - partially settings inside these keys:
771 - `:seconds_valid` in `Pleroma.Captcha`
772 - `:proxy_remote` in `Pleroma.Upload`
773 - `:upload_limit` in `:instance`
774
775 - Params:
776 - `configs` - array of config objects
777 - config object params:
778 - `group` - string (**required**)
779 - `key` - string (**required**)
780 - `value` - string, [], {} or {"tuple": []} (**required**)
781 - `delete` - true (*optional*, if setting must be deleted)
782 - `subkeys` - array of strings (*optional*, only works when `delete=true` parameter is passed, otherwise will be ignored)
783
784 *When a value have several nested settings, you can delete only some nested settings by passing a parameter `subkeys`, without deleting all settings by key.*
785 ```
786 [subkey: val1, subkey2: val2, subkey3: val3] \\ initial value
787 {"group": ":pleroma", "key": "some_key", "delete": true, "subkeys": [":subkey", ":subkey3"]} \\ passing json for deletion
788 [subkey2: val2] \\ value after deletion
789 ```
790
791 *Most of the settings can be partially updated through merge old values with new values, except settings value of which is list or is not keyword.*
792
793 Example of setting without keyword in value:
794 ```elixir
795 config :tesla, :adapter, Tesla.Adapter.Hackney
796 ```
797
798 List of settings which support only full update by key:
799 ```elixir
800 @full_key_update [
801 {:pleroma, :ecto_repos},
802 {:quack, :meta},
803 {:mime, :types},
804 {:cors_plug, [:max_age, :methods, :expose, :headers]},
805 {:auto_linker, :opts},
806 {:swarm, :node_blacklist},
807 {:logger, :backends}
808 ]
809 ```
810
811 List of settings which support only full update by subkey:
812 ```elixir
813 @full_subkey_update [
814 {:pleroma, :assets, :mascots},
815 {:pleroma, :emoji, :groups},
816 {:pleroma, :workers, :retries},
817 {:pleroma, :mrf_subchain, :match_actor},
818 {:pleroma, :mrf_keyword, :replace}
819 ]
820 ```
821
822 *Settings without explicit key must be sended in separate config object params.*
823 ```elixir
824 config :quack,
825 level: :debug,
826 meta: [:all],
827 ...
828 ```
829 ```json
830 {
831 "configs": [
832 {"group": ":quack", "key": ":level", "value": ":debug"},
833 {"group": ":quack", "key": ":meta", "value": [":all"]},
834 ...
835 ]
836 }
837 ```
838 - Request:
839
840 ```json
841 {
842 "configs": [
843 {
844 "group": ":pleroma",
845 "key": "Pleroma.Upload",
846 "value": [
847 {"tuple": [":uploader", "Pleroma.Uploaders.Local"]},
848 {"tuple": [":filters", ["Pleroma.Upload.Filter.Dedupe"]]},
849 {"tuple": [":link_name", true]},
850 {"tuple": [":proxy_remote", false]},
851 {"tuple": [":proxy_opts", [
852 {"tuple": [":redirect_on_failure", false]},
853 {"tuple": [":max_body_length", 1048576]},
854 {"tuple": [":http", [
855 {"tuple": [":follow_redirect", true]},
856 {"tuple": [":pool", ":upload"]},
857 ]]}
858 ]
859 ]},
860 {"tuple": [":dispatch", {
861 "tuple": ["/api/v1/streaming", "Pleroma.Web.MastodonAPI.WebsocketHandler", []]
862 }]}
863 ]
864 }
865 ]
866 }
867 ```
868
869 - Response:
870 - On failure:
871 - 400 Bad Request `"To use this endpoint you need to enable configuration from database."`
872 ```json
873 {
874 "configs": [
875 {
876 "group": ":pleroma",
877 "key": "Pleroma.Upload",
878 "value": [...]
879 }
880 ],
881 "need_reboot": true
882 }
883 ```
884 need_reboot - *optional*, if were changed reboot time settings.
885
886 ## ` GET /api/pleroma/admin/config/descriptions`
887
888 ### Get JSON with config descriptions.
889 Loads json generated from `config/descriptions.exs`.
890
891 - Params: none
892 - Response:
893
894 ```json
895 [{
896 "group": ":pleroma", // string
897 "key": "ModuleName", // string
898 "type": "group", // string or list with possible values,
899 "description": "Upload general settings", // string
900 "children": [
901 {
902 "key": ":uploader", // string or module name `Pleroma.Upload`
903 "type": "module",
904 "description": "Module which will be used for uploads",
905 "suggestions": ["module1", "module2"]
906 },
907 {
908 "key": ":filters",
909 "type": ["list", "module"],
910 "description": "List of filter modules for uploads",
911 "suggestions": [
912 "module1", "module2", "module3"
913 ]
914 }
915 ]
916 }]
917 ```
918
919 ## `GET /api/pleroma/admin/moderation_log`
920
921 ### Get moderation log
922
923 - Params:
924 - *optional* `page`: **integer** page number
925 - *optional* `page_size`: **integer** number of log entries per page (default is `50`)
926 - *optional* `start_date`: **datetime (ISO 8601)** filter logs by creation date, start from `start_date`. Accepts datetime in ISO 8601 format (YYYY-MM-DDThh:mm:ss), e.g. `2005-08-09T18:31:42`
927 - *optional* `end_date`: **datetime (ISO 8601)** filter logs by creation date, end by from `end_date`. Accepts datetime in ISO 8601 format (YYYY-MM-DDThh:mm:ss), e.g. 2005-08-09T18:31:42
928 - *optional* `user_id`: **integer** filter logs by actor's id
929 - *optional* `search`: **string** search logs by the log message
930 - Response:
931
932 ```json
933 [
934 {
935 "data": {
936 "actor": {
937 "id": 1,
938 "nickname": "lain"
939 },
940 "action": "relay_follow"
941 },
942 "time": 1502812026, // timestamp
943 "message": "[2017-08-15 15:47:06] @nick0 followed relay: https://example.org/relay" // log message
944 }
945 ]
946 ```
947
948 ## `POST /api/pleroma/admin/reload_emoji`
949
950 ### Reload the instance's custom emoji
951
952 - Authentication: required
953 - Params: None
954 - Response: JSON, "ok" and 200 status
955
956 ## `PATCH /api/pleroma/admin/users/confirm_email`
957
958 ### Confirm users' emails
959
960 - Params:
961 - `nicknames`
962 - Response: Array of user nicknames
963
964 ## `PATCH /api/pleroma/admin/users/resend_confirmation_email`
965
966 ### Resend confirmation email
967
968 - Params:
969 - `nicknames`
970 - Response: Array of user nicknames
971
972 ## `GET /api/pleroma/admin/stats`
973
974 ### Stats
975
976 - Response:
977
978 ```json
979 {
980 "status_visibility": {
981 "direct": 739,
982 "private": 9,
983 "public": 17,
984 "unlisted": 14
985 }
986 }
987 ```