fdd9df6c778bac9a044aa4a66c8369845f175b25
[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 "confirmation_pending": bool,
51 "approval_pending": bool,
52 "registration_reason": string,
53 },
54 ...
55 ]
56 }
57 ```
58
59 ## DEPRECATED `DELETE /api/pleroma/admin/users`
60
61 ### Remove a user
62
63 - Params:
64 - `nickname`
65 - Response: User’s nickname
66
67 ## `DELETE /api/pleroma/admin/users`
68
69 ### Remove a user
70
71 - Params:
72 - `nicknames`
73 - Response: Array of user nicknames
74
75 ### Create a user
76
77 - Method: `POST`
78 - Params:
79 `users`: [
80 {
81 `nickname`,
82 `email`,
83 `password`
84 }
85 ]
86 - Response: User’s nickname
87
88 ## `POST /api/pleroma/admin/users/follow`
89
90 ### Make a user follow another user
91
92 - Params:
93 - `follower`: The nickname of the follower
94 - `followed`: The nickname of the followed
95 - Response:
96 - "ok"
97
98 ## `POST /api/pleroma/admin/users/unfollow`
99
100 ### Make a user unfollow another user
101
102 - Params:
103 - `follower`: The nickname of the follower
104 - `followed`: The nickname of the followed
105 - Response:
106 - "ok"
107
108 ## `PATCH /api/pleroma/admin/users/:nickname/toggle_activation`
109
110 ### Toggle user activation
111
112 - Params:
113 - `nickname`
114 - Response: User’s object
115
116 ```json
117 {
118 "deactivated": bool,
119 "id": integer,
120 "nickname": string
121 }
122 ```
123
124 ## `PUT /api/pleroma/admin/users/tag`
125
126 ### Tag a list of users
127
128 - Params:
129 - `nicknames` (array)
130 - `tags` (array)
131
132 ## `DELETE /api/pleroma/admin/users/tag`
133
134 ### Untag a list of users
135
136 - Params:
137 - `nicknames` (array)
138 - `tags` (array)
139
140 ## `GET /api/pleroma/admin/users/:nickname/permission_group`
141
142 ### Get user user permission groups membership
143
144 - Params: none
145 - Response:
146
147 ```json
148 {
149 "is_moderator": bool,
150 "is_admin": bool
151 }
152 ```
153
154 ## `GET /api/pleroma/admin/users/:nickname/permission_group/:permission_group`
155
156 Note: Available `:permission_group` is currently moderator and admin. 404 is returned when the permission group doesn’t exist.
157
158 ### Get user user permission groups membership per permission group
159
160 - Params: none
161 - Response:
162
163 ```json
164 {
165 "is_moderator": bool,
166 "is_admin": bool
167 }
168 ```
169
170 ## DEPRECATED `POST /api/pleroma/admin/users/:nickname/permission_group/:permission_group`
171
172 ### Add user to permission group
173
174 - Params: none
175 - Response:
176 - On failure: `{"error": "…"}`
177 - On success: JSON of the user
178
179 ## `POST /api/pleroma/admin/users/permission_group/:permission_group`
180
181 ### Add users to permission group
182
183 - Params:
184 - `nicknames`: nicknames array
185 - Response:
186 - On failure: `{"error": "…"}`
187 - On success: JSON of the user
188
189 ## DEPRECATED `DELETE /api/pleroma/admin/users/:nickname/permission_group/:permission_group`
190
191 ## `DELETE /api/pleroma/admin/users/:nickname/permission_group/:permission_group`
192
193 ### Remove user from permission group
194
195 - Params: none
196 - Response:
197 - On failure: `{"error": "…"}`
198 - On success: JSON of the user
199 - Note: An admin cannot revoke their own admin status.
200
201 ## `DELETE /api/pleroma/admin/users/permission_group/:permission_group`
202
203 ### Remove users from permission group
204
205 - Params:
206 - `nicknames`: nicknames array
207 - Response:
208 - On failure: `{"error": "…"}`
209 - On success: JSON of the user
210 - Note: An admin cannot revoke their own admin status.
211
212 ## `PATCH /api/pleroma/admin/users/activate`
213
214 ### Activate user
215
216 - Params:
217 - `nicknames`: nicknames array
218 - Response:
219
220 ```json
221 {
222 users: [
223 {
224 // user object
225 }
226 ]
227 }
228 ```
229
230 ## `PATCH /api/pleroma/admin/users/deactivate`
231
232 ### Deactivate user
233
234 - Params:
235 - `nicknames`: nicknames array
236 - Response:
237
238 ```json
239 {
240 users: [
241 {
242 // user object
243 }
244 ]
245 }
246 ```
247
248 ## `GET /api/pleroma/admin/users/:nickname_or_id`
249
250 ### Retrive the details of a user
251
252 - Params:
253 - `nickname` or `id`
254 - Response:
255 - On failure: `Not found`
256 - On success: JSON of the user
257
258 ## `GET /api/pleroma/admin/users/:nickname_or_id/statuses`
259
260 ### Retrive user's latest statuses
261
262 - Params:
263 - `nickname` or `id`
264 - *optional* `page_size`: number of statuses to return (default is `20`)
265 - *optional* `godmode`: `true`/`false` – allows to see private statuses
266 - *optional* `with_reblogs`: `true`/`false` – allows to see reblogs (default is false)
267 - Response:
268 - On failure: `Not found`
269 - On success: JSON array of user's latest statuses
270
271 ## `GET /api/pleroma/admin/instances/:instance/statuses`
272
273 ### Retrive instance's latest statuses
274
275 - Params:
276 - `instance`: instance name
277 - *optional* `page_size`: number of statuses to return (default is `20`)
278 - *optional* `godmode`: `true`/`false` – allows to see private statuses
279 - *optional* `with_reblogs`: `true`/`false` – allows to see reblogs (default is false)
280 - Response:
281 - On failure: `Not found`
282 - On success: JSON array of instance's latest statuses
283
284 ## `GET /api/pleroma/admin/statuses`
285
286 ### Retrives all latest statuses
287
288 - Params:
289 - *optional* `page_size`: number of statuses to return (default is `20`)
290 - *optional* `local_only`: excludes remote statuses
291 - *optional* `godmode`: `true`/`false` – allows to see private statuses
292 - *optional* `with_reblogs`: `true`/`false` – allows to see reblogs (default is false)
293 - Response:
294 - On failure: `Not found`
295 - On success: JSON array of user's latest statuses
296
297 ## `POST /api/pleroma/admin/relay`
298
299 ### Follow a Relay
300
301 - Params:
302 - `relay_url`
303 - Response:
304 - On success: URL of the followed relay
305
306 ## `DELETE /api/pleroma/admin/relay`
307
308 ### Unfollow a Relay
309
310 - Params:
311 - `relay_url`
312 - Response:
313 - On success: URL of the unfollowed relay
314
315 ## `GET /api/pleroma/admin/relay`
316
317 ### List Relays
318
319 - Params: none
320 - Response:
321 - On success: JSON array of relays
322
323 ## `POST /api/pleroma/admin/users/invite_token`
324
325 ### Create an account registration invite token
326
327 - Params:
328 - *optional* `max_use` (integer)
329 - *optional* `expires_at` (date string e.g. "2019-04-07")
330 - Response:
331
332 ```json
333 {
334 "id": integer,
335 "token": string,
336 "used": boolean,
337 "expires_at": date,
338 "uses": integer,
339 "max_use": integer,
340 "invite_type": string (possible values: `one_time`, `reusable`, `date_limited`, `reusable_date_limited`)
341 }
342 ```
343
344 ## `GET /api/pleroma/admin/users/invites`
345
346 ### Get a list of generated invites
347
348 - Params: none
349 - Response:
350
351 ```json
352 {
353
354 "invites": [
355 {
356 "id": integer,
357 "token": string,
358 "used": boolean,
359 "expires_at": date,
360 "uses": integer,
361 "max_use": integer,
362 "invite_type": string (possible values: `one_time`, `reusable`, `date_limited`, `reusable_date_limited`)
363 },
364 ...
365 ]
366 }
367 ```
368
369 ## `POST /api/pleroma/admin/users/revoke_invite`
370
371 ### Revoke invite by token
372
373 - Params:
374 - `token`
375 - Response:
376
377 ```json
378 {
379 "id": integer,
380 "token": string,
381 "used": boolean,
382 "expires_at": date,
383 "uses": integer,
384 "max_use": integer,
385 "invite_type": string (possible values: `one_time`, `reusable`, `date_limited`, `reusable_date_limited`)
386
387 }
388 ```
389
390 ## `POST /api/pleroma/admin/users/email_invite`
391
392 ### Sends registration invite via email
393
394 - Params:
395 - `email`
396 - `name`, optional
397
398 - Response:
399 - On success: `204`, empty response
400 - On failure:
401 - 400 Bad Request, JSON:
402
403 ```json
404 [
405 {
406 "error": "Appropriate error message here"
407 }
408 ]
409 ```
410
411 ## `GET /api/pleroma/admin/users/:nickname/password_reset`
412
413 ### Get a password reset token for a given nickname
414
415
416 - Params: none
417 - Response:
418
419 ```json
420 {
421 "token": "base64 reset token",
422 "link": "https://pleroma.social/api/pleroma/password_reset/url-encoded-base64-token"
423 }
424 ```
425
426 ## `PATCH /api/pleroma/admin/users/force_password_reset`
427
428 ### Force passord reset for a user with a given nickname
429
430 - Params:
431 - `nicknames`
432 - Response: none (code `204`)
433
434 ## PUT `/api/pleroma/admin/users/disable_mfa`
435
436 ### Disable mfa for user's account.
437
438 - Params:
439 - `nickname`
440 - Response: User’s nickname
441
442 ## `GET /api/pleroma/admin/users/:nickname/credentials`
443
444 ### Get the user's email, password, display and settings-related fields
445
446 - Params:
447 - `nickname`
448
449 - Response:
450
451 ```json
452 {
453 "actor_type": "Person",
454 "allow_following_move": true,
455 "avatar": "https://pleroma.social/media/7e8e7508fd545ef580549b6881d80ec0ff2c81ed9ad37b9bdbbdf0e0d030159d.jpg",
456 "background": "https://pleroma.social/media/4de34c0bd10970d02cbdef8972bef0ebbf55f43cadc449554d4396156162fe9a.jpg",
457 "banner": "https://pleroma.social/media/8d92ba2bd244b613520abf557dd448adcd30f5587022813ee9dd068945986946.jpg",
458 "bio": "bio",
459 "default_scope": "public",
460 "discoverable": false,
461 "email": "user@example.com",
462 "fields": [
463 {
464 "name": "example",
465 "value": "<a href=\"https://example.com\" rel=\"ugc\">https://example.com</a>"
466 }
467 ],
468 "hide_favorites": false,
469 "hide_followers": false,
470 "hide_followers_count": false,
471 "hide_follows": false,
472 "hide_follows_count": false,
473 "id": "9oouHaEEUR54hls968",
474 "locked": true,
475 "name": "user",
476 "no_rich_text": true,
477 "pleroma_settings_store": {},
478 "raw_fields": [
479 {
480 "id": 1,
481 "name": "example",
482 "value": "https://example.com"
483 },
484 ],
485 "show_role": true,
486 "skip_thread_containment": false
487 }
488 ```
489
490 ## `PATCH /api/pleroma/admin/users/:nickname/credentials`
491
492 ### Change the user's email, password, display and settings-related fields
493
494 * Params:
495 * `email`
496 * `password`
497 * `name`
498 * `bio`
499 * `avatar`
500 * `locked`
501 * `no_rich_text`
502 * `default_scope`
503 * `banner`
504 * `hide_follows`
505 * `hide_followers`
506 * `hide_followers_count`
507 * `hide_follows_count`
508 * `hide_favorites`
509 * `allow_following_move`
510 * `background`
511 * `show_role`
512 * `skip_thread_containment`
513 * `fields`
514 * `discoverable`
515 * `actor_type`
516
517 * Responses:
518
519 Status: 200
520
521 ```json
522 {"status": "success"}
523 ```
524
525 Status: 400
526
527 ```json
528 {"errors":
529 {"actor_type": "is invalid"},
530 {"email": "has invalid format"},
531 ...
532 }
533 ```
534
535 Status: 404
536
537 ```json
538 {"error": "Not found"}
539 ```
540
541 ## `GET /api/pleroma/admin/reports`
542
543 ### Get a list of reports
544
545 - Params:
546 - *optional* `state`: **string** the state of reports. Valid values are `open`, `closed` and `resolved`
547 - *optional* `limit`: **integer** the number of records to retrieve
548 - *optional* `page`: **integer** page number
549 - *optional* `page_size`: **integer** number of log entries per page (default is `50`)
550 - Response:
551 - On failure: 403 Forbidden error `{"error": "error_msg"}` when requested by anonymous or non-admin
552 - On success: JSON, returns a list of reports, where:
553 - `account`: the user who has been reported
554 - `actor`: the user who has sent the report
555 - `statuses`: list of statuses that have been included to the report
556
557 ```json
558 {
559 "total" : 1,
560 "reports": [
561 {
562 "account": {
563 "acct": "user",
564 "avatar": "https://pleroma.example.org/images/avi.png",
565 "avatar_static": "https://pleroma.example.org/images/avi.png",
566 "bot": false,
567 "created_at": "2019-04-23T17:32:04.000Z",
568 "display_name": "User",
569 "emojis": [],
570 "fields": [],
571 "followers_count": 1,
572 "following_count": 1,
573 "header": "https://pleroma.example.org/images/banner.png",
574 "header_static": "https://pleroma.example.org/images/banner.png",
575 "id": "9i6dAJqSGSKMzLG2Lo",
576 "locked": false,
577 "note": "",
578 "pleroma": {
579 "confirmation_pending": false,
580 "hide_favorites": true,
581 "hide_followers": false,
582 "hide_follows": false,
583 "is_admin": false,
584 "is_moderator": false,
585 "relationship": {},
586 "tags": []
587 },
588 "source": {
589 "note": "",
590 "pleroma": {},
591 "sensitive": false
592 },
593 "tags": ["force_unlisted"],
594 "statuses_count": 3,
595 "url": "https://pleroma.example.org/users/user",
596 "username": "user"
597 },
598 "actor": {
599 "acct": "lain",
600 "avatar": "https://pleroma.example.org/images/avi.png",
601 "avatar_static": "https://pleroma.example.org/images/avi.png",
602 "bot": false,
603 "created_at": "2019-03-28T17:36:03.000Z",
604 "display_name": "Roger Braun",
605 "emojis": [],
606 "fields": [],
607 "followers_count": 1,
608 "following_count": 1,
609 "header": "https://pleroma.example.org/images/banner.png",
610 "header_static": "https://pleroma.example.org/images/banner.png",
611 "id": "9hEkA5JsvAdlSrocam",
612 "locked": false,
613 "note": "",
614 "pleroma": {
615 "confirmation_pending": false,
616 "hide_favorites": false,
617 "hide_followers": false,
618 "hide_follows": false,
619 "is_admin": false,
620 "is_moderator": false,
621 "relationship": {},
622 "tags": []
623 },
624 "source": {
625 "note": "",
626 "pleroma": {},
627 "sensitive": false
628 },
629 "tags": ["force_unlisted"],
630 "statuses_count": 1,
631 "url": "https://pleroma.example.org/users/lain",
632 "username": "lain"
633 },
634 "content": "Please delete it",
635 "created_at": "2019-04-29T19:48:15.000Z",
636 "id": "9iJGOv1j8hxuw19bcm",
637 "state": "open",
638 "statuses": [
639 {
640 "account": { ... },
641 "application": {
642 "name": "Web",
643 "website": null
644 },
645 "bookmarked": false,
646 "card": null,
647 "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>",
648 "created_at": "2019-04-23T19:15:47.000Z",
649 "emojis": [],
650 "favourited": false,
651 "favourites_count": 0,
652 "id": "9i6mQ9uVrrOmOime8m",
653 "in_reply_to_account_id": null,
654 "in_reply_to_id": null,
655 "language": null,
656 "media_attachments": [],
657 "mentions": [
658 {
659 "acct": "lain",
660 "id": "9hEkA5JsvAdlSrocam",
661 "url": "https://pleroma.example.org/users/lain",
662 "username": "lain"
663 },
664 {
665 "acct": "user",
666 "id": "9i6dAJqSGSKMzLG2Lo",
667 "url": "https://pleroma.example.org/users/user",
668 "username": "user"
669 }
670 ],
671 "muted": false,
672 "pinned": false,
673 "pleroma": {
674 "content": {
675 "text/plain": "@lain click on my link https://www.google.com/"
676 },
677 "conversation_id": 28,
678 "in_reply_to_account_acct": null,
679 "local": true,
680 "spoiler_text": {
681 "text/plain": ""
682 }
683 },
684 "reblog": null,
685 "reblogged": false,
686 "reblogs_count": 0,
687 "replies_count": 0,
688 "sensitive": false,
689 "spoiler_text": "",
690 "tags": [],
691 "uri": "https://pleroma.example.org/objects/8717b90f-8e09-4b58-97b0-e3305472b396",
692 "url": "https://pleroma.example.org/notice/9i6mQ9uVrrOmOime8m",
693 "visibility": "direct"
694 }
695 ]
696 }
697 ]
698 }
699 ```
700
701 ## `GET /api/pleroma/admin/grouped_reports`
702
703 ### Get a list of reports, grouped by status
704
705 - Params: none
706 - On success: JSON, returns a list of reports, where:
707 - `date`: date of the latest report
708 - `account`: the user who has been reported (see `/api/pleroma/admin/reports` for reference)
709 - `status`: reported status (see `/api/pleroma/admin/reports` for reference)
710 - `actors`: users who had reported this status (see `/api/pleroma/admin/reports` for reference)
711 - `reports`: reports (see `/api/pleroma/admin/reports` for reference)
712
713 ```json
714 "reports": [
715 {
716 "date": "2019-10-07T12:31:39.615149Z",
717 "account": { ... },
718 "status": { ... },
719 "actors": [{ ... }, { ... }],
720 "reports": [{ ... }]
721 }
722 ]
723 ```
724
725 ## `GET /api/pleroma/admin/reports/:id`
726
727 ### Get an individual report
728
729 - Params:
730 - `id`
731 - Response:
732 - On failure:
733 - 403 Forbidden `{"error": "error_msg"}`
734 - 404 Not Found `"Not found"`
735 - On success: JSON, Report object (see above)
736
737 ## `PATCH /api/pleroma/admin/reports`
738
739 ### Change the state of one or multiple reports
740
741 - Params:
742
743 ```json
744 `reports`: [
745 {
746 `id`, // required, report id
747 `state` // required, the new state. Valid values are `open`, `closed` and `resolved`
748 },
749 ...
750 ]
751 ```
752
753 - Response:
754 - On failure:
755 - 400 Bad Request, JSON:
756
757 ```json
758 [
759 {
760 `id`, // report id
761 `error` // error message
762 }
763 ]
764 ```
765
766 - On success: `204`, empty response
767
768 ## `POST /api/pleroma/admin/reports/:id/notes`
769
770 ### Create report note
771
772 - Params:
773 - `id`: required, report id
774 - `content`: required, the message
775 - Response:
776 - On failure:
777 - 400 Bad Request `"Invalid parameters"` when `status` is missing
778 - On success: `204`, empty response
779
780 ## `DELETE /api/pleroma/admin/reports/:report_id/notes/:id`
781
782 ### Delete report note
783
784 - Params:
785 - `report_id`: required, report id
786 - `id`: required, note id
787 - Response:
788 - On failure:
789 - 400 Bad Request `"Invalid parameters"` when `status` is missing
790 - On success: `204`, empty response
791
792 ## `GET /api/pleroma/admin/statuses/:id`
793
794 ### Show status by id
795
796 - Params:
797 - `id`: required, status id
798 - Response:
799 - On failure:
800 - 404 Not Found `"Not Found"`
801 - On success: JSON, Mastodon Status entity
802
803 ## `PUT /api/pleroma/admin/statuses/:id`
804
805 ### Change the scope of an individual reported status
806
807 - Params:
808 - `id`
809 - `sensitive`: optional, valid values are `true` or `false`
810 - `visibility`: optional, valid values are `public`, `private` and `unlisted`
811 - Response:
812 - On failure:
813 - 400 Bad Request `"Unsupported visibility"`
814 - 403 Forbidden `{"error": "error_msg"}`
815 - 404 Not Found `"Not found"`
816 - On success: JSON, Mastodon Status entity
817
818 ## `DELETE /api/pleroma/admin/statuses/:id`
819
820 ### Delete an individual reported status
821
822 - Params:
823 - `id`
824 - Response:
825 - On failure:
826 - 403 Forbidden `{"error": "error_msg"}`
827 - 404 Not Found `"Not found"`
828 - On success: 200 OK `{}`
829
830 ## `GET /api/pleroma/admin/restart`
831
832 ### Restarts pleroma application
833
834 **Only works when configuration from database is enabled.**
835
836 - Params: none
837 - Response:
838 - On failure:
839 - 400 Bad Request `"To use this endpoint you need to enable configuration from database."`
840
841 ```json
842 {}
843 ```
844
845 ## `GET /api/pleroma/admin/need_reboot`
846
847 ### Returns the flag whether the pleroma should be restarted
848
849 - Params: none
850 - Response:
851 - `need_reboot` - boolean
852 ```json
853 {
854 "need_reboot": false
855 }
856 ```
857
858 ## `GET /api/pleroma/admin/config`
859
860 ### Get list of merged default settings with saved in database.
861
862 *If `need_reboot` is `true`, instance must be restarted, so reboot time settings can take effect.*
863
864 **Only works when configuration from database is enabled.**
865
866 - Params:
867 - `only_db`: true (*optional*, get only saved in database settings)
868 - Response:
869 - On failure:
870 - 400 Bad Request `"To use this endpoint you need to enable configuration from database."`
871
872 ```json
873 {
874 "configs": [
875 {
876 "group": ":pleroma",
877 "key": "Pleroma.Upload",
878 "value": []
879 }
880 ],
881 "need_reboot": true
882 }
883 ```
884
885 ## `POST /api/pleroma/admin/config`
886
887 ### Update config settings
888
889 *If `need_reboot` is `true`, instance must be restarted, so reboot time settings can take effect.*
890
891 **Only works when configuration from database is enabled.**
892
893 Some modifications are necessary to save the config settings correctly:
894
895 - strings which start with `Pleroma.`, `Phoenix.`, `Tesla.` or strings like `Oban`, `Ueberauth` will be converted to modules;
896 ```
897 "Pleroma.Upload" -> Pleroma.Upload
898 "Oban" -> Oban
899 ```
900 - strings starting with `:` will be converted to atoms;
901 ```
902 ":pleroma" -> :pleroma
903 ```
904 - objects with `tuple` key and array value will be converted to tuples;
905 ```
906 {"tuple": ["string", "Pleroma.Upload", []]} -> {"string", Pleroma.Upload, []}
907 ```
908 - arrays with *tuple objects* will be converted to keywords;
909 ```
910 [{"tuple": [":key1", "value"]}, {"tuple": [":key2", "value"]}] -> [key1: "value", key2: "value"]
911 ```
912
913 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:
914 - all settings inside these keys:
915 - `:hackney_pools`
916 - `:connections_pool`
917 - `:pools`
918 - `:chat`
919 - partially settings inside these keys:
920 - `:seconds_valid` in `Pleroma.Captcha`
921 - `:proxy_remote` in `Pleroma.Upload`
922 - `:upload_limit` in `:instance`
923
924 - Params:
925 - `configs` - array of config objects
926 - config object params:
927 - `group` - string (**required**)
928 - `key` - string (**required**)
929 - `value` - string, [], {} or {"tuple": []} (**required**)
930 - `delete` - true (*optional*, if setting must be deleted)
931 - `subkeys` - array of strings (*optional*, only works when `delete=true` parameter is passed, otherwise will be ignored)
932
933 *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.*
934 ```
935 [subkey: val1, subkey2: val2, subkey3: val3] \\ initial value
936 {"group": ":pleroma", "key": "some_key", "delete": true, "subkeys": [":subkey", ":subkey3"]} \\ passing json for deletion
937 [subkey2: val2] \\ value after deletion
938 ```
939
940 *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.*
941
942 Example of setting without keyword in value:
943 ```elixir
944 config :tesla, :adapter, Tesla.Adapter.Hackney
945 ```
946
947 List of settings which support only full update by key:
948 ```elixir
949 @full_key_update [
950 {:pleroma, :ecto_repos},
951 {:quack, :meta},
952 {:mime, :types},
953 {:cors_plug, [:max_age, :methods, :expose, :headers]},
954 {:auto_linker, :opts},
955 {:swarm, :node_blacklist},
956 {:logger, :backends}
957 ]
958 ```
959
960 List of settings which support only full update by subkey:
961 ```elixir
962 @full_subkey_update [
963 {:pleroma, :assets, :mascots},
964 {:pleroma, :emoji, :groups},
965 {:pleroma, :workers, :retries},
966 {:pleroma, :mrf_subchain, :match_actor},
967 {:pleroma, :mrf_keyword, :replace}
968 ]
969 ```
970
971 *Settings without explicit key must be sended in separate config object params.*
972 ```elixir
973 config :quack,
974 level: :debug,
975 meta: [:all],
976 ...
977 ```
978 ```json
979 {
980 "configs": [
981 {"group": ":quack", "key": ":level", "value": ":debug"},
982 {"group": ":quack", "key": ":meta", "value": [":all"]},
983 ...
984 ]
985 }
986 ```
987 - Request:
988
989 ```json
990 {
991 "configs": [
992 {
993 "group": ":pleroma",
994 "key": "Pleroma.Upload",
995 "value": [
996 {"tuple": [":uploader", "Pleroma.Uploaders.Local"]},
997 {"tuple": [":filters", ["Pleroma.Upload.Filter.Dedupe"]]},
998 {"tuple": [":link_name", true]},
999 {"tuple": [":proxy_remote", false]},
1000 {"tuple": [":proxy_opts", [
1001 {"tuple": [":redirect_on_failure", false]},
1002 {"tuple": [":max_body_length", 1048576]},
1003 {"tuple": [":http", [
1004 {"tuple": [":follow_redirect", true]},
1005 {"tuple": [":pool", ":upload"]},
1006 ]]}
1007 ]
1008 ]},
1009 {"tuple": [":dispatch", {
1010 "tuple": ["/api/v1/streaming", "Pleroma.Web.MastodonAPI.WebsocketHandler", []]
1011 }]}
1012 ]
1013 }
1014 ]
1015 }
1016 ```
1017
1018 - Response:
1019 - On failure:
1020 - 400 Bad Request `"To use this endpoint you need to enable configuration from database."`
1021 ```json
1022 {
1023 "configs": [
1024 {
1025 "group": ":pleroma",
1026 "key": "Pleroma.Upload",
1027 "value": [...]
1028 }
1029 ],
1030 "need_reboot": true
1031 }
1032 ```
1033
1034 ## ` GET /api/pleroma/admin/config/descriptions`
1035
1036 ### Get JSON with config descriptions.
1037 Loads json generated from `config/descriptions.exs`.
1038
1039 - Params: none
1040 - Response:
1041
1042 ```json
1043 [{
1044 "group": ":pleroma", // string
1045 "key": "ModuleName", // string
1046 "type": "group", // string or list with possible values,
1047 "description": "Upload general settings", // string
1048 "children": [
1049 {
1050 "key": ":uploader", // string or module name `Pleroma.Upload`
1051 "type": "module",
1052 "description": "Module which will be used for uploads",
1053 "suggestions": ["module1", "module2"]
1054 },
1055 {
1056 "key": ":filters",
1057 "type": ["list", "module"],
1058 "description": "List of filter modules for uploads",
1059 "suggestions": [
1060 "module1", "module2", "module3"
1061 ]
1062 }
1063 ]
1064 }]
1065 ```
1066
1067 ## `GET /api/pleroma/admin/moderation_log`
1068
1069 ### Get moderation log
1070
1071 - Params:
1072 - *optional* `page`: **integer** page number
1073 - *optional* `page_size`: **integer** number of log entries per page (default is `50`)
1074 - *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`
1075 - *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
1076 - *optional* `user_id`: **integer** filter logs by actor's id
1077 - *optional* `search`: **string** search logs by the log message
1078 - Response:
1079
1080 ```json
1081 [
1082 {
1083 "data": {
1084 "actor": {
1085 "id": 1,
1086 "nickname": "lain"
1087 },
1088 "action": "relay_follow"
1089 },
1090 "time": 1502812026, // timestamp
1091 "message": "[2017-08-15 15:47:06] @nick0 followed relay: https://example.org/relay" // log message
1092 }
1093 ]
1094 ```
1095
1096 ## `POST /api/pleroma/admin/reload_emoji`
1097
1098 ### Reload the instance's custom emoji
1099
1100 - Authentication: required
1101 - Params: None
1102 - Response: JSON, "ok" and 200 status
1103
1104 ## `PATCH /api/pleroma/admin/users/confirm_email`
1105
1106 ### Confirm users' emails
1107
1108 - Params:
1109 - `nicknames`
1110 - Response: Array of user nicknames
1111
1112 ## `PATCH /api/pleroma/admin/users/resend_confirmation_email`
1113
1114 ### Resend confirmation email
1115
1116 - Params:
1117 - `nicknames`
1118 - Response: Array of user nicknames
1119
1120 ## `GET /api/pleroma/admin/stats`
1121
1122 ### Stats
1123
1124 - Query Params:
1125 - *optional* `instance`: **string** instance hostname (without protocol) to get stats for
1126 - Example: `https://mypleroma.org/api/pleroma/admin/stats?instance=lain.com`
1127
1128 - Response:
1129
1130 ```json
1131 {
1132 "status_visibility": {
1133 "direct": 739,
1134 "private": 9,
1135 "public": 17,
1136 "unlisted": 14
1137 }
1138 }
1139 ```
1140
1141 ## `GET /api/pleroma/admin/oauth_app`
1142
1143 ### List OAuth app
1144
1145 - Params:
1146 - *optional* `name`
1147 - *optional* `client_id`
1148 - *optional* `page`
1149 - *optional* `page_size`
1150 - *optional* `trusted`
1151
1152 - Response:
1153
1154 ```json
1155 {
1156 "apps": [
1157 {
1158 "id": 1,
1159 "name": "App name",
1160 "client_id": "yHoDSiWYp5mPV6AfsaVOWjdOyt5PhWRiafi6MRd1lSk",
1161 "client_secret": "nLmis486Vqrv2o65eM9mLQx_m_4gH-Q6PcDpGIMl6FY",
1162 "redirect_uri": "https://example.com/oauth-callback",
1163 "website": "https://example.com",
1164 "trusted": true
1165 }
1166 ],
1167 "count": 17,
1168 "page_size": 50
1169 }
1170 ```
1171
1172
1173 ## `POST /api/pleroma/admin/oauth_app`
1174
1175 ### Create OAuth App
1176
1177 - Params:
1178 - `name`
1179 - `redirect_uris`
1180 - `scopes`
1181 - *optional* `website`
1182 - *optional* `trusted`
1183
1184 - Response:
1185
1186 ```json
1187 {
1188 "id": 1,
1189 "name": "App name",
1190 "client_id": "yHoDSiWYp5mPV6AfsaVOWjdOyt5PhWRiafi6MRd1lSk",
1191 "client_secret": "nLmis486Vqrv2o65eM9mLQx_m_4gH-Q6PcDpGIMl6FY",
1192 "redirect_uri": "https://example.com/oauth-callback",
1193 "website": "https://example.com",
1194 "trusted": true
1195 }
1196 ```
1197
1198 - On failure:
1199 ```json
1200 {
1201 "redirect_uris": "can't be blank",
1202 "name": "can't be blank"
1203 }
1204 ```
1205
1206 ## `PATCH /api/pleroma/admin/oauth_app/:id`
1207
1208 ### Update OAuth App
1209
1210 - Params:
1211 - *optional* `name`
1212 - *optional* `redirect_uris`
1213 - *optional* `scopes`
1214 - *optional* `website`
1215 - *optional* `trusted`
1216
1217 - Response:
1218
1219 ```json
1220 {
1221 "id": 1,
1222 "name": "App name",
1223 "client_id": "yHoDSiWYp5mPV6AfsaVOWjdOyt5PhWRiafi6MRd1lSk",
1224 "client_secret": "nLmis486Vqrv2o65eM9mLQx_m_4gH-Q6PcDpGIMl6FY",
1225 "redirect_uri": "https://example.com/oauth-callback",
1226 "website": "https://example.com",
1227 "trusted": true
1228 }
1229 ```
1230
1231 ## `DELETE /api/pleroma/admin/oauth_app/:id`
1232
1233 ### Delete OAuth App
1234
1235 - Params: None
1236
1237 - Response:
1238 - On success: `204`, empty response
1239 - On failure:
1240 - 400 Bad Request `"Invalid parameters"` when `status` is missing
1241
1242 ## `GET /api/pleroma/admin/media_proxy_caches`
1243
1244 ### Get a list of all banned MediaProxy URLs in Cachex
1245
1246 - Authentication: required
1247 - Params:
1248 - *optional* `page`: **integer** page number
1249 - *optional* `page_size`: **integer** number of log entries per page (default is `50`)
1250
1251 - Response:
1252
1253 ``` json
1254 {
1255 "urls": [
1256 "http://example.com/media/a688346.jpg",
1257 "http://example.com/media/fb1f4d.jpg"
1258 ]
1259 }
1260
1261 ```
1262
1263 ## `POST /api/pleroma/admin/media_proxy_caches/delete`
1264
1265 ### Remove a banned MediaProxy URL from Cachex
1266
1267 - Authentication: required
1268 - Params:
1269 - `urls` (array)
1270
1271 - Response:
1272
1273 ``` json
1274 {
1275 "urls": [
1276 "http://example.com/media/a688346.jpg",
1277 "http://example.com/media/fb1f4d.jpg"
1278 ]
1279 }
1280
1281 ```
1282
1283 ## `POST /api/pleroma/admin/media_proxy_caches/purge`
1284
1285 ### Purge a MediaProxy URL
1286
1287 - Authentication: required
1288 - Params:
1289 - `urls` (array)
1290 - `ban` (boolean)
1291
1292 - Response:
1293
1294 ``` json
1295 {
1296 "urls": [
1297 "http://example.com/media/a688346.jpg",
1298 "http://example.com/media/fb1f4d.jpg"
1299 ]
1300 }
1301
1302 ```