merge develop
[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 - Response:
396 - On success: `204`, empty response
397 - On failure:
398 - 400 Bad Request, JSON:
399
400 ```json
401 [
402 {
403 "error": "Appropriate error message here"
404 }
405 ]
406 ```
407
408 ## `GET /api/pleroma/admin/users/:nickname/password_reset`
409
410 ### Get a password reset token for a given nickname
411
412
413 - Params: none
414 - Response:
415
416 ```json
417 {
418 "token": "base64 reset token",
419 "link": "https://pleroma.social/api/pleroma/password_reset/url-encoded-base64-token"
420 }
421 ```
422
423 ## `PATCH /api/pleroma/admin/users/force_password_reset`
424
425 ### Force passord reset for a user with a given nickname
426
427 - Params:
428 - `nicknames`
429 - Response: none (code `204`)
430
431 ## PUT `/api/pleroma/admin/users/disable_mfa`
432
433 ### Disable mfa for user's account.
434
435 - Params:
436 - `nickname`
437 - Response: User’s nickname
438
439 ## `GET /api/pleroma/admin/users/:nickname/credentials`
440
441 ### Get the user's email, password, display and settings-related fields
442
443 - Params:
444 - `nickname`
445
446 - Response:
447
448 ```json
449 {
450 "actor_type": "Person",
451 "allow_following_move": true,
452 "avatar": "https://pleroma.social/media/7e8e7508fd545ef580549b6881d80ec0ff2c81ed9ad37b9bdbbdf0e0d030159d.jpg",
453 "background": "https://pleroma.social/media/4de34c0bd10970d02cbdef8972bef0ebbf55f43cadc449554d4396156162fe9a.jpg",
454 "banner": "https://pleroma.social/media/8d92ba2bd244b613520abf557dd448adcd30f5587022813ee9dd068945986946.jpg",
455 "bio": "bio",
456 "default_scope": "public",
457 "discoverable": false,
458 "email": "user@example.com",
459 "fields": [
460 {
461 "name": "example",
462 "value": "<a href=\"https://example.com\" rel=\"ugc\">https://example.com</a>"
463 }
464 ],
465 "hide_favorites": false,
466 "hide_followers": false,
467 "hide_followers_count": false,
468 "hide_follows": false,
469 "hide_follows_count": false,
470 "id": "9oouHaEEUR54hls968",
471 "locked": true,
472 "name": "user",
473 "no_rich_text": true,
474 "pleroma_settings_store": {},
475 "raw_fields": [
476 {
477 "id": 1,
478 "name": "example",
479 "value": "https://example.com"
480 },
481 ],
482 "show_role": true,
483 "skip_thread_containment": false
484 }
485 ```
486
487 ## `PATCH /api/pleroma/admin/users/:nickname/credentials`
488
489 ### Change the user's email, password, display and settings-related fields
490
491 - Params:
492 - `email`
493 - `password`
494 - `name`
495 - `bio`
496 - `avatar`
497 - `locked`
498 - `no_rich_text`
499 - `default_scope`
500 - `banner`
501 - `hide_follows`
502 - `hide_followers`
503 - `hide_followers_count`
504 - `hide_follows_count`
505 - `hide_favorites`
506 - `allow_following_move`
507 - `background`
508 - `show_role`
509 - `skip_thread_containment`
510 - `fields`
511 - `discoverable`
512 - `actor_type`
513
514 - Response:
515
516 ```json
517 {"status": "success"}
518 ```
519
520 ```json
521 {"errors":
522 {"actor_type": "is invalid"},
523 {"email": "has invalid format"},
524 ...
525 }
526 ```
527
528 ```json
529 {"error": "Unable to update user."}
530 ```
531
532 ## `GET /api/pleroma/admin/reports`
533
534 ### Get a list of reports
535
536 - Params:
537 - *optional* `state`: **string** the state of reports. Valid values are `open`, `closed` and `resolved`
538 - *optional* `limit`: **integer** the number of records to retrieve
539 - *optional* `page`: **integer** page number
540 - *optional* `page_size`: **integer** number of log entries per page (default is `50`)
541 - Response:
542 - On failure: 403 Forbidden error `{"error": "error_msg"}` when requested by anonymous or non-admin
543 - On success: JSON, returns a list of reports, where:
544 - `account`: the user who has been reported
545 - `actor`: the user who has sent the report
546 - `statuses`: list of statuses that have been included to the report
547
548 ```json
549 {
550 "total" : 1,
551 "reports": [
552 {
553 "account": {
554 "acct": "user",
555 "avatar": "https://pleroma.example.org/images/avi.png",
556 "avatar_static": "https://pleroma.example.org/images/avi.png",
557 "bot": false,
558 "created_at": "2019-04-23T17:32:04.000Z",
559 "display_name": "User",
560 "emojis": [],
561 "fields": [],
562 "followers_count": 1,
563 "following_count": 1,
564 "header": "https://pleroma.example.org/images/banner.png",
565 "header_static": "https://pleroma.example.org/images/banner.png",
566 "id": "9i6dAJqSGSKMzLG2Lo",
567 "locked": false,
568 "note": "",
569 "pleroma": {
570 "confirmation_pending": false,
571 "hide_favorites": true,
572 "hide_followers": false,
573 "hide_follows": false,
574 "is_admin": false,
575 "is_moderator": false,
576 "relationship": {},
577 "tags": []
578 },
579 "source": {
580 "note": "",
581 "pleroma": {},
582 "sensitive": false
583 },
584 "tags": ["force_unlisted"],
585 "statuses_count": 3,
586 "url": "https://pleroma.example.org/users/user",
587 "username": "user"
588 },
589 "actor": {
590 "acct": "lain",
591 "avatar": "https://pleroma.example.org/images/avi.png",
592 "avatar_static": "https://pleroma.example.org/images/avi.png",
593 "bot": false,
594 "created_at": "2019-03-28T17:36:03.000Z",
595 "display_name": "Roger Braun",
596 "emojis": [],
597 "fields": [],
598 "followers_count": 1,
599 "following_count": 1,
600 "header": "https://pleroma.example.org/images/banner.png",
601 "header_static": "https://pleroma.example.org/images/banner.png",
602 "id": "9hEkA5JsvAdlSrocam",
603 "locked": false,
604 "note": "",
605 "pleroma": {
606 "confirmation_pending": false,
607 "hide_favorites": false,
608 "hide_followers": false,
609 "hide_follows": false,
610 "is_admin": false,
611 "is_moderator": false,
612 "relationship": {},
613 "tags": []
614 },
615 "source": {
616 "note": "",
617 "pleroma": {},
618 "sensitive": false
619 },
620 "tags": ["force_unlisted"],
621 "statuses_count": 1,
622 "url": "https://pleroma.example.org/users/lain",
623 "username": "lain"
624 },
625 "content": "Please delete it",
626 "created_at": "2019-04-29T19:48:15.000Z",
627 "id": "9iJGOv1j8hxuw19bcm",
628 "state": "open",
629 "statuses": [
630 {
631 "account": { ... },
632 "application": {
633 "name": "Web",
634 "website": null
635 },
636 "bookmarked": false,
637 "card": null,
638 "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>",
639 "created_at": "2019-04-23T19:15:47.000Z",
640 "emojis": [],
641 "favourited": false,
642 "favourites_count": 0,
643 "id": "9i6mQ9uVrrOmOime8m",
644 "in_reply_to_account_id": null,
645 "in_reply_to_id": null,
646 "language": null,
647 "media_attachments": [],
648 "mentions": [
649 {
650 "acct": "lain",
651 "id": "9hEkA5JsvAdlSrocam",
652 "url": "https://pleroma.example.org/users/lain",
653 "username": "lain"
654 },
655 {
656 "acct": "user",
657 "id": "9i6dAJqSGSKMzLG2Lo",
658 "url": "https://pleroma.example.org/users/user",
659 "username": "user"
660 }
661 ],
662 "muted": false,
663 "pinned": false,
664 "pleroma": {
665 "content": {
666 "text/plain": "@lain click on my link https://www.google.com/"
667 },
668 "conversation_id": 28,
669 "in_reply_to_account_acct": null,
670 "local": true,
671 "spoiler_text": {
672 "text/plain": ""
673 }
674 },
675 "reblog": null,
676 "reblogged": false,
677 "reblogs_count": 0,
678 "replies_count": 0,
679 "sensitive": false,
680 "spoiler_text": "",
681 "tags": [],
682 "uri": "https://pleroma.example.org/objects/8717b90f-8e09-4b58-97b0-e3305472b396",
683 "url": "https://pleroma.example.org/notice/9i6mQ9uVrrOmOime8m",
684 "visibility": "direct"
685 }
686 ]
687 }
688 ]
689 }
690 ```
691
692 ## `GET /api/pleroma/admin/grouped_reports`
693
694 ### Get a list of reports, grouped by status
695
696 - Params: none
697 - On success: JSON, returns a list of reports, where:
698 - `date`: date of the latest report
699 - `account`: the user who has been reported (see `/api/pleroma/admin/reports` for reference)
700 - `status`: reported status (see `/api/pleroma/admin/reports` for reference)
701 - `actors`: users who had reported this status (see `/api/pleroma/admin/reports` for reference)
702 - `reports`: reports (see `/api/pleroma/admin/reports` for reference)
703
704 ```json
705 "reports": [
706 {
707 "date": "2019-10-07T12:31:39.615149Z",
708 "account": { ... },
709 "status": { ... },
710 "actors": [{ ... }, { ... }],
711 "reports": [{ ... }]
712 }
713 ]
714 ```
715
716 ## `GET /api/pleroma/admin/reports/:id`
717
718 ### Get an individual report
719
720 - Params:
721 - `id`
722 - Response:
723 - On failure:
724 - 403 Forbidden `{"error": "error_msg"}`
725 - 404 Not Found `"Not found"`
726 - On success: JSON, Report object (see above)
727
728 ## `PATCH /api/pleroma/admin/reports`
729
730 ### Change the state of one or multiple reports
731
732 - Params:
733
734 ```json
735 `reports`: [
736 {
737 `id`, // required, report id
738 `state` // required, the new state. Valid values are `open`, `closed` and `resolved`
739 },
740 ...
741 ]
742 ```
743
744 - Response:
745 - On failure:
746 - 400 Bad Request, JSON:
747
748 ```json
749 [
750 {
751 `id`, // report id
752 `error` // error message
753 }
754 ]
755 ```
756
757 - On success: `204`, empty response
758
759 ## `POST /api/pleroma/admin/reports/:id/notes`
760
761 ### Create report note
762
763 - Params:
764 - `id`: required, report id
765 - `content`: required, the message
766 - Response:
767 - On failure:
768 - 400 Bad Request `"Invalid parameters"` when `status` is missing
769 - On success: `204`, empty response
770
771 ## `DELETE /api/pleroma/admin/reports/:report_id/notes/:id`
772
773 ### Delete report note
774
775 - Params:
776 - `report_id`: required, report id
777 - `id`: required, note id
778 - Response:
779 - On failure:
780 - 400 Bad Request `"Invalid parameters"` when `status` is missing
781 - On success: `204`, empty response
782
783 ## `GET /api/pleroma/admin/statuses/:id`
784
785 ### Show status by id
786
787 - Params:
788 - `id`: required, status id
789 - Response:
790 - On failure:
791 - 404 Not Found `"Not Found"`
792 - On success: JSON, Mastodon Status entity
793
794 ## `PUT /api/pleroma/admin/statuses/:id`
795
796 ### Change the scope of an individual reported status
797
798 - Params:
799 - `id`
800 - `sensitive`: optional, valid values are `true` or `false`
801 - `visibility`: optional, valid values are `public`, `private` and `unlisted`
802 - Response:
803 - On failure:
804 - 400 Bad Request `"Unsupported visibility"`
805 - 403 Forbidden `{"error": "error_msg"}`
806 - 404 Not Found `"Not found"`
807 - On success: JSON, Mastodon Status entity
808
809 ## `DELETE /api/pleroma/admin/statuses/:id`
810
811 ### Delete an individual reported status
812
813 - Params:
814 - `id`
815 - Response:
816 - On failure:
817 - 403 Forbidden `{"error": "error_msg"}`
818 - 404 Not Found `"Not found"`
819 - On success: 200 OK `{}`
820
821 ## `GET /api/pleroma/admin/restart`
822
823 ### Restarts pleroma application
824
825 **Only works when configuration from database is enabled.**
826
827 - Params: none
828 - Response:
829 - On failure:
830 - 400 Bad Request `"To use this endpoint you need to enable configuration from database."`
831
832 ```json
833 {}
834 ```
835
836 ## `GET /api/pleroma/admin/need_reboot`
837
838 ### Returns the flag whether the pleroma should be restarted
839
840 - Params: none
841 - Response:
842 - `need_reboot` - boolean
843 ```json
844 {
845 "need_reboot": false
846 }
847 ```
848
849 ## `GET /api/pleroma/admin/config`
850
851 ### Get list of merged default settings with saved in database.
852
853 *If `need_reboot` is `true`, instance must be restarted, so reboot time settings can take effect.*
854
855 **Only works when configuration from database is enabled.**
856
857 - Params:
858 - `only_db`: true (*optional*, get only saved in database settings)
859 - Response:
860 - On failure:
861 - 400 Bad Request `"To use this endpoint you need to enable configuration from database."`
862
863 ```json
864 {
865 "configs": [
866 {
867 "group": ":pleroma",
868 "key": "Pleroma.Upload",
869 "value": []
870 }
871 ],
872 "need_reboot": true
873 }
874 ```
875
876 ## `POST /api/pleroma/admin/config`
877
878 ### Update config settings
879
880 *If `need_reboot` is `true`, instance must be restarted, so reboot time settings can take effect.*
881
882 **Only works when configuration from database is enabled.**
883
884 Some modifications are necessary to save the config settings correctly:
885
886 - strings which start with `Pleroma.`, `Phoenix.`, `Tesla.` or strings like `Oban`, `Ueberauth` will be converted to modules;
887 ```
888 "Pleroma.Upload" -> Pleroma.Upload
889 "Oban" -> Oban
890 ```
891 - strings starting with `:` will be converted to atoms;
892 ```
893 ":pleroma" -> :pleroma
894 ```
895 - objects with `tuple` key and array value will be converted to tuples;
896 ```
897 {"tuple": ["string", "Pleroma.Upload", []]} -> {"string", Pleroma.Upload, []}
898 ```
899 - arrays with *tuple objects* will be converted to keywords;
900 ```
901 [{"tuple": [":key1", "value"]}, {"tuple": [":key2", "value"]}] -> [key1: "value", key2: "value"]
902 ```
903
904 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:
905 - all settings inside these keys:
906 - `:hackney_pools`
907 - `:connections_pool`
908 - `:pools`
909 - `:chat`
910 - partially settings inside these keys:
911 - `:seconds_valid` in `Pleroma.Captcha`
912 - `:proxy_remote` in `Pleroma.Upload`
913 - `:upload_limit` in `:instance`
914
915 - Params:
916 - `configs` - array of config objects
917 - config object params:
918 - `group` - string (**required**)
919 - `key` - string (**required**)
920 - `value` - string, [], {} or {"tuple": []} (**required**)
921 - `delete` - true (*optional*, if setting must be deleted)
922 - `subkeys` - array of strings (*optional*, only works when `delete=true` parameter is passed, otherwise will be ignored)
923
924 *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.*
925 ```
926 [subkey: val1, subkey2: val2, subkey3: val3] \\ initial value
927 {"group": ":pleroma", "key": "some_key", "delete": true, "subkeys": [":subkey", ":subkey3"]} \\ passing json for deletion
928 [subkey2: val2] \\ value after deletion
929 ```
930
931 *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.*
932
933 Example of setting without keyword in value:
934 ```elixir
935 config :tesla, :adapter, Tesla.Adapter.Hackney
936 ```
937
938 List of settings which support only full update by key:
939 ```elixir
940 @full_key_update [
941 {:pleroma, :ecto_repos},
942 {:quack, :meta},
943 {:mime, :types},
944 {:cors_plug, [:max_age, :methods, :expose, :headers]},
945 {:auto_linker, :opts},
946 {:swarm, :node_blacklist},
947 {:logger, :backends}
948 ]
949 ```
950
951 List of settings which support only full update by subkey:
952 ```elixir
953 @full_subkey_update [
954 {:pleroma, :assets, :mascots},
955 {:pleroma, :emoji, :groups},
956 {:pleroma, :workers, :retries},
957 {:pleroma, :mrf_subchain, :match_actor},
958 {:pleroma, :mrf_keyword, :replace}
959 ]
960 ```
961
962 *Settings without explicit key must be sended in separate config object params.*
963 ```elixir
964 config :quack,
965 level: :debug,
966 meta: [:all],
967 ...
968 ```
969 ```json
970 {
971 "configs": [
972 {"group": ":quack", "key": ":level", "value": ":debug"},
973 {"group": ":quack", "key": ":meta", "value": [":all"]},
974 ...
975 ]
976 }
977 ```
978 - Request:
979
980 ```json
981 {
982 "configs": [
983 {
984 "group": ":pleroma",
985 "key": "Pleroma.Upload",
986 "value": [
987 {"tuple": [":uploader", "Pleroma.Uploaders.Local"]},
988 {"tuple": [":filters", ["Pleroma.Upload.Filter.Dedupe"]]},
989 {"tuple": [":link_name", true]},
990 {"tuple": [":proxy_remote", false]},
991 {"tuple": [":proxy_opts", [
992 {"tuple": [":redirect_on_failure", false]},
993 {"tuple": [":max_body_length", 1048576]},
994 {"tuple": [":http", [
995 {"tuple": [":follow_redirect", true]},
996 {"tuple": [":pool", ":upload"]},
997 ]]}
998 ]
999 ]},
1000 {"tuple": [":dispatch", {
1001 "tuple": ["/api/v1/streaming", "Pleroma.Web.MastodonAPI.WebsocketHandler", []]
1002 }]}
1003 ]
1004 }
1005 ]
1006 }
1007 ```
1008
1009 - Response:
1010 - On failure:
1011 - 400 Bad Request `"To use this endpoint you need to enable configuration from database."`
1012 ```json
1013 {
1014 "configs": [
1015 {
1016 "group": ":pleroma",
1017 "key": "Pleroma.Upload",
1018 "value": [...]
1019 }
1020 ],
1021 "need_reboot": true
1022 }
1023 ```
1024
1025 ## ` GET /api/pleroma/admin/config/descriptions`
1026
1027 ### Get JSON with config descriptions.
1028 Loads json generated from `config/descriptions.exs`.
1029
1030 - Params: none
1031 - Response:
1032
1033 ```json
1034 [{
1035 "group": ":pleroma", // string
1036 "key": "ModuleName", // string
1037 "type": "group", // string or list with possible values,
1038 "description": "Upload general settings", // string
1039 "children": [
1040 {
1041 "key": ":uploader", // string or module name `Pleroma.Upload`
1042 "type": "module",
1043 "description": "Module which will be used for uploads",
1044 "suggestions": ["module1", "module2"]
1045 },
1046 {
1047 "key": ":filters",
1048 "type": ["list", "module"],
1049 "description": "List of filter modules for uploads",
1050 "suggestions": [
1051 "module1", "module2", "module3"
1052 ]
1053 }
1054 ]
1055 }]
1056 ```
1057
1058 ## `GET /api/pleroma/admin/moderation_log`
1059
1060 ### Get moderation log
1061
1062 - Params:
1063 - *optional* `page`: **integer** page number
1064 - *optional* `page_size`: **integer** number of log entries per page (default is `50`)
1065 - *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`
1066 - *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
1067 - *optional* `user_id`: **integer** filter logs by actor's id
1068 - *optional* `search`: **string** search logs by the log message
1069 - Response:
1070
1071 ```json
1072 [
1073 {
1074 "data": {
1075 "actor": {
1076 "id": 1,
1077 "nickname": "lain"
1078 },
1079 "action": "relay_follow"
1080 },
1081 "time": 1502812026, // timestamp
1082 "message": "[2017-08-15 15:47:06] @nick0 followed relay: https://example.org/relay" // log message
1083 }
1084 ]
1085 ```
1086
1087 ## `POST /api/pleroma/admin/reload_emoji`
1088
1089 ### Reload the instance's custom emoji
1090
1091 - Authentication: required
1092 - Params: None
1093 - Response: JSON, "ok" and 200 status
1094
1095 ## `PATCH /api/pleroma/admin/users/confirm_email`
1096
1097 ### Confirm users' emails
1098
1099 - Params:
1100 - `nicknames`
1101 - Response: Array of user nicknames
1102
1103 ## `PATCH /api/pleroma/admin/users/resend_confirmation_email`
1104
1105 ### Resend confirmation email
1106
1107 - Params:
1108 - `nicknames`
1109 - Response: Array of user nicknames
1110
1111 ## `GET /api/pleroma/admin/stats`
1112
1113 ### Stats
1114
1115 - Query Params:
1116 - *optional* `instance`: **string** instance hostname (without protocol) to get stats for
1117 - Example: `https://mypleroma.org/api/pleroma/admin/stats?instance=lain.com`
1118
1119 - Response:
1120
1121 ```json
1122 {
1123 "status_visibility": {
1124 "direct": 739,
1125 "private": 9,
1126 "public": 17,
1127 "unlisted": 14
1128 }
1129 }
1130 ```
1131
1132 ## `GET /api/pleroma/admin/oauth_app`
1133
1134 ### List OAuth app
1135
1136 - Params:
1137 - *optional* `name`
1138 - *optional* `client_id`
1139 - *optional* `page`
1140 - *optional* `page_size`
1141 - *optional* `trusted`
1142
1143 - Response:
1144
1145 ```json
1146 {
1147 "apps": [
1148 {
1149 "id": 1,
1150 "name": "App name",
1151 "client_id": "yHoDSiWYp5mPV6AfsaVOWjdOyt5PhWRiafi6MRd1lSk",
1152 "client_secret": "nLmis486Vqrv2o65eM9mLQx_m_4gH-Q6PcDpGIMl6FY",
1153 "redirect_uri": "https://example.com/oauth-callback",
1154 "website": "https://example.com",
1155 "trusted": true
1156 }
1157 ],
1158 "count": 17,
1159 "page_size": 50
1160 }
1161 ```
1162
1163
1164 ## `POST /api/pleroma/admin/oauth_app`
1165
1166 ### Create OAuth App
1167
1168 - Params:
1169 - `name`
1170 - `redirect_uris`
1171 - `scopes`
1172 - *optional* `website`
1173 - *optional* `trusted`
1174
1175 - Response:
1176
1177 ```json
1178 {
1179 "id": 1,
1180 "name": "App name",
1181 "client_id": "yHoDSiWYp5mPV6AfsaVOWjdOyt5PhWRiafi6MRd1lSk",
1182 "client_secret": "nLmis486Vqrv2o65eM9mLQx_m_4gH-Q6PcDpGIMl6FY",
1183 "redirect_uri": "https://example.com/oauth-callback",
1184 "website": "https://example.com",
1185 "trusted": true
1186 }
1187 ```
1188
1189 - On failure:
1190 ```json
1191 {
1192 "redirect_uris": "can't be blank",
1193 "name": "can't be blank"
1194 }
1195 ```
1196
1197 ## `PATCH /api/pleroma/admin/oauth_app/:id`
1198
1199 ### Update OAuth App
1200
1201 - Params:
1202 - *optional* `name`
1203 - *optional* `redirect_uris`
1204 - *optional* `scopes`
1205 - *optional* `website`
1206 - *optional* `trusted`
1207
1208 - Response:
1209
1210 ```json
1211 {
1212 "id": 1,
1213 "name": "App name",
1214 "client_id": "yHoDSiWYp5mPV6AfsaVOWjdOyt5PhWRiafi6MRd1lSk",
1215 "client_secret": "nLmis486Vqrv2o65eM9mLQx_m_4gH-Q6PcDpGIMl6FY",
1216 "redirect_uri": "https://example.com/oauth-callback",
1217 "website": "https://example.com",
1218 "trusted": true
1219 }
1220 ```
1221
1222 ## `DELETE /api/pleroma/admin/oauth_app/:id`
1223
1224 ### Delete OAuth App
1225
1226 - Params: None
1227
1228 - Response:
1229 - On success: `204`, empty response
1230 - On failure:
1231 - 400 Bad Request `"Invalid parameters"` when `status` is missing