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